Skip to content

test: add single-source coverage gate - #382

Merged
Sinity merged 2 commits into
masterfrom
feature/test/coverage-ratchet-gate
Apr 23, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/test/coverage-ratchet-gate

Conversation

@Sinity

@Sinity Sinity commented Apr 23, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a shared devtools coverage-gate command, points CI at it, and ratchets the committed coverage floor from 83% to 84% using the current measured suite.

Problem

#197 tracks restoring the coverage floor toward the original 90%, but enforcement had drifted: pyproject.toml declared fail_under = 83 while CI still invoked pytest with --cov-fail-under=80. A fresh coverage run also showed that instrumentation made several generated-payload Hypothesis properties trip HealthCheck.too_slow, so the gate could fail for test-generation cost rather than product behavior.

Solution

  • Added devtools coverage-gate, which reads tool.coverage.report.fail_under from pyproject.toml and passes that value to pytest.
  • Updated CI to call uv run devtools coverage-gate instead of hard-coding a separate threshold.
  • Raised the committed coverage floor to 84%, below the measured 85.60% CI-shaped result.
  • Registered the new devtools command and regenerated docs/devtools.md.
  • Stabilized generated provider/source property tests under coverage instrumentation.
  • Updated the real-repository MCP search integration assertion to the current nested conversation/match search-hit payload.

Verification

  • pytest -q tests/unit/devtools/test_coverage_gate.py tests/unit/devtools/test_command_catalog.py tests/unit/devtools/test_devtools_main.py tests/unit/sources/test_parsers_props.py -> 51 passed.
  • pytest -q tests/unit/sources/test_source_laws.py::test_detect_provider_recognizes_generated_payloads tests/integration/test_mcp.py::TestMCPRealRepositoryPaths::test_search_uses_real_repository_and_filter_stack -> 2 passed.
  • devtools coverage-gate --ignore-integration -> 5175 passed, required coverage 84% reached, total coverage 84.83%.
  • devtools coverage-gate -> 5355 passed, required coverage 84% reached, total coverage 85.60%.
  • devtools verify --quick -> all checks passed.
  • git push -u origin feature/test/coverage-ratchet-gate -> pre-push devtools verify --quick passed.

Ref #197

Sinity added 2 commits April 23, 2026 08:22
Problem: running the coverage gate under instrumentation made provider-payload Hypothesis strategies trip slow-generation health checks, and the broader CI-shaped gate exposed an MCP search integration assertion that still expected the old flat search-hit payload.\n\nWhat changed: explicitly suppress the slow-generation health check for the generated provider/source properties that are expected to be expensive under coverage, and update the real-repository MCP search assertion to the current nested conversation/match payload.\n\nVerification: devtools coverage-gate reached the 84% threshold after this stabilization, with the final branch reporting 5355 passed and total coverage 85.60%.\n\nRef #197
Problem: the committed coverage floor and CI enforcement had drifted, with pyproject.toml declaring 83% while CI still passed --cov-fail-under=80 directly to pytest.\n\nWhat changed: add devtools coverage-gate as the shared coverage entrypoint, read the threshold from tool.coverage.report.fail_under, point CI at that entrypoint, document the command in the generated devtools catalog, and ratchet the floor to the measured safe 84%.\n\nVerification: devtools coverage-gate passed with 5355 tests and total coverage 85.60%; devtools verify --quick also passed.\n\nRef #197
@coderabbitai

coderabbitai Bot commented Apr 23, 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 19 minutes and 8 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 19 minutes and 8 seconds.

⌛ 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: 56facd05-0e2d-41b6-90b2-c9ddf0f511d2

📥 Commits

Reviewing files that changed from the base of the PR and between f95bf9f and 1a1aa93.

📒 Files selected for processing (9)
  • .github/workflows/ci.yml
  • devtools/command_catalog.py
  • devtools/coverage_gate.py
  • docs/devtools.md
  • pyproject.toml
  • tests/integration/test_mcp.py
  • tests/unit/devtools/test_coverage_gate.py
  • tests/unit/sources/test_parsers_props.py
  • tests/unit/sources/test_source_laws.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/test/coverage-ratchet-gate

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.

@Sinity
Sinity merged commit 427c487 into master Apr 23, 2026
13 checks passed
@Sinity
Sinity deleted the feature/test/coverage-ratchet-gate branch April 23, 2026 06:27
@Sinity

Sinity commented May 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@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: 427c487a46

ℹ️ 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/coverage_gate.py Resolved
@Sinity
Sinity requested a review from Copilot May 1, 2026 01:54
@Sinity
Sinity removed the request for review from Copilot May 1, 2026 02:15
Sinity added a commit that referenced this pull request May 7, 2026
Summary: Adds a shared `devtools coverage-gate` command, points CI at it, and ratchets the committed coverage floor from 83% to 84% using the current measured suite.

Problem: #197 tracks restoring the coverage floor toward the original 90%, but enforcement had drifted: `pyproject.toml` declared `fail_under = 83` while CI still invoked pytest with `--cov-fail-under=80`. A fresh coverage run also showed that instrumentation made several generated-payload Hypothesis properties trip `HealthCheck.too_slow`, so the gate could fail for test-generation cost rather than product behavior.

Solution: Added `devtools coverage-gate`, which reads `tool.coverage.report.fail_under` from `pyproject.toml` and passes that value to pytest. Updated CI to call the shared gate, raised the floor to 84%, registered the command in the generated devtools catalog, stabilized generated provider/source properties under coverage, and updated the MCP search integration assertion to the current nested search-hit payload.

Verification: `devtools coverage-gate --ignore-integration` passed with 5175 tests and total coverage 84.83%. `devtools coverage-gate` passed with 5355 tests and total coverage 85.60%. `devtools verify --quick` passed locally and in the pre-push hook.

Ref #197
@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.

  • 53.F074 / P2: stale at the checked revision: devtools/coverage_gate.py was deleted in 985e0f9 (refactor(devtools): fold the command surface into twelve verbs); the cited code no longer exists at 5ebcfe5.

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