Summary
.githooks/validate-lint-format.sh gates its Rust arm on whether the repo tracks a Cargo.toml anywhere, then runs cargo from the repo root. cargo asks a different question: is there a Cargo.toml in the current directory or a parent. This repo has none at the root, so the arm fires and then fails for a reason that has nothing to do with the staged code.
This is the recurring estate trap: a guard that asks a different question than its consumer. The comment above the arm (lines 82–86) even names the failure it is trying to prevent — it just prevents it in the wrong repo shape.
Measured evidence
$ ls Cargo.toml
ls: cannot access 'Cargo.toml': No such file or directory
$ git ls-files | grep -c 'Cargo\.toml$'
12
$ cargo fmt --all --check ; echo rc=$?
error: could not find `Cargo.toml` in `<repo root>` or any parent directory
rc=1
$ cargo clippy --all-targets -- -D warnings ; echo rc=$?
rc=101
tracks 'Cargo.toml' '*/Cargo.toml' (.githooks/validate-lint-format.sh:66) returns true because 12 manifests are tracked, so the arm always fires. The consequence: any commit staging a .rs file is rejected, and the message reads Rust: sources are not formatted (cargo fmt --check), which misnames the cause.
There is a second arm with the same shape. The Nickel arm globs *.ncl and feeds every match to nickel, but the .k9.ncl population is mixed:
total .ncl files: 36
.k9.ncl files: 16
.k9.ncl starting with `K9!`: 8 # not Nickel source at all
nickel fails those 8 at line 1 column 0 with a parse error on K9!. Extension is not a valid discriminator here; the K9! content marker is.
Acceptance criteria
Found while measuring #931. Related: the pin-detector defect in #931 is the same trap in a different file.
Summary
.githooks/validate-lint-format.shgates its Rust arm on whether the repo tracks aCargo.tomlanywhere, then runscargofrom the repo root.cargoasks a different question: is there aCargo.tomlin the current directory or a parent. This repo has none at the root, so the arm fires and then fails for a reason that has nothing to do with the staged code.This is the recurring estate trap: a guard that asks a different question than its consumer. The comment above the arm (lines 82–86) even names the failure it is trying to prevent — it just prevents it in the wrong repo shape.
Measured evidence
tracks 'Cargo.toml' '*/Cargo.toml'(.githooks/validate-lint-format.sh:66) returns true because 12 manifests are tracked, so the arm always fires. The consequence: any commit staging a.rsfile is rejected, and the message readsRust: sources are not formatted (cargo fmt --check), which misnames the cause.There is a second arm with the same shape. The Nickel arm globs
*.ncland feeds every match tonickel, but the.k9.nclpopulation is mixed:nickelfails those 8 at line 1 column 0 with a parse error onK9!. Extension is not a valid discriminator here; theK9!content marker is.Acceptance criteria
cargoper crate directory (from each staged file's nearest ancestorCargo.toml), not once from the repo root..rsstaged in a crate that is clean, the hook passes; the root having noCargo.tomlis not itself a failure.could not find Cargo.tomlcondition is reported as a tooling/scope error naming the directory, never assources are not formatted.K9!, and says how many it skipped — a denominator, not silence.bash -nclean; the arms stay read-only (--checkonly, nocargo fmtwithout--check).Found while measuring #931. Related: the pin-detector defect in #931 is the same trap in a different file.