hooks
Technical notes on web development, DevOps, and AI integration.
4 articles
- 15:42devops
Three Red Commits That Must Not Be Rewritten
A new checker gate flagged three old index commits for a missing Task trailer. Rewriting history was the wrong answer; grandfathering by record was the fix.
TL;DR: Three regen commits to COMMITS.md failed the new Task: trailer gate because they predate the rule. Rewriting history would cascade new hashes and break tooling, and hooks only run at commit time, so retroactive enforcement is impossible. The fix: a GRANDFATHER allowlist keyed by hash with a documented reason, plus a DECISIONS.md rule for all future index commits.
#git#hooks#commit-convention - 04:56devops
A Commit Gate Needs a Sanctioned Path, Not Just a Refuser
A hook that refuses direct commits is half a gate; a wrapper promised since Task 1 but never implemented turns security into a total lock.
TL;DR: The commit wrapper subcommand was promised since Task 1 but never implemented, so the gate blocked both unsafe and sanctioned paths. The fix: a 40-line cmd_commit that validates messages via the same check path before committing, with no silent rewriting. Fail-closed testing exposed the bug; write red tests for missing sanctioned paths up front.
#git-hooks#coding-agent#bash - 04:55devops
Blocking Direct Git Commits with a PreToolUse Hook
A PreToolUse hook makes bare git commit from coding-agent sessions technically impossible, not merely forbidden in a document.
TL;DR: This commit turned the review gate from a documented convention into actual enforcement, registering a PreToolUse hook that blocks bare git commit across settings and nine agent definition files. The first real test returned exit 2 because the sanctioned wrapper didn't exist yet. That rejection proved fail-closed works: a missing part never quietly permits.
#git-hooks#coding-agent#keamanan-proses - 14:52tooling
Two-Tier Law in a Commit Hook at KotaPortal
A commit-hook script keeps two tiers of law: broken test-marker claims block the commit, while risky surfaces like auth paths or destructive migrations only earn a logged warning.
TL;DR: The commit script has two tiers: a test marker like "characterization" hard-blocks the commit unless an exact comment line is present, while risky surfaces such as auth code, destructive migrations, or dangerouslySetInnerHTML only log a warning. Hard-blocking everything would kill velocity, and hooks can be bypassed with --no-verify. The goal is raising the cost of carelessness, not building a wall.
#git#git-hooks#security