fix(gui): make headless GUI path feature-independent#44
Merged
Conversation
Root-cause fix for the CI failures in PR #39 that survived its merge: the readiness test `readiness_d_gui_headless_runs` invokes `panic-attack gui --headless` and the `Test` job runs against the default feature set. After #39 hid `Commands::Gui` behind `#[cfg(feature = "gui")]`, the subcommand no longer existed in default builds, so this test (and the `Readiness` workflow) fail on every main-build until this lands. The headless renderer is pure text output — it touches `ReportFormatter` and the report data structures, never `eframe` or `egui`. Move it into a new always-compiled module `src/report/gui_text.rs` so the subcommand always exists and the text path works regardless of the `gui` feature. The windowed renderer stays gated. Changes: - `src/report/gui_text.rs` (new) — `run_headless` lifted verbatim from `gui::ReportGui::run_headless`. Always compiled. - `src/report/gui.rs` — `run_headless` removed (now lives in `gui_text`); module header docstring updated to explain the feature gate. - `src/report/mod.rs` — `pub mod gui_text;` always; `pub mod gui` stays `#[cfg(feature = "gui")]`. - `src/main.rs` — drop `#[cfg(feature = "gui")]` from `Commands::Gui` (subcommand is always available). Match arm routes `--headless` to `gui_text::run_headless` always; the windowed path is `#[cfg(feature = "gui")]` with a `#[cfg(not(feature = "gui"))]` `anyhow::bail!` arm that gives a clear "rebuild with --features gui" error. Verified locally: * `cargo build` — default, OK * `cargo build --features gui` — opt-in, OK * `cargo clippy --all-targets --features signing,http -- -D warnings` — clean * `cargo clippy --all-targets --all-features -- -D warnings` — clean * `cargo test --test readiness` — 20 passed, 0 failed (including `readiness_d_gui_headless_runs`) * `cargo fmt --check` — clean This is the principled fix: the readiness test stays meaningful on the MSRV-clean default build, the windowed GUI stays opt-in, and a user who tries non-headless mode without the feature gets a precise actionable error instead of a clap "unrecognized subcommand". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🔍 Hypatia Security ScanFindings: 49 issues detected
View findings[
{
"reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
"type": "unpinned_action",
"file": "governance.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "high"
},
{
"reason": "Nickel file missing SPDX-License-Identifier header (1 occurrences, CWE-1104)",
"type": "ncl_missing_spdx",
"file": "/home/runner/work/panic-attack/panic-attack/reports/panic-attack-20260211180017.ncl",
"action": "flag",
"rule_module": "code_safety",
"severity": "medium"
},
{
"reason": "expect() in hot path (2 occurrences, CWE-754)",
"type": "expect_in_hot_path",
"file": "/home/runner/work/panic-attack/panic-attack/src/attestation/chain.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "medium"
},
{
"reason": "unwrap_or(0) with dangerous default (1 occurrences, CWE-754)",
"type": "unwrap_dangerous_default",
"file": "/home/runner/work/panic-attack/panic-attack/src/attestation/evidence.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "critical"
},
{
"reason": "unwrap_or(0) with dangerous default (1 occurrences, CWE-754)",
"type": "unwrap_dangerous_default",
"file": "/home/runner/work/panic-attack/panic-attack/src/ambush/mod.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "critical"
},
{
"reason": "unwrap_or(0) with dangerous default (3 occurrences, CWE-754)",
"type": "unwrap_dangerous_default",
"file": "/home/runner/work/panic-attack/panic-attack/src/kanren/strategy.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "critical"
},
{
"reason": "unwrap_or(0) with dangerous default (3 occurrences, CWE-754)",
"type": "unwrap_dangerous_default",
"file": "/home/runner/work/panic-attack/panic-attack/src/axial/mod.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "critical"
},
{
"reason": "expect() in hot path (4 occurrences, CWE-754)",
"type": "expect_in_hot_path",
"file": "/home/runner/work/panic-attack/panic-attack/src/assail/analyzer.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "medium"
},
{
"reason": "unwrap() without prior check -- DoS via panic (4 occurrences, CWE-754)",
"type": "unwrap_without_check",
"file": "/home/runner/work/panic-attack/panic-attack/benches/scan_bench.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "high"
},
{
"reason": "expect() in hot path (2 occurrences, CWE-754)",
"type": "expect_in_hot_path",
"file": "/home/runner/work/panic-attack/panic-attack/benches/scan_bench.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "medium"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root-cause fix for the CI failures that survived PR #39's merge. The readiness test `readiness_d_gui_headless_runs` and the `Readiness` workflow have been red on main since #39 hid `Commands::Gui` behind `#[cfg(feature = "gui")]` — the subcommand no longer exists in default builds, but the readiness test (which runs against default features) still invokes `panic-attack gui --headless`.
The headless renderer is pure text output — it touches `ReportFormatter` and the report data structures, never `eframe` or `egui`. Moving it into a feature-independent module fixes the underlying contract: the subcommand should always exist; only the windowed renderer needs the feature.
Changes
User-visible result
Default build (`cargo build`):
GUI build (`cargo build --features gui`):
Test plan
Why this is the principled fix
🤖 Generated with Claude Code