gitreins-tier1-ruff-format-drift-blocks-commits
Written to ~/gitreins-tier1-ruff-format-drift-blocks-commits.md.
I reproduced the failure in a scratch git repo and verified the remedy empirically, then documented it.
Root cause confirmed: The tier-1 arm ruff format --check $files is a file-level predicate. When a prior --no-verify commit leaves a file unformatted, every later commit touching that file fails the check regardless of the new change's quality — the unformatted bytes at base always fail. It's sticky and cannot be fixed by any content change.
Remedy verified: Two commits —
1. A style-only prerequisite: restore the drifted baseline, ruff format, prove ast.dump(parse(old)) == ast.dump(parse(new)) vs parent, commit.
2. The real fix reapplied on the formatted base.
Notable finding during verification: the intuitive git stash + format + stash pop approach conflicts (the stashed diff was generated against the unformatted base). The robust recipe preserves the desired final file content instead of the diff, avoiding the conflict.
Evidence captured in the doc:
- Clean fix blocked with EXIT=1 before remedy.
- AST equality vs parent: True.
- Style diff is whitespace-only; fix diff is exactly the one-line semantic change.
- Both commits pass the hook, and subsequent commits pass too.
- History: <fix> → <style> → <drift> → <base>, mapped to auger 593acc8 + 0851846.
The document includes a reusable shell script, a minimal inline version, multi-file and accidental-commit variations, and prevention notes.
# Evidence - Problem class: gitreins-tier1-ruff-format-drift-blocks-commits - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-23T06:52:14.102Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "A gitreins tier-1 lint arm that runs `ruff format --check` over whole staged files hard-blocks every commit touching those files once formatting drift enters via a --no-verify commit. Symptom: worker commit attempts die in the pre-commit hook at the lint arm with the file already unformatted at base; no content change can pass. Remedy: run `ruff format <files>` once as a separate style commit (AST-equality proof against parent = no semantic change), keep the fix diff readable, commit the style prerequisite first, then the fix. Verified on auger wave 2026-09-23 (commit 0851846 prerequisite + fix 593acc8; tier-1 lint arm then passes).", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "gitreins-tier1-ruff-format-drift-blocks-commits", "provider": "openrouter", "solved_at": "2026-09-23T06:52:14.102Z", "version": ""}Written to ~/gitreins-tier1-ruff-format-drift-blocks-commits.md.
I reproduced the failure in a scratch git repo and verified the remedy empirically, then documented it.
Root cause confirmed: The tier-1 arm ruff format --check $files is a file-level predicate. When a prior --no-verify commit leaves a file unformatted, every later commit touching that file fails the check regardless of the new change's quality — the unformatted bytes at base always fail. It's sticky and cannot be fixed by any content change.
Remedy verified: Two commits —
1. A style-only prerequisite: restore the drifted baseline, ruff format, prove ast.dump(parse(old)) == ast.dump(parse(new)) vs parent, commit.
2. The real fix reapplied on the formatted base.
Notable finding during verification: the intuitive git stash + format + stash pop approach conflicts (the stashed diff was generated against the unformatted base). The robust recipe preserves the desired final file content instead of the diff, avoiding the conflict.
Evidence captured in the doc:
- Clean fix blocked with EXIT=1 before remedy.
- AST equality vs parent: True.
- Style diff is whitespace-only; fix diff is exactly the one-line semantic change.
- Both commits pass the hook, and subsequent commits pass too.
- History: <fix> → <style> → <drift> → <base>, mapped to auger 593acc8 + 0851846.
The document includes a reusable shell script, a minimal inline version, multi-file and accidental-commit variations, and prevention notes.
# Evidence - Problem class: gitreins-tier1-ruff-format-drift-blocks-commits - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-23T06:52:14.102Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "A gitreins tier-1 lint arm that runs `ruff format --check` over whole staged files hard-blocks every commit touching those files once formatting drift enters via a --no-verify commit. Symptom: worker commit attempts die in the pre-commit hook at the lint arm with the file already unformatted at base; no content change can pass. Remedy: run `ruff format <files>` once as a separate style commit (AST-equality proof against parent = no semantic change), keep the fix diff readable, commit the style prerequisite first, then the fix. Verified on auger wave 2026-09-23 (commit 0851846 prerequisite + fix 593acc8; tier-1 lint arm then passes).", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "gitreins-tier1-ruff-format-drift-blocks-commits", "provider": "openrouter", "solved_at": "2026-09-23T06:52:14.102Z", "version": ""}