Skip to content

fix(verification): enforce coverage gap lifecycle - #701

Merged
Sinity merged 3 commits into
masterfrom
feature/fix/coverage-gap-lifecycle
May 2, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/fix/coverage-gap-lifecycle

Conversation

@Sinity

@Sinity Sinity commented May 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

Tightens verify-manifests so coverage gaps are lifecycle records instead of prose-only rows, and updates every current docs/plans/*coverage*.yaml gap to satisfy the new contract.

Problem

#590 tracks the fact that coverage manifests were visible but passive: a row could name a gap and owner without stable identity, issue/suppression linkage, review metadata, severity, or a resolvable next evidence path. That made proof-pack known-gap reporting useful but too shallow to support durable closure.

Solution

devtools/verify_manifests.py now requires each coverage gap to have a stable id, axis, gap, owner, severity, declared_at, review_after, issue or suppression linkage, and next_evidence that resolves to a known devtools command or supported command family such as pytest.

The existing distribution, docs/media, scenario, security/privacy, and test-quality coverage gaps now carry that lifecycle metadata. polylogue/proof/coverage_manifests.py also forwards the new metadata into assurance.coverage_gap subjects and uses stable gap IDs in subject IDs instead of index-derived IDs.

Automated review caught two edge cases, both addressed: pytest evidence commands are parsed by command token instead of naive path extraction, and the manifest verifier rejects coverage-gap IDs that collide after proof-subject slugging.

This intentionally keeps ordinary known gaps report-only per the latest #590 policy; serious affected gaps still escalate through proof-pack/check policy rather than every known gap failing quick verification.

CI also exposed stale showcase help baselines from the previously merged selector/message-type work. This PR refreshes those committed baselines so the showcase lane matches current CLI behavior.

Verification

  • ruff check devtools/verify_manifests.py tests/unit/devtools/test_verify_manifests.py polylogue/proof/coverage_manifests.py tests/unit/proof/test_catalog.py
  • devtools verify-manifests
  • pytest tests/unit/devtools/test_verify_manifests.py tests/unit/proof/test_catalog.py tests/unit/proof/test_diffing.py -q
  • pytest tests/unit/proof tests/unit/devtools/test_proof_pack.py tests/unit/devtools/test_render_verification_catalog.py -q
  • devtools render-verification-catalog --check
  • devtools proof-pack --path docs/plans/distribution-coverage.yaml --path docs/plans/docs-media-coverage.yaml --path devtools/verify_manifests.py --path polylogue/proof/coverage_manifests.py --check
  • devtools proof-pack --path docs/plans/distribution-coverage.yaml --path docs/plans/docs-media-coverage.yaml --path docs/plans/scenario-coverage.yaml --path docs/plans/security-privacy-coverage.yaml --path docs/plans/test-quality-coverage.yaml --markdown
  • devtools lab-scenario verify-baselines --update
  • devtools lab-scenario verify-baselines
  • devtools verify --quick
  • devtools verify
  • pre-push devtools verify --quick after each push

Proof-pack with explicit changed paths reports the expected known-gap warnings under the current #590/#594 policy. GitHub proof-pack, lint, typecheck, nix-build, nix-check, analysis, and showcase checks passed. Remaining GitHub pytest jobs were pending under the known CI-capacity issue; local full devtools verify passed.

Ref #590

Problem: coverage manifests recorded known gaps as prose rows, so the
manifest gate accepted debt without stable identity, review metadata,
issue linkage, or resolvable next evidence. That kept #590's coverage
contracts passive even though proof-pack could surface the gaps.

What changed: verify-manifests now requires every coverage gap to carry a
stable id, severity, declared/review dates, issue or suppression linkage,
and a next_evidence command that resolves to a known devtools command or
supported runtime/test command. The existing coverage manifests now
satisfy that contract, and proof gap subjects carry the lifecycle
metadata with stable gap-derived subject ids.

Verification: ruff check devtools/verify_manifests.py
tests/unit/devtools/test_verify_manifests.py
polylogue/proof/coverage_manifests.py tests/unit/proof/test_catalog.py;
devtools verify-manifests; pytest
tests/unit/devtools/test_verify_manifests.py tests/unit/proof/test_catalog.py
tests/unit/proof/test_diffing.py -q; pytest tests/unit/proof
tests/unit/devtools/test_proof_pack.py
tests/unit/devtools/test_render_verification_catalog.py -q; devtools
render-verification-catalog --check; devtools proof-pack --path
docs/plans/distribution-coverage.yaml --path docs/plans/docs-media-coverage.yaml
--path devtools/verify_manifests.py --path polylogue/proof/coverage_manifests.py
--check; devtools verify --quick.

Ref #590
Copilot AI review requested due to automatic review settings May 2, 2026 12:45
@coderabbitai

coderabbitai Bot commented May 2, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Coverage gap manifests now include stable identifiers, mandatory metadata fields (severity, declared_at, review_after, issue), and stringent validation rules: unique gap IDs, resolvable next_evidence commands, ISO date compliance, and proof-subject slug deduplication. The discovery and validation pipeline extracts these enriched gap records into catalog subjects with full metadata propagation.

Changes

Coverage Gap Schema & Validation Overhaul

Layer / File(s) Summary
Data Schema
docs/plans/distribution-coverage.yaml, docs/plans/docs-media-coverage.yaml, docs/plans/scenario-coverage.yaml, docs/plans/security-privacy-coverage.yaml, docs/plans/test-quality-coverage.yaml
Each coverage gap entry gains id, severity, declared_at, review_after, and issue fields; all existing gap descriptions, owners, and evidence guidance are preserved in the new structure.
Validation Constants & Helpers
devtools/verify_manifests.py (lines 9–21, 196–243)
Module-level coverage axis keys and severity allowlists are defined; helpers _valid_iso_date, _valid_issue_ref, _valid_suppression_ref, _resolvable_next_evidence, and _coverage_gap_slug are added to parse/validate dates, issue/suppression references, command resolvability, and slug derivation.
Manifest Validation
devtools/verify_manifests.py (lines 141–193)
check_coverage_gaps enforces unique id values, detects duplicate proof-subject slugs, validates required fields (axis, gap, owner, severity), checks ISO date compliance for declared_at/review_after, requires either a valid issue reference or non-empty suppression, and confirms next_evidence resolves to a known command (via COMMANDS registry or evidence command set).
Gap Discovery & Enrichment
polylogue/proof/coverage_manifests.py (lines 165–235)
_iter_manifest_gaps extracts optional id and normalizes severity, declared_at, review_after, issue, suppression into yielded gap records; _coverage_gap_subject derives stable gap_id and subject_leaf from gap id (or falls back to index-based construction) and propagates all normalized metadata to subject attributes.
Validation & Catalog Tests
tests/unit/devtools/test_verify_manifests.py (lines 9–127), tests/unit/proof/test_catalog.py (lines 100–105)
Test fixtures now include the expanded gap schema; validation tests confirm rejection of missing required fields, non-command next_evidence, and duplicate slugs, while also verifying pytest-filter support; catalog compilation tests assert presence of gap_id, severity, declared_at, review_after, and issue/suppression in compiled subjects.

CLI Enhancement

Layer / File(s) Summary
Help Text Baseline Updates
tests/baselines/showcase/help-main.txt, tests/baselines/showcase/help-messages.txt, tests/baselines/showcase/help-select.txt
Added message as an accepted value for --message-type option across baseline help files; introduced new select command baseline documenting usage, description, and options (--print, --limit, --help).

Sequence Diagram

sequenceDiagram
    participant Manifest as Coverage<br/>Manifest File
    participant Validator as verify_manifests<br/>check_coverage_gaps
    participant Discovery as coverage_manifests<br/>_iter_manifest_gaps
    participant Catalog as Proof<br/>Catalog Subject

    Manifest->>Validator: Load gap entries with id,<br/>severity, dates, issue
    Validator->>Validator: Validate id uniqueness,<br/>date ISO format, command resolvability
    Validator->>Validator: Check for duplicate<br/>proof-subject slugs
    Validator->>Discovery: Emit validated gaps
    Discovery->>Discovery: Extract id, normalize<br/>metadata fields
    Discovery->>Discovery: Derive stable subject_leaf<br/>from gap id
    Discovery->>Catalog: Inject gap_id and enriched<br/>metadata into attributes
    Catalog->>Catalog: Compile subjects with<br/>gap identifiers & traceability
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • fix(verification): make coverage declarations executable contracts #590: The enhancements to devtools/verify_manifests.py introduce stable gap IDs, stricter issue/suppression requirement enforcement, ISO date validation, and executable next_evidence command validation—directly implementing key acceptance criteria for making coverage declarations executable contracts.

Possibly related PRs

Suggested labels

type:test, area:cli, area:schema, area:qa

Poem

🐰 A rabbit bounds through manifests neat,
Adding IDs to gaps—the validation's complete!
Dates dance in ISO, commands now compile,
Proof subjects no longer collide with a smile ✨
Coverage tales, now traceable and true!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 17.65% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(verification): enforce coverage gap lifecycle' directly and specifically describes the main change: enforcing a lifecycle model for coverage gaps in verification manifests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description covers all required template sections with comprehensive detail about changes, rationale, verification steps, and risks.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/coverage-gap-lifecycle

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

github-actions Bot commented May 2, 2026 •

Copy link
Copy Markdown
Contributor

Polylogue Proof Pack

Refs: origin/master..HEAD
Changed paths: 12

Affected Domains

  • architecture_discipline — 4 claim(s), maturity growing
  • operational_resilience — 14 claim(s), maturity seed
  • schema_correctness — 1 claim(s), maturity growing
  • spec_completeness — 3 claim(s), maturity seed
  • surface_parity — 1 claim(s), maturity nascent
  • test_quality — 1 claim(s), maturity growing
  • unclassified — 18 claim(s), maturity seed
Additional routed domains with zero affected claims
  • benchmark_coverage — maturity seed
  • cli_surface — maturity established
  • distribution — maturity seed
  • docs_media — maturity seed
  • migration_safety — maturity nascent
  • mutation_coverage — maturity growing
  • performance — maturity nascent
  • pipeline_correctness — maturity growing
  • provider_coverage — maturity growing
  • scenario_coverage — maturity nascent
  • security_privacy — maturity nascent
  • site_publication — maturity seed
  • spec_accuracy — maturity seed
  • storage_correctness — maturity established

Focused Gates

  • devtools verify-manifests — structural manifest changed
  • devtools affected-obligations --path devtools/verify_manifests.py — refresh structural obligation routing
  • devtools render-verification-catalog --check — coverage manifests feed proof subjects
  • devtools proof-pack --path docs/plans/distribution-coverage.yaml --markdown — coverage changes feed proof-pack gaps
  • devtools proof-pack --path docs/plans/docs-media-coverage.yaml --markdown — coverage changes feed proof-pack gaps
  • devtools proof-pack --path docs/plans/scenario-coverage.yaml --markdown — coverage changes feed proof-pack gaps
  • devtools proof-pack --path docs/plans/security-privacy-coverage.yaml --markdown — coverage changes feed proof-pack gaps
  • devtools proof-pack --path docs/plans/test-quality-coverage.yaml --markdown — coverage changes feed proof-pack gaps
  • pytest tests/unit/proof — proof kernel or catalog changed
  • pytest tests/unit/devtools/test_proof_pack.py — proof-pack policy or CLI changed
  • pytest tests/unit/devtools/test_render_verification_catalog.py — catalog renderer changed
  • devtools proof-pack --check — proof-pack policy gate changed

Required PR Gates

  • devtools verify --quick — full PR gate remains explicit
  • devtools verify — full PR gate remains explicit

Optional Confidence Gates

  • devtools build-package — deployment readiness gate; run when packaging or release confidence matters
  • nix flake check — deployment readiness gate; run when packaging or release confidence matters

Known Gaps

  • test_quality: direct_coverage: Coverage per-module not tracked (only aggregate fail_under) [owner: test-quality; next: devtools coverage-gate], flakiness: No systematic flakiness tracking, CI retry, or quarantine [owner: test-quality; next: devtools run-validation-lanes --list], fuzz: Atheris fuzz targets not run in CI [owner: test-quality; next: devtools run-validation-lanes --list], mock_depth: Mock depth not measured or enforced [owner: test-quality; next: devtools run-validation-lanes --list]
Additional gaps in zero-claim routed domains
  • distribution: dev_install: Not verified in CI; devshell is canonical environment [owner: distribution; next: devtools verify-distribution-surface], distribution: No scenario for install/package verification [owner: scenario-coverage; next: devtools scenario-projections], install_parity: Local gate smokes wheel and sdist-built wheel, but exact Nix/devshell parity is not yet compared in CI [owner: distribution; next: devtools verify-distribution-surface], macos: No macOS CI runner [owner: distribution; next: devtools verify-distribution-surface], sdist: Distribution gate exists locally but is not scheduled in CI [owner: distribution; next: devtools verify-distribution-surface], wheel: Distribution gate exists locally but is not scheduled in CI [owner: distribution; next: devtools verify-distribution-surface], windows: No Windows CI runner [owner: distribution; next: devtools verify-distribution-surface]
  • docs_media: docs_media: No scenario for documentation freshness verification [owner: scenario-coverage; next: devtools scenario-projections], docs_media: README examples and media are not yet generated from executable scenario projections. [owner: docs-media; next: devtools render-docs-surface --check], docs_media: Screenshots and VHS media have no committed nonblank/readability verification. [owner: docs-media; next: devtools render-docs-surface --check]
  • migration_safety: migration_safety: No scenario for migration safety verification [owner: scenario-coverage; next: devtools scenario-projections]
  • performance: performance: No scenario family exercising memory or throughput budgets [owner: scenario-coverage; next: devtools scenario-projections]
  • security_privacy: dependency_audit: No dependency vulnerability scanning in CI [owner: security-privacy; next: devtools verify --quick], file_permissions: Crawl-source file permissions not verified [owner: security-privacy; next: pytest -q tests/unit/security], secrets_detection: No automated secrets scanning in CI [owner: security-privacy; next: devtools verify --quick], security_privacy: Security verification uses unit tests, not scenario specs [owner: scenario-coverage; next: devtools scenario-projections], xss_prevention: No dedicated XSS test file; relies on snapshot rendering [owner: security-privacy; next: pytest -q tests/unit/security]
  • site_publication: site_publication: Static-site publication has no visual or hyperlink integrity gate. [owner: docs-media; next: devtools render-docs-surface --check]
  • storage_correctness: storage_correctness: No dedicated scenario family for storage-layer verification [owner: scenario-coverage; next: devtools scenario-projections]

Oracle / Cost

  • oracle mix: {"construction_sanity": 513, "drift_check": 5, "manual_review": 1, "proof": 37, "smoke": 12}
  • cost tier: {"static": 552, "unit": 16}
  • stable affected obligations: 545
  • agent judgment cells: 1

Agent Judgment Cells

  • operation.effect.privacy_safe_evidence — result tracked_exception; artifact missing; reviewer missing; produced_at missing; freshness missing

@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: 9a010c3fe0

ℹ️ 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_manifests.py Resolved
Comment thread polylogue/proof/coverage_manifests.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR strengthens Polylogue’s verification coverage manifests by turning coverage_gaps entries into structured lifecycle records (stable identity + review metadata + resolvable closure path), and wires that richer metadata into proof subjects so proof-pack reporting can rely on durable gap identities.

Changes:

  • Enforce lifecycle fields for coverage_gaps in devtools verify-manifests, including stable id, severity, dates, issue/suppression linkage, and resolvable next_evidence.
  • Forward the new gap metadata into assurance.coverage_gap proof subjects and switch subject IDs from index-derived to stable gap IDs.
  • Update existing docs/plans/*coverage*.yaml manifests and add/extend unit tests for the new contract.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
devtools/verify_manifests.py Adds stricter validation for coverage gap lifecycle fields and validates next_evidence against known commands/families.
polylogue/proof/coverage_manifests.py Includes new gap metadata in proof subjects and derives gap subject IDs from stable gap IDs.
docs/plans/distribution-coverage.yaml Converts distribution gaps into lifecycle records with IDs, dates, severity, and closure commands.
docs/plans/docs-media-coverage.yaml Converts docs/media gaps into lifecycle records with IDs, dates, severity, and closure commands.
docs/plans/scenario-coverage.yaml Converts scenario coverage gaps into lifecycle records with IDs, dates, severity, and closure commands.
docs/plans/security-privacy-coverage.yaml Converts security/privacy gaps into lifecycle records with IDs, dates, severity, and closure commands.
docs/plans/test-quality-coverage.yaml Converts test-quality gaps into lifecycle records with IDs, dates, severity, and closure commands.
tests/unit/devtools/test_verify_manifests.py Updates/adds tests to assert the new lifecycle-field and next_evidence validation behavior.
tests/unit/proof/test_catalog.py Adds assertions that coverage-gap subjects carry the required new metadata fields.

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

Comment on lines +232 to +239
def _resolvable_next_evidence(value: str) -> bool:
stripped = value.strip()
if not any(stripped.startswith(prefix) for prefix in _EVIDENCE_COMMAND_PREFIXES):
return False
try:
tokens = shlex.split(stripped)
except ValueError:
return False
Comment thread devtools/verify_manifests.py Outdated
Comment on lines +250 to +254
def _pytest_target_exists(tokens: list[str]) -> bool:
targets = [token for token in tokens if not token.startswith("-")]
return not targets or any((_REPO_ROOT / token).exists() for token in targets)


Comment on lines +216 to +219
gap_id = str(gap.get("id") or "")
domain = str(gap.get("domain") or entry.domain)
subject_id = f"assurance.coverage_gap.{entry.manifest_id}.{index:03d}.{_slug(axis)}"
subject_leaf = _slug(gap_id) if gap_id else f"{index:03d}.{_slug(axis)}"
subject_id = f"assurance.coverage_gap.{entry.manifest_id}.{subject_leaf}"
Problem: automated review caught two verifier edge cases in #701. Pytest
next_evidence commands with option values could be rejected as missing
paths, and different raw gap IDs could collide after slugging into proof
subject IDs.

What changed: next_evidence validation now parses with shlex first and
validates by command token instead of prefix strings or naive pytest
target checks. Coverage gap validation also rejects duplicate
proof-subject slugs so the stable IDs cannot mint duplicate
assurance.coverage_gap subject IDs.

Verification: ruff check devtools/verify_manifests.py
tests/unit/devtools/test_verify_manifests.py; devtools verify-manifests;
pytest tests/unit/devtools/test_verify_manifests.py
tests/unit/proof/test_catalog.py tests/unit/proof/test_diffing.py -q.

Ref #590
@Sinity

Sinity commented May 2, 2026

Copy link
Copy Markdown
Owner Author

Automated review triage after the second commit:

  • Codex/Copilot pytest parsing comments: actionable. Addressed by removing prefix-string matching and naive pytest path validation; next_evidence is now parsed with shlex and validated by command token. Added a regression for pytest -k "docs_media and not slow".
  • Codex/Copilot proof-subject collision comments: actionable. Addressed by validating uniqueness of the slug that will become the assurance.coverage_gap subject leaf. Added a regression for docs_media.generated_proof vs docs-media.generated-proof.
  • CodeRabbit comment: tool/rate-limit status only, no substantive findings. The CodeRabbit check is green.
  • Proof Pack: read and matched to verification. It reports known-gap warnings, but the check policy is OK and those warnings are expected for this fix(verification): make coverage declarations executable contracts #590 slice.

Additional verification after review fixes:

  • ruff check devtools/verify_manifests.py tests/unit/devtools/test_verify_manifests.py
  • devtools verify-manifests
  • pytest tests/unit/devtools/test_verify_manifests.py tests/unit/proof/test_catalog.py tests/unit/proof/test_diffing.py -q
  • pre-push devtools verify --quick

Problem: CI showcase verification exposed committed help baselines that were
stale after the earlier selector and strict message-type work.

What changed: refreshed the tier-0 CLI help baselines for root help,
messages help, and the new select command.

Verification: devtools lab-scenario verify-baselines --update; devtools
lab-scenario verify-baselines.

Ref #590
@Sinity

Sinity commented May 2, 2026

Copy link
Copy Markdown
Owner Author

CI/showcase follow-up:

The showcase-verify failure was not quota noise. Its log showed stale CLI help baselines from the previously merged selector/message-type changes:

  • new help-select baseline missing;
  • help-main missing select and the message message-type choice;
  • help-messages missing the message message-type choice.

I refreshed those baselines in commit 71c64504 and verified with:

  • devtools lab-scenario verify-baselines --update
  • devtools lab-scenario verify-baselines
  • pre-push 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: 1

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)

141-171: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Scope proof-subject slug dedupe to a single manifest.

gap_subject_leaves is global across all coverage manifests, but the actual proof subject id is namespaced by entry.manifest_id. That means two different manifests can legitimately reuse the same slug today, and this validator would reject them as a false collision.

Proposed fix
-    gap_subject_leaves: set[str] = set()
+    gap_subject_leaves: set[tuple[str, str]] = set()
     for path in sorted(plans_dir.glob("*coverage*.yaml")):
@@
-                if gap_subject_leaf in gap_subject_leaves:
+                slug_key = (path.stem, gap_subject_leaf)
+                if slug_key in gap_subject_leaves:
                     errors.append(f"{label} duplicate proof subject slug {gap_subject_leaf!r}")
                 else:
-                    gap_subject_leaves.add(gap_subject_leaf)
+                    gap_subject_leaves.add(slug_key)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@devtools/verify_manifests.py` around lines 141 - 171, The validator currently
uses a single global gap_subject_leaves set which flags slug collisions across
different manifests; change this to scope deduplication per-manifest by
replacing gap_subject_leaves with a mapping keyed by the manifest id (e.g.,
gap_subject_leaves_by_manifest: dict[str, set[str]]), obtain the manifest id
from the loaded data (data.get("manifest_id") or fallback to path if absent),
and for each gap use _coverage_gap_slug(gap_id) to check/insert into the
per-manifest set rather than the global set so that duplicate slugs are only
reported when they occur within the same manifest.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@devtools/verify_manifests.py`:
- Around line 181-183: The current loop validates "declared_at" and
"review_after" independently, but you must also reject records where
review_after is earlier than declared_at; after confirming both fields pass
_valid_iso_date(gap.get(...)) for the given gap, parse the two ISO dates (e.g.,
using the same ISO parsing logic used elsewhere) and if review_after <
declared_at append an error like f"{label} review_after earlier than
declared_at" to errors; place this check near the existing validation loop so it
uses gap, label, errors and the _valid_iso_date guard to avoid parsing invalid
strings.

---

Outside diff comments:
In `@devtools/verify_manifests.py`:
- Around line 141-171: The validator currently uses a single global
gap_subject_leaves set which flags slug collisions across different manifests;
change this to scope deduplication per-manifest by replacing gap_subject_leaves
with a mapping keyed by the manifest id (e.g., gap_subject_leaves_by_manifest:
dict[str, set[str]]), obtain the manifest id from the loaded data
(data.get("manifest_id") or fallback to path if absent), and for each gap use
_coverage_gap_slug(gap_id) to check/insert into the per-manifest set rather than
the global set so that duplicate slugs are only reported when they occur within
the same manifest.
🪄 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: 4f23d0f0-c032-414b-a09f-c815231a98a1

📥 Commits

Reviewing files that changed from the base of the PR and between d30589f and 71c6450.

📒 Files selected for processing (12)
  • devtools/verify_manifests.py
  • docs/plans/distribution-coverage.yaml
  • docs/plans/docs-media-coverage.yaml
  • docs/plans/scenario-coverage.yaml
  • docs/plans/security-privacy-coverage.yaml
  • docs/plans/test-quality-coverage.yaml
  • polylogue/proof/coverage_manifests.py
  • tests/baselines/showcase/help-main.txt
  • tests/baselines/showcase/help-messages.txt
  • tests/baselines/showcase/help-select.txt
  • tests/unit/devtools/test_verify_manifests.py
  • tests/unit/proof/test_catalog.py

Comment on lines +181 to +183
for field in ("declared_at", "review_after"):
if not _valid_iso_date(gap.get(field)):
errors.append(f"{label} missing or invalid {field}")

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

Reject review_after dates earlier than declared_at.

The new lifecycle fields are only validated independently, so an impossible record like declared_at=2026-05-02 and review_after=2026-04-01 still passes. That undercuts the lifecycle invariant this PR is introducing.

Proposed fix
-            for field in ("declared_at", "review_after"):
-                if not _valid_iso_date(gap.get(field)):
-                    errors.append(f"{label} missing or invalid {field}")
+            declared_at = gap.get("declared_at")
+            review_after = gap.get("review_after")
+            if not _valid_iso_date(declared_at):
+                errors.append(f"{label} missing or invalid declared_at")
+            if not _valid_iso_date(review_after):
+                errors.append(f"{label} missing or invalid review_after")
+            if _valid_iso_date(declared_at) and _valid_iso_date(review_after):
+                if date.fromisoformat(str(review_after)) < date.fromisoformat(str(declared_at)):
+                    errors.append(f"{label} review_after must be on or after declared_at")
📝 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.

Suggested change
for field in ("declared_at", "review_after"):
if not _valid_iso_date(gap.get(field)):
errors.append(f"{label} missing or invalid {field}")
declared_at = gap.get("declared_at")
review_after = gap.get("review_after")
if not _valid_iso_date(declared_at):
errors.append(f"{label} missing or invalid declared_at")
if not _valid_iso_date(review_after):
errors.append(f"{label} missing or invalid review_after")
if _valid_iso_date(declared_at) and _valid_iso_date(review_after):
if date.fromisoformat(str(review_after)) < date.fromisoformat(str(declared_at)):
errors.append(f"{label} review_after must be on or after declared_at")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@devtools/verify_manifests.py` around lines 181 - 183, The current loop
validates "declared_at" and "review_after" independently, but you must also
reject records where review_after is earlier than declared_at; after confirming
both fields pass _valid_iso_date(gap.get(...)) for the given gap, parse the two
ISO dates (e.g., using the same ISO parsing logic used elsewhere) and if
review_after < declared_at append an error like f"{label} review_after earlier
than declared_at" to errors; place this check near the existing validation loop
so it uses gap, label, errors and the _valid_iso_date guard to avoid parsing
invalid strings.

@Sinity
Sinity merged commit 62a1637 into master May 2, 2026
16 checks passed
@Sinity
Sinity deleted the feature/fix/coverage-gap-lifecycle branch May 2, 2026 13:10
Sinity added a commit that referenced this pull request May 7, 2026
## Summary

Tightens coverage manifest verification so known gaps are lifecycle records with stable IDs, severity, review dates, issue/suppression linkage, and resolvable next evidence commands.

## Problem

Coverage manifests could previously record passive prose gaps with only an owner and free-text next step. That made proof-pack gap reporting visible but too shallow to support durable closure under #590.

## Solution

`verify-manifests` now validates coverage-gap lifecycle fields and checks next evidence against known devtools commands or supported command families. Existing distribution, docs/media, scenario, security/privacy, and test-quality gaps were updated to the new contract. Proof gap subjects now carry the lifecycle metadata and use stable gap IDs in subject IDs. Automated review findings around pytest command parsing and proof subject slug collisions were addressed with regressions. The PR also refreshes stale showcase CLI help baselines exposed by CI.

## Verification

- `devtools verify-manifests`
- `pytest tests/unit/devtools/test_verify_manifests.py tests/unit/proof/test_catalog.py tests/unit/proof/test_diffing.py -q`
- `pytest tests/unit/proof tests/unit/devtools/test_proof_pack.py tests/unit/devtools/test_render_verification_catalog.py -q`
- `devtools render-verification-catalog --check`
- explicit-path `devtools proof-pack --check` / `--markdown` runs for coverage manifests
- `devtools lab-scenario verify-baselines --update`
- `devtools lab-scenario verify-baselines`
- `devtools verify --quick`
- `devtools verify`
- pre-push `devtools verify --quick`

GitHub proof-pack, lint, typecheck, nix-build, nix-check, analysis, and showcase checks passed. Remaining GitHub pytest jobs were pending under the known CI-capacity issue; local full `devtools verify` passed.

Ref #590
Sinity pushed a commit that referenced this pull request Sep 14, 2026
Bumps [pytest-randomly](https://github.com/pytest-dev/pytest-randomly)
from 4.1.0 to 5.0.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pytest-dev/pytest-randomly/blob/main/CHANGELOG.rst">pytest-randomly's
changelog</a>.</em></p>
<blockquote>
<h2>5.0.0 (2026-09-01)</h2>
<ul>
<li>
<p>Support Python 3.15.</p>
</li>
<li>
<p>Shuffle tests in a wrapper around the
<code>pytest_collection_modifyitems</code> hook, guaranteeing that the
shuffle runs before all other plugins’ implementations of the hook.</p>
<p>Previously, pytest-randomly shuffled in a plain <code>tryfirst</code>
hook implementation.
When another plugin also implemented the hook with
<code>tryfirst</code>, as pytest-django does, whichever plugin pytest
happened to register later ran first.
Registration order comes from package metadata on disk, which can differ
between seemingly identical environments — even two containers built
from the same <code>Dockerfile</code>, or the same virtual environment
after reinstalling a package.
As a result, the same seed could yield different test orders in
different environments.
Worse, in environments where pytest-randomly ended up shuffling last, it
silently destroyed the other plugin’s ordering — for pytest-django, the
grouping of database tests that mirrors Django’s test runner
(non-transactional database tests, then transactional ones, then the
rest).</p>
<p>Now the shuffle always runs first, and plugins that group tests with
a stable sort apply their grouping on top of the shuffled order, so the
final order is reproducible from the seed alone.
In environments that previously hit the reversed hook order, upgrading
changes the test order for a given seed — restoring both reproducibility
and other plugins’ grouping.</p>
<p><code>PR
[#746](pytest-dev/pytest-randomly#746)
&lt;https://github.com/pytest-dev/pytest-randomly/pull/746&gt;</code><strong>.
Thanks to milssky for the report in <code>Issue
[#701](pytest-dev/pytest-randomly#701)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/701&gt;</code></strong>.</p>
</li>
<li>
<p>Require pytest 8+, the first version to require a version of pluggy
that supports hook wrappers, as used by the above fix.</p>
<p><code>PR
[#746](pytest-dev/pytest-randomly#746)
&lt;https://github.com/pytest-dev/pytest-randomly/pull/746&gt;</code>__.</p>
</li>
<li>
<p>Reset <code>Polyfactory
&lt;https://polyfactory.litestar.dev/&gt;</code>__\’s default random
state at the start of every test, if it is installed.</p>
<p>Thanks to Rahul Kumar in <code>PR
[#735](pytest-dev/pytest-randomly#735)
&lt;https://github.com/pytest-dev/pytest-randomly/issues/735&gt;</code>__.</p>
</li>
<li>
<p>Switch package build backend from setuptools to <code>uv_build
&lt;https://docs.astral.sh/uv/concepts/build-backend/&gt;</code>__.
This makes builds with uv about nine times faster, since uv runs the
backend natively, without creating a build environment or spawning a
Python process.
Additionally, source distributions no longer include test files, which
setuptools previously included incompletely, missing the files needed to
actually run them.</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/89ddfb1025cf15a81eb3defec7554740f32bcbe3"><code>89ddfb1</code></a>
Version 5.0.0</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/0d00951e3fd85145567adfa2b638c7987f3e33ef"><code>0d00951</code></a>
Shuffle before other plugins' collection hooks (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/746">#746</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/817091daca7b0540edb45da652ffc84a766724a1"><code>817091d</code></a>
Upgrade dependencies (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/745">#745</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/42a2066ee95bdb1c606945436d7170ef3a6376c5"><code>42a2066</code></a>
Fix podcast link in README (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/740">#740</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/c2a001d37d14abc95940c923f730a07ccf87b4e2"><code>c2a001d</code></a>
Reset Polyfactory's default random state on each test (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/735">#735</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/cc4762bcb547a455b670b812ea362c483a31e7ef"><code>cc4762b</code></a>
Upgrade dependencies (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/744">#744</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/94aba4ad675e863b65f024ab924688e595fa8a3f"><code>94aba4a</code></a>
Upgrade dependencies (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/743">#743</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/c9140eff32cadcdc14d82a944e63d3ad1b4dbe8c"><code>c9140ef</code></a>
Support Python 3.15 (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/741">#741</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/15f531e2a7c1c88f27febc9c92966472d5bb18fc"><code>15f531e</code></a>
Switch build backend to uv_build (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/739">#739</a>)</li>
<li><a
href="https://github.com/pytest-dev/pytest-randomly/commit/79eee6c2f5475911d178b1a42b649182cbfc5e9f"><code>79eee6c</code></a>
[pre-commit.ci] pre-commit autoupdate (<a
href="https://redirect.github.com/pytest-dev/pytest-randomly/issues/738">#738</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/pytest-dev/pytest-randomly/compare/4.1.0...5.0.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pytest-randomly&package-manager=uv&previous-version=4.1.0&new-version=5.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@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.

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

@Sinity

Sinity commented Oct 1, 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.

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.

2 participants