Repository navigation
refactor(git): build every plumbing diff through PlumbingDiff - #4147
Conversation
Plumbing diffs still honor `submodule.<name>.ignore`, so each one needs `--ignore-submodules=none`. `PlumbingDiff::args` adds it, every call site uses it, and a test rejects a plumbing diff spelled by hand under `src/`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The offender push ran only when the scan failed, so coverage counted it as missed. Recording every file-command pair and filtering afterwards runs each line on a passing run. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
worktrunk-bot
left a comment
There was a problem hiding this comment.
The reshape in 74e05a6 makes every line of the guard run on a clean tree, and the cost lands on the message a contributor reads when it trips — details inline. That pressure is worth removing rather than paying, because it is an artifact of where the guard lives rather than of what it checks.
tests/CLAUDE.md § "Guards that scan source text" covers this shape directly: "Several guards read src/ … as text rather than compiling it … Each one asserts absence over what its walk handed it. … So that walk lives once, in tests/common/source_scan.rs." This is another guard of that shape with its own walk, and sitting in a #[cfg(test)] module inside the library it cannot reach that helper at all. Moved beside the other source-text guards in the integration crate, the coverage question stops existing — cargo llvm-cov instruments src/ only, and the cobertura report on this branch is 195 classes, every one of them under src/ — so the original if text.contains(command) { offenders.push(format!(…)) } stands as written. It also picks up the section's other half, "Each guard also proves its walk reached something", which visit_files enforces with a #[must_use] count; neither shape of this walk answers for it, and an empty walk passes both.
CLAUDE.md § Coverage draws the same line: "codecov/patch gates the merge, not the design. Write the change the design calls for, then deal with the check. … neither the code nor the tests get contorted to move the number."
Separately, #4100 adds let args = ["diff-tree", "-r", "-z", "--name-only", &merge_base, branch]; to src/git/repository/integration.rs. It will trip this guard on rebase, which is the guard earning its keep — that site does want the override, since a submodule.<name>.ignore that hides a gitlink leaves the branch's path list short, and that list is what the squash-merge scan compares.
Happy to push the move as a commit here if you want it.
The guard now walks `src/` and `tests/` through `visit_files`, counts each root, and takes its needles from `PlumbingDiff`, so it spells none of them. Living in the integration crate, its failure-only branch no longer counts against library coverage, and the failure message names each file plainly again. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Follow-up to #4146. Plumbing diffs ignore the user's diff display configuration but still honor
submodule.<name>.ignore, from repository config or.gitmodules. #4146 passed--ignore-submodules=noneat each of about ten call sites, and review twice found sites that missed it.PlumbingDiffinsrc/git/diff.rsnow builds everydiff-tree,diff-index, anddiff-filesinvocation, andPlumbingDiff::argsalways adds the flag.test_plumbing_diffs_are_built_by_plumbing_diff, beside the other source-text guards, fails when a file undersrc/ortests/spells one of those commands as a string literal, so a new call site can't skip the override. The call sites and CLAUDE.md's plumbing paragraph move to it; behavior is unchanged apart from argument order.🤖 Generated with Claude Code