Skip to content

test(coverage): rename-only hunks owe no changed-line coverage - #2248

Merged
thymikee merged 4 commits into
mainfrom
claude/coverage-rename-only-hunks
Sep 4, 2026
Merged

test(coverage): rename-only hunks owe no changed-line coverage#2248
thymikee merged 4 commits into
mainfrom
claude/coverage-rename-only-hunks

Conversation

@thymikee

@thymikee thymikee commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

The changed-line coverage gate joins lcov with git diff --unified=0 base...HEAD. Rename detection depended on the host's diff.renames: with it off, a pure move became delete + add and owed coverage on every moved line.

  • run.ts passes --find-renames=90%: a 100%-similarity move owes nothing; an edited move owes only the hunks that differ from its source; below 90% it is an add. Threshold unchanged (70).
  • model.test.ts: fixture diff with a 100% rename, a 90% rename with 3 edited lines, and an ordinary modified file, asserted through parseUnifiedDiff + computeChangedCoverage.
  • run.test.ts: git mv under diff.renames=false reports 0/0 (n/a) PASS.
  • AGENTS.md: "Pure moves carry their tests unchanged; rename-only hunks owe no new coverage." The session.ts over-budget rule is restored per review; three redundant sentences are compressed to hold the byte budget (9,994/10,000).

Validation

  • pnpm check:coverage-changed:test 22/22; pnpm check:agent-guidance 4/4; pnpm check:quick green.
  • Planted red A (pre-change run.ts): a pure move owes nothing regardless of the host diff.renames setting FAILS.
  • Planted red B (hunkless section owes its whole file): rename-only hunks owe no changed-line coverage FAILS, actual: 35, expected: 5.
  • Model test is green pre-change: the defect was the git invocation.
  • AGENTS.md-only restoration delta: pnpm check:agent-guidance 4/4 and pnpm check:affected --run pass at cc6c521.
  • Full affected gate: green at 4526f80 (pnpm check:affected --run); 32 gates ran: format, lint, typecheck, layering, di-seams, fallow, mcp-metadata, build, package, integration-node, macos-coverage, vitest-related, integration-progress, replay-compat, daemon-wire-compat, affected-selector, gate-manifest(+model), depgraph, tmpdir-leaks(+model), coverage-model, wire-compat-model, production-exports, bundle-owner-files, fixture-cache(+fallback), command-docs, agent-guidance, xctest-selection, maestro-conformance, mutation-model.

Tradeoffs / follow-ups

  • No enforcement artifacts changed, so no chore(gates) commit.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 2.58 MB 2.58 MB 0 B
JS gzip 869.6 kB 869.6 kB 0 B
npm bundled raw 2.58 MB 2.58 MB 0 B
npm bundled gzip 869.6 kB 869.6 kB 0 B
npm tarball 1.02 MB 1.02 MB +10 B
npm unpacked 3.46 MB 3.46 MB 0 B
npm clean-installed 3.46 MB 3.46 MB 0 B

npm unpacked components

Component Base Current Diff
JS / dist source 2.74 MB 2.74 MB 0 B
Apple runner source/project 544.4 kB 544.4 kB 0 B
Apple snapshot presentation source 33.8 kB 33.8 kB 0 B
macOS helper source 54.8 kB 54.8 kB 0 B
Android helper artifacts 43.3 kB 43.3 kB 0 B
Other package files 46.3 kB 46.3 kB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 31.7 ms 31.1 ms -0.6 ms
CLI --help 79.9 ms 80.0 ms +0.2 ms

Top changed chunks: no changes in the largest emitted chunks.

Top changed packed files

No changed packed files.

@thymikee

thymikee commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

BLOCKED at 34bc30af0fa4a76c286cebf7e74ec63c773e8af3.

Owner-action CI failure: Lint & Format is red because oxfmt --check reports scripts/coverage-changed/run.ts as unformatted. Lint itself is clean; this is not infrastructure.

No code finding beyond the required formatting fix: the owning route correctly forces git diff --find-renames=90%, the real temp-repo planted-red proves host diff.renames=false formerly misclassified a pure move, and the model test covers edited rename hunks. All other exact-head checks are green and package size is unchanged.

Do not apply ready-for-human while required CI is red.

Pass --find-renames=90% to the changed-line diff so rename detection no
longer depends on the host diff.renames setting: a 100%-similarity move
contributes no changed lines and an edited move contributes only the
hunks that differ from its source. Threshold unchanged.
Drops the stale src/daemon/handlers/session.ts over-budget bullet (242
lines on main) to stay under the AGENTS.md byte budget.
@thymikee
thymikee force-pushed the claude/coverage-rename-only-hunks branch from 34bc30a to 4526f80 Compare September 3, 2026 06:13
@thymikee

thymikee commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

Lint & Format: ran pnpm format repository-wide; scripts/coverage-changed/run.ts reformatted (git diff arg array collapsed to one line), pnpm format:check clean, committed as style: format coverage-changed run.ts. Rebased on main; no conflicts. Focused coverage-changed tests (22/22) and pnpm check:quick pass locally. Head: 4526f80. The full affected gate result follows from the gate stage.

@thymikee

thymikee commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

BLOCKED at 4526f80967059fc332284f6089d2a84579f149b9.

The prior formatting failure is resolved and the rename-coverage implementation/tests are correct.

Required iOS Smoke is now red due to unrelated fixture accessibility-capture truncation (is absent cannot establish close-sheet absence); #2248 changes no iOS/runtime/fixture code, so it appears infrastructure/device evidence, but this exact head needs a passing rerun or baseline control before readiness. No label.

@thymikee

thymikee commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

BLOCKED at 4526f80967059fc332284f6089d2a84579f149b9. The rename implementation/tests and exact-head CI are clean, but the AGENTS.md edit also deletes the unrelated hard rule that src/daemon/handlers/session.ts is over budget and must be extracted before adding behavior. Restore that rule; then no remaining blocker.

@thymikee

thymikee commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

Restored the over-budget rule for src/daemon/handlers/session.ts in AGENTS.md, worded as it stood on main: "already over budget; extract the relevant platform-specific concept before adding behavior." To stay under the 10,000-byte budget (now 9,994), three redundant phrasings elsewhere in the file were tightened without dropping any rule. pnpm check:agent-guidance 4/4 and pnpm check:affected --run pass at cc6c521.

@thymikee

thymikee commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

Code review is clean, but this head is BLOCKED by iOS Smoke. The rename-only coverage logic and regressions are sound, including explicit 90% rename detection and the repository-level diff.renames=false case. The lone failure is the shared assert closed fixture sheet is absent truncated-observation assertion, also seen on #2237 and unrelated to this tooling-only diff. Rerun iOS Smoke; merge only after exact-head green or after the shared lane is separately repaired.

@thymikee
thymikee merged commit 17b6ca3 into main Sep 4, 2026
18 of 19 checks passed
@thymikee
thymikee deleted the claude/coverage-rename-only-hunks branch September 4, 2026 09:58
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-04 09:58 UTC

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