Orchestrata Ultimate › Gates › coverage-claude

Gate: coverage-claude

At a glance

Purpose Refuse the claude/ tree's measured line coverage dropping below its ratcheted floor.
Where it runs The scripts/gates.py battery (registered as coverage-claude).
Trigger A battery run whose claude/, tests/claude/ or tests/scripts/test_task_context_hook.py fingerprint changed.
Exact command python scripts/coverage_ratchet.py --scope claude --paths claude --tests tests/claude tests/scripts/test_task_context_hook.py --min 19.5
Blocks Exit 1 when coverage drops below --min; exit 2 when the coverage run or its JSON report failed; 0 at or above the floor.
Ruling / ADR User ruling 2026-08-19 (quoted below; no RUL page). The 90% ambition is RUL-034 / ADR-0069.
Last recorded verdict ok: true in the primary checkout's .cache/gates.json (file last written 2026-09-22 10:01 local). wt-MAP-PRECOMMIT has no .cache/gates.json.

What it refuses

The claude/ scope's line coverage, measured by a real pytest+coverage run, dropping below the baseline recorded at the call site (--min 19.5 today). It does not demand any universal target — only that coverage never gets worse.

Why it exists

Two rulings meet here. From the gates.py registry comment:

"coverage-claude is the RATCHET half of the same 'claude/ is production, not scaffolding' ruling plugin-drift enforces: claude/ (the deployed hooks + tools — task_context_hook.py rewrites every dispatched agent's prompt, route_pytest_to_threads.py decides whether a test command runs at all) is in [tool.coverage.run] source but was NEVER gated on a floor (user ruling 2026-08-19)."

And from scripts/coverage_ratchet.py's docstring, the ratchet philosophy:

"Why a ratchet and not fail_under = 90 directly (user ruling 2026-08-19): the AGENTS.md 'Definition of done' 90% bar stays the AMBITION; this gate is the ENFORCEMENT MECHANISM that makes ANY floor real without demanding 90% on day one from code that has never been measured… A hard fail_under = 90 would have been red on arrival, and a gate that is red on arrival gets waived, then ignored, then defanged — this project watched exactly that happen to earlier, unenforced coverage prose. A ratchet starts GREEN and can only go up: the baseline is a CLI flag inlined at the call site… tightened by hand as real tests land, never loosened to make a red run green."

The baseline history is recorded in the registry comment: 12.5 at birth (measured 12.96%), tightened to 19.5 on 2026-08-19 after two new test modules "landed real coverage on claude/'s two highest-blast-radius previously-untested modules, moving the measured claude/ scope from 12.96% to 19.80%… 19.5 keeps ~0.3 points of float-jitter headroom." The standing instruction: "Tighten --min by hand as real tests land; never loosen it to paper over a drop."

How it runs

Typical failures and how to fix them

Wiring