Skip to content

fix(verification): reject coverage status contradictions - #703

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/coverage-status-claim-validation
May 2, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/coverage-status-claim-validation

Conversation

@Sinity

@Sinity Sinity commented May 2, 2026

Copy link
Copy Markdown
Owner

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 claim implemented: false while declaring realized controls/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: true requires a non-empty controls list and test_coverage.location.
  • implemented: false rejects declared controls and declared test_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.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

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
Copilot AI review requested due to automatic review settings May 2, 2026 13:34
@coderabbitai

coderabbitai Bot commented May 2, 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 29 minutes and 41 seconds before requesting another review.

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 @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: 380ff8b6-26fe-4bea-9725-d79044ef5078

📥 Commits

Reviewing files that changed from the base of the PR and between 6761f57 and c1b06d5.

📒 Files selected for processing (2)
  • devtools/verify_manifests.py
  • tests/unit/devtools/test_verify_manifests.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix/coverage-status-claim-validation

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
Review rate limit: 0/1 reviews remaining, refill in 29 minutes and 41 seconds.

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: 2

Affected Domains

  • architecture_discipline — 1 claim(s), maturity growing

Focused Gates

  • devtools verify-manifests — structural manifest changed
  • devtools affected-obligations --path devtools/verify_manifests.py — refresh structural obligation routing

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

  • none for domains with affected claims

Oracle / Cost

  • oracle mix: {"drift_check": 1}
  • cost tier: {"static": 1}
  • stable affected obligations: 1
  • agent judgment cells: 0

@Sinity
Sinity merged commit 9c936f8 into master May 2, 2026
15 checks passed
@Sinity
Sinity deleted the feature/fix/coverage-status-claim-validation branch May 2, 2026 13:36

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 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*.yaml for implemented status contradictions vs controls and test_coverage.location.
  • Register the new verifier in the verify-manifests check pipeline.
  • Add unit tests covering a realized implemented: true case 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.

Comment on lines +242 to +249
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:
Comment on lines +249 to +253
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")
Comment on lines +168 to +226
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",
]
Sinity added a commit that referenced this pull request May 7, 2026
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
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