Coverage Delta
Role: worker. Reports coverage change vs. the captured baseline. One snapshot per Story so the operator can see whether each add actually moved the needle. Callers with a phase model (such as /test-improve, where the baseline lands in Phase 2 and per-Story deltas fire in Phase 5) label snapshots by phase; phase-less workflows omit that label.
You have been invoked with the /coverage-delta command.
Parse Arguments
Arguments: $ARGUMENTS
- Positional:
<repo-path>. --parent <issue-url>— parent issue URL (or empty for local-files).--repo-slug <slug>—.claude/memory/<workflow>/namespace.--workflow <name>— the workflow namespace under.claude/memory/. Defaults totest-improve. Orchestrators pass their own namespace (e.g./test-improvepassestest-improvefor its Phase-5 per-Story deltas).--story <id-or-path>— optional Story this delta is attributed to. Used as the snapshot label.--story-files <glob-or-comma-list>— production-code files the Story touched (typically from/build's commit diff, tests filtered out). When both--storyAND a non-empty--story-filesare present, Step 2b runs scoped mutation; otherwise it is a no-op so/quality-targets-convergecan keep calling this worker without--story-filesexactly as before.
Steps
1. Load the baseline
Read .dev-team-reports/<workflow>/<slug>/data/baseline-coverage.json. If missing, tell the operator the baseline has not been captured (/coverage-baseline must run first; for /test-improve that is Phase 2) and stop.
2. Re-run coverage
Use the same coverage tool /coverage-baseline recorded — DO NOT switch tools mid-workflow, or the delta is meaningless. This governs the tool only, never the project/package list: for a multi-project repo (Step 2a below), the set of included projects/packages is re-derived from fresh discovery on every call, never reused from a prior run — a frozen, never-revisited list is exactly what caused issue #1759's ~30x underreported delta.
For a multi-project repo, load the persisted coverage-config.json first (Step 2a) and print coverage_config.measurement_basis_notice(config.get("bootstrapped_at"), baseline["captured_at"])'s result verbatim when non-None — a non-blocking notice that the comparison baseline predates multi-project discovery, so a reported delta may reflect a widened measurement scope rather than a real coverage change.
Capture exit code + stdout + stderr.
If the run fails, surface the first error and stop. Do not post a delta from a broken run.
2a. Multi-project re-derivation (.NET solutions, JS/TS workspaces & Java multi-module builds)
When a .sln file exists at the repo root (.NET), a workspace signal is present (JS/TS), or a multi-module signal is present (Java) — the same triggers coverage-baseline's Step 1a uses — re-run the appropriate discovery script fresh, every call, never reusing a project/package/module list recorded by a prior run:
- .NET:
${CLAUDE_PLUGIN_ROOT}/scripts/coverage_discovery_dotnet.py'sdiscover_dotnet_projects(repo_root) - JS/TS:
${CLAUDE_PLUGIN_ROOT}/scripts/coverage_discovery_js.py'sdiscover_js_packages(repo_root) - Java:
${CLAUDE_PLUGIN_ROOT}/scripts/coverage_discovery_java.py'sdiscover_java_modules(repo_root)— a rootpom.xmldeclaring<modules>(Maven, which wins when both are present) or asettings.gradle/settings.gradle.ktsdeclaringinclude(...)(Gradle)
Implementation mechanics (the bootstrap/drift-check contract, weighted-merge, and the exact message templates):