Repository navigation
fix: close proof and surface gaps - #577
Conversation
Problem: post-close audits showed architecture, proof, CLI/MCP, browser-capture, and Codex surfaces had shipped with uneven closure evidence and several verification mechanisms were tracking historical issue cleanup rather than durable semantic contracts. What changed: expand proof-pack, coverage-manifest, schema-roundtrip, witness, topology, and evidence-quality gates; retire the public audit CLI; normalize browser-capture spool wording; role-gate MCP tools and sanitize server errors; add Codex cwd/event extraction; add scenario presentation metadata and high-value witnesses; and remove closed-issue-shaped verifiability checks in favor of stable owners, next-evidence paths, and semantic invariants. Verification: devtools verify passed. git diff --check passed. Closes #576
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis pull request implements comprehensive closure for post-close architecture and verifiability audit gaps across the repository. The changes introduce: a new proof-pack CI workflow for PR comments, schema roundtrip verification infrastructure, removal of the Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related issues
Possibly related PRs
Suggested labels
✨ Finishing Touches🧪 Generate unit tests (beta)
|
Polylogue Proof PackRefs: Affected Domains
Required Gates
Known Gaps
Oracle / Cost
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa77c0fc22
ℹ️ 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".
| if record_type == "function_call_output": | ||
| tool_id = payload.get("call_id") or payload.get("id") | ||
| output = payload.get("output") | ||
| output_text = output if isinstance(output, str) else json.dumps(output, sort_keys=True) if output else None |
There was a problem hiding this comment.
Preserve falsy function outputs when building tool results
The new function_call_output parsing drops valid outputs like 0, false, {}, or [] because output_text is only serialized when output is truthy. In those cases the parser emits text=None (or even returns None when tool_id is also absent), so Codex tool-result messages lose content and downstream action-event/materialization logic sees incomplete evidence for otherwise successful calls.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR closes the post-shipping audit work in #576 by converting previously “closed-by-architecture” proof/verification cleanup into enforceable, diff-shaped verification layers, while also tightening several user-facing surfaces (MCP authorization/error sanitization, CLI output format consistency, browser-capture terminology, and Codex event extraction).
Changes:
- Adds proof-catalog “assurance coverage” subjects, evidence-quality proof laws, diff-shaped proof-pack/obligation-diff outputs (incl. PR comment workflow), and schema roundtrip verification wired into
devtools verify --quick. - Hardens MCP and CLI surfaces: MCP role gating (
read|write|admin) + sanitized internal errors; expands canonical--format jsonbehavior across query-shaped CLI commands; removes publicpolylogue audit. - Improves ingestion/product semantics: Codex parser materializes cwd + tool call/result messages/events; browser-capture terminology and paths move from “inbox” to “spool”; scenario projection metadata gains presentation fields.
Reviewed changes
Copilot reviewed 136 out of 136 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/witnesses/topology-projection.witness.json | Removes closed-issue linkage field from witness metadata. |
| tests/witnesses/site-publication-contract.witness.json | Adds committed synthetic witness metadata for static site publication semantics. |
| tests/witnesses/mcp-tool-schemas.witness.json | Removes linked-issue field; updates metadata text encoding. |
| tests/witnesses/golden-tool-use-json.witness.json | Removes linked-issue field from witness metadata. |
| tests/witnesses/cli-command-surface.witness.json | Adds committed synthetic witness metadata for public CLI surface contract. |
| tests/witnesses/browser-capture-sequence.witness.json | Adds committed synthetic witness metadata for browser-capture sequence/terminology contract. |
| tests/witnesses/blob-store-layout.witness.json | Removes linked-issue field; normalizes witness prose encoding. |
| tests/unit/sources/test_tool_aliases.py | Adds unit tests for canonical tool-name aliasing and categorization. |
| tests/unit/sources/test_parsers_codex.py | Extends Codex parser tests for cwd extraction and function/tool events/messages. |
| tests/unit/sources/test_browser_capture.py | Updates tests to use spool_path instead of inbox_path. |
| tests/unit/showcase/test_exercise_catalog.py | Removes audit JSON exercise assertion now that audit is retired from product CLI. |
| tests/unit/security/test_mcp_security.py | Tightens MCP error sanitization contract assertions (no raw message/traceback). |
| tests/unit/scenarios/test_metadata.py | Adds presentation metadata fields to ScenarioMetadata and merge/defaulting behavior tests. |
| tests/unit/proof/test_witnesses.py | Adds high-value witness coverage checks; updates known-failing witness validation semantics. |
| tests/unit/proof/test_generated_scenario_obligations.py | Renames subject test and changes mapped-claim requirement from issue link to mapping note. |
| tests/unit/proof/test_diffing.py | Adds routing tests for architecture/coverage-manifest/schema-roundtrip change kinds. |
| tests/unit/proof/test_catalog.py | Expands catalog compilation expectations (new claims/subjects, oracle independence OK check). |
| tests/unit/mcp/test_tool_schema_witness.py | Builds MCP server as admin for tool-schema witness generation/collection. |
| tests/unit/mcp/test_tool_contracts.py | Updates MCP error expectations to sanitized internal error envelope. |
| tests/unit/mcp/test_server_surfaces.py | Adds tests for role-gated tool registration (read/write omit tools appropriately). |
| tests/unit/mcp/test_server_runtime.py | Updates runtime server caching tests to pass default role (read). |
| tests/unit/mcp/test_mcp_edge_cases.py | Updates edge-case error assertions to sanitized internal error envelope. |
| tests/unit/mcp/conftest.py | Uses admin role for MCP server fixture to keep existing tool coverage in tests. |
| tests/unit/devtools/test_verify_schema_roundtrip.py | Adds tests for new schema-roundtrip verifier command (JSON output + scope requirement). |
| tests/unit/devtools/test_verify_migrations.py | Adds parsing test for empty manifest; removes strict-mode test tied to retired migration. |
| tests/unit/devtools/test_verify_manifests.py | Adds tests for new coverage-gap manifest validation (owner/next_evidence required). |
| tests/unit/devtools/test_verify_file_budgets.py | Updates budget exception schema from until to reason. |
| tests/unit/devtools/test_verify.py | Updates quick verify step list (adds layering + schema-roundtrip, removes migrations). |
| tests/unit/devtools/test_scenario_projections.py | Adds coverage for presentation metadata in scenario projection entries. |
| tests/unit/devtools/test_render_topology_status.py | Updates topology status tests from per-issue to placement-domain (owner) reporting. |
| tests/unit/devtools/test_proof_pack.py | Adds tests for diff-shaped proof-pack fields + markdown rendering. |
| tests/unit/devtools/test_obligation_diff.py | Adds tests for --base-ref/--head-ref and markdown output. |
| tests/unit/devtools/test_devtools_main.py | Ensures new devtools command appears in command list JSON. |
| tests/unit/core/test_paths.py | Updates exported path roots: adds browser_capture_spool_root, removes inbox_root. |
| tests/unit/cli/test_operator_support_runtime.py | Updates MCP CLI wiring tests to pass role into serve_stdio. |
| tests/unit/cli/test_json_envelope_contract.py | Adds query-shaped command × JSON output matrix for --format json and --json alias. |
| tests/unit/cli/test_click_app.py | Removes audit command registration and its associated tests. |
| tests/unit/cli/test_cli_error_boundaries.py | Removes error-boundary tests for removed audit/generate surfaces. |
| tests/unit/cli/test_bulk_export.py | Adds end-to-end-ish authored-content bulk-export filter workflow coverage. |
| tests/unit/cli/snapshots/test_terminal_snapshots.ambr | Updates CLI help snapshots (audit removed; browser-capture wording updated). |
| tests/unit/browser_capture/test_receiver.py | Updates receiver tests for spool_path naming and plumbing. |
| tests/unit/architecture/test_topology_invariants.py | Converts xfail/issue-shaped topology invariants into durable invariants. |
| tests/proof/laws/evidence_quality/test_serious_claims_have_independent_evidence.py | Adds proof law enforcing oracle independence metadata for serious claims. |
| tests/proof/laws/evidence_quality/test_serious_claims_explain_staleness.py | Adds proof law requiring staleness conditions for serious claims. |
| tests/proof/laws/evidence_quality/test_runner_trust_metadata_is_complete.py | Adds proof law requiring runner trust/freshness metadata completeness. |
| tests/proof/laws/evidence_quality/init.py | Introduces evidence-quality proof-law package. |
| tests/proof/laws/completeness/test_every_json_command_has_envelope_claim.py | Marks existing completeness law with proof_law marker. |
| tests/proof/laws/completeness/test_every_command_has_help_claim.py | Marks existing completeness law with proof_law marker. |
| tests/proof/laws/anti_dead_code/test_every_subject_has_at_least_one_claim.py | Expands fully-bound kinds and marks with proof_law. |
| tests/proof/laws/anti_dead_code/test_every_claim_selects_at_least_one_subject.py | Marks existing anti-dead-code law with proof_law marker. |
| tests/data/witnesses/site-publication-contract.json | Adds synthetic fixture describing static site publication expectations. |
| tests/data/witnesses/cli-command-surface.json | Adds synthetic fixture describing public CLI command/flag surface expectations. |
| tests/data/witnesses/browser-capture-sequence.json | Adds synthetic fixture describing browser-capture terminology and required sequence. |
| tests/baselines/showcase/help-main.txt | Updates help baseline (audit removed; browser-capture wording updated). |
| tests/baselines/showcase/help-browser-capture.txt | Updates help baseline to “spool” terminology. |
| tests/baselines/showcase/help-browser-capture-status.txt | Updates help baseline: --spool replaces --inbox. |
| tests/baselines/showcase/help-browser-capture-serve.txt | Updates help baseline: --spool replaces --inbox. |
| tests/baselines/showcase/help-audit.txt | Removes baseline for retired polylogue audit command. |
| pyproject.toml | Registers new pytest marker proof_law. |
| polylogue/sources/parsers/codex.py | Materializes cwd + function/tool events into provider_meta/messages/events. |
| polylogue/showcase/generators.py | Removes audit JSON-contract scenario from generated showcase exercises. |
| polylogue/showcase/exercise_catalog.json | Removes help-audit generated exercise entry. |
| polylogue/scenarios/projections.py | Includes presentation metadata fields in projection entries. |
| polylogue/scenarios/metadata.py | Adds presentation metadata fields + payload/object extraction and merge/default logic. |
| polylogue/proof/witnesses.py | Removes linked-issue field; requires rejection_reason for known-failing witnesses. |
| polylogue/proof/subjects.py | Expands selected JSON command subjects and adds architecture/schema-roundtrip/coverage-manifest subjects. |
| polylogue/proof/runners.py | Updates generated-scenario evidence checks to use mapping notes and removes issue-shaped checks. |
| polylogue/proof/rendering.py | Renders assurance coverage subject summary in generated verification catalog markdown. |
| polylogue/proof/models.py | Adds oracle/evidence source + independence metadata fields to claims. |
| polylogue/proof/generated_scenarios.py | Replaces issue-link mapping with explicit mapping notes; removes default issue field. |
| polylogue/proof/diffing.py | Adds new change kinds and markdown rendering for affected obligations; routes architecture/coverage/schema changes. |
| polylogue/proof/coverage_manifests.py | New module to parse coverage manifests and compile assurance coverage subjects/gaps. |
| polylogue/paths/_roots.py | Renames inbox root to browser-capture spool root. |
| polylogue/paths/init.py | Re-exports browser_capture_spool_root and removes inbox_root. |
| polylogue/mcp/server_tools.py | Registers mutation/maintenance tools only when allowed by MCP role. |
| polylogue/mcp/server_support.py | Adds role model + role ordering; sanitizes MCP tool errors; extends error payload schema. |
| polylogue/mcp/server_resources.py | Sanitizes MCP resource errors with stable internal error envelope. |
| polylogue/mcp/server.py | Adds role parameter to server construction/caching; passes role through callbacks and serve entrypoint. |
| polylogue/mcp/payloads.py | Extends MCP error payload with code and detail. |
| polylogue/lib/viewport/tools.py | Adds Codex tool aliases to tool categorization logic. |
| polylogue/lib/action_event/action_events.py | Adds canonical tool-name mapping used for cross-provider statistics. |
| polylogue/cli/commands/schema.py | Adds canonical --format support (json/markdown where applicable) as alias for machine output. |
| polylogue/cli/commands/qa.py | Removes retired polylogue audit command implementation. |
| polylogue/cli/commands/mcp.py | Adds --role flag and passes role through to MCP server. |
| polylogue/cli/commands/browser_capture.py | Renames browser-capture CLI options/help from inbox to spool. |
| polylogue/cli/click_command_registration.py | Unregisters retired audit command. |
| polylogue/browser_capture/server.py | Plumbs spool_path naming into receiver server behavior. |
| polylogue/browser_capture/receiver.py | Renames config/plumbing from inbox to spool; updates payload fields accordingly. |
| docs/verification-lab.md | Updates docs to reflect audit retirement and devtools surfaces for schema audit. |
| docs/verification-catalog.md | Refreshes generated catalog output for new subjects/claims and quality checks. |
| docs/topology-status.md | Updates generated topology status wording to placement-domain progress. |
| docs/test-quality-workflows.md | Refreshes generated scenario projection counts and removes audit-related rows. |
| docs/plans/test-quality-coverage.yaml | Removes issue-shaped header; adds owner/next_evidence to coverage gaps. |
| docs/plans/test-ownership.yaml | Removes issue-shaped header. |
| docs/plans/suppressions.yaml | Removes issue-shaped comment field mention. |
| docs/plans/security-privacy-coverage.yaml | Removes issue-shaped header; adds owner/next_evidence to coverage gaps. |
| docs/plans/scenario-coverage.yaml | Removes issue-shaped header; normalizes gap schema to include owner/next_evidence. |
| docs/plans/oracle-quality.yaml | Removes issue-shaped header. |
| docs/plans/migrations.yaml | Converts manifest to active-only empty baseline with guidance text. |
| docs/plans/lint-escalation.yaml | Removes issue-shaped fields and drops verify-migrations rule entry. |
| docs/plans/layering.yaml | Reframes layering rules as no-backward-import contracts; updates rule structure. |
| docs/plans/file-size-budgets.yaml | Replaces issue-shaped exception fields with explicit reasons; updates guidance. |
| docs/plans/evidence-freshness.yaml | Removes issue-shaped header; reframes as manifest. |
| docs/plans/docs-media-coverage.yaml | Adds explicit path fields per surface and introduces owner/next_evidence coverage gaps. |
| docs/plans/distribution-coverage.yaml | Removes issue-shaped header; adds owner/next_evidence to coverage gaps. |
| docs/plans/campaign-coverage.yaml | Removes issue-shaped header; reframes as manifest. |
| docs/plans/assurance-domains.yaml | Updates domain notes and adds architecture_discipline domain. |
| docs/plans/api-parity.yaml | Removes issue-shaped references; adds ownership field for output-format parity gap. |
| docs/devtools.md | Documents new verify-schema-roundtrip command and updates verify step list. |
| docs/configuration.md | Removes inbox directory guidance; documents browser-capture spool and run --input conventions. |
| docs/cli-reference.md | Removes audit docs; updates browser-capture wording; documents mcp --role. |
| docs/browser-capture.md | Updates terminology from inbox to spool. |
| devtools/witness_promote.py | Removes linked-issue flag; requires rejection reason when promoting known-failing witness. |
| devtools/verify_topology.py | Removes issue-shaped reference from docstring. |
| devtools/verify_test_ownership.py | Removes issue-shaped reference from docstring. |
| devtools/verify_suppressions.py | Removes issue-shaped reference from docstring. |
| devtools/verify_schema_roundtrip.py | Adds new schema roundtrip verifier command implementation. |
| devtools/verify_migrations.py | Reframes as active-only tool; improves empty-manifest parsing and output formatting. |
| devtools/verify_manifests.py | Adds coverage-gap validation (owner + next_evidence required). |
| devtools/verify_layering.py | Improves import collection/path reporting and package matching logic. |
| devtools/verify_file_budgets.py | Removes sunset-issue logic; simplifies exception handling text. |
| devtools/verify_cross_cuts.py | Updates docstring/comments to remove issue-shaped phrasing. |
| devtools/verify_cluster_cohesion.py | Removes issue-shaped reference from docstring. |
| devtools/verify.py | Wires verify-layering + verify-schema-roundtrip into verify steps; drops verify-migrations. |
| devtools/scenario_projections.py | Renders scenario projection presentation metadata in text output. |
| devtools/render_topology_status.py | Switches topology dashboard from per-issue to per-owner progress. |
| devtools/render_cli_reference.py | Removes audit section from CLI reference generation. |
| devtools/obligation_diff.py | Switches CLI flags to --base-ref/--head-ref; adds markdown output and obligation ID collection. |
| devtools/command_catalog.py | Adds verify-schema-roundtrip; updates obligation-diff/proof-pack examples; updates witness-promote docs. |
| devtools/build_topology_projection.py | Reframes projection ownership from issue IDs to placement-domain owners; updates emitted YAML header. |
| README.md | Clarifies devtools vs product CLI roles and provides fallback for non-devtools installs. |
| CHANGELOG.md | Adds entries for MCP roles, proof-pack/obligation-diff/workflow, Codex materialization, spool terminology, schema output, audit removal. |
| .github/workflows/proof-comment.yml | Adds PR workflow to compute and post sticky proof-pack markdown comment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if record_type == "function_call_output": | ||
| tool_id = payload.get("call_id") or payload.get("id") | ||
| output = payload.get("output") | ||
| output_text = output if isinstance(output, str) else json.dumps(output, sort_keys=True) if output else None | ||
| if not tool_id and not output_text: | ||
| return None | ||
| return ParsedMessage( |
There was a problem hiding this comment.
output_text = ... json.dumps(output) if output else None treats valid outputs like 0, false, empty list, or empty object as missing and drops them from the parsed tool-result message. Prefer checking output is not None (and serializing even falsy JSON values) so tool output roundtrips accurately.
There was a problem hiding this comment.
Actionable comments posted: 20
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (6)
tests/baselines/showcase/help-browser-capture-serve.txt (1)
1-9:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winFinish the terminology migration in this help snapshot.
The option rename landed, but the synopsis still says "browser-capture receiver." Keeping that line in the baseline will lock the old user-facing wording back in.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/baselines/showcase/help-browser-capture-serve.txt` around lines 1 - 9, The help snapshot still uses the old phrase "browser-capture receiver" in the synopsis for the command "polylogue browser-capture serve"; update the baseline text to the new terminology by replacing "Run the local browser-capture receiver." with the new phrasing (e.g., "Run the local browser-capture service." or the agreed replacement) so the help snapshot matches the completed option rename and no longer locks the old user-facing wording.tests/unit/devtools/test_devtools_main.py (1)
16-26: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winMirror the new command assertion in the human-output test.
This change only protects
verify-schema-roundtripin the JSON listing. If the plain-text catalog drops it,test_list_commands_human_outputstill passes.Suggested assertion
def test_list_commands_human_output(capsys: pytest.CaptureFixture[str]) -> None: assert devtools_main.main(["--list-commands"]) == 0 captured = capsys.readouterr() assert "verification lab surface:" in captured.out assert "semantic-axis-evidence" in captured.out assert "lab-corpus" in captured.out assert "lab-scenario" in captured.out assert "schema-generate" in captured.out assert "schema-promote" in captured.out assert "schema-audit" in captured.out + assert "verify-schema-roundtrip" in captured.out assert "generated surfaces:" in captured.out🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/unit/devtools/test_devtools_main.py` around lines 16 - 26, The human-readable output test (test_list_commands_human_output) is missing an assertion for the newly-protected "verify-schema-roundtrip" command present in payload["surfaces"]["verification_lab"]; update that test to assert the plain-text/catalog human output includes "verify-schema-roundtrip" exactly the same way the JSON assertion does so both representations stay in sync (locate test_list_commands_human_output in tests/unit/devtools/test_devtools_main.py and add a corresponding check for the "verify-schema-roundtrip" entry).polylogue/cli/commands/schema.py (1)
62-94:⚠️ Potential issue | 🟠 Major | ⚡ Quick winReject contradictory output selectors in
schema compare.The new OR-based render flags allow combinations like
--json --format markdownor--markdown --format json, which can set both output modes at once. That breaks the command×format contract and makes the surface nondeterministic.Suggested guard
def schema_compare( env: AppEnv, provider: str, from_version: str, @@ ) -> None: """Compare two schema package versions for a provider.""" del env + requested_formats = {output_format} + if json_output: + requested_formats.add("json") + if md_output: + requested_formats.add("markdown") + requested_formats.discard(None) + if len(requested_formats) > 1: + fail("schema compare", "choose a single output format") + result = _run_schema_action( "schema compare", lambda: compare_schema_versions( SchemaCompareRequest(🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@polylogue/cli/commands/schema.py` around lines 62 - 94, Add validation at the start of schema_compare (before calling _run_schema_action) to detect contradictory output selectors: compute the effective formats from json_output, md_output, and output_format (e.g., add "json" if json_output or output_format == "json", add "markdown" if md_output or output_format == "markdown") and if more than one format is selected raise click.UsageError (or click.BadParameter) with a clear message; this check belongs inside schema_compare (referencing the schema_compare function and the render_schema_compare_result call) so you reject combinations like --json --format markdown or --markdown --format json early.docs/plans/assurance-domains.yaml (1)
1-13:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUpdate the declared assurance-domain count after adding
architecture_discipline.The header/description still says 26 domains, but this file now defines 27. Please update the count to keep the manifest self-consistent for audit readers.
Also applies to: 272-281
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs/plans/assurance-domains.yaml` around lines 1 - 13, The YAML header text claiming "26 assurance domains" is out of date after adding the new domain architecture_discipline; update the prose in the description (and the corresponding summary occurrences around the previously noted block) to state "27 assurance domains" so the manifest and its description remain consistent with the actual list (also apply the same change where the old count appears in the region referenced around lines 272-281).devtools/build_topology_projection.py (1)
426-439:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winGenerator still emits YAMLlint-invalid
cross_cutmappings.Lines 437-438 produce flow mappings like
cross_cut: { api: async }, which matches the brace-format errors already reported ondocs/plans/topology-target.yaml. Since this file owns the output, fix the emitter here and then regenerate the projection.Suggested fix
if row["cross_cut"]: - tags = ", ".join(f"{k}: {v}" for k, v in sorted(row["cross_cut"].items())) - lines.append(f" cross_cut: {{ {tags} }}") + lines.append(" cross_cut:") + for key, value in sorted(row["cross_cut"].items()): + lines.append(f" {key}: {value}")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@devtools/build_topology_projection.py` around lines 426 - 439, The emit_yaml function is emitting inline brace-style mappings for cross_cut (producing lines like "cross_cut: { api: async }") which is YAMLlint-invalid; modify emit_yaml to output cross_cut as a proper indented block mapping instead of a single-brace inline mapping: inside the loop where row["cross_cut"] is handled, if cross_cut exists append a line " cross_cut:" then iterate sorted(row["cross_cut"].items()) and for each key/value append " {key}: {yaml_escape(value)}" (use yaml_escape for values and optionally for keys) so keys/values are on separate indented lines; keep other fields and the final out.write_text unchanged and regenerate the projection.devtools/render_topology_status.py (1)
88-97:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDon’t count a cell as migrated just because its target path exists.
Lines 91-93 treat a row as “At target” when any file already exists at
target. Because each row already represents the current source path, that inflates placement-domain progress for conflicts and for files that still exist at the old location.Suggested fix
at_target = sum( 1 for cell in cells if str(cell.get("path") or "") == str(cell.get("target") or "") - or str(cell.get("target") or "") in realized_targets )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@devtools/render_topology_status.py` around lines 88 - 97, The at_target count is currently inflated because the generator in at_target treats any existing file at a row's target as that row being migrated (it uses "or str(cell.get('target') or '') in realized_targets"); fix by changing the at_target computation in render_topology_status.py to only count a cell when its own current path equals its target (i.e., str(cell.get("path") or "") == str(cell.get("target") or "")) and remove the realized_targets membership check so at_target only reflects rows whose path literally equals their target.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/proof-comment.yml:
- Around line 50-54: The marker-only lookup can match non-bot comments; restrict
updates to bot-authored comments by changing how previous is selected: when
scanning comments (the comments array and the previous variable), require both
comment.body.includes(marker) and that the comment is authored by the bot (e.g.,
check comment.user?.type === 'Bot' or comment.user?.login ===
github.context.actor / 'github-actions[bot]') before choosing it; then continue
to call github.rest.issues.updateComment or createComment using owner, repo,
issue_number as before.
In `@devtools/proof_pack.py`:
- Around line 82-93: The code currently uses claim.oracle when computing
oracle-related buckets; update all places to prefer claim.oracle_kind if set
(i.e., use claim.oracle_kind or claim.oracle) so counts and escalation use the
effective kind. Specifically, change the computation for "oracle_mix" in the
dict to use (claim.oracle_kind or claim.oracle), update per-domain oracle_counts
inside _domain_payload/_domain_coverage where oracle counts are aggregated to
use (claim.oracle_kind or claim.oracle), and ensure _manual_review_cells and any
other functions that inspect claim.oracle use the same expression so
manual-review gating uses the effective oracle kind consistently. Also audit
_known_gaps and _cost_tier_counts call-sites to use the same effective-oracle
expression where they rely on claim.oracle.
In `@devtools/verify_cross_cuts.py`:
- Line 46: Remove the unused EXPECTED_API constant to avoid confusion: delete
the EXPECTED_API: dict[str, str] = {} declaration and any related unused imports
or references; confirm expected_for() and UI_FACADE_API_PATHS remain the single
sources of truth for deriving api from path and run tests to ensure nothing else
relied on EXPECTED_API.
In `@devtools/verify_layering.py`:
- Around line 45-50: The ImportFrom handling only records node.module and thus
misses child names and relative imports; update the block that processes
ast.ImportFrom so it records each imported name (use alias.name for each alias,
handling '*' specially) by adding module + "." + alias.name when node.module is
set, and resolve relative imports (node.level > 0 or node.module is None) by
converting the current file/module identifier (rel) plus the relative level and
alias into a fully qualified module path before adding to imports[rel]; keep
using ast.ImportFrom, imports[rel], and rel to locate where to change.
In `@devtools/verify_migrations.py`:
- Around line 63-73: The current flush logic drops a pending cur_subfield_dict
when encountering state transitions like "migrations: {}" or "completed: []" or
when starting a new migration/field at the same indent; fix by explicitly
flushing any pending cur_subfield_dict into
out["migrations"][cur_migration][cur_field] before changing state or updating
cur_migration/cur_field. Add a small helper or inline guard that checks if
cur_subfield_dict is not None and cur_migration and cur_field are set and
appends it (same as the existing append logic) immediately before any lines that
set state = "migrations"/"completed" or reassign cur_migration/cur_field so
nested list-dict transitions at indent levels 2/4 are preserved.
In `@devtools/witness_promote.py`:
- Around line 66-68: Validation and output should use a combined known_failing
and rejection_reason derived from both CLI args and metadata: compute
combined_known_failing = args.known_failing or getattr(metadata,
"known_failing", False) and combined_rejection_reason = args.rejection_reason or
getattr(metadata, "rejection_reason", None), then replace the check at the
current args-only guard with "if combined_known_failing and not
combined_rejection_reason: ..." so promotions inherited from metadata also
require rationale; use combined_known_failing when deciding to write a
known-failing witness (the logic around the write at line ~104) and use
combined_rejection_reason when formatting/printing the rationale (so you never
print "None" at line ~124).
In `@docs/plans/layering.yaml`:
- Around line 20-41: The substrate rules for polylogue/lib, polylogue/storage,
and polylogue/sources omit polylogue/api, leaving a hole in the
no-backward-import contract; update each target's disallow.from array (for
targets polylogue/lib, polylogue/storage, and polylogue/sources) to include
"polylogue/api" alongside the existing entries so the API surface is treated as
a surface adapter and cannot be imported by those substrate packages.
In `@polylogue/lib/action_event/action_events.py`:
- Around line 44-47: canonical_tool_name currently applies the "unknown"
fallback before trimming, so whitespace-only names become empty strings; update
canonical_tool_name to trim first (e.g., compute stripped = (name or
"").strip()), then if stripped is empty set it to "unknown", then lowercase and
look up in _CANONICAL_TOOL_NAMES; reference canonical_tool_name and
_CANONICAL_TOOL_NAMES when making the change.
In `@polylogue/lib/viewport/tools.py`:
- Line 53: The current assignment cmd = input_data.get("command",
input_data.get("cmd", "")) will keep a present-but-empty or None "command" value
and never fall back to "cmd"; change the logic around the cmd variable in
tools.py so that you treat empty strings/None as missing — e.g., read command =
input_data.get("command") and if it's falsy use input_data.get("cmd", "") (or
otherwise coalesce with a default) so functions that rely on cmd/gittype
classification see the fallback value.
In `@polylogue/proof/coverage_manifests.py`:
- Around line 100-103: The loop over _COVERAGE_MANIFEST_NAMES in
coverage_manifests.py currently silently skips missing files; change it to
surface missing manifests by raising a clear error (e.g., FileNotFoundError or a
custom MissingManifestError) or by emitting an explicit "missing manifest"
subject into the catalog before continuing. Update the for loop that iterates
over _COVERAGE_MANIFEST_NAMES (the path = plans_dir / name block) to check
path.exists() and if false either raise the error with the missing filename
included or call the function that records subjects to add a missing-manifest
subject so the absence is treated as a hard failure/recorded risk. Ensure the
new behavior is used wherever manifests are consumed so missing committed
manifests cannot be ignored.
In `@polylogue/proof/diffing.py`:
- Line 530: The change adds direct.add("schema.roundtrip.provider_packages") but
the recommendation generation that surfaces
schema.roundtrip.inference_validation never suggests running the full roundtrip
verifier; update the recommendation logic so when
"schema.roundtrip.provider_packages" (and/or
"schema.roundtrip.inference_validation") is present you also emit the CLI
instruction "devtools verify-schema-roundtrip --all" (or include that command in
the same recommendation text), i.e., modify the code path that builds the
affected-obligations report to check for the symbol
"schema.roundtrip.provider_packages" and append the devtools
verify-schema-roundtrip --all recommendation alongside any inference_validation
recommendations.
In `@polylogue/proof/generated_scenarios.py`:
- Around line 287-290: The scenario currently references claim IDs
"archive.content_hash.stability" and "archive.storage.idempotent_upsert" via
_claim(...) in generated_scenarios.py but those IDs are not present in the claim
set returned by default_claims() in polylogue/proof/catalog.py; fix by either
(A) adding definitions for these two claim IDs to default_claims() in catalog.py
(provide matching claim metadata and identifiers) so the scenario can bind to
them, or (B) change the two _claim(...) calls in generated_scenarios.py to
mapped notes (e.g., downgrade from "implemented" to a note/mapped status) so
they do not assert implemented coverage until the claims are added. Reference
the _claim(...) calls in generated_scenarios.py and the default_claims()
function in catalog.py when making the change.
In `@polylogue/proof/runners.py`:
- Around line 816-820: The current check in the mapped_missing_note
comprehension stringifies mapping_note before validating, so mapping_note=None
becomes "None" and passes; update the predicate in the mapped_missing_note
comprehension to first fetch mapping_note (e.g., note =
claim.get("mapping_note")) and treat it as missing if it is None or if
str(note).strip() == "" instead of always converting to str up-front; apply the
same fix to the analogous logic in the block referenced at lines 825-833 so None
values are treated as missing in both places (refer to mapped_missing_note and
the similar variable/logic in that later block).
In `@polylogue/proof/subjects.py`:
- Around line 36-38: The current hard-coded --json behavior should be moved into
per-command metadata: replace SELECTED_JSON_COMMAND_ARGS with a general
SELECTED_COMMAND_ARGS (or extend it) mapping from command tuples (e.g.,
("neighbors",), ("schema","list")) to their specific output flags (e.g.,
("--query","__polylogue_json_contract_probe__") and ("--format","json")), then
update json_command_subjects() to use that per-command mapping instead of always
appending --json; also apply the same change for the other mapping usage noted
around lines 107-113 so every command uses its configured output flag rather
than a global --json.
In `@polylogue/sources/parsers/codex.py`:
- Around line 150-155: The parser currently treats falsy outputs as missing and
risks raising on non-serializable values in the function_call_output branch:
change the presence test to check if "output" is present in payload (use
'output' in payload) rather than truthiness, attempt json.dumps(output,
sort_keys=True) inside a try/except and on failure fall back to a safe string
representation (e.g., str(output) or repr(output)); keep using tool_id =
payload.get("call_id") or payload.get("id") and only return None if neither
tool_id nor a safely-derived output_text exists. Ensure you update the code
around the record_type == "function_call_output" block to reference these
variables (tool_id, output, output_text) and handle serialization errors
gracefully.
In `@tests/proof/laws/evidence_quality/test_runner_trust_metadata_is_complete.py`:
- Line 27: The current comprehension for absent fields treats whitespace-only
values as present; update the check that builds absent (which iterates over
required) to treat strings with only whitespace as empty by stripping values
before testing (i.e., consider value is missing if value is None or
str(value).strip() == ""); ensure you only call .strip() on non-None values so
the comprehension that defines absent still uses the same variable names
(required, name, value, absent).
In `@tests/unit/cli/test_bulk_export.py`:
- Around line 150-167: The test sets message_role=("user",) on the _request but
never asserts it made it into the captured ConversationQuerySpec; add an
assertion on the captured spec (the variable spec = cast(ConversationQuerySpec,
captured["spec"])) to verify the role field was propagated, e.g. assert
spec.message_role == ("user",) (or assert spec.message_roles == ("user",) if
that is the actual attribute name) so the query-layer role filter is explicitly
tested.
In `@tests/unit/devtools/test_proof_pack.py`:
- Around line 11-13: Tests hard-code "origin/master" for base_ref (used where
base_ref="origin/master", head_ref="HEAD", changed_paths=[...]) which makes them
brittle; replace those literals with a dynamic default-branch value (e.g., use a
test fixture or helper like get_default_branch() or an env var such as
GIT_DEFAULT_BRANCH) and use that variable for base_ref in all three places (the
three test invocations in tests/unit/devtools/test_proof_pack.py) so the same
replacement is applied consistently instead of hard-coding origin/master.
In `@tests/unit/devtools/test_scenario_projections.py`:
- Around line 115-121: The test
test_projection_entries_preserve_presentation_metadata currently checks
serialization but misses asserting the new presentation rendering; extend it to
call render_scenario_projections (or the public renderer used by projections)
with _PresentationScenario().to_projection_entry() and assert the rendered
output contains the new presentation lines (e.g., the "tour" docs_role
caption/demonstrates text or the specific presentation text fragment introduced
by render_scenario_projections) so the user-facing branch is locked in; locate
test_projection_entries_preserve_presentation_metadata and _PresentationScenario
to add a small assertion on the renderer output.
---
Outside diff comments:
In `@devtools/build_topology_projection.py`:
- Around line 426-439: The emit_yaml function is emitting inline brace-style
mappings for cross_cut (producing lines like "cross_cut: { api: async }") which
is YAMLlint-invalid; modify emit_yaml to output cross_cut as a proper indented
block mapping instead of a single-brace inline mapping: inside the loop where
row["cross_cut"] is handled, if cross_cut exists append a line " cross_cut:"
then iterate sorted(row["cross_cut"].items()) and for each key/value append "
{key}: {yaml_escape(value)}" (use yaml_escape for values and optionally for
keys) so keys/values are on separate indented lines; keep other fields and the
final out.write_text unchanged and regenerate the projection.
In `@devtools/render_topology_status.py`:
- Around line 88-97: The at_target count is currently inflated because the
generator in at_target treats any existing file at a row's target as that row
being migrated (it uses "or str(cell.get('target') or '') in realized_targets");
fix by changing the at_target computation in render_topology_status.py to only
count a cell when its own current path equals its target (i.e.,
str(cell.get("path") or "") == str(cell.get("target") or "")) and remove the
realized_targets membership check so at_target only reflects rows whose path
literally equals their target.
In `@docs/plans/assurance-domains.yaml`:
- Around line 1-13: The YAML header text claiming "26 assurance domains" is out
of date after adding the new domain architecture_discipline; update the prose in
the description (and the corresponding summary occurrences around the previously
noted block) to state "27 assurance domains" so the manifest and its description
remain consistent with the actual list (also apply the same change where the old
count appears in the region referenced around lines 272-281).
In `@polylogue/cli/commands/schema.py`:
- Around line 62-94: Add validation at the start of schema_compare (before
calling _run_schema_action) to detect contradictory output selectors: compute
the effective formats from json_output, md_output, and output_format (e.g., add
"json" if json_output or output_format == "json", add "markdown" if md_output or
output_format == "markdown") and if more than one format is selected raise
click.UsageError (or click.BadParameter) with a clear message; this check
belongs inside schema_compare (referencing the schema_compare function and the
render_schema_compare_result call) so you reject combinations like --json
--format markdown or --markdown --format json early.
In `@tests/baselines/showcase/help-browser-capture-serve.txt`:
- Around line 1-9: The help snapshot still uses the old phrase "browser-capture
receiver" in the synopsis for the command "polylogue browser-capture serve";
update the baseline text to the new terminology by replacing "Run the local
browser-capture receiver." with the new phrasing (e.g., "Run the local
browser-capture service." or the agreed replacement) so the help snapshot
matches the completed option rename and no longer locks the old user-facing
wording.
In `@tests/unit/devtools/test_devtools_main.py`:
- Around line 16-26: The human-readable output test
(test_list_commands_human_output) is missing an assertion for the
newly-protected "verify-schema-roundtrip" command present in
payload["surfaces"]["verification_lab"]; update that test to assert the
plain-text/catalog human output includes "verify-schema-roundtrip" exactly the
same way the JSON assertion does so both representations stay in sync (locate
test_list_commands_human_output in tests/unit/devtools/test_devtools_main.py and
add a corresponding check for the "verify-schema-roundtrip" entry).
🪄 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: 434c97ce-6a65-468a-97d6-d4ab644f784c
📒 Files selected for processing (136)
.github/workflows/proof-comment.ymlCHANGELOG.mdREADME.mddevtools/build_topology_projection.pydevtools/command_catalog.pydevtools/obligation_diff.pydevtools/proof_pack.pydevtools/render_cli_reference.pydevtools/render_topology_status.pydevtools/scenario_projections.pydevtools/verify.pydevtools/verify_cluster_cohesion.pydevtools/verify_cross_cuts.pydevtools/verify_file_budgets.pydevtools/verify_layering.pydevtools/verify_manifests.pydevtools/verify_migrations.pydevtools/verify_schema_roundtrip.pydevtools/verify_suppressions.pydevtools/verify_test_ownership.pydevtools/verify_topology.pydevtools/witness_promote.pydocs/browser-capture.mddocs/cli-reference.mddocs/configuration.mddocs/devtools.mddocs/plans/api-parity.yamldocs/plans/assurance-domains.yamldocs/plans/campaign-coverage.yamldocs/plans/distribution-coverage.yamldocs/plans/docs-media-coverage.yamldocs/plans/evidence-freshness.yamldocs/plans/file-size-budgets.yamldocs/plans/layering.yamldocs/plans/lint-escalation.yamldocs/plans/migrations.yamldocs/plans/oracle-quality.yamldocs/plans/scenario-coverage.yamldocs/plans/security-privacy-coverage.yamldocs/plans/suppressions.yamldocs/plans/test-ownership.yamldocs/plans/test-quality-coverage.yamldocs/plans/topology-target.yamldocs/test-quality-workflows.mddocs/topology-status.mddocs/verification-catalog.mddocs/verification-lab.mdpolylogue/browser_capture/receiver.pypolylogue/browser_capture/server.pypolylogue/cli/click_command_registration.pypolylogue/cli/commands/browser_capture.pypolylogue/cli/commands/mcp.pypolylogue/cli/commands/qa.pypolylogue/cli/commands/schema.pypolylogue/lib/action_event/action_events.pypolylogue/lib/viewport/tools.pypolylogue/mcp/payloads.pypolylogue/mcp/server.pypolylogue/mcp/server_resources.pypolylogue/mcp/server_support.pypolylogue/mcp/server_tools.pypolylogue/paths/__init__.pypolylogue/paths/_roots.pypolylogue/proof/catalog.pypolylogue/proof/coverage_manifests.pypolylogue/proof/diffing.pypolylogue/proof/generated_scenarios.pypolylogue/proof/models.pypolylogue/proof/rendering.pypolylogue/proof/runners.pypolylogue/proof/subjects.pypolylogue/proof/witnesses.pypolylogue/scenarios/metadata.pypolylogue/scenarios/projections.pypolylogue/showcase/exercise_catalog.jsonpolylogue/showcase/generators.pypolylogue/sources/parsers/codex.pypyproject.tomltests/baselines/showcase/help-audit.txttests/baselines/showcase/help-browser-capture-serve.txttests/baselines/showcase/help-browser-capture-status.txttests/baselines/showcase/help-browser-capture.txttests/baselines/showcase/help-main.txttests/data/witnesses/browser-capture-sequence.jsontests/data/witnesses/cli-command-surface.jsontests/data/witnesses/site-publication-contract.jsontests/proof/laws/anti_dead_code/test_every_claim_selects_at_least_one_subject.pytests/proof/laws/anti_dead_code/test_every_subject_has_at_least_one_claim.pytests/proof/laws/completeness/test_every_command_has_help_claim.pytests/proof/laws/completeness/test_every_json_command_has_envelope_claim.pytests/proof/laws/evidence_quality/__init__.pytests/proof/laws/evidence_quality/test_runner_trust_metadata_is_complete.pytests/proof/laws/evidence_quality/test_serious_claims_explain_staleness.pytests/proof/laws/evidence_quality/test_serious_claims_have_independent_evidence.pytests/unit/architecture/test_topology_invariants.pytests/unit/browser_capture/test_receiver.pytests/unit/cli/__snapshots__/test_terminal_snapshots.ambrtests/unit/cli/test_bulk_export.pytests/unit/cli/test_cli_error_boundaries.pytests/unit/cli/test_click_app.pytests/unit/cli/test_json_envelope_contract.pytests/unit/cli/test_operator_support_runtime.pytests/unit/core/test_paths.pytests/unit/devtools/test_devtools_main.pytests/unit/devtools/test_obligation_diff.pytests/unit/devtools/test_proof_pack.pytests/unit/devtools/test_render_topology_status.pytests/unit/devtools/test_scenario_projections.pytests/unit/devtools/test_verify.pytests/unit/devtools/test_verify_file_budgets.pytests/unit/devtools/test_verify_manifests.pytests/unit/devtools/test_verify_migrations.pytests/unit/devtools/test_verify_schema_roundtrip.pytests/unit/mcp/conftest.pytests/unit/mcp/test_mcp_edge_cases.pytests/unit/mcp/test_server_runtime.pytests/unit/mcp/test_server_surfaces.pytests/unit/mcp/test_tool_contracts.pytests/unit/mcp/test_tool_schema_witness.pytests/unit/proof/test_catalog.pytests/unit/proof/test_diffing.pytests/unit/proof/test_generated_scenario_obligations.pytests/unit/proof/test_witnesses.pytests/unit/scenarios/test_metadata.pytests/unit/security/test_mcp_security.pytests/unit/showcase/test_exercise_catalog.pytests/unit/sources/test_browser_capture.pytests/unit/sources/test_parsers_codex.pytests/unit/sources/test_tool_aliases.pytests/witnesses/blob-store-layout.witness.jsontests/witnesses/browser-capture-sequence.witness.jsontests/witnesses/cli-command-surface.witness.jsontests/witnesses/golden-tool-use-json.witness.jsontests/witnesses/mcp-tool-schemas.witness.jsontests/witnesses/site-publication-contract.witness.jsontests/witnesses/topology-projection.witness.json
💤 Files with no reviewable changes (15)
- devtools/verify_suppressions.py
- devtools/verify_test_ownership.py
- devtools/verify_topology.py
- polylogue/cli/click_command_registration.py
- devtools/render_cli_reference.py
- docs/plans/suppressions.yaml
- polylogue/showcase/generators.py
- tests/unit/showcase/test_exercise_catalog.py
- polylogue/showcase/exercise_catalog.json
- devtools/verify_cluster_cohesion.py
- tests/unit/cli/test_cli_error_boundaries.py
- tests/unit/cli/test_click_app.py
- polylogue/cli/commands/qa.py
- docs/plans/lint-escalation.yaml
- tests/baselines/showcase/help-audit.txt
| const previous = comments.find(comment => comment.body && comment.body.includes(marker)); | ||
| if (previous) { | ||
| await github.rest.issues.updateComment({owner, repo, comment_id: previous.id, body}); | ||
| } else { | ||
| await github.rest.issues.createComment({owner, repo, issue_number, body}); |
There was a problem hiding this comment.
Scope sticky-comment updates to bot-authored comments.
The current marker-only lookup can target user comments containing the marker, making updates fail or behave unpredictably.
Suggested fix
- const previous = comments.find(comment => comment.body && comment.body.includes(marker));
+ const previous = comments.find(
+ (comment) =>
+ comment.user?.login === "github-actions[bot]" &&
+ typeof comment.body === "string" &&
+ comment.body.startsWith(marker)
+ );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/proof-comment.yml around lines 50 - 54, The marker-only
lookup can match non-bot comments; restrict updates to bot-authored comments by
changing how previous is selected: when scanning comments (the comments array
and the previous variable), require both comment.body.includes(marker) and that
the comment is authored by the bot (e.g., check comment.user?.type === 'Bot' or
comment.user?.login === github.context.actor / 'github-actions[bot]') before
choosing it; then continue to call github.rest.issues.updateComment or
createComment using owner, repo, issue_number as before.
| paths = tuple(sorted(dict.fromkeys(changed_paths or changed_paths_between_refs(base_ref, head_ref)))) | ||
| base_ids = () if changed_paths else obligation_ids_for_ref(base_ref) | ||
| head_ids = tuple(obligation.id for obligation in catalog.obligations) if head_ref in {"", "HEAD"} else None | ||
| if head_ids is None: | ||
| head_ids = obligation_ids_for_ref(head_ref) | ||
| affected = build_affected_obligation_report( | ||
| paths, | ||
| base_ref=base_ref, | ||
| head_ref=head_ref, | ||
| catalog=catalog, | ||
| base_obligation_ids=base_ids, | ||
| head_obligation_ids=head_ids, | ||
| ) |
There was a problem hiding this comment.
Don't treat --path runs as if the base catalog were empty.
When callers pass explicit paths, base_ids becomes (). That makes the downstream obligation diff compare the head catalog against an empty base, so devtools proof-pack --path ... can end up reporting every head obligation as newly added/stale instead of only the path-affected ones. Preserve the real base/head ID sets here, or disable obligation diffing in path-only mode.
| "affected_domains": [ | ||
| _domain_payload(domain, domains_data.get(domain, {}), affected_claims) for domain in affected_domains | ||
| ], | ||
| "domain_coverage": _domain_coverage(domains_data, catalog), | ||
| "required_gates": _checks_payload( | ||
| (*affected.inner_loop_checks, *affected.pr_gates, *affected.deployment_gates) | ||
| ), | ||
| "manual_review_cells": _manual_review_cells(affected_claims), | ||
| "stale_evidence": list(affected.obligation_diff.stale_evidence), | ||
| "known_gaps": _known_gaps(domains_data, catalog, affected_domains), | ||
| "oracle_mix": dict(Counter(claim.oracle for claim in affected_claims)), | ||
| "cost_tier": _cost_tier_counts(affected, catalog), |
There was a problem hiding this comment.
Report against oracle_kind once it is present.
This code still buckets and escalates on claim.oracle only. After adding Claim.oracle_kind, any claim that overrides the kind will be counted under the wrong oracle and can miss the manual-review path entirely. Please use claim.oracle_kind or claim.oracle consistently for oracle_mix, per-domain oracle_counts, and manual_review_cells.
Also applies to: 97-106, 145-154
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@devtools/proof_pack.py` around lines 82 - 93, The code currently uses
claim.oracle when computing oracle-related buckets; update all places to prefer
claim.oracle_kind if set (i.e., use claim.oracle_kind or claim.oracle) so counts
and escalation use the effective kind. Specifically, change the computation for
"oracle_mix" in the dict to use (claim.oracle_kind or claim.oracle), update
per-domain oracle_counts inside _domain_payload/_domain_coverage where oracle
counts are aggregated to use (claim.oracle_kind or claim.oracle), and ensure
_manual_review_cells and any other functions that inspect claim.oracle use the
same expression so manual-review gating uses the effective oracle kind
consistently. Also audit _known_gaps and _cost_tier_counts call-sites to use the
same effective-oracle expression where they rely on claim.oracle.
| } | ||
|
|
||
| EXPECTED_API: dict[str, str] = {} # path-based after #426; see expected_for() | ||
| EXPECTED_API: dict[str, str] = {} # path-based; see expected_for() |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
Remove/avoid unused EXPECTED_API to prevent confusion.
EXPECTED_API is defined as {} but appears unused because expected_for() derives api directly from path (and UI_FACADE_API_PATHS). If it’s truly unused, dropping it will reduce reader confusion and “false leads” during future edits.
Suggestion
-EXPECTED_API: dict[str, str] = {} # path-based; see expected_for()
CONVENTION_TAGS = frozenset(("api", "layer", "lifecycle"))📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| EXPECTED_API: dict[str, str] = {} # path-based; see expected_for() | |
| CONVENTION_TAGS = frozenset(("api", "layer", "lifecycle")) |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@devtools/verify_cross_cuts.py` at line 46, Remove the unused EXPECTED_API
constant to avoid confusion: delete the EXPECTED_API: dict[str, str] = {}
declaration and any related unused imports or references; confirm expected_for()
and UI_FACADE_API_PATHS remain the single sources of truth for deriving api from
path and run tests to ensure nothing else relied on EXPECTED_API.
| for node in ast.walk(tree): | ||
| if isinstance(node, ast.Import): | ||
| for alias in node.names: | ||
| imports[rel].add(alias.name.split(".")[0]) | ||
| imports[rel].add(alias.name) | ||
| elif isinstance(node, ast.ImportFrom) and node.module is not None: | ||
| imports[rel].add(node.module) |
There was a problem hiding this comment.
ImportFrom handling still misses real layering violations.
Only recording node.module loses the imported child module for statements like from polylogue import mcp, and it drops relative imports entirely. Those cases never match polylogue/mcp, polylogue/site, etc., so verify-layering still has false negatives.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@devtools/verify_layering.py` around lines 45 - 50, The ImportFrom handling
only records node.module and thus misses child names and relative imports;
update the block that processes ast.ImportFrom so it records each imported name
(use alias.name for each alias, handling '*' specially) by adding module + "." +
alias.name when node.module is set, and resolve relative imports (node.level > 0
or node.module is None) by converting the current file/module identifier (rel)
plus the relative level and alias into a fully qualified module path before
adding to imports[rel]; keep using ast.ImportFrom, imports[rel], and rel to
locate where to change.
| if record_type == "function_call_output": | ||
| tool_id = payload.get("call_id") or payload.get("id") | ||
| output = payload.get("output") | ||
| output_text = output if isinstance(output, str) else json.dumps(output, sort_keys=True) if output else None | ||
| if not tool_id and not output_text: | ||
| return None |
There was a problem hiding this comment.
Preserve falsy function_call_output payloads and guard serialization failures.
Line 153 currently treats falsy outputs as missing and can also throw on non-serializable values, which can drop valid tool results or break parsing for that record.
Suggested fix
- output = payload.get("output")
- output_text = output if isinstance(output, str) else json.dumps(output, sort_keys=True) if output else None
+ output = payload.get("output")
+ if isinstance(output, str):
+ output_text = output
+ elif output is None:
+ output_text = None
+ else:
+ try:
+ output_text = json.dumps(output, sort_keys=True)
+ except TypeError:
+ output_text = str(output)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@polylogue/sources/parsers/codex.py` around lines 150 - 155, The parser
currently treats falsy outputs as missing and risks raising on non-serializable
values in the function_call_output branch: change the presence test to check if
"output" is present in payload (use 'output' in payload) rather than truthiness,
attempt json.dumps(output, sort_keys=True) inside a try/except and on failure
fall back to a safe string representation (e.g., str(output) or repr(output));
keep using tool_id = payload.get("call_id") or payload.get("id") and only return
None if neither tool_id nor a safely-derived output_text exists. Ensure you
update the code around the record_type == "function_call_output" block to
reference these variables (tool_id, output, output_text) and handle
serialization errors gracefully.
| "freshness": trust.freshness, | ||
| "origin": trust.origin, | ||
| } | ||
| absent = [name for name, value in required.items() if value is None or value == ""] |
There was a problem hiding this comment.
Trim-aware emptiness check is needed for trust fields.
Line 27 accepts whitespace-only values as “present.” Treat stripped-empty strings as missing so completeness cannot be bypassed by " " values.
Suggested patch
- absent = [name for name, value in required.items() if value is None or value == ""]
+ absent = [
+ name
+ for name, value in required.items()
+ if value is None or (isinstance(value, str) and not value.strip())
+ ]📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| absent = [name for name, value in required.items() if value is None or value == ""] | |
| absent = [ | |
| name | |
| for name, value in required.items() | |
| if value is None or (isinstance(value, str) and not value.strip()) | |
| ] |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/proof/laws/evidence_quality/test_runner_trust_metadata_is_complete.py`
at line 27, The current comprehension for absent fields treats whitespace-only
values as present; update the check that builds absent (which iterates over
required) to treat strings with only whitespace as empty by stripping values
before testing (i.e., consider value is missing if value is None or
str(value).strip() == ""); ensure you only call .strip() on non-None values so
the comprehension that defines absent still uses the same variable names
(required, name, value, absent).
| request = _request( | ||
| provider="claude-code", | ||
| repo="__thoughtspace", | ||
| filter_has_paste=True, | ||
| typed_only=True, | ||
| message_role=("user",), | ||
| ) | ||
|
|
||
| output = _capture_run(_capturing_env(convs, captured), request, "jsonl", None) | ||
|
|
||
| spec = cast(ConversationQuerySpec, captured["spec"]) | ||
| assert spec.providers == (Provider.CLAUDE_CODE,) | ||
| assert spec.repo_names == ("__thoughtspace",) | ||
| assert spec.filter_has_paste is True | ||
| assert spec.typed_only is True | ||
| exported = json.loads(output) | ||
| assert [message["role"] for message in exported["messages"]] == ["user"] | ||
| assert exported["messages"][0]["text"] == "typed authored content" |
There was a problem hiding this comment.
Assert role-filter propagation on the captured query spec as well.
Line 155 sets message_role=("user",), but the test currently only proves output filtering. Please also assert the corresponding role field on the captured ConversationQuerySpec so query-layer regressions don’t get masked by downstream serialization behavior.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/unit/cli/test_bulk_export.py` around lines 150 - 167, The test sets
message_role=("user",) on the _request but never asserts it made it into the
captured ConversationQuerySpec; add an assertion on the captured spec (the
variable spec = cast(ConversationQuerySpec, captured["spec"])) to verify the
role field was propagated, e.g. assert spec.message_role == ("user",) (or assert
spec.message_roles == ("user",) if that is the actual attribute name) so the
query-layer role filter is explicitly tested.
| base_ref="origin/master", | ||
| head_ref="HEAD", | ||
| changed_paths=["docs/plans/layering.yaml"], |
There was a problem hiding this comment.
Avoid hard-coding origin/master in unit tests.
Using origin/master on Line 11, Line 28, and Line 42 makes these tests dependent on repo remote/default-branch shape. That can fail in shallow clones or main-default repos even when behavior is correct.
Proposed fix
- base_ref="origin/master",
+ base_ref="HEAD",
head_ref="HEAD",Apply the same replacement in all three tests.
Also applies to: 28-30, 42-44
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/unit/devtools/test_proof_pack.py` around lines 11 - 13, Tests hard-code
"origin/master" for base_ref (used where base_ref="origin/master",
head_ref="HEAD", changed_paths=[...]) which makes them brittle; replace those
literals with a dynamic default-branch value (e.g., use a test fixture or helper
like get_default_branch() or an env var such as GIT_DEFAULT_BRANCH) and use that
variable for base_ref in all three places (the three test invocations in
tests/unit/devtools/test_proof_pack.py) so the same replacement is applied
consistently instead of hard-coding origin/master.
| def test_projection_entries_preserve_presentation_metadata() -> None: | ||
| entry = _PresentationScenario().to_projection_entry() | ||
|
|
||
| assert entry.to_payload()["docs_role"] == "tour" | ||
| assert entry.to_payload()["caption"] == "Query recall demo" | ||
| assert entry.to_payload()["demonstrates"] == ["recall", "json-output"] | ||
| assert entry.to_dict()["narrative_order"] == 1 |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | ⚡ Quick win
Add a direct renderer assertion for the new presentation lines.
This test validates entry serialization, but it doesn’t directly lock in the new text rendering branch added in render_scenario_projections(). A small patched-catalog test would prevent regressions on the user-facing output.
Proposed test extension
+from unittest.mock import patch
import json
from devtools import scenario_projections
from devtools.scenario_projection_catalog import build_scenario_projection_entries
@@
def test_projection_entries_preserve_presentation_metadata() -> None:
entry = _PresentationScenario().to_projection_entry()
assert entry.to_payload()["docs_role"] == "tour"
assert entry.to_payload()["caption"] == "Query recall demo"
assert entry.to_payload()["demonstrates"] == ["recall", "json-output"]
assert entry.to_dict()["narrative_order"] == 1
+
+
+def test_render_scenario_projections_text_includes_presentation_metadata() -> None:
+ entry = _PresentationScenario().to_projection_entry()
+ with patch(
+ "devtools.scenario_projections.build_scenario_projection_entries",
+ return_value=(entry,),
+ ):
+ rendered = scenario_projections.render_scenario_projections(as_json=False)
+
+ assert "docs role: tour" in rendered
+ assert "caption: Query recall demo" in rendered
+ assert "demonstrates: recall, json-output" in rendered🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/unit/devtools/test_scenario_projections.py` around lines 115 - 121, The
test test_projection_entries_preserve_presentation_metadata currently checks
serialization but misses asserting the new presentation rendering; extend it to
call render_scenario_projections (or the public renderer used by projections)
with _PresentationScenario().to_projection_entry() and assert the rendered
output contains the new presentation lines (e.g., the "tour" docs_role
caption/demonstrates text or the specific presentation text fragment introduced
by render_scenario_projections) so the user-facing branch is locked in; locate
test_projection_entries_preserve_presentation_metadata and _PresentationScenario
to add a small assertion on the renderer output.
## Summary Closes the consolidated post-shipping closure audit in #576 by turning the broad architecture/proof cleanup into durable verification layers and by fixing the user-facing surfaces that were still uneven. ## Problem Recent audits showed two related failure modes: broad issues were closed without precise executable closure evidence, and parts of the verification surface were themselves brittle because they encoded closed-issue archaeology rather than semantic contracts. Product surfaces also still had residual gaps around MCP authorization/sanitization, browser-capture terminology, schema roundtrips, Codex cwd/event extraction, scenario presentation metadata, and output-format consistency. ## Solution - Adds reusable assurance coverage subjects, proof-pack known-gap reporting, schema roundtrip verification, evidence-quality proof laws, high-value witness coverage, and PR proof-pack comments. - Reworks verifiability to avoid closed-issue-shaped checks: coverage gaps now declare owners and next evidence, topology progress uses placement domains, file-size exceptions are pure thresholds, completed migrations are not durable proof, generated-scenario mappings use rationale instead of issue links, and known-failing witnesses require explicit rejection reasons. - Tightens product and integration surfaces: MCP role gating plus sanitized internal errors, `schema --format json`, browser-capture spool terminology, no public `polylogue audit`, Codex cwd/function/token event capture, canonical tool aliases, and authored bulk-export filter coverage. - Refreshes generated docs, CLI baselines, topology/status projections, verification catalog, witness metadata, and changelog entries. ## Verification - `devtools verify` — passed. - `devtools verify --quick` — passed during pre-push hook. - `git diff --check` — passed. Closes #576 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** - Added MCP role-based access control with `--role` option (read/write/admin) - Added schema roundtrip verification command to devtools - Added `--format json` option to schema subcommands as canonical format * **Changes** - Removed `polylogue audit` command from public CLI (moved to devtools) - Browser capture storage renamed from "inbox" to "capture spool" throughout * **Documentation** - Updated help text and reference documentation for naming changes - Added devtools command documentation for schema verification <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Closes the consolidated post-shipping closure audit in #576 by turning the broad architecture/proof cleanup into durable verification layers and by fixing the user-facing surfaces that were still uneven.
Problem
Recent audits showed two related failure modes: broad issues were closed without precise executable closure evidence, and parts of the verification surface were themselves brittle because they encoded closed-issue archaeology rather than semantic contracts. Product surfaces also still had residual gaps around MCP authorization/sanitization, browser-capture terminology, schema roundtrips, Codex cwd/event extraction, scenario presentation metadata, and output-format consistency.
Solution
schema --format json, browser-capture spool terminology, no publicpolylogue audit, Codex cwd/function/token event capture, canonical tool aliases, and authored bulk-export filter coverage.Verification
devtools verify— passed.devtools verify --quick— passed during pre-push hook.git diff --check— passed.Closes #576
Summary by CodeRabbit
New Features
--roleoption (read/write/admin)--format jsonoption to schema subcommands as canonical formatChanges
polylogue auditcommand from public CLI (moved to devtools)Documentation