Repository navigation
feat(devtools): evidence dashboard and changed-path traceability (#998) - #1091
Conversation
Introduce `devtools evidence-dashboard` as a sibling to `evidence-report` that aggregates real artifacts emitted by the pytest-first verification pipeline (PRs #1083/#1086/#1087/#1088) without rebuilding a proof-row dashboard. Sections, each backed by a real artifact (or reported as unavailable): - pytest health from .cache/verify/last-pytest.json - contract evidence inventory from .cache/verification/evidence/*.json, grouped by surface with stale-artifact detection - coverage from coverage.xml or .coverage when present - benchmark campaign freshness from .local/benchmark-campaigns/ - SLO catalog rows (required vs informational) - static gate status from .cache/last-verify-result.json and .cache/verify-history.jsonl - witness counts (committed + local) - mutation campaign freshness from .local/mutation-campaigns/ `devtools evidence-dashboard trace --base <ref> --head <ref>` reuses the existing verification-impact report and links each change subject to the contract-evidence artifacts emitted by tests under that path, plus the required PR gates and deployment gates. Both surfaces emit JSON by default and Markdown when --markdown is set. Ref #998 Ref #1058 Co-Authored-By: Claude Sonnet 4.7 <[email protected]>
📝 WalkthroughWalkthroughThis pull request introduces a new ChangesEvidence Dashboard Feature
Sequence DiagramsequenceDiagram
participant Operator as Operator
participant CLI as evidence-dashboard CLI
participant Dashboard as build_dashboard
participant Readers as Artifact Readers
participant Files as On-Disk Artifacts
participant Trace as build_trace
participant Report as Impact Report
Operator->>CLI: devtools evidence-dashboard --json
CLI->>Dashboard: build_dashboard(root, stale_days)
Dashboard->>Readers: _pytest_health, _contract_evidence, etc.
Readers->>Files: scan .cache, .local, docs/plans
Files-->>Readers: JSON/YAML data, mtimes
Readers-->>Dashboard: structured sections (available/unavailable)
Dashboard-->>CLI: dashboard payload dict
CLI-->>Operator: JSON output or markdown report
Operator->>CLI: devtools evidence-dashboard trace --base origin/master
CLI->>Trace: build_trace(root, base_ref, head_ref)
Trace->>Report: build_verification_impact_report
Report-->>Trace: changed paths & claims
Trace->>Readers: _changed_path_evidence_map
Readers->>Files: load evidence artifacts
Files-->>Readers: contract/surface/nodeid metadata
Readers-->>Trace: path→evidence index
Trace-->>CLI: trace payload (path→claim→evidence)
CLI-->>Operator: JSON or markdown trace report
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@devtools/evidence_dashboard.py`:
- Around line 763-768: The --stale-days argument currently accepts any integer;
update the parser.add_argument call for "--stale-days" in
devtools/evidence_dashboard.py to validate that the value is non-negative by
providing either a type-checking function or an argparse "type" wrapper that
raises argparse.ArgumentTypeError for negative values (referencing the existing
DEFAULT_STALE_DAYS constant and the parser.add_argument invocation). Ensure the
parser rejects negative inputs at parse time with a clear error message like
"stale-days must be a non-negative integer".
🪄 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
Run ID: 3a748941-60f2-47db-9bf8-770806803313
📒 Files selected for processing (4)
devtools/command_catalog.pydevtools/evidence_dashboard.pydocs/devtools.mdtests/unit/devtools/test_evidence_dashboard.py
| parser.add_argument( | ||
| "--stale-days", | ||
| type=int, | ||
| default=DEFAULT_STALE_DAYS, | ||
| help=f"Mark contract-evidence artifacts older than N days as stale (default: {DEFAULT_STALE_DAYS}).", | ||
| ) |
There was a problem hiding this comment.
Validate --stale-days as non-negative.
Line 765 accepts any integer, so values like --stale-days -1 make stale reporting misleading. Reject negative values at parse time.
Suggested fix
+def _non_negative_int(value: str) -> int:
+ parsed = int(value)
+ if parsed < 0:
+ raise argparse.ArgumentTypeError("--stale-days must be >= 0")
+ return parsed
+
+
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
@@
parser.add_argument(
"--stale-days",
- type=int,
+ type=_non_negative_int,
default=DEFAULT_STALE_DAYS,
help=f"Mark contract-evidence artifacts older than N days as stale (default: {DEFAULT_STALE_DAYS}).",
)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@devtools/evidence_dashboard.py` around lines 763 - 768, The --stale-days
argument currently accepts any integer; update the parser.add_argument call for
"--stale-days" in devtools/evidence_dashboard.py to validate that the value is
non-negative by providing either a type-checking function or an argparse "type"
wrapper that raises argparse.ArgumentTypeError for negative values (referencing
the existing DEFAULT_STALE_DAYS constant and the parser.add_argument
invocation). Ensure the parser rejects negative inputs at parse time with a
clear error message like "stale-days must be a non-negative integer".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0288ded7e8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…al rows (#1082) (#1096) ## Summary Records the policy decision for `docs/media/` (no committed screenshots or VHS tapes; render on demand from `polylogue/showcase/` exercises) and brings the docs-media coverage manifest in line with what is actually committed. Resolves the question #1082 left open. ## Problem PR #1088 stripped the aspirational `screenshots` and `vhs_tapes` rows from `docs/plans/docs-media-coverage.yaml` because they had no executable verification path — no asset to check, no freshness gate, no render target. #1082 asked whether to commit those assets and reintroduce real rows, or close the question. The manifest carried a placeholder coverage_gap (`docs-media.screenshot-integrity`) and an inline comment pointing at #1082, but neither described an actual gap in committed content — they described an undecided product question. ## Solution Decision: do not commit screenshots or VHS tapes. Cost/benefit analysis: - README does not currently reference any screenshots or VHS tapes (verified with `grep`). - Committed terminal/UI captures bind the repo to specific terminal sizes, themes, fonts, sample data, and timestamps, all of which drift faster than the underlying code — large diffs with no semantic signal that date the documentation badly. - The showcase + qa workflows already provide reproducible captures when needed (release notes, blog posts, the website). - A committed asset without a `--check`-style freshness gate would be dead weight the manifest cannot honestly claim coverage over. Changes: - `docs/media/README.md` (new): policy doc explaining why the directory holds only renderable diagrams, and the three requirements any future committed asset must satisfy (render script, `--check` freshness gate, manifest row). - `docs/plans/docs-media-coverage.yaml`: replace the screenshots/VHS-tape inline comment with a real `media_policy` row pointing at the README and a `readme_diagrams` row covering the Mermaid/SVG diagrams that `devtools render-readme-media` already verifies. Drop the `docs-media.screenshot-integrity` coverage_gap — the gap was the open question itself. - `docs/verification-catalog.md`: regenerated (subjects +1, coverage_item +2, coverage_gap -1). - `devtools/evidence_dashboard.py`: drop a redundant `isinstance(entry, dict)` ternary that mypy --strict rejects with `redundant-expr`. Landed unguarded by #1091 and has been red on master since; unblocks the pre-push hook for this PR. Pulled into this branch only because the gate would otherwise prevent the policy change from landing. ## Verification ``` nix develop -c devtools verify-manifests ✓ manifest consistency checks passed nix develop -c devtools render-readme-media --check (no drift) nix develop -c devtools render-all --check OK: .cache/site matches sources. nix develop -c devtools verify --quick exit_code: 0 (after the evidence_dashboard.py fix) ``` Closes #1082
) (#1098) ## Summary Pin the post-#944 external-content FTS conversion with three focused regression tests, and clear an inherited mypy `redundant-expr` failure that was blocking the local `devtools verify --quick` baseline. The headline scope of #817 — FTS storage bloat, external-content delete correctness, FTS trigger commit-ordering, JSON tag read paths — already landed across #944 / #882. After auditing each acceptance criterion on master and against the corrections in the reopened-issue comments (`live_cursor` is active, `conversation_tags` is active, `ArchiveWriteGateway` is active), the actionable remaining work for this scope is *durable evidence*: the invariants must not silently regress, and the catalogue must hold them after future schema edits. ## Problem The original PR for #817 attempted the external-content FTS conversion but reverted it because a DELETE on `messages` left the row matchable in FTS. The conversion was reapplied in #944 (with the corrected `messages_fts_ad` trigger), but no committed test verifies either: - the DDL still uses `content='messages', content_rowid='rowid'`, - on synthetic data the FTS pages stay well under the source-table pages (the original "~6 GB bloat" claim), - DELETE on `messages` is propagated to `messages_fts` via the AD trigger (the exact bug that forced the earlier revert). Without that coverage, the next schema edit that touches `MESSAGE_FTS_DDL` or the trigger DDL in `polylogue/storage/fts/fts_lifecycle.py` can silently bring the bloat back, and CI will not notice. Concurrent finding: `devtools verify --quick` on master fails with one mypy `[redundant-expr]` error in `devtools/evidence_dashboard.py:347` introduced by #1091. That blocks every push from this branch (and every other branch), so it is folded into this PR. ## Solution `tests/unit/storage/test_fts_bloat_invariants.py` (new file, owned by the storage tier): - `test_messages_fts_is_contentless_external_content` — reads `sqlite_master.sql` for `messages_fts` and asserts the DDL still carries both `content='messages'` and `content_rowid='rowid'`. - `test_messages_fts_storage_does_not_duplicate_message_bodies` — synthesises 2000 messages × ~5 KB and uses the `dbstat` virtual table to compare `SUM(pgsize) WHERE name LIKE 'messages_fts%'` to `SUM(pgsize) WHERE name LIKE 'messages%'`. Observed ratio on the fixture is ~0.2; threshold is 0.5, well below the ~1.0 a regression to standalone FTS5 would produce. - `test_messages_fts_deletion_consistency_with_external_content` — inserts two messages with unique tokens, deletes one, and asserts the deleted token no longer matches while the surviving token still does. Pins the `messages_fts_ad` trigger semantics. The dedicated file (151 LOC) was placed alongside `test_fts5.py` instead of inlined because `test_fts5.py` is already at its declared `docs/plans/file-size-budgets.yaml` ceiling of 1650 LOC. `devtools/evidence_dashboard.py` — drop the `isinstance(entry, dict)` guard on a `list[dict[str, Any]]` so mypy --strict is clean again. ### Audit results for the original #817 acceptance criteria | AC | State | Evidence | | --- | --- | --- | | FTS bloat measured before/after | Pinned by new tests | Synthetic fixture: messages = ~11 MB, messages_fts_* = ~2.1 MB (ratio ~0.19) | | Removed indexes/tables/columns have query evidence | No removal in this PR — `idx_messages_provider_role`, `idx_messages_provider_stats`, all four `idx_conv_stats_*` indexes are actively used by `EXPLAIN QUERY PLAN` on the filter pushdowns and provider-rollup queries | EQP probes against synthetic data | | Remaining tag reads use canonical M2M tag model | `storage/sqlite/queries/conversations_identity.py:list_tags` already prefers the `conversation_tags`+`tags` M2M join; the JSON `metadata->'tags'` query is an explicitly documented fallback for unmigrated archives only. The other `json_extract(metadata, '$.tags')` matches in `schema_bootstrap.py` are one-time migration backfill SQL (`SchemaBackfillDescriptor`), not runtime reads | Grep + file inspection | | FTS trigger suspension/repair regression coverage | Pre-existing `test_fts_triggers_restored_after_exception` (test_fts5.py:1498), `test_fts_triggers_restored_after_exception_during_ingest` (test_backend.py:1652), plus daemon startup-repair path in `polylogue/daemon/cli.py:_fts_startup_check` | Existing tests + daemon code | | Schema/fresh-init implications recorded | No schema change in this PR. The new tests are read-only against the current `SCHEMA_DDL` | N/A | ANALYZE scheduling already exists in `polylogue/daemon/cli.py:_periodic_db_optimize` (daily `PRAGMA optimize`). ### Files NOT changed (intentional) Per the worktree scope, only `polylogue/storage/sqlite/`, `polylogue/storage/search_providers/`, repository read-side mixins, and related tests are owned by this PR. The mypy fix in `devtools/` is an inherited blocker that must be cleared to push from this branch; it is intentionally minimal (one line) and unrelated to ownership boundaries. ## Verification ``` $ nix develop -c pytest tests/unit/storage/test_fts_bloat_invariants.py -q ... [100%] 3 passed in 20.23s $ nix develop -c mypy --strict polylogue tests/unit/storage devtools Success: no issues found in 873 source files $ nix develop -c devtools verify-file-budgets file-size budgets: clean $ git push # (pre-push hook = devtools verify --quick) ... exit_code: 0 ``` Measured FTS bloat (synthetic 2000-message fixture, ~10 MB of message text, post-VACUUM): ``` messages table pages: 10,936,320 bytes (~10.4 MB) messages_fts_data: 2,109,440 bytes messages_fts_docsize: 28,672 bytes messages_fts_config: 4,096 bytes messages_fts_idx: 4,096 bytes messages_fts total: 2,146,304 bytes (~2.0 MB) ratio: ~0.20 ``` Stale JSON-tag read paths migrated: 0 (the only remaining JSON read in `list_tags` is an explicit fallback for unmigrated archives, kept on purpose per the issue's "stale JSON tag reads should use `conversation_tags`+`tags`" framing combined with the schema-bootstrap backfill that turns the JSON tags into M2M rows on first start). Ref #817 --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Adds
devtools evidence-dashboardanddevtools evidence-dashboard traceas the V7/V8 surface for #998 — a pytest-first evidence dashboard built over the real artifacts produced by PRs #1083/#1086/#1087/#1088, plus a changed-path traceability view that links each change to its committed contract evidence and required gates.Problem
The pytest-first evidence model is now real:
.cache/verify/last-pytest.json(#1087),.cache/verification/evidence/*.json(100+ artifacts),.cache/last-verify-result.json, the SLO catalog with tier/freshness (#1086), and parsed CI workflow facts (#1088) all exist. What was missing was the single surface that reads those artifacts and presents the V7 dashboard / V8 traceability view from #998, without rebuilding a proof-row aggregator.devtools evidence-reportoverlaps in shape but is anchored to verify-history + suppressions + witnesses. It is intentionally left in place; the new dashboard is a sibling so existing consumers and tests are not disturbed.Solution
New module
devtools/evidence_dashboard.pywith sections, each backed by a real artifact (or reported asavailable: falsewith the reason — no aspirational rows):.cache/verify/last-pytest.json(status, counts, duration, last-run, staleness).cache/verification/evidence/*.json, grouped by surface, with stale-artifact and dirty-tree detectioncoverage.xml(line %) or.coverage(presence only) when present.local/benchmark-campaigns/devtools.verify_slos._parse_slo_catalog.cache/last-verify-result.json(preferred) falling back to.cache/verify-history.jsonltests/witnesses/+.local/witnesses/).local/mutation-campaigns/evidence-dashboard trace --base <ref> --head <ref>reusesbuild_verification_impact_reportand joins each change subject (bytest_nodeid→ test source path) to the contract-evidence artifacts emitted by that test, plus required PR gates and deployment gates. Output is JSON by default and Markdown when--markdownis set; both formats are combinable.Registered in
devtools/command_catalog.py,docs/devtools.mdregenerated.Verification
Local commands run:
nix develop -c pytest tests/unit/devtools/test_evidence_dashboard.py -v— 15 passednix develop -c pytest tests/unit/devtools/test_evidence_dashboard.py tests/unit/devtools/test_evidence_report.py tests/unit/devtools/test_command_catalog.py tests/unit/devtools/test_render_devtools_reference.py -q— 35 passednix develop -c mypy devtools/evidence_dashboard.py tests/unit/devtools/test_evidence_dashboard.py— Success: no issuesnix develop -c ruff check devtools/evidence_dashboard.py tests/unit/devtools/test_evidence_dashboard.py— cleannix develop -c devtools render-all --check— sync OKnix develop -c devtools verify --quick— exit_code 0nix develop -c devtools evidence-dashboard --json— emits dashboard against this worktree, correctly reports missing pytest/coverage/campaign artifacts on the clean fixture worktree, surfaces real SLO catalog rows (3 required, 3 informational) and witness countsnix develop -c devtools evidence-dashboard trace --base origin/master --head HEAD --json— emits trace; 0 changes on the post-commit working tree, required_gates and deployment_gates populated from the verification-impact pipelineArtifact gaps observed
The dashboard reports these as
available: falsebecause the underlying artifacts don't exist in this worktree:.cache/verify/last-pytest.json— only produced bydevtools verifyruns that include the pytest step; a fresh worktree without a verify run reports unavailablecoverage.xml/.coverage— none committed;devtools coverage-gateproduces them.local/benchmark-campaigns/— populated only bydevtools benchmark-campaign run <name>.local/mutation-campaigns/— populated only bydevtools mutmut-campaign run <name>These gaps are honest: the dashboard does not fabricate values, and each section names the command needed to populate it. The main checkout at
/realm/project/polylogueis the same shape — the SLO catalog, witnesses, and static-gate cache are present; coverage and pytest-report artifacts depend on operator runs.Ref #998
Ref #1058
Summary by CodeRabbit
evidence-dashboarddeveloper command with a dashboard mode to visualize verification artifacts, test health, coverage status, and benchmark freshness.