Skip to content

Raise test coverage past the per-module gate (core ≥95%, others ≥90%)#7

Merged
grammy-jiang merged 2 commits into
masterfrom
claude/pre-commit-hooks-setup-2sc78y
Jul 19, 2026
Merged

Raise test coverage past the per-module gate (core ≥95%, others ≥90%)#7
grammy-jiang merged 2 commits into
masterfrom
claude/pre-commit-hooks-setup-2sc78y

Conversation

@grammy-jiang

Copy link
Copy Markdown
Owner

What

Raises coverage so every mcp_servers module clears a per-module floor — not just the average — and enforces it in CI.

The gate

scripts/check_coverage.py reads the coverage JSON and fails if any module is below its floor:

  • Core (≥95%) — the durable state/integrity/security logic: the three store.py engines, common.py, staleness.py, the egress.py SSRF guard, and all models.py.
  • Other (≥90%) — the FastMCP tool wrappers (server.py) and OSINT IO helpers (exif.py, artifacts.py, audit.py).

Enforced per file so a well-covered module can't mask a thin one. Wired into the CI test job (JSON coverage report + gate step); the pyproject total backstop is also raised 80 → 90.

The tests

Six new tests/test_*_cov.py files, +82 tests (152 → 234), targeting the previously-thin branches — tool-wrapper success/error paths and main() fail-closed, store rollback/WAL/guard branches, the egress SSRF redirect + pinned-TLS path, EXIF GPS extraction, and manifest-migration edges:

Module Before → after
calibration_tracker server / store 55→100% / 88→100%
evidence_ledger server 63→99%
ach_engine server / store 73→100% / 94→100%
osint_toolkit server / egress / exif 62→98% / 87→100% / 63→100%
common / staleness 89→100% / 92→100%

Every module now sits at 96–100%.

Verified locally

  • Full suite: 234 passed on fastmcp 3.4.4.
  • scripts/check_coverage.py: gate OK — all 17 modules meet their floor.
  • All 14 pre-commit hooks green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fd4FtxJFV2fVSSoD7urqqn


Generated by Claude Code

claude added 2 commits July 19, 2026 21:17
scripts/check_coverage.py reads the coverage JSON report and fails if any
mcp_servers module is below its floor — core modules (the store engines,
common, staleness, egress SSRF guard, models) must clear 95%, all other
modules 90%. This enforces coverage per file so a well-covered module cannot
mask a thin one, which a single total `fail_under` would allow.

CI: the test job now emits a JSON coverage report and runs the gate; the
pyproject total backstop is raised 80 -> 90. (Tests to satisfy the gate land
in a follow-up commit.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fd4FtxJFV2fVSSoD7urqqn
Six new tests/test_*_cov.py files lift coverage above the per-module floors
(core >= 95%, others >= 90%), adding 82 tests (152 -> 234). Each exercises the
previously-thin branches — the FastMCP tool wrappers' success/error paths and
main() fail-closed, store rollback/WAL/guard branches, the egress SSRF redirect
and pinned-TLS paths, EXIF GPS extraction, and the manifest migration edges:

- calibration_tracker server 55->100%, store 88->100%
- evidence_ledger server 63->99%
- ach_engine server 73->100%, store 94->100%
- osint_toolkit server 62->98%, egress 87->100%, exif 63->100%
- common 89->100%, staleness 92->100%

README: document the per-module coverage gate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fd4FtxJFV2fVSSoD7urqqn
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.14%. Comparing base (aa58b49) to head (e2b9b54).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           master       #7       +/-   ##
===========================================
+ Coverage   85.25%   99.14%   +13.89%     
===========================================
  Files          17       17               
  Lines        1756     1756               
===========================================
+ Hits         1497     1741      +244     
+ Misses        259       15      -244     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@grammy-jiang
grammy-jiang merged commit 51b1502 into master Jul 19, 2026
6 checks passed
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.

3 participants