From 15117b0233456f95bfb51dec18cd2979b862d5a9 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Sep 2026 10:44:14 +0000 Subject: [PATCH] fix(hooks): correct the false deferral claim in check-regen-pending.mjs and .githooks/pre-commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both sibling copies of the false claim corrected in os-regen-merge.sh by #14154 survived: the hook's refuse-stale message and the pre-commit header still said this hook records the sanctioned landing sequence's step-3 commit as a deferral. It does not — step 1's merge auto-commits with no hook run at all (git skips pre-commit for a merge it completes itself), so the marker is untouched going into step 3, whose commit is an ordinary one this hook refuses on purpose. That refusal is the designed collection point, not a deferral. The deferral mode (#8047) is real, but applies only to a merge commit finished BY HAND with MERGE_HEAD present at commit time — a conflicted merge an operator resolves and finishes with `git commit`. Both texts now state that precisely, mirroring the reference wording already correct in scripts/pm/os-regen-merge.sh:110-115. Fixes #14470 Co-Authored-By: Claude Code --- .githooks/pre-commit | 18 ++++++++++++------ scripts/check-regen-pending.mjs | 8 +++++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index c07276dd0f..f2eeaf699c 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -6,12 +6,18 @@ # exits before doing any work, which is every commit that did not just merge a # generator-owned artifact (#4675). # -# One commit is exempt, and only one: the MERGE commit itself, which the -# sanctioned landing sequence (`scripts/pm/os-regen-merge.sh`, step 3) commits -# BEFORE regenerating, so that "what main brought" stays readable apart from -# "what the change produces". That commit records a deferral instead of being -# refused; the immediately following commit must discharge it, and -# `.githooks/pre-push` refuses the push if none ever does (#8047). +# One commit is exempt, and only one: a MERGE commit finished BY HAND, with +# `MERGE_HEAD` present at commit time — a conflicted merge an operator +# resolves and finishes with `git commit`. That commit records a deferral +# instead of being refused; the immediately following commit must discharge +# it, and `.githooks/pre-push` refuses the push if none ever does (#8047). +# +# The sanctioned landing sequence (`scripts/pm/os-regen-merge.sh`) does NOT +# hit that exemption: its step 1 merge auto-commits with no hook run at all +# (see below), so the marker is untouched going into step 3, whose commit is +# an ORDINARY one this hook refuses on purpose — that refusal is the designed +# collection point, "what main brought" read apart from "what the change +# produces" by the fallback it prints, not a deferral. # # ⚠️ git does not run this hook for a merge it completes ITSELF — only for one # you finish with `git commit`. A clean auto-committed merge therefore lands diff --git a/scripts/check-regen-pending.mjs b/scripts/check-regen-pending.mjs index a9aedff9e9..14396b2bb6 100755 --- a/scripts/check-regen-pending.mjs +++ b/scripts/check-regen-pending.mjs @@ -411,9 +411,11 @@ function main({ prePush = false } = {}) { console.error( `\nRegenerate ${owed}, \`git add\` them, and ${prePush ? 'commit the result before pushing' : 'commit again'}.\n` + ' This check clears itself the moment they are current — nothing to reset by hand.\n' - + ' Landing a merge? `bash scripts/pm/os-regen-merge.sh` runs the sanctioned sequence — it commits\n' - + ' the merge first (this hook records that as a deferral) and regeneration follows as its own\n' - + ' commit. Every artifact above also has a required gate on the PR.\n', + + ' Landing a merge? `bash scripts/pm/os-regen-merge.sh` runs the sanctioned sequence — its merge\n' + + ' auto-commits first with no hook run at all (git skips pre-commit for a merge it completes\n' + + ' itself), so THIS refusal, on the ordinary commit right after, is that sequence\'s designed\n' + + ' collection point — not a deferral. Regeneration follows as its own commit; every artifact\n' + + ' above also has a required gate on the PR.\n', ); return 1; }