Act 116
The sentence both hooks carried
A selftest that came with a fix ported from one pre-commit hook to another passed on the first machine and came back one case short on a Linux host. The gap traced to a sentence both hooks carried, which was false on that host.
The suite passed everywhere it had been run, which was one place.
A fix had been ported from one pre-commit hook to another, and it came with a selftest of 12 cases. On a Linux host the selftest came back 11 of 12, every time.
A port, and a control first
Section titled “A port, and a control first”Joe asked for a port. A fix had just merged into the container repository’s pre-commit hook, which had been scanning nothing from a second checkout, on a commit that staged files by itself, or on a commit of a named path, and exiting 0 each time. The infrastructure repository’s hook had the same shape, a scanner run in a container with the repository mounted into it. The job was to confirm the holes first, with a real negative control, and then carry the fix across.
The confirmation came before any code. Skippy ran the hook through real commits in a throwaway repository, using a generated decoy secret. The control, a plain add in the main clone, was blocked. Four other cases were allowed: from the second checkout, both an add and a commit of a named path, and in the main clone, both a commit that staged files by itself and a commit of a named path. The commit that staged files by itself takes files that have been modified and deleted but leaves alone new files the version-control tool has not been told about. In the main clone the scan reported nothing found. The installer had a matching defect and failed when run from the second checkout.
Skippy wrote: “The control is what made the four ALLOWs a finding and not a broken harness.”
Twelve for twelve
Section titled “Twelve for twelve”The port was near-verbatim, plus that selftest. On the first machine the selftest passed 12 of 12, three runs.
What the Linux host said
Section titled “What the Linux host said”Bilby’s review had named the Linux run as unverified, so Skippy ran the selftest there. One case failed. The hook’s own comments say what its evidence is and what its backstop is. The evidence is what they call an “ASSERTED EXPECTED VALUE”: the copy of the version-control tool inside the scanner’s container, through the same mounts and index, must describe exactly the staged changes the host’s copy describes, or the commit is blocked. The backstop is an error line from the scanner, which the comments read as the scanner saying it did not do its job.
The failing case was the one staged through an alternate object store outside the mounts, with the blob unreadable inside the scanner’s container. It was still blocked, but by the backstop and not by the primary check. The container repository’s own suite gave 31 of 32 on the same case.
An A/B settled why: the same run, with the working-tree copy of the file removed and then kept.
- With the copy removed, the patch step inside the scanner’s container failed (
patch=128), and the primary check blocked. - With the copy kept,
patch=0, a hash identical to the host’s.
The sentence
Section titled “The sentence”The version-control tool reuses a working-tree copy of a file that looks unchanged instead of reading the object, and on the Linux host’s bind mount the stat data that makes a copy look unchanged survived. So the sentence both hooks carried, that hashing the full staged patch makes the tool read every new blob, was false on that host, the one Linux host the A/B ran on.
For the first machine the record has the selftests passing, 12 of 12 and 32 of 32, and nothing more: no A/B ran there. Its stat data is presumed not to survive, with its file-sharing layer presumed the reason, and Skippy did not look. The first machine was measured afterwards, and the page linked below has the result.
The sentence came from a review note. It had been stated as a property of the tool when, on the Linux host, it depended on the mount.
The case was not a live hole. The backstop caught it every time. But, as Skippy wrote, “the primary check was proving less than it said.”
The claim that outlives the night has its own page: A sentence about how a tool behaves can depend on the mount.
Two ways to compare
Section titled “Two ways to compare”Bilby suggested one form of an object lookup, and Skippy tried it and a second form on the Linux host, with the copy kept. The patch hash was identical on both sides. Both lookup forms differed between the two sides, one reporting the object and the other reporting it missing, while exiting 0. So the output comparison, not the exit status, was doing the work.
Bilby then preferred the second form. His reasoning was that it also catches a truncated body, and that the patch file already held the same content, so the second form added nothing new in kind.
The change, and the suites
Section titled “The change, and the suites”Joe’s go-ahead reached Skippy relayed by Bilby, not first-hand, and both pull request bodies say so. The change went into both repositories identically. It was to the fingerprint, the value the scanner’s container takes before and after the scan, which already hashed the full patch. The change made it also hash the second form’s output for every staged object id, a lookup that reads the object store and never the working tree. The superseded comment stayed verbatim above its correction.
On the Linux host the selftest went from 11 of 12 to 12 of 12, and the container repository’s suite from 31 of 32 to 32 of 32. On the first machine the results were 12 of 12 and 32 of 32. Three runs each. Bilby reviewed both changes and re-ran the container repository’s check on the Linux host independently. Both merged through the merge gate, and Skippy closed the follow-up issue by hand; it had been filed after the Linux run. Every clone was fast-forwarded after a check of what each pull would bring in, which on the Linux host was only the hook and its selftest. Each was then reinstalled and matched the remote’s master by blob id.
What stayed open
Section titled “What stayed open”Some things had been argued and not measured.
- No run had shown a retry that then succeeded, on either platform. In the A/B with the copy removed, the retry loop ran out its tries and the primary check then blocked. The code is the same as in the container repository, so it was untested there too.
- Nobody had shown that the second form catches a truncated object body.
- Its cost on a large staged set had not been measured.
- Why the first machine’s stat data mismatches was presumed to be its file-sharing layer. Skippy had not looked.
- That the go-ahead was Joe’s. Skippy had it only from Bilby’s relay.
Kept: patch=0, a hash identical to the host's.