Commit 4dc6f28
committed
Prevent the nested-repo accident, not just detect it; control the CSV check
Two corrections from an adversarial review of the previous commit. Both hold.
**The CI check fires too late.** It runs `on: push`, so a nested private clone
swept in by `git add -A` would already be on GitHub when the job goes red, and
deleting the branch would not remove it -- GitHub keeps `refs/pull/N/head`
permanently, which is why a sibling repository had to be deleted and recreated
rather than force-pushed. Detection after publication is not prevention.
Calling the previous commit a structural fix was wrong; it was a structural
alarm. `tools/pre-commit` is the half that prevents, with install instructions
and its own negative control in the header. `.git/hooks` is per-clone and not
committed, so the hook ships as a file to copy and CI remains the backstop for
anyone who has not installed it.
**The byte-identity check had no negative control.** It re-runs the extractor
and requires `data/labels.csv` to be unchanged -- which is trivially true if
the extractor were reading the CSV rather than the Markdown. The check would
then be green forever and catch nothing, the same vacuity as a proof whose
hypothesis is its conclusion. It now mutates a label in the Markdown source
and requires the check to fail, then restores and requires it to pass.
Both controls run, in both directions, before this commit: mutating
bandit-classification.md moves labels.csv and restoring it restores the file
byte-for-byte; the hook refuses a commit with a planted nested repository and
allows one without it.
The review also asked whether the accident happened in the tree the gate
covers. It did -- the private clone was inside this repository's worktree.
That was never the weak point; the timing was.1 parent 964cff7 commit 4dc6f28
1 file changed
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
0 commit comments