Repository navigation
fix(verification): reject coverage status contradictions - #703
Conversation
Problem: coverage manifests could declare an item implemented while omitting realized controls or test coverage, or declare an item unimplemented while still claiming realized evidence. That let passive coverage rows look stronger than the evidence they carried. Solution: add a coverage status-claim verifier that recursively inspects coverage manifests and rejects contradictory implemented/control/test-coverage claims. Add focused unit tests for accepted realized rows and both contradiction shapes. Verification: - ruff format devtools/verify_manifests.py tests/unit/devtools/test_verify_manifests.py - ruff check devtools/verify_manifests.py tests/unit/devtools/test_verify_manifests.py - devtools verify-manifests - pytest tests/unit/devtools/test_verify_manifests.py -q - devtools affected-obligations --path devtools/verify_manifests.py --path tests/unit/devtools/test_verify_manifests.py - devtools proof-pack --path devtools/verify_manifests.py --path tests/unit/devtools/test_verify_manifests.py --check - devtools verify --quick - devtools verify Ref #590
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 29 minutes and 41 seconds.Comment |
Polylogue Proof PackRefs: Affected Domains
Focused Gates
Required PR Gates
Optional Confidence Gates
Known Gaps
Oracle / Cost
|
There was a problem hiding this comment.
Pull request overview
This PR strengthens devtools verify-manifests by enforcing that coverage manifest implemented status rows are internally consistent with declared evidence, moving coverage manifests closer to executable/validated contracts (per #590).
Changes:
- Add a new verifier pass that scans
*coverage*.yamlforimplementedstatus contradictions vscontrolsandtest_coverage.location. - Register the new verifier in the
verify-manifestscheck pipeline. - Add unit tests covering a realized
implemented: truecase and both contradiction classes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
devtools/verify_manifests.py |
Adds check_coverage_status_claims() and wires it into the verifier run. |
tests/unit/devtools/test_verify_manifests.py |
Adds unit tests for accepted realized shape and the two contradiction scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| label = f"{path}: {'.'.join(ref_path)}" | ||
| implemented = payload.get("implemented") | ||
| if implemented is True: | ||
| if not _non_empty_list(payload.get("controls")): | ||
| errors.append(f"{label} implemented=true but controls are missing or empty") | ||
| if not _has_test_coverage_location(payload.get("test_coverage")): | ||
| errors.append(f"{label} implemented=true but test_coverage.location is missing") | ||
| elif implemented is False: |
| elif implemented is False: | ||
| if _non_empty_list(payload.get("controls")): | ||
| errors.append(f"{label} implemented=false but controls are declared") | ||
| if _has_test_coverage_location(payload.get("test_coverage")): | ||
| errors.append(f"{label} implemented=false but test_coverage.location is declared") |
| def test_coverage_status_claims_accept_realized_implemented_item(tmp_path: Path) -> None: | ||
| plans = tmp_path | ||
| (plans / "example-coverage.yaml").write_text( | ||
| """areas: | ||
| path_traversal: | ||
| implemented: true | ||
| controls: | ||
| - sanitize_path: blocks traversal | ||
| test_coverage: | ||
| location: tests/unit/security/test_path_sanitization.py | ||
| """, | ||
| encoding="utf-8", | ||
| ) | ||
|
|
||
| assert verify_manifests.check_coverage_status_claims(plans) == [] | ||
|
|
||
|
|
||
| def test_coverage_status_claims_reject_implemented_item_without_evidence(tmp_path: Path) -> None: | ||
| plans = tmp_path | ||
| (plans / "example-coverage.yaml").write_text( | ||
| """areas: | ||
| path_traversal: | ||
| implemented: true | ||
| controls: [] | ||
| test_coverage: | ||
| location: null | ||
| """, | ||
| encoding="utf-8", | ||
| ) | ||
|
|
||
| errors = verify_manifests.check_coverage_status_claims(plans) | ||
|
|
||
| assert errors == [ | ||
| f"{plans / 'example-coverage.yaml'}: areas.path_traversal implemented=true but controls are missing or empty", | ||
| f"{plans / 'example-coverage.yaml'}: areas.path_traversal implemented=true but test_coverage.location is missing", | ||
| ] | ||
|
|
||
|
|
||
| def test_coverage_status_claims_reject_missing_item_with_realized_evidence(tmp_path: Path) -> None: | ||
| plans = tmp_path | ||
| (plans / "example-coverage.yaml").write_text( | ||
| """areas: | ||
| dependency_audit: | ||
| implemented: false | ||
| controls: | ||
| - pip_audit: configured | ||
| test_coverage: | ||
| location: tests/unit/security/test_dependency_audit.py | ||
| """, | ||
| encoding="utf-8", | ||
| ) | ||
|
|
||
| errors = verify_manifests.check_coverage_status_claims(plans) | ||
|
|
||
| assert errors == [ | ||
| f"{plans / 'example-coverage.yaml'}: areas.dependency_audit implemented=false but controls are declared", | ||
| f"{plans / 'example-coverage.yaml'}: areas.dependency_audit implemented=false " | ||
| "but test_coverage.location is declared", | ||
| ] |
Summary: Add a coverage-manifest verifier that rejects internally contradictory implemented status rows. Problem: #590 is moving coverage manifests from passive dashboards toward executable contracts. After the gap-lifecycle and reference-resolution slices, manifest rows could still claim implemented=true without realized controls or test coverage, or implemented=false while declaring realized controls or test locations. That contradiction made the manifest state look stronger or weaker than the evidence actually recorded. Solution: `devtools verify-manifests` now recursively inspects `docs/plans/*coverage*.yaml` mappings for implemented status claims. Implemented rows require a non-empty controls list and `test_coverage.location`; unimplemented rows reject controls and `test_coverage.location`. Focused unit coverage exercises the accepted realized shape and both contradiction classes. Verification: - `ruff format devtools/verify_manifests.py tests/unit/devtools/test_verify_manifests.py` - `ruff check devtools/verify_manifests.py tests/unit/devtools/test_verify_manifests.py` - `devtools verify-manifests` - `pytest tests/unit/devtools/test_verify_manifests.py -q` -> `10 passed in 8.89s` - `devtools affected-obligations --path devtools/verify_manifests.py --path tests/unit/devtools/test_verify_manifests.py` - `devtools proof-pack --path devtools/verify_manifests.py --path tests/unit/devtools/test_verify_manifests.py --check` - `devtools verify --quick` -> `verify: all checks passed` - `devtools verify` -> `verify: all checks passed` Ref #590
Summary
Add a coverage-manifest verifier that rejects internally contradictory
implementedstatus rows.Problem
#590 is moving coverage manifests from passive dashboards toward executable contracts. After the gap-lifecycle and reference-resolution slices, manifest rows could still claim
implemented: truewithout realized controls or test coverage, or claimimplemented: falsewhile declaring realized controls/test locations. That contradiction made the manifest state look stronger or weaker than the evidence actually recorded.Solution
devtools verify-manifestsnow recursively inspectsdocs/plans/*coverage*.yamlmappings forimplementedstatus claims:implemented: truerequires a non-emptycontrolslist andtest_coverage.location.implemented: falserejects declared controls and declaredtest_coverage.location.The new unit coverage exercises the accepted realized shape and both contradiction classes.
Verification
ruff format devtools/verify_manifests.py tests/unit/devtools/test_verify_manifests.pyruff check devtools/verify_manifests.py tests/unit/devtools/test_verify_manifests.pydevtools verify-manifestspytest tests/unit/devtools/test_verify_manifests.py -q→10 passed in 8.89sdevtools affected-obligations --path devtools/verify_manifests.py --path tests/unit/devtools/test_verify_manifests.pydevtools proof-pack --path devtools/verify_manifests.py --path tests/unit/devtools/test_verify_manifests.py --checkdevtools verify --quick→verify: all checks passeddevtools verify→verify: all checks passedRef #590