Skip to content

refactor(review): report rendering leaves the orchestrator #1008

Description

@dan-petty

Refreshed plan (2026-10-17, unblocking review)

This section supersedes any text below that conflicts with it.

Decisions

Scope

Delivery

  1. One PR (L), after refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151's PR 2 merges. Commit 1 adds the golden test, which goes through generate_consolidated_report and passes before the move. It uses a saved payload fixture plus tests/golden/review_report.md and tests/golden/review_console.txt. Files: new src/devops_cli/review/report.py and tests/review/test_report.py; src/devops_cli/ai/review/pipeline.py; src/devops_cli/ai/review/category_metrics.py (the baseline renders from history it is given); deleted src/devops_cli/ai/review/stages/__init__.py and reporting.py; ARCHITECTURE.md:184-185, which describe stages/; tests/test_codebase_hygiene_and_shims.py, whose _DELETED_REVIEW_MODULES entry devops_cli.ai.review.stages.adversarial_debate (:46) becomes devops_cli.ai.review.stages, because find_spec (:279) raises once the parent package is gone; and the 12 test files the rg check below names. Closes refactor(review): report rendering leaves the orchestrator #1008.

Acceptance criteria (these replace the matching criteria below; the rest stand)

  • src/devops_cli/review/report.py holds all report rendering: the 26 _build_*, _render_* and _format_* methods and _select_console_findings; the module-level render helpers and tables; _status_rows; and the functions of stages/reporting.py. rg -n -i persona src/devops_cli/review/report.py returns nothing.
  • The report reads no orchestrator attribute and opens no file. The orchestrator reads the review history for the category baseline and passes it in. The golden test calls the report with no orchestrator.
  • rg -n 'print_table|print_panel|format_markdown_fix|_CONSOLE_|_REPORT_|stages\.reporting' src/devops_cli/ai/review/pipeline.py returns nothing, src/devops_cli/ai/review/stages/ does not exist, and rg -n 'stages/' ARCHITECTURE.md returns nothing.
  • Severity counting has one implementation: the console breakdown (today _format_severity_breakdown) counts through the same function as the summary's _severity_breakdown. This replaces "One _format_severity_breakdown remains", which is already true word for word.
  • rg -n 'devops_cli\.ai\.review\.pipeline\.print_table|(orchestrator|pipeline|ReviewPipelineOrchestrator|\))\._(build|render|format)_' tests returns nothing. Today it matches 40 lines in 13 files. 3 of those lines are _build_multi_persona_pipeline calls that refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151's PR 2 deletes. The \) alternative catches calls on _orchestrator(tmp_path), which the narrower pattern missed.
  • The golden payload also holds a producer, a title containing | and a backtick fence, Rich markup in a description, and an errored file. The console view is recorded at a fixed width. Markdown and console text equal the output at the PR's base, so escaping is unchanged.
  • _persist_session_artifacts, the collection and dedupe helpers and _run_group_analysis_stage stay in the orchestrator, unchanged.

Current references (at 3dd7fa6)

  • Report methods: src/devops_cli/ai/review/pipeline.py:3911-4721, 26 methods plus _select_console_findings at :4382. _run_group_analysis_stage at :4191-4218 sits inside that range and stays.
  • Module-level render helpers and tables: pipeline.py:1617-1803; _status_rows at :2012-2020; the test-only alias format_markdown_fix at :4894, used at tests/test_review_report_summary.py:282.
  • Orchestrator state the report reads today: self.partial_context at pipeline.py:4128; self.full_output at :4387, :4466 and :4505; and the review history, which _build_category_baseline_section (:4063-4075) loads through format_category_baseline_markdown (src/devops_cli/ai/review/category_metrics.py:102, history read at :115 and :97).
  • Call site: generate_consolidated_report at pipeline.py:4781-4891, with the report calls at :4856-4882. Persistence: _persist_session_artifacts at :4736-4779, which writes the SARIF at :4754-4778.
  • Code refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151 changes first: persona columns at pipeline.py:1679, :1737, :3948, :3958, :3976, :4432; report dedupe at :3875-3884; payload personas at :4795-4800 and :4825-4843 (all PR 2); the has_personas gate at :4191-4198 and its call at :4854 (PR 1).
  • Severity: pipeline.py:4543 and src/devops_cli/ai/review/stages/reporting.py:59. stages is imported at pipeline.py:2014, :4119 and stages/__init__.py:5, and named at tests/test_codebase_hygiene_and_shims.py:46.
  • Group-analysis section: render_model_analysis_markdown at src/devops_cli/review/analysis.py:907, called at pipeline.py:4175-4177.
  • Tests:
    • _build_consolidated_markdown_report is called 20 times in 5 files: test_review_report_summary.py 10, test_review_report_integrity.py 4, test_review_static_analyzers.py 4, test_category_metrics.py 1, test_review_ruff_mypy_evidence.py 1.
    • pipeline.print_table is patched at tests/test_review_history.py:91, tests/test_review_report_integrity.py:236, tests/test_verdict_polarity.py:345, tests/test_review_symbol_delta.py:96 and tests/ai/review/test_cited_code.py:112.
    • Other private render calls: tests/test_review_admission.py:623-631, :888, :928-929; tests/test_verdict_polarity.py:324-325, :346; tests/test_review_report_integrity.py:251; tests/test_review_worktree_regression.py:246; tests/test_review_pipeline.py:1092.

Dependencies and order


Context & Rationale

Report rendering lives inside the orchestrator. Checked at 9c879ae.

Deletion test: the code moves rather than vanishes, but report changes stop touching the orchestrator, which is the locality this item buys.

Scope & Deliverables

Strategic Alignment

Scope added 2026-10-02: checked at 38517a8; the claims hold. The 20 rendering methods are at ai/review/pipeline.py:2976-3629, tests name _build_consolidated_markdown_report 12 times and patch pipeline.print_table 3 times. _format_severity_breakdown exists twice, at pipeline.py:3444 and ai/review/stages/reporting.py:141. #987 merged after the baseline (b1fddd0, pipeline.py +270/-117), so line numbers moved. #1009 merged after it too (79e1e93, PR #1012) and added a failed analyzer's reason to the report (pipeline.py +27/-2). #948 (v0.2.25, in flight) changes how the report ranks and groups findings.

Acceptance criteria

Key questions

Update 2026-10-08: refinement

The re-check the freeze asked for; it stays frozen. #871 did not rebuild the report from findings.sarif, which holds only admitted scanner findings (ai/review/pipeline.py:4887-4910). Rendering is 26 methods (:3995-4810); the suppressed section reads admitted_scanner_findings.

  • The module takes the admitted findings as input; the golden test has introduced, pre-existing and suppressed findings; one severity-breakdown function remains.

Activity

  1. added
    type/refactor
    scope/review
    priority/p3-low
    on Oct 2, 2026
  2. dan-petty commented on Oct 3, 2026

    @dan-petty
    OwnerAuthor

    Frozen by the evidence-first review redesign (#1137, owner direction of 2026-10-03): patches to the model generator and verifier stop, and tool-layer fixes continue. Report rendering survives the redesign, but the report is rebuilt from findings.sarif by #871 (one admission step). This item stays open, labelled status/blocked, and linked to #871; it is re-checked against #871's output before any work starts.

  3. added
    status/blocked
    on Oct 3, 2026
  4. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Linked: #771 and #872 (frozen item, link only). All three edit the constructor and generate_consolidated_report (ai/review/pipeline.py:2372-2377, :4811-4958); whichever lands second rebases. Found by the 2026-10-08 backlog review.

  5. added
    status/ready
    value/medium
    effort/medium
    and removed
    status/blocked
    on Oct 28, 2026
  6. added a commit that references this issue on Oct 29, 2026
  7. removed
    status/ready
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p3-lowscope/reviewtype/refactorvalue/medium

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions