Skip to content

Visual P10Y report in local quickstart#14

Merged
awrobel-gd merged 3 commits into
mainfrom
report-save
Jul 3, 2026
Merged

Visual P10Y report in local quickstart#14
awrobel-gd merged 3 commits into
mainfrom
report-save

Conversation

@awrobel-gd

@awrobel-gd awrobel-gd commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a visual HTML version of the P10Y multi-workspace estimation report so local quickstart users, who have no email or Slack notifier configured, can still view a rendered report by pressing a key in the TUI instead of only getting the raw markdown.

Entrypoint

The workflow writes the HTML report in multi_workspace_estimation_p10y_workflow (backend/app/workflows/multi_workspace_estimation_p10y.py), served via the new GET /api/v1/generation-sessions/{generation_id}/report.html endpoint (backend/app/api/v1/generation_sessions.py), and opened from the TUI's new h keybinding in DashboardScreen.action_open_report (mcp_server/tui/app.py).

Diagram

Nothing structural changed beyond an added artifact file (multi-workspace-estimation-report.html) written next to the existing markdown report under ARTIFACTS_BASE/{generation_id}/report/.

Details

The "Review 1" commit fixes a bug where the workflow passed the async StateMachineDBAdapter into the report renderer instead of its underlying sync IDatabase, which silently swallowed AttributeErrors and dropped the Variants section from the HTML entirely; the fix exposes a sync_db property on the adapter (backend/app/state/db_adapter.py) strictly for this read-only renderer use, since state/checkpoint writes must still go through the async adapter.

…r read-only access. Update notifications report renderer to utilize this new interface, ensuring write operations are restricted. Adjust related components to support the new read-only view in the async database adapter.

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.

Pull request overview

Adds a browser-renderable HTML version of the multi-workspace P10Y estimation report for local quickstart users, including an API endpoint to fetch the report and a TUI keybinding to open it, plus related backend refactors to safely pass a read-only DB handle into the renderer.

Changes:

  • Generate and persist an HTML report alongside the existing markdown report, and archive it under the artifacts report/ subdir.
  • Add GET /api/v1/generation-sessions/{generation_id}/report.html to serve the HTML report.
  • Update the local TUI to show component comparison details and support h to fetch/cache/open the HTML report.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
mcp_server/tui/render.py Adds component comparison rows to the estimate panel model and parsing.
mcp_server/tui/app.py Renders component breakdown + hint; adds h keybinding to fetch/cache/open report HTML.
mcp_server/tests/test_tui_render.py Updates render tests for new payload shape + component comparison sorting.
mcp_server/tests/test_tui_app.py Adds coverage for component breakdown rendering and open-report behavior.
backend/test/test_report_generation.py Adds workflow-level tests ensuring HTML report is written and Variants render with a real DB adapter.
backend/test/api/test_generation_sessions.py Adds endpoint tests for /report.html success/404.
backend/test/api/test_email_notifications.py Adds tests for shared HTML/plain report renderer used by email + workflow.
backend/scripts/example_test_session.py Adds a utility script to seed a completed session + reports for local TUI testing.
backend/app/workflows/multi_workspace_estimation_p10y.py Writes HTML report (best-effort) and archives report artifacts after completion.
backend/app/state/db_adapter.py Adds a read-only DB view property to safely pass to read-only renderers.
backend/app/database/interface.py Introduces ReadOnlyDatabase protocol (get-only).
backend/app/core/notifications.py Refactors report rendering into a shared function used by email + workflow.
backend/app/core/artifact_files.py Centralizes markdown/HTML report filenames as constants.
backend/app/api/v1/generation_sessions.py Adds the /report.html endpoint serving the archived HTML report.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1288 to +1289
html_parts.append(f'<div class="summary-item"><span class="summary-label">Specification:</span> {spec_path}</div>')
html_parts.append(f'<div class="summary-item"><span class="summary-label">Run ID:</span> {generation_id}</div>')
Comment on lines +1319 to 1322
html_parts.append(f'<strong>{repo_link["workspace_id"]}:</strong> ')
html_parts.append(
'<div class="summary-item"><span class="summary-label">Total LLM cost (cumulative):</span> '
f"<strong>{cost_display}</strong></div>"
f'<a href="{repo_link["branch_url"]}" target="_blank">Branch link</a>'
)
@awrobel-gd awrobel-gd merged commit 45fb65c into main Jul 3, 2026
4 checks passed
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.

3 participants