Skip to content

test: ground verification in executable evidence - #1066

Merged
Sinity merged 22 commits into
masterfrom
feature/test/verification-evidence-model
May 15, 2026
Merged

Sinity merged 22 commits into
masterfrom
feature/test/verification-evidence-model

Conversation

@Sinity

@Sinity Sinity commented May 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Move the #1058 verification model toward executable artifacts instead of declarative confidence rows. This branch makes pytest-testmon the normal verify path, adds bounded pytest evidence artifacts for daemon contracts, tightens suppression discovery, grounds required SLO rows in benchmark-result presence, and softens proof-pack report language toward verification impact reporting.

Problem

The verification stack had two practical failures: agents paid for unnecessarily broad pytest runs, and several assurance surfaces could look meaningful without being backed by executable artifacts. Required SLO rows could be missing benchmark output without failing, suppression discovery found source suppressions without reducing the baseline, and proof-pack wording still implied stronger bespoke proof semantics than the underlying tests/artifacts provided.

Solution

  • Default devtools verify to pytest-testmon and let testmon own invalidation, with global refresh for config/dependency/test-harness changes.
  • Add contract evidence artifacts for daemon runtime/health/notifications/backup readability.
  • Discover source-level suppressions and remove the first concrete suppression class (pytest_skip_marker).
  • Make devtools verify-slos validate gate, fail missing benchmark results for required SLO rows, and report informational gaps separately.
  • Update proof-pack report wording and generated command docs toward verification impact terminology.

Verification

Ref #1058
Ref #1059
Ref #1060
Ref #1062
Ref #1063
Ref #1065

Summary by CodeRabbit

  • New Features

    • Verification now defaults to pytest-testmon "affected" runs with a seed mode and explicit full-run flag; SLO checks distinguish required vs informational and suppression scans can optionally enforce discovered suppressions.
    • Test-side contract evidence recording and automatic evidence artifacts added.
  • Documentation

    • Guidance and docs updated to emphasize executable evidence (tests/coverage/benchmarks/CI) over legacy "proof" wording.
  • Configuration

    • Added pytest-testmon dev dependency and a contract pytest marker.
  • Tests

    • Many contract-marked tests and helpers added to produce and validate evidence artifacts.

Review Change Stack

Sinity added 12 commits May 15, 2026 20:43
Problem: verification reports had no standard artifact path for surface contracts, leaving proof-era rows and bespoke runner output as the apparent assurance surface. That made the migration away from proof/catalog abstractions hard to execute concretely.\n\nWhat changed: add an explicit pytest contract evidence recorder that writes bounded JSON artifacts, exposes artifact paths through pytest record_property, and redacts repo/home paths plus obvious secret assignments. Wire the fixture into CLI JSON envelope tests and MCP surface registration tests, register the contract marker, and update verification planning docs/manifests around pytest/coverage/benchmark/CI artifacts as the authority.\n\nVerification: pytest -q tests/infra/test_contract_evidence.py tests/unit/cli/test_json_envelope_contract.py tests/unit/mcp/test_server_surfaces.py::TestServerSurfaceRegistration::test_server_surface_contract; ruff check tests/infra/contract_evidence.py tests/infra/test_contract_evidence.py tests/conftest.py tests/unit/cli/test_json_envelope_contract.py tests/unit/mcp/test_server_surfaces.py; mypy --strict tests/infra/contract_evidence.py tests/infra/test_contract_evidence.py tests/conftest.py tests/unit/cli/test_json_envelope_contract.py tests/unit/mcp/test_server_surfaces.py; devtools verify-manifests; devtools render-all --check
Problem: the suppression check only validated the YAML ledger, so an empty registry could coexist with real pytest, Ruff, mypy, and coverage exceptions in source.\n\nWhat changed: teach devtools verify-suppressions to discover source-level suppression mechanisms with AST/tokenized parsing, report current discovered counts, and fail unregistered discoveries when --enforce-discovered is requested. Add focused unit coverage and record the baseline in the execution log.\n\nVerification:\n- pytest -q tests/unit/devtools/test_verify_suppressions.py\n- ruff check devtools/verify_suppressions.py tests/unit/devtools/test_verify_suppressions.py\n- mypy --strict devtools/verify_suppressions.py tests/unit/devtools/test_verify_suppressions.py\n- devtools verify-suppressions --json\n- devtools render-all --check\n\nRef #1062
Problem: daemon status and convergence behavior had ordinary tests, but the verifiability plan needed bounded artifacts that expose runtime facts through pytest instead of a separate proof layer.\n\nWhat changed: mark the status JSON and convergence-debt retry tests as contract tests and record daemon status, source availability, retry counts, debt before/after, and cursor cleanup facts through the contract evidence fixture. Record the slice in the MK3 execution log.\n\nVerification:\n- pytest -q tests/unit/daemon/test_daemon_cli.py::test_polylogued_status_json_reports_daemon_components tests/unit/daemon/test_daemon_cli.py::test_drain_convergence_debt_retries_due_items_without_source_failure tests/unit/daemon/test_daemon_cli.py::test_drain_convergence_debt_retries_conversation_subjects_without_source_lookup\n- ruff check tests/unit/daemon/test_daemon_cli.py\n- mypy --strict tests/unit/daemon/test_daemon_cli.py\n- ruff format --check tests/unit/daemon/test_daemon_cli.py\n- devtools render-all --check\n\nRef #999\nRef #1060
Problem: backup verification only proved that a database copy could be created, not that the produced backup could be opened and queried afterward.\n\nWhat changed: add a daemon backup contract test that seeds an isolated archive, runs backup_archive, opens the produced backup read-only, runs PRAGMA integrity_check, queries restored conversation/message rows, and records bounded backup restore evidence. Record the slice in the execution log.\n\nVerification:\n- pytest -q tests/unit/daemon/test_backup.py\n- ruff check tests/unit/daemon/test_backup.py\n- mypy --strict tests/unit/daemon/test_backup.py\n- ruff format --check tests/unit/daemon/test_backup.py\n- devtools render-all --check\n\nRef #999\nRef #1060
Problem: daemon notifications had a dispatch surface but no focused pytest evidence for alert routing, invalid backend selection, or backend failure boundaries.\n\nWhat changed: add notification dispatch tests that pin batch delivery to a selected backend, config forwarding, unknown backend failure, and backend exception propagation. Record bounded daemon.notifications.dispatch evidence and document the slice in the execution log.\n\nVerification:\n- pytest -q tests/unit/daemon/test_notifications.py\n- ruff check tests/unit/daemon/test_notifications.py\n- mypy --strict tests/unit/daemon/test_notifications.py\n- ruff format --check tests/unit/daemon/test_notifications.py\n- devtools render-all --check\n\nRef #999\nRef #1060
Problem: daemon health tiers had aggregation behavior that was not pinned with executable evidence artifacts.\n\nWhat changed: add a deterministic contract test for requested tier selection, worst-severity aggregation, tier summary counts, and excluded expensive checks. Record bounded daemon.health.aggregate evidence and update the execution log.\n\nVerification:\n- pytest -q tests/unit/daemon/test_health_contracts.py\n- ruff check tests/unit/daemon/test_health_contracts.py\n- mypy --strict tests/unit/daemon/test_health_contracts.py\n- ruff format --check tests/unit/daemon/test_health_contracts.py\n- devtools render-all --check\n\nRef #999\nRef #1060
Problem: devtools verify still had a homegrown --affected router that mapped changed files to test files with import heuristics. It was not reliable enough to be the normal agent path and it encouraged broad pytest reruns after tiny changes.

What changed: add pytest-testmon as the dev dependency, make default devtools verify run pytest --testmon after static/generated gates, add explicit --seed-testmon and --all/--full modes, remove --affected routing, fail fast on the first failed step, ignore local testmon databases, and document the new workflow.

Verification: pytest -q tests/unit/devtools/test_verify.py; ruff check devtools/verify.py tests/unit/devtools/test_verify.py pyproject.toml; mypy --strict devtools/verify.py tests/unit/devtools/test_verify.py; devtools render-all --check; POLYLOGUE_PYTEST_WORKERS=4 devtools verify --seed-testmon --skip-slow --json; devtools verify --json.
Problem: the devtools worktree-result cache could replay a previous verify result before pytest-testmon had a chance to evaluate package, Python, or source invalidation. That made the affected-test path less trustworthy than the underlying testmon engine.

What changed: remove the outer result replay cache and --force bypass, keep every default verify invocation flowing through pytest-testmon, and automatically widen to --testmon-noselect when pytest config, dependency locks, or shared test infrastructure changed since the seed. Successful global refreshes update the seed stamp so the next ordinary run returns to affected selection.

Verification: pytest -q tests/unit/devtools/test_verify.py; ruff check devtools/verify.py tests/unit/devtools/test_verify.py; mypy --strict devtools/verify.py tests/unit/devtools/test_verify.py; devtools verify --json selected pytest testmon-global for 6449 tests; devtools verify --json then returned to pytest testmon with 0 selected tests.
Problem: The proof-pack report surfaced grandiose proof/confidence wording in headings and command help even though the command remains a practical verification impact report. This made the operator-facing surface sound stronger than the evidence it presents.

What changed: Retitled the markdown and human report output around verification impact/catalog checks, softened argparse and command catalog help, and refreshed the generated devtools command reference. The proof-pack command name and JSON/data-model fields are unchanged.

Verification: pytest -q tests/unit/devtools/test_proof_pack.py (13 passed); devtools render-devtools-reference --check (sync OK).
Required SLO rows previously fell into the same non-blocking uncovered bucket as informational placeholders, so devtools verify-slos could pass without any artifact for a required latency budget. That made the catalog look stronger than the executable evidence behind it.

Add explicit gate validation, split missing required benchmark results from informational uncovered rows, and make missing required artifacts blocking in both JSON and human output. The catalog comments and unit tests now pin the required/informational distinction.

Verification:
- pytest -q tests/unit/devtools/test_slo_catalog.py -> 7 passed
- ruff check devtools/verify_slos.py tests/unit/devtools/test_slo_catalog.py -> All checks passed
- mypy --strict devtools/verify_slos.py tests/unit/devtools/test_slo_catalog.py -> Success
- devtools verify-slos --skip-benchmarks --json -> exits 1 with three missing_required required SLOs and two uncovered_informational rows
Regenerate AGENTS.md after the proof-pack command catalog wording changed so render-all --check stays clean.

Verification:
- devtools render-all --check -> sync OK
@coderabbitai

coderabbitai Bot commented May 15, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 111f7780-3b19-4618-bd52-46d148a09695

📥 Commits

Reviewing files that changed from the base of the PR and between 51c4241 and 7f694d0.

📒 Files selected for processing (13)
  • AGENTS.md
  • CLAUDE.md
  • CONTRIBUTING.md
  • devtools/verify.py
  • devtools/verify_slos.py
  • devtools/verify_suppressions.py
  • tests/infra/contract_evidence.py
  • tests/infra/test_contract_evidence.py
  • tests/unit/daemon/test_backup.py
  • tests/unit/daemon/test_daemon_cli.py
  • tests/unit/devtools/test_slo_catalog.py
  • tests/unit/devtools/test_verify.py
  • tests/unit/devtools/test_verify_suppressions.py
📝 Walkthrough

Walkthrough

Shift verification baseline to pytest-testmon with seed/invalidation, add a contract-evidence recorder and fixtures, update proof-pack into a verification-impact report, refine SLO/suppression blocking semantics, parse pytest-benchmark payloads centrally, make ingest inbox staging safe, instrument tests to record evidence, and update docs/manifests for proof→evidence migration.

Changes

Verification migration & test evidence

Layer / File(s) Summary
Foundation: deps, pytest config, ignore, and conftest
pyproject.toml, tests/conftest.py, .gitignore, tests/infra/contract_evidence.py, tests/infra/test_contract_evidence.py
Add pytest-testmon to dev deps, enable contract marker and xfail_strict, ignore .testmondata*, register tests.infra.contract_evidence, and implement ContractEvidenceRecorder with tests.
Core devtools.verify refactor
devtools/verify.py
Default to pytest-testmon affected tests, add --seed-testmon and --all/--full, change build_verify_steps signature, add seed stamping and global invalidator detection, and require preflight seeding when appropriate.
Verify utilities: seed, fingerprint, workers, preflight
devtools/verify.py
Implement seed.json read/write, fingerprinting, worker arg computation, detection of changes since seed, and preflight error paths.
Proof-Pack → Verification Impact
devtools/proof_pack.py, devtools/command_catalog.py, tests/unit/devtools/test_proof_pack.py
Replace taxonomy grouping with artifact-source grouping, add manual-review requirements and contract-evidence summary, rename slop→anti-vacuity, update CLI/help/markdown headings.
SLO gating and benchmark parsing
devtools/verify_slos.py, devtools/benchmark_results.py, devtools/benchmark_campaign.py, tests/unit/devtools/test_slo_catalog.py
Add SLO_GATES, validate gate values, make missing required benchmarks blocking, switch benchmark parsing to parse_pytest_benchmark_stats, and add tests.
Suppression discovery and enforcement
devtools/verify_suppressions.py, tests/unit/devtools/test_verify_suppressions.py
Discover source suppressions via AST/comment tokenization, add DiscoveredSuppression, --scan-root/--enforce-discovered, and report/block unregistered discovered suppressions with JSON output.
Contract evidence instrumentation in tests
tests/unit/daemon/*, tests/unit/cli/*, tests/unit/mcp/*, tests/unit/ui/*
Wire record_contract_evidence fixture and @pytest.mark.contract into many tests (daemon status/convergence/backup/notifications/health/mcp/CLI), add new contract tests, and modernize skip handling via pytest.importorskip.
Ingest staging and daemon inbox safety
polylogue/cli/commands/ingest.py, polylogue/daemon/http.py, tests/unit/cli/test_ingest.py, tests/unit/daemon/test_daemon_http_security.py
Stage local paths into the archive inbox before daemon ingest, add _stage_for_daemon and _staged_inbox_source helpers, ensure daemon only accepts staged inbox references, and add tests verifying inbox-boundary behavior.
Devtools tests and proof-pack tests
tests/unit/devtools/test_verify.py, tests/unit/devtools/test_proof_pack.py, tests/unit/devtools/test_benchmark_campaign.py
Expand unit tests for verify step selection, preflight, stop-on-first-failure, update proof-pack/report tests to expect verification-impact schema, and add benchmark fixture parsing test.
Docs and manifests
AGENTS.md, CONTRIBUTING.md, TESTING.md, docs/*, docs/plans/*, polylogue/verification/manifests/models.py
Replace “proof” wording with “verification/evidence”, retire maturity/oracle* fields in manifests and models, update verification workflow docs to document devtools verify + seed semantics.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Possibly related PRs

Suggested labels

type:test, area:qa, area:cli, area:storage, area:pipeline, area:schema, type:docs

🐰 I hopped through code, both old and new,

Seeded tests and evidence too.
Proofs turned to checks, reports that sing,
Contract crumbs the runners bring.
Hooray — tests pass on a tiny spring!

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/test/verification-evidence-model

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a136584c00

ℹ️ 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".

Comment thread devtools/verify.py Resolved
Comment thread devtools/verify_slos.py
@@ -188,11 +197,19 @@ def main(argv: list[str] | None = None) -> int:
benchmark_stats = _run_benchmarks(test_ids) if not args.skip_benchmarks else {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep --skip-benchmarks as non-blocking catalog mode

With --skip-benchmarks, benchmark_stats is forced to {}, and required SLO rows are then treated as missing benchmark results and made blocking, so this mode now exits non-zero even when the user explicitly requested catalog-only output. That contradicts the option’s own help text and makes --skip-benchmarks --json unusable for non-gating inspection workflows.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Caution

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

⚠️ Outside diff range comments (3)
devtools/verify_slos.py (1)

213-220: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Required surfaces with malformed p50_ms/p95_ms/benchmark_test are silently skipped.

Now that missing benchmark results block for gate: required, the two continue branches here become a soft hole in the same gate: a required surface whose p50_ms is non-int, whose p95_ms is missing, or whose benchmark_test is not a string is dropped from every bucket — it is neither missing_required nor a catalog_error. A typo in the catalog for a required surface will pass verify-slos with blocking=False, which contradicts the contract this PR is trying to pin.

Consider promoting these to catalog_errors (at least when gate == "required"):

🛠️ Proposed adjustment
         target_p50 = config.get("p50_ms")
         target_p95 = config.get("p95_ms")
         if not isinstance(target_p50, int) or not isinstance(target_p95, int):
-            continue
+            if gate == "required":
+                catalog_errors.append(
+                    f"{surface_name}: required surface must declare integer p50_ms and p95_ms"
+                )
+            continue
 
         benchmark_test = config.get("benchmark_test")
         if not isinstance(benchmark_test, str):
-            continue
+            if gate == "required":
+                catalog_errors.append(
+                    f"{surface_name}: required surface must declare benchmark_test (string)"
+                )
+            continue
🤖 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/verify_slos.py` around lines 213 - 220, Currently entries with
non-int target_p50/target_p95 or non-str benchmark_test are silently skipped via
the two continue branches; instead, when gate == "required" mark these as
catalog errors so they aren't dropped from all buckets. Replace the continue
branches after checking target_p50/target_p95/benchmark_test with logic that, if
gate == "required", appends a descriptive error for that surface into
catalog_errors (include which field is malformed and the surface id/name from
the current config) and otherwise keeps the existing continue behavior;
reference the variables target_p50, target_p95, benchmark_test, gate and the
result buckets catalog_errors (and avoid changing missing_required behavior).
AGENTS.md (1)

224-339: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Duplicate "Verification Baseline" sections create confusion.

The file contains two sections with the identical heading "Verification Baseline" (lines 224 and 315). The second section (315-339) is more detailed and includes additional guidance about testmon behavior, cache invalidation, and auto-widening that's missing from the first (224-248).

Since AGENTS.md is generated from CLAUDE.md and included files, this suggests the source includes (likely CONTRIBUTING.md based on the <!-- begin include: CONTRIBUTING.md --> marker at line 91) contain overlapping content. Readers will be confused about which section is authoritative.

Consider consolidating these sections in the source files or restructuring the includes to avoid duplication.

🤖 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 `@AGENTS.md` around lines 224 - 339, There are two duplicated "Verification
Baseline" sections in AGENTS.md; remove the duplication by consolidating the
content at the source (likely CLAUDE.md and the included CONTRIBUTING.md
fragment): pick the more detailed section as authoritative, merge any missing
guidance from the shorter section into it, then update the include directives
(or remove the redundant include) so only one "Verification Baseline" block is
generated; look for the "Verification Baseline" heading in the included
fragments and the include markers (e.g., the <!-- begin include: CONTRIBUTING.md
--> area) to find and fix the overlap.
CONTRIBUTING.md (1)

178-247: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Critical: Duplicate "Verification Baseline" sections in the same file.

CONTRIBUTING.md contains two H2 sections titled "Verification Baseline" (lines 178 and 224). The first section (178-208) covers git hooks, default baseline, and seed/refresh commands. The second section (224-247) provides a different command matrix and adds critical details about testmon cache behavior, no-replay semantics, and automatic widening that are absent from the first section.

Readers cannot determine which section is authoritative. The duplication also propagates to the generated AGENTS.md file, creating the same confusion there.

Merge these sections into a single coherent "Verification Baseline" section, or if the content serves different purposes, use distinct section titles (e.g., "Git Hooks and Verification Workflow" vs. "Verification Command Reference" vs. "Verification Behavior and Cache Semantics").

🤖 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 `@CONTRIBUTING.md` around lines 178 - 247, Two duplicate H2 sections titled
"Verification Baseline" exist; merge them into one authoritative section (or
rename into two distinct sections like "Git Hooks and Verification Workflow" and
"Verification Command Reference") so content about git hooks, baseline commands,
pytest-testmon seed/refresh, quick/all variations, and the testmon
cache/no-replay semantics are all present exactly once; update the single
"Verification Baseline" heading (or the two new distinct headings) to contain
the combined, deduplicated paragraphs from both occurrences and apply the same
change to the generated AGENTS.md to remove the duplicate/conflicting entry.
🤖 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/verify_suppressions.py`:
- Around line 144-155: The AST parse in _pytest_suppression_lines currently only
catches SyntaxError and can still crash on pathological inputs (e.g.,
RecursionError); broaden the exception handling around ast.parse(text) to catch
other possible errors (at minimum RecursionError and a general Exception
fallback) so the function returns an empty list on any parse failure; keep the
rest of the logic unchanged and reference _pytest_call_kind and ast.parse when
locating the code to update.

In `@devtools/verify.py`:
- Around line 519-521: The loop currently breaks on the first non-zero rc (using
the break next to setting exit_code), which prevents aggregating failures from
cheap deterministic gates; change the logic so that non-zero rc sets exit_code
but does not break for fast/cheap steps (identify them by the step name like
"ruff format", "ruff check", "mypy", or any "verify-*" steps) and only break (or
short-circuit) when a heavy test step fails (e.g., "pytest" or "lab")—implement
this by checking the step identity/or a new is_heavy flag before executing
break; also update the test test_verify_stops_after_first_failed_step to reflect
the intended behavior if you change the breaking policy.
- Line 14: The help text for the --lab option is misleadingly worded; update the
string used for the --lab add_argument (the '--lab' option) to clarify that it
composes with the current default baseline (the "testmon-affected" tier) and
runs the verification-lab scenario plus verify-slos, and does not trigger a
full/--all pytest run—replace "Full baseline + verification-lab scenario
checks." with wording that explicitly states it uses the default
testmon-affected baseline plus lab scenario and verify-slos (and that it does
not imply a full baseline).

In `@tests/infra/contract_evidence.py`:
- Around line 95-97: The current code redacts each argv token independently
(payload["command"] = [_redact_text(str(part), self.repo_root) for part in
command]), which allows sensitive values like ("--api-key", "abc123") to leak;
change the logic to redact the entire command string as a single unit (e.g.,
join command tokens into one string, call _redact_text(joined_command,
self.repo_root), and store the redacted string or split back safely) and apply
the same fix for the second occurrence around the code that builds command
artifacts (lines referenced in the comment). Use the existing _redact_text and
self.repo_root symbols to locate and implement the change.
- Around line 103-108: The payload currently assigns unbounded JSON blobs to
payload["request"], payload["result"], and payload["facts"] via _json_document,
which can produce oversized artifacts; change these assignments to use a bounded
serializer (e.g., add or call a variant like _json_document(..., max_bytes=... )
or wrap _json_document with a truncation step) so each of request/result/facts
is size-limited before being placed into payload, and ensure the truncation
strategy preserves valid JSON and records that the value was truncated.

In `@tests/unit/daemon/test_backup.py`:
- Around line 33-46: The test currently reads PRAGMA integrity_check into the
variable integrity but only asserts it after running queries; change the order
in the test using open_read_connection(backup_path) so that you assert integrity
== "ok" immediately after fetching integrity (the result of conn.execute("PRAGMA
integrity_check").fetchone()[0]) before executing the SELECT COUNT(*) queries
that populate conversation_count and message_count, ensuring integrity is
verified prior to any further reads.

In `@tests/unit/daemon/test_daemon_cli.py`:
- Around line 128-142: The fact recorded to contract evidence in
record_contract_evidence.record is redundant and contradicts the assertion:
replace the current fact "cursor_record_remaining": cursor.get_record(source) is
not None with a clear, aligned fact such as "cursor_record_cleared":
cursor.get_record(source) is None (or remove the fact entirely), so the recorded
evidence matches the earlier assertion that cursor.get_record(source) is None;
update the facts map in the record_contract_evidence.record call accordingly.

---

Outside diff comments:
In `@AGENTS.md`:
- Around line 224-339: There are two duplicated "Verification Baseline" sections
in AGENTS.md; remove the duplication by consolidating the content at the source
(likely CLAUDE.md and the included CONTRIBUTING.md fragment): pick the more
detailed section as authoritative, merge any missing guidance from the shorter
section into it, then update the include directives (or remove the redundant
include) so only one "Verification Baseline" block is generated; look for the
"Verification Baseline" heading in the included fragments and the include
markers (e.g., the <!-- begin include: CONTRIBUTING.md --> area) to find and fix
the overlap.

In `@CONTRIBUTING.md`:
- Around line 178-247: Two duplicate H2 sections titled "Verification Baseline"
exist; merge them into one authoritative section (or rename into two distinct
sections like "Git Hooks and Verification Workflow" and "Verification Command
Reference") so content about git hooks, baseline commands, pytest-testmon
seed/refresh, quick/all variations, and the testmon cache/no-replay semantics
are all present exactly once; update the single "Verification Baseline" heading
(or the two new distinct headings) to contain the combined, deduplicated
paragraphs from both occurrences and apply the same change to the generated
AGENTS.md to remove the duplicate/conflicting entry.

In `@devtools/verify_slos.py`:
- Around line 213-220: Currently entries with non-int target_p50/target_p95 or
non-str benchmark_test are silently skipped via the two continue branches;
instead, when gate == "required" mark these as catalog errors so they aren't
dropped from all buckets. Replace the continue branches after checking
target_p50/target_p95/benchmark_test with logic that, if gate == "required",
appends a descriptive error for that surface into catalog_errors (include which
field is malformed and the surface id/name from the current config) and
otherwise keeps the existing continue behavior; reference the variables
target_p50, target_p95, benchmark_test, gate and the result buckets
catalog_errors (and avoid changing missing_required behavior).
🪄 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: 7c0012cc-55bd-45e8-a588-a349fb85ef25

📥 Commits

Reviewing files that changed from the base of the PR and between d3628b5 and a136584.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (36)
  • .gitignore
  • AGENTS.md
  • CLAUDE.md
  • CONTRIBUTING.md
  • TESTING.md
  • devtools/command_catalog.py
  • devtools/proof_pack.py
  • devtools/verify.py
  • devtools/verify_slos.py
  • devtools/verify_suppressions.py
  • docs/devtools.md
  • docs/execution-plan.md
  • docs/plans/assurance-domains.yaml
  • docs/plans/evidence-freshness.yaml
  • docs/plans/mk3-execution-log.md
  • docs/plans/oracle-quality.yaml
  • docs/plans/slo-catalog.yaml
  • docs/plans/suppressions.yaml
  • docs/plans/test-coverage-domains.yaml
  • pyproject.toml
  • tests/conftest.py
  • tests/infra/contract_evidence.py
  • tests/infra/test_contract_evidence.py
  • tests/unit/cli/test_check_runtime.py
  • tests/unit/cli/test_json_envelope_contract.py
  • tests/unit/cli/test_terminal_snapshots.py
  • tests/unit/daemon/test_backup.py
  • tests/unit/daemon/test_daemon_cli.py
  • tests/unit/daemon/test_health_contracts.py
  • tests/unit/daemon/test_notifications.py
  • tests/unit/devtools/test_proof_pack.py
  • tests/unit/devtools/test_slo_catalog.py
  • tests/unit/devtools/test_verify.py
  • tests/unit/devtools/test_verify_suppressions.py
  • tests/unit/mcp/test_server_surfaces.py
  • tests/unit/ui/test_tui.py

Comment thread devtools/verify_suppressions.py Resolved
Comment thread devtools/verify.py Resolved
Comment thread devtools/verify.py Resolved
Comment thread tests/infra/contract_evidence.py Resolved
Comment thread tests/infra/contract_evidence.py Resolved
Comment thread tests/unit/daemon/test_backup.py Resolved
Comment thread tests/unit/daemon/test_daemon_cli.py Resolved
@Sinity

Sinity commented May 15, 2026

Copy link
Copy Markdown
Owner Author

Added #1064 Pack A in 4a6d987.\n\nThis removes editable assurance maturity/oracle fields from assurance-domains.yaml and its model, makes verify-manifests reject those retired fields if they return, and removes manifest maturity from proof-pack payloads.\n\nAdditional verification after the new commit:\n- devtools verify --quick -> exit 0, total 29.96s\n- focused manifest/proof-pack tests -> 15 passed\n- full tests/unit/devtools/test_verify_manifests.py -> 14 passed

Assurance-domain maturity and oracle rows were editable manifest fields, not executable evidence. Keeping them in the model and report made a YAML edit look like assurance state.

Remove the self-declared maturity/oracle fields from the assurance-domain manifest and Pydantic model, make verify-manifests reject them if they return, and stop proof-pack from surfacing maturity values from the manifest. The assurance-domain file is now explicitly a documentation inventory; verification closure must come from tests, coverage, benchmark, CI, or static-check artifacts.

Verification:
- pytest -q tests/unit/devtools/test_verify_manifests.py tests/unit/devtools/test_proof_pack.py -k 'assurance or domain or maturity or manifest' -> 15 passed
- pytest -q tests/unit/devtools/test_verify_manifests.py -> 14 passed
- ruff check devtools/verify_manifests.py tests/unit/devtools/test_verify_manifests.py polylogue/verification/manifests/models.py devtools/proof_pack.py -> All checks passed
- mypy --strict devtools/verify_manifests.py tests/unit/devtools/test_verify_manifests.py polylogue/verification/manifests/models.py devtools/proof_pack.py -> Success
- devtools verify-manifests -> manifest consistency checks passed
- devtools render-all --check -> sync OK
@Sinity
Sinity force-pushed the feature/test/verification-evidence-model branch from 4a6d987 to b125e91 Compare May 15, 2026 22:40
SLO verification and benchmark campaigns both parsed pytest-benchmark JSON with separate local code. That made required SLO evidence depend on a second parser while benchmark-campaign already had the more complete result shape.

Extract the parser into devtools.benchmark_results, make benchmark-campaign and verify-slos use it, and add a compact fixture based on the actual pytest-benchmark JSON schema from a live reader-status run. Null pytest-benchmark groups now normalize to the existing default group name, benchmark.

Verification:
- pytest -q tests/unit/devtools/test_benchmark_campaign.py tests/unit/devtools/test_slo_catalog.py -> 17 passed
- ruff check devtools/benchmark_results.py devtools/benchmark_campaign.py devtools/verify_slos.py tests/unit/devtools/test_benchmark_campaign.py tests/unit/devtools/test_slo_catalog.py -> All checks passed
- mypy --strict devtools/benchmark_results.py devtools/benchmark_campaign.py devtools/verify_slos.py tests/unit/devtools/test_benchmark_campaign.py tests/unit/devtools/test_slo_catalog.py -> Success
- devtools verify-slos --skip-benchmarks --json -> expected exit 1 with missing_required rows
- pytest -q --override-ini=addopts=-ra -n 0 -p no:randomly --benchmark-enable --benchmark-json=.cache/polylogue-benchmark-smoke.json tests/benchmarks/test_reader_api.py::test_bench_reader_status -> 1 passed
- python parser smoke over .cache/polylogue-benchmark-smoke.json -> parsed reader-status fullname, group benchmark, and rounds
@Sinity

Sinity commented May 15, 2026

Copy link
Copy Markdown
Owner Author

Added #1063 Pack B in 91a89fe.\n\nSLO verification and benchmark campaigns now share devtools.benchmark_results for pytest-benchmark JSON parsing, backed by a fixture matching the live pytest-benchmark schema.\n\nVerification after the new commit:\n- devtools verify --quick -> exit 0, total 30.05s\n- benchmark/SLO focused tests -> 17 passed\n- live single-node pytest-benchmark smoke -> 1 passed and generated parseable JSON

The suppression scanner found nineteen noqa directives, but the normal Ruff config did not enforce unused noqa detection. Enabling Ruff's native RUF100 rule is the standard mechanism; the custom scanner can then report the remaining real suppressions instead of carrying stale comments.

Run Ruff's fixer for unused noqa directives, restore only the suppressions proven load-bearing by the normal Ruff gate, and enable RUF100 in pyproject.toml.

Verification:
- ruff check polylogue tests devtools -> All checks passed
- pytest -q tests/unit/devtools/test_verify_suppressions.py -> 7 passed
- devtools verify-suppressions --json -> discovered_total 157, noqa 4, blocking false
@Sinity

Sinity commented May 15, 2026

Copy link
Copy Markdown
Owner Author

Added #1062 Ruff-native unused-noqa enforcement in cbb9260.\n\nRuff now selects RUF100; stale # noqa comments were removed, and only four load-bearing noqa suppressions remain.\n\nVerification after the new commit:\n- devtools verify --quick -> exit 0, total 22.30s\n- ruff check polylogue tests devtools -> All checks passed\n- devtools verify-suppressions --json -> noqa: 4, blocking: false

Problem: non-strict xfails let realized behavior stay hidden as expected failure bookkeeping, which is exactly the kind of passive verifiability debt this branch is removing.

What changed: enable pytest strict xfail handling globally, keep the remaining real marker xfail strict, and remove two stale xfail markers whose tests now pass as ordinary executable contracts.

Verification: pytest -q tests/unit/cli/test_command_aux_runtime.py::test_tags_command_plain_paths_cover_empty_hint_and_tabular_counts tests/unit/cli/test_query_exec_laws.py::test_apply_modifiers_contract tests/unit/core/test_content_projection.py::test_prose_only_drops_claude_code_protocol_artifacts tests/unit/verification/test_breakers.py::test_empty_routing_fails; ruff check pyproject.toml tests/unit/cli/test_command_aux_runtime.py tests/unit/cli/test_query_exec_laws.py tests/unit/core/test_content_projection.py; mypy --strict tests/unit/cli/test_command_aux_runtime.py tests/unit/cli/test_query_exec_laws.py tests/unit/core/test_content_projection.py; devtools verify-suppressions --json; devtools verify --quick.
@Sinity

Sinity commented May 15, 2026 •

Copy link
Copy Markdown
Owner Author

Added another #1062 native-enforcement slice: pytest xfails are strict by default now, and two stale expected-failure markers were removed after strict mode exposed them as XPASS. Verification: focused pytest reported 2 passed and 2 xfailed; devtools verify-suppressions --json reports pytest_xfail=2; devtools verify --quick passed at a8af1bc.

Problem: the PR impact report still presented proof obligations, taxonomy, and agent judgment cells as the operator-facing model even after the underlying goal shifted to standard tests, static checks, artifacts, and review requirements.

What changed: group affected checks by artifact source in the report payload and markdown, rename stable affected obligations and agent judgment cells in the report surface, and adjust changed-path routing prose so recommended gates read as verification checks rather than proof-pack internals.

Verification: pytest -q tests/unit/devtools/test_proof_pack.py tests/unit/proof/test_diffing.py tests/unit/proof/test_diffing_runtime.py; ruff check devtools/proof_pack.py polylogue/proof/diffing.py tests/unit/devtools/test_proof_pack.py tests/unit/proof/test_diffing.py; mypy --strict devtools/proof_pack.py polylogue/proof/diffing.py tests/unit/devtools/test_proof_pack.py tests/unit/proof/test_diffing.py; devtools proof-pack --path devtools/proof_pack.py --check; devtools verify --quick.
@Sinity

Sinity commented May 15, 2026

Copy link
Copy Markdown
Owner Author

Added #1065 artifact-source report slice at 55c4645. The PR impact report now presents routed verification checks by artifact source instead of proof-obligation taxonomy, and manual review requirements instead of agent judgment cells. Focused proof-pack/diffing tests passed (33 tests), touched-file ruff/mypy passed, devtools proof-pack --path devtools/proof_pack.py --check passed, and pre-push devtools verify --quick passed.

Problem: the verification report still exposed a slop dashboard name for catalog anti-vacuity checks, preserving the bespoke terminology this cleanup is removing.

What changed: replace the slop dashboard functions, output fields, markdown, human output, and CLI option with anti-vacuity report terminology. No compatibility alias is kept for the old option.

Verification: pytest -q tests/unit/verification/test_breakers.py tests/unit/devtools/test_proof_pack.py; ruff format devtools/proof_pack.py tests/unit/verification/test_breakers.py; ruff check devtools/proof_pack.py tests/unit/verification/test_breakers.py; mypy --strict devtools/proof_pack.py tests/unit/verification/test_breakers.py; rg -n -e '--slop' -e 'Slop' -e 'slop' -e 'build_slop_dashboard' -e 'render_slop_markdown' -e '_print_slop_dashboard' devtools polylogue tests docs .github; devtools proof-pack --anti-vacuity --markdown; devtools verify --quick.
@Sinity

Sinity commented May 15, 2026

Copy link
Copy Markdown
Owner Author

Added anti-vacuity terminology cleanup at 1617af8: removed the slop dashboard naming and --slop option in favor of devtools proof-pack --anti-vacuity, with report fields/output updated to flagged claims. Focused tests, ruff/mypy, rg cleanup check, anti-vacuity markdown render, and pre-push devtools verify --quick passed.

Problem: generated command docs and the verification-lab reference still described routine verification surfaces as proof obligations and proof-lab operations even after the report surface moved to standard checks and artifacts.

What changed: update command catalog, generated-surface descriptions, docs map entries, verification-lab prose, README, architecture placement text, and regenerated AGENTS/docs surfaces to describe catalog-backed verification checks and evidence records.

Verification: devtools render-all; devtools render-devtools-reference; devtools render-agents; devtools render-all --check; pytest -q tests/unit/devtools/test_render_devtools_reference.py tests/unit/devtools/test_render_docs_surface.py tests/unit/devtools/test_devtools_main.py; ruff check devtools/command_catalog.py devtools/generated_surfaces.py devtools/docs_surface.py devtools/render_devtools_reference.py; mypy --strict devtools/command_catalog.py devtools/generated_surfaces.py devtools/docs_surface.py devtools/render_devtools_reference.py; rg for proof-obligation/proof-lab stale terms in touched docs; devtools verify --quick.
@Sinity

Sinity commented May 15, 2026

Copy link
Copy Markdown
Owner Author

Added docs/catalog terminology slice at 73d7bd7: command catalog, generated docs, README/docs map, verification-lab prose, architecture placement text, and AGENTS now frame the surface as catalog-backed verification checks and evidence records. render-all/check, targeted docs tests, ruff/mypy, stale-term rg, and pre-push devtools verify --quick passed.

Problem: the verification impact report could group routed checks by artifact source but did not actually consume the pytest contract evidence artifacts emitted by record_contract_evidence.

What changed: add contract evidence artifact discovery under .cache/verification/evidence, summarize artifact count, surface counts, recent contract IDs, test node IDs, and artifact paths, and render that summary in markdown and human report output.

Verification: pytest -q tests/unit/devtools/test_proof_pack.py tests/infra/test_contract_evidence.py; ruff format devtools/proof_pack.py tests/unit/devtools/test_proof_pack.py; ruff check devtools/proof_pack.py tests/unit/devtools/test_proof_pack.py; mypy --strict devtools/proof_pack.py tests/unit/devtools/test_proof_pack.py; devtools proof-pack --path tests/unit/cli/test_json_envelope_contract.py --markdown; devtools verify --quick.
@Sinity

Sinity commented May 15, 2026

Copy link
Copy Markdown
Owner Author

Added #1060 report-consumption slice at 4f57ff1: proof-pack now summarizes real pytest contract evidence artifacts from .cache/verification/evidence, including surface counts, contract IDs, test node IDs, and artifact paths. Focused tests, ruff/mypy, sample markdown render, and pre-push devtools verify --quick passed.

Problem: CodeQL flagged POST /api/ingest because the daemon resolved and copied an arbitrary path supplied in the HTTP request body. That made the HTTP surface responsible for local filesystem reads instead of just scheduling daemon-owned convergence work.

What changed: move arbitrary local path staging into the CLI ingest adapter, and restrict the daemon HTTP endpoint to scheduling an artifact that already exists in the archive inbox. The daemon matches by staged entry name, verifies symlink resolution remains inside the inbox, and emits the same import operation envelope for the normal watcher path.

Verification: pytest -q tests/unit/daemon/test_daemon_http_security.py tests/unit/cli/test_ingest.py; ruff check polylogue/daemon/http.py polylogue/cli/commands/ingest.py tests/unit/daemon/test_daemon_http_security.py tests/unit/cli/test_ingest.py; mypy --strict polylogue/daemon/http.py polylogue/cli/commands/ingest.py tests/unit/daemon/test_daemon_http_security.py tests/unit/cli/test_ingest.py; devtools verify --quick

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

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

⚠️ Outside diff range comments (1)
devtools/verify_manifests.py (1)

115-139: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Reintroduce explicit rejection of retired assurance fields.

Line 132 onward only checks shape/description. This no longer enforces the retired-key policy (maturity, oracle, oracle_present) at the manifest-check layer, so legacy self-attested rows can slip if schema strictness changes.

Suggested patch
@@
 _COVERAGE_PATH_LIST_FIELDS = {"locations", "paths_to_mutate", "tests"}
+_RETIRED_ASSURANCE_FIELDS = {"maturity", "oracle", "oracle_present"}
@@ def check_assurance_domains(plans_dir: Path) -> list[str]:
     for name, domain in domains.items():
         if not isinstance(domain, dict):
             errors.append(f"{path}: domain {name!r} is not a mapping")
             continue
         if "description" not in domain:
             errors.append(f"{path}: domain {name!r} missing description")
+        retired = sorted(_RETIRED_ASSURANCE_FIELDS.intersection(domain.keys()))
+        for field in retired:
+            errors.append(
+                f"{path}: domain {name!r} uses retired field {field!r}; "
+                "replace with executable evidence artifacts"
+            )
🤖 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/verify_manifests.py` around lines 115 - 139, The
check_assurance_domains function currently only validates that each domain is a
mapping and has a description; update the loop over domains (in
check_assurance_domains, iterating name, domain) to explicitly reject any
retired assurance fields by adding errors when the domain dict contains the keys
"maturity", "oracle", or "oracle_present" (e.g., append f"{path}: domain
{name!r} contains retired field 'maturity'" for each offending key); perform
this check for each domain alongside the existing type/description checks so
manifests containing those legacy fields fail validation.
🤖 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/proof_pack.py`:
- Around line 396-434: The _contract_evidence_summary function currently accepts
any dict payload and silently yields empty fields; add basic schema validation
after loading the payload: check that payload is a dict and that required keys
(at minimum "contract" and "surface", optionally "test_nodeid" or "git_sha") are
present and non-empty; if a file is missing required fields, emit a warning (use
the module logger or logging.warning) including the offending path
(path.relative_to(root).as_posix()) and the missing keys, then continue
processing (do not crash) so malformed files are still skipped but visible in
logs; keep the rest of the logic (by_surface, artifacts collection,
artifacts[-20:]) unchanged.

In `@polylogue/cli/commands/ingest.py`:
- Around line 32-41: The current staging writes to dest = inbox / resolved.name
which can collide across different sources; change the behavior in the ingest
routine that computes dest so that if dest exists and resolved != dest.resolve()
you either (a) compute a unique destination name (e.g., append a short hash
derived from the resolved path or its stat info to resolved.name) before calling
shutil.copytree/copy2, or (b) raise/return an error to avoid silently merging
unrelated inputs; update the logic around the dest, resolved, and the
shutil.copytree/shutil.copy2 calls to use the new unique dest or to fail when an
existing different source is detected.

---

Outside diff comments:
In `@devtools/verify_manifests.py`:
- Around line 115-139: The check_assurance_domains function currently only
validates that each domain is a mapping and has a description; update the loop
over domains (in check_assurance_domains, iterating name, domain) to explicitly
reject any retired assurance fields by adding errors when the domain dict
contains the keys "maturity", "oracle", or "oracle_present" (e.g., append
f"{path}: domain {name!r} contains retired field 'maturity'" for each offending
key); perform this check for each domain alongside the existing type/description
checks so manifests containing those legacy fields fail validation.
🪄 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: 0faa0c8d-8e73-4973-ad04-3a9d171fd484

📥 Commits

Reviewing files that changed from the base of the PR and between 4a6d987 and 51c4241.

📒 Files selected for processing (40)
  • AGENTS.md
  • README.md
  • devtools/benchmark_campaign.py
  • devtools/benchmark_results.py
  • devtools/command_catalog.py
  • devtools/docs_surface.py
  • devtools/generated_surfaces.py
  • devtools/proof_pack.py
  • devtools/render_devtools_reference.py
  • devtools/verify_manifests.py
  • devtools/verify_slos.py
  • docs/README.md
  • docs/architecture.md
  • docs/devtools.md
  • docs/plans/assurance-domains.yaml
  • docs/verification-lab.md
  • polylogue/cli/commands/ingest.py
  • polylogue/cli/query.py
  • polylogue/cli/query_verbs.py
  • polylogue/daemon/convergence_stages.py
  • polylogue/daemon/http.py
  • polylogue/proof/diffing.py
  • polylogue/sources/parsers/antigravity.py
  • polylogue/storage/embeddings/materialization.py
  • polylogue/storage/fts/sql.py
  • polylogue/storage/insights/session/rebuild.py
  • polylogue/verification/manifests/models.py
  • pyproject.toml
  • tests/data/pytest-benchmark/reader-status.json
  • tests/unit/cli/test_command_aux_runtime.py
  • tests/unit/cli/test_ingest.py
  • tests/unit/cli/test_query_exec_laws.py
  • tests/unit/core/test_content_projection.py
  • tests/unit/daemon/test_daemon_http_security.py
  • tests/unit/daemon/test_schema_preflight.py
  • tests/unit/devtools/test_benchmark_campaign.py
  • tests/unit/devtools/test_proof_pack.py
  • tests/unit/devtools/test_verify_manifests.py
  • tests/unit/proof/test_diffing.py
  • tests/unit/verification/test_breakers.py
💤 Files with no reviewable changes (3)
  • tests/unit/cli/test_query_exec_laws.py
  • tests/unit/core/test_content_projection.py
  • polylogue/verification/manifests/models.py

Comment thread devtools/proof_pack.py
Comment on lines +396 to +434
def _contract_evidence_summary(root: Path) -> dict[str, Any]:
evidence_dir = root / _CONTRACT_EVIDENCE_DIR
if not evidence_dir.exists():
return {
"artifact_dir": _CONTRACT_EVIDENCE_DIR.as_posix(),
"artifact_count": 0,
"by_surface": {},
"artifacts": [],
}

artifacts: list[dict[str, Any]] = []
by_surface: Counter[str] = Counter()
for path in sorted(evidence_dir.glob("*.json")):
try:
payload = json.loads(path.read_text(encoding="utf-8"))
except (OSError, json.JSONDecodeError):
continue
if not isinstance(payload, dict):
continue
surface = str(payload.get("surface") or "unknown")
by_surface[surface] += 1
artifacts.append(
{
"path": path.relative_to(root).as_posix(),
"contract": str(payload.get("contract") or ""),
"surface": surface,
"test_nodeid": str(payload.get("test_nodeid") or ""),
"git_sha": str(payload.get("git_sha") or ""),
"dirty": bool(payload.get("dirty", False)),
"timestamp": str(payload.get("timestamp") or ""),
}
)

return {
"artifact_dir": _CONTRACT_EVIDENCE_DIR.as_posix(),
"artifact_count": len(artifacts),
"by_surface": dict(sorted(by_surface.items())),
"artifacts": artifacts[-20:],
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | 💤 Low value

Consider adding basic schema validation for evidence artifacts.

The function silently skips malformed JSON files (good), but accepts any dict as valid. If an evidence file lacks expected fields like contract or surface, the summary will contain empty strings. Consider logging a warning for files missing required fields to aid debugging.

♻️ Optional: Add warning for incomplete evidence files
         if not isinstance(payload, dict):
             continue
+        required_fields = ("contract", "surface", "test_nodeid")
+        if not all(payload.get(f) for f in required_fields):
+            # Optionally log: logger.warning(f"Evidence file {path} missing required fields")
+            continue
         surface = str(payload.get("surface") or "unknown")
🤖 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/proof_pack.py` around lines 396 - 434, The
_contract_evidence_summary function currently accepts any dict payload and
silently yields empty fields; add basic schema validation after loading the
payload: check that payload is a dict and that required keys (at minimum
"contract" and "surface", optionally "test_nodeid" or "git_sha") are present and
non-empty; if a file is missing required fields, emit a warning (use the module
logger or logging.warning) including the offending path
(path.relative_to(root).as_posix()) and the missing keys, then continue
processing (do not crash) so malformed files are still skipped but visible in
logs; keep the rest of the logic (by_surface, artifacts collection,
artifacts[-20:]) unchanged.

Comment on lines +32 to +41
dest = inbox / resolved.name

if dest.exists() and resolved == dest.resolve():
return dest

try:
if resolved.is_dir():
shutil.copytree(resolved, dest, dirs_exist_ok=True)
else:
shutil.copy2(resolved, dest)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Prevent inbox destination collisions by source basename.

Staging to inbox/<resolved.name> can overwrite or merge unrelated inputs that share a name, which can ingest wrong content. Use a unique destination (e.g., include a hash of resolved path) or fail when destination exists for a different source.

Suggested fix
 def _stage_for_daemon(path: Path) -> Path:
@@
-    dest = inbox / resolved.name
+    stable_id = str(abs(hash(str(resolved))))
+    dest = inbox / f"{resolved.name}-{stable_id}"
@@
-    if dest.exists() and resolved == dest.resolve():
-        return dest
+    if dest.exists():
+        return dest
@@
-        if resolved.is_dir():
+        if resolved.is_dir():
             shutil.copytree(resolved, dest, dirs_exist_ok=True)
         else:
             shutil.copy2(resolved, dest)
🤖 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 `@polylogue/cli/commands/ingest.py` around lines 32 - 41, The current staging
writes to dest = inbox / resolved.name which can collide across different
sources; change the behavior in the ingest routine that computes dest so that if
dest exists and resolved != dest.resolve() you either (a) compute a unique
destination name (e.g., append a short hash derived from the resolved path or
its stat info to resolved.name) before calling shutil.copytree/copy2, or (b)
raise/return an error to avoid silently merging unrelated inputs; update the
logic around the dest, resolved, and the shutil.copytree/shutil.copy2 calls to
use the new unique dest or to fail when an existing different source is
detected.

Problem: the verification evidence PR still had valid review findings around malformed SLO rows, evidence artifact bounds, suppression scanning robustness, verify failure aggregation, and duplicated verification guidance.

What changed: required SLO rows now fail as catalog errors when budgets or benchmark IDs are malformed; contract evidence records redact command strings as whole commands and bounds JSON documents; suppression discovery tolerates parser failures; verify continues through cheap deterministic failures while stopping on heavy pytest/lab steps; docs now have one authoritative verification baseline section. Related contract evidence and daemon tests were aligned with their assertions.

Verification: pytest -q tests/unit/daemon/test_daemon_http_security.py tests/unit/cli/test_ingest.py tests/infra/test_contract_evidence.py tests/unit/devtools/test_slo_catalog.py tests/unit/devtools/test_verify_suppressions.py tests/unit/daemon/test_backup.py tests/unit/daemon/test_daemon_cli.py tests/unit/devtools/test_verify.py; ruff check devtools/verify.py devtools/verify_slos.py devtools/verify_suppressions.py tests/infra/contract_evidence.py tests/infra/test_contract_evidence.py tests/unit/devtools/test_slo_catalog.py tests/unit/devtools/test_verify_suppressions.py tests/unit/daemon/test_backup.py tests/unit/daemon/test_daemon_cli.py tests/unit/devtools/test_verify.py; mypy --strict devtools/verify.py devtools/verify_slos.py devtools/verify_suppressions.py tests/infra/contract_evidence.py tests/infra/test_contract_evidence.py tests/unit/devtools/test_slo_catalog.py tests/unit/devtools/test_verify_suppressions.py tests/unit/daemon/test_backup.py tests/unit/daemon/test_daemon_cli.py tests/unit/devtools/test_verify.py; devtools verify --quick
@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 54.F052 / P1: Fix and current-source recheck assigned to polylogue-t5jl2; not claimed fixed. The old invalidator matcher was removed, but nested conftest changes still receive only native affected selection (devtools/verify.py:397,502). A newly introduced autouse fixture has no prior execution edge, and there is no conftest-change refusal or forced collection to protect already-recorded tests from that new fixture.

Only the rows listed above are dispositioned. Held findings remain open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant