You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor existing report flow to separate result building from rendering #1099
Multiple outputs already reuse one scan. Rendering and writing also have separate helpers. This refactor tightens the existing boundaries:
report() formats output, but also calculates risk, partitions suppressed findings, and adjusts completeness. _render_report() repeats that processing for additional formats.
The scan graph and _scan_transitive() render the primary report. Primary and additional outputs therefore take different rendering paths.
_scan_multi_skill() still combines scanning, aggregation, rendering, and writing.
Proposed changes
Use the same flow for every output:
flowchart LR
A["Scan skill<br/>Collect and merge analysis state"]
B["Build scan results<br/>Determine scores, suppression,<br/>and completeness once"]
C["Render report<br/>Format results as JSON, SARIF,<br/>Markdown, or terminal text"]
D["Write report<br/>Write rendered content<br/>to stdout or a file"]
A -->|"Complete<br/>scan<br/>state"| B
B -->|"Format<br/>independent<br/>results"| C
C -->|"Rendered<br/>content"| D
Loading
Keep _scan_skill() and _scan_transitive() focused on collecting and merging complete scan state.
Extract _build_scan_results() from report(). Build scoring, suppression, and completeness once from the complete state. Retain findings, component metadata, executable-script status, baseline information, and LLM telemetry.
Keep _render_report(). Render primary and additional formats from the same built results, without changing them or recalculating scan semantics.
Keep _scan_multi_skill() and move combined rendering into _render_multi_skill_report().
Rename _write_result() to _write_report(). Accept rendered content rather than scan state. Separate _render_reports() from _write_reports().
Centralize destination checks in _validate_report_destinations(). Preserve writer-compatible normalization, no-follow writing, duplicate detection, and input/baseline protection.
Acceptance criteria
Cover single, non-transitive, transitive, recursive, and multi-skill scans with local and remote inputs.
Multiple formats reuse one scan and the same built results.
Rendering does not mutate results. Format selection and report order do not change findings, scores, suppression, or completeness.
Extend tests/unit/test_cli_reports.py with tests for these guarantees, output selection, and byte preservation of inputs and baselines.
changed the title [-]Refactor CLI scans into scan, build, render, and write stages[/-][+]Refactor existing report flow to separate result building from rendering[/+]on Nov 12, 2026
Activity
[-]Refactor CLI scans into scan, build, render, and write stages[/-][+]Refactor existing report flow to separate result building from rendering[/+]