Skip to content

Add post-run review UX renderer - #18

Merged
Mad-Labs42 merged 4 commits into
mainfrom
feat/post-run-review-ux
Apr 26, 2026
Merged

Add post-run review UX renderer#18
Mad-Labs42 merged 4 commits into
mainfrom
feat/post-run-review-ux

Conversation

@Mad-Labs42

@Mad-Labs42 Mad-Labs42 commented Apr 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a reusable post-run review renderer for final campaign output.
  • Routes runner post-run terminal presentation through the new UI renderer.
  • Preserves scoring, telemetry, DB, artifact generation, trust logic, and process-exit behavior.
  • Adds focused renderer tests and updates YOLO UX coverage.
  • Adds validation and blast-radius documentation.

Validation

  • ruff check
  • targeted pytest for post-run/yolo UX
  • full pytest suite
  • mypy checked during pre-commit review audit

Notes

  • YOLO remains dormant unless explicitly passed through the existing hook.
  • No interactive menu, recommendation logic, ACPM-specific final-screen divergence, or artifact-generation semantics were added.

Summary by CodeRabbit

  • New Features

    • Centralized post-run review screen showing campaign artifacts, diagnostics retention notice, YOLO reminder when applicable, and context-aware "Next actions".
  • Bug Fixes

    • Escaped file/path strings in console output to prevent markup misinterpretation.
  • Documentation

    • Added audit and validation notes detailing post-run review UX, tests, and risk guidance.
  • Chores

    • Minor type-annotation and internal tidy-ups.

Copilot AI review requested due to automatic review settings April 26, 2026 06:35
@coderabbitai

coderabbitai Bot commented Apr 26, 2026

Copy link
Copy Markdown

Walkthrough

Collects campaign artifact paths after writers finish, escapes file/path output for Rich-safe console rendering, adds render_post_run_review() to src/ui.py, and integrates artifact discovery and diagnostics path reporting into run_campaign() in src/runner.py. Also includes documentation and minor type-annotation tweaks.

Changes

Cohort / File(s) Summary
Documentation
docs/AUDITS/Post-Run-Review-UX/Post-Run-Review-UX-Blast-Radius-Audit.md, docs/Plans/Post-Run-Review-UX/Post-Run-Review-UX-Validation.md
New audit and validation notes describing current post-run output, test expectations, scope, implementation guidance, and follow-up testing.
Runner integration
src/runner.py
After artifact writers finish, computes diagnostics path, calls get_campaign_artifact_paths(...), updates in-memory artifact db_status/exists, escapes several path strings for Rich, removes YOLO trust-warning prints, and calls ui.render_post_run_review(...) (handles failures as non-fatal warnings).
UI renderer
src/ui.py
Adds render_post_run_review(...); updates render_artifact_block to escape artifact path values with rich.markup.escape; conditionally prints YOLO reminder, artifact block, "Next actions" only when report_ok, and diagnostics retention message with escaped path.
Artifact path helper
src/artifact_paths.py
Refined local type annotation in _resolve_artifact_path (resolved non-optional Path when DB path present); no logic change.
ACPM planning
src/acpm_planning.py
Added static type annotation dict[str, Any] for coverage_policy in compile_repeat_tier branch (no behavioral change).

Sequence Diagram(s)

sequenceDiagram
    participant Runner as Runner (run_campaign)
    participant ArtifactPaths as ArtifactPaths (get_campaign_artifact_paths)
    participant UI as UI Renderer (render_post_run_review)
    participant Console as Console Output

    Runner->>ArtifactPaths: get_campaign_artifact_paths(db_path)
    activate ArtifactPaths
    ArtifactPaths-->>Runner: artifact_list
    deactivate ArtifactPaths

    Runner->>UI: render_post_run_review(campaign_id, report_ok, artifacts, diagnostics_path, yolo_mode)
    activate UI
    alt yolo_mode is True
        UI->>Console: Print YOLO-active reminder
    end
    alt artifacts provided
        UI->>Console: Render artifact status block (paths escaped)
    end
    alt report_ok is True
        UI->>Console: Print "Next actions"
    end
    alt diagnostics_path provided
        UI->>Console: Print diagnostics retention message (path escaped)
    end
    deactivate UI
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add post-run review UX renderer' clearly and directly describes the main change: introducing a new post-run review UI renderer function and integrating it into the runner.
Description check ✅ Passed The PR description covers Summary, Validation, and Notes sections, addressing the core change and testing performed, though it deviates from the template structure (missing Scope, Risk, Why, Agent Surface sections).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/post-run-review-ux

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/AUDITS/Post-Run-Review-UX/Post-Run-Review-UX-Blast-Radius-Audit.md`:
- Around line 71-85: The out-of-scope file list in
Post-Run-Review-UX-Blast-Radius-Audit.md is stale because this PR modifies
src/artifact_paths.py and src/acpm_planning.py; update the table or wording in
the document to remove or soften the “must not be modified” claim so it reflects
the current bundle (refer to the table rows for `src/artifact_paths.py` and
`src/acpm_planning.py`), ensuring the docs either exclude those files or add a
qualifying note about exceptions/required separate review to avoid the
self-contradiction.
- Around line 269-275: The heading "Appendix A — Read-Only Commands Run During
Audit" is incorrect because the PowerShell line New-Item -ItemType Directory
-Force ... mutates the workspace; either remove that New-Item line from the
read-only list or rename the heading to something like "Commands Run During
Audit" / "Commands (including workspace changes)" so it accurately reflects
behavior; update the Appendix A heading text and any surrounding explanation
mentioning read-only commands and ensure the snippet with Select-String and
New-Item are placed in the correct section and consistent with docs/** guidance
about factual consistency.

In `@docs/Plans/Post-Run-Review-UX/Post-Run-Review-UX-Validation.md`:
- Around line 17-18: The table references the wrong-cased directory
`docs/Audits/...` while the new file lives under `docs/AUDITS/...`; update the
entry in `Post-Run-Review-UX-Validation.md` to use the exact `docs/AUDITS/...`
path (replace
`docs/Audits/Post-Run-Review-UX/Post-Run-Review-UX-Blast-Radius-Audit.md` with
`docs/AUDITS/Post-Run-Review-UX/Post-Run-Review-UX-Blast-Radius-Audit.md`) and
scan the same file for any other `docs/Audits` occurrences to correct them to
`docs/AUDITS` to avoid case-sensitive filesystem mismatches.

In `@src/runner.py`:
- Around line 2853-2870: The current post-run review uses
get_campaign_artifact_paths(effective_campaign_id, _effective_lab_root,
db_path=_eff_db_path) which can return stale artifacts from previous runs;
change the logic to restrict artifacts to those produced in this invocation by
checking the presence and freshness of canonical artifact rows (e.g.,
campaign_summary_md, metadata_json) in the current run before assigning
_artifact_list, or explicitly mark missing/failed canonical artifacts for
effective_campaign_id before calling ui.render_post_run_review; ensure you
reference get_campaign_artifact_paths, effective_campaign_id,
_effective_lab_root/_eff_db_path, _artifact_list and ui.render_post_run_review
so the review UI only receives artifacts verified as created/updated during this
invocation (or includes explicit failure markers) instead of reusing stale
DB/filesystem entries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a7425782-8ad0-4b91-be8a-c1d6ed96abb5

📥 Commits

Reviewing files that changed from the base of the PR and between eb4edb8 and 4d85f65.

⛔ Files ignored due to path filters (2)
  • test_cli_ux_post_run_review.py is excluded by none and included by none
  • test_cli_ux_yolo_review.py is excluded by none and included by none
📒 Files selected for processing (6)
  • docs/AUDITS/Post-Run-Review-UX/Post-Run-Review-UX-Blast-Radius-Audit.md
  • docs/Plans/Post-Run-Review-UX/Post-Run-Review-UX-Validation.md
  • src/acpm_planning.py
  • src/artifact_paths.py
  • src/runner.py
  • src/ui.py

Comment thread docs/AUDITS/Post-Run-Review-UX/Post-Run-Review-UX-Blast-Radius-Audit.md Outdated
Comment thread docs/AUDITS/Post-Run-Review-UX/Post-Run-Review-UX-Blast-Radius-Audit.md Outdated
Comment thread docs/Plans/Post-Run-Review-UX/Post-Run-Review-UX-Validation.md Outdated
Comment thread src/runner.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/runner.py`:
- Around line 2867-2875: The three branches for _art["artifact_type"]
(ARTIFACT_CAMPAIGN_SUMMARY, ARTIFACT_RUN_REPORTS, ARTIFACT_METADATA) repeat
identical logic; instead map artifact types to their corresponding "ok" flags
(report_ok, v2_ok, meta_ok) and compute a single conditional: if the artifact
type is one of those and its mapped ok flag is False then set _art["db_status"]
= "failed" and _art["exists"] = False. Update the code around the checks of
_art["artifact_type"] to use this map/lookup so the duplicated branches are
consolidated into one place.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: aeda5107-e599-49b3-8a3b-8dd7957b1111

📥 Commits

Reviewing files that changed from the base of the PR and between 4d85f65 and ec55101.

⛔ Files ignored due to path filters (1)
  • test_cli_ux_post_run_review.py is excluded by none and included by none
📒 Files selected for processing (3)
  • docs/AUDITS/Post-Run-Review-UX/Post-Run-Review-UX-Blast-Radius-Audit.md
  • docs/Plans/Post-Run-Review-UX/Post-Run-Review-UX-Validation.md
  • src/runner.py

Comment thread src/runner.py Outdated
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/Plans/Post-Run-Review-UX/Post-Run-Review-UX-Validation.md (1)

1-109: 🧹 Nitpick | 🔵 Trivial

Documentation is factually consistent with the source implementation.

The validation note accurately describes:

  • The get_campaign_artifact_paths import and read-only discovery call (lines 29-36)
  • The artifact status override consolidation (lines 71-72)
  • The call sequence (artifact writers → discovery → render)

Minor formatting note: The code block at line 78 should specify a language (e.g., bash or shell) for consistent rendering. This is a nitpick flagged by markdownlint.

🔧 Optional fix for code block language
-```
+```bash
 # Targeted lint
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/Plans/Post-Run-Review-UX/Post-Run-Review-UX-Validation.md` around lines
1 - 109, The fenced code block under "Validation Commands and Results" (the
block that begins with "# Targeted lint") is missing a language tag; update that
fenced code block to use a language specifier (e.g., add "bash" so the fence
becomes ```bash) to satisfy markdownlint and ensure consistent rendering in
render_post_run_review / docs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@docs/Plans/Post-Run-Review-UX/Post-Run-Review-UX-Validation.md`:
- Around line 1-109: The fenced code block under "Validation Commands and
Results" (the block that begins with "# Targeted lint") is missing a language
tag; update that fenced code block to use a language specifier (e.g., add "bash"
so the fence becomes ```bash) to satisfy markdownlint and ensure consistent
rendering in render_post_run_review / docs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4f49aa13-fa58-4d1b-a584-a3f8b7b8ea32

📥 Commits

Reviewing files that changed from the base of the PR and between ec55101 and dad1cb7.

📒 Files selected for processing (2)
  • docs/Plans/Post-Run-Review-UX/Post-Run-Review-UX-Validation.md
  • src/runner.py

@Mad-Labs42
Mad-Labs42 merged commit 1719d64 into main Apr 26, 2026
6 checks passed
@Mad-Labs42
Mad-Labs42 deleted the feat/post-run-review-ux branch April 26, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants