Skip to content

Commit e6fd6b2

Browse files
baozhoutaoclaude
andauthored
fix(hooks): correct the false deferral claim in check-regen-pending.mjs and .githooks/pre-commit (#14545)
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 <noreply@anthropic.com>
1 parent 0e68ed2 commit e6fd6b2

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

.githooks/pre-commit

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@
66
# exits before doing any work, which is every commit that did not just merge a
77
# generator-owned artifact (#4675).
88
#
9-
# One commit is exempt, and only one: the MERGE commit itself, which the
10-
# sanctioned landing sequence (`scripts/pm/os-regen-merge.sh`, step 3) commits
11-
# BEFORE regenerating, so that "what main brought" stays readable apart from
12-
# "what the change produces". That commit records a deferral instead of being
13-
# refused; the immediately following commit must discharge it, and
14-
# `.githooks/pre-push` refuses the push if none ever does (#8047).
9+
# One commit is exempt, and only one: a MERGE commit finished BY HAND, with
10+
# `MERGE_HEAD` present at commit time — a conflicted merge an operator
11+
# resolves and finishes with `git commit`. That commit records a deferral
12+
# instead of being refused; the immediately following commit must discharge
13+
# it, and `.githooks/pre-push` refuses the push if none ever does (#8047).
14+
#
15+
# The sanctioned landing sequence (`scripts/pm/os-regen-merge.sh`) does NOT
16+
# hit that exemption: its step 1 merge auto-commits with no hook run at all
17+
# (see below), so the marker is untouched going into step 3, whose commit is
18+
# an ORDINARY one this hook refuses on purpose — that refusal is the designed
19+
# collection point, "what main brought" read apart from "what the change
20+
# produces" by the fallback it prints, not a deferral.
1521
#
1622
# ⚠️ git does not run this hook for a merge it completes ITSELF — only for one
1723
# you finish with `git commit`. A clean auto-committed merge therefore lands

scripts/check-regen-pending.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,11 @@ function main({ prePush = false } = {}) {
411411
console.error(
412412
`\nRegenerate ${owed}, \`git add\` them, and ${prePush ? 'commit the result before pushing' : 'commit again'}.\n`
413413
+ ' This check clears itself the moment they are current — nothing to reset by hand.\n'
414-
+ ' Landing a merge? `bash scripts/pm/os-regen-merge.sh` runs the sanctioned sequence — it commits\n'
415-
+ ' the merge first (this hook records that as a deferral) and regeneration follows as its own\n'
416-
+ ' commit. Every artifact above also has a required gate on the PR.\n',
414+
+ ' Landing a merge? `bash scripts/pm/os-regen-merge.sh` runs the sanctioned sequence — its merge\n'
415+
+ ' auto-commits first with no hook run at all (git skips pre-commit for a merge it completes\n'
416+
+ ' itself), so THIS refusal, on the ordinary commit right after, is that sequence\'s designed\n'
417+
+ ' collection point — not a deferral. Regeneration follows as its own commit; every artifact\n'
418+
+ ' above also has a required gate on the PR.\n',
417419
);
418420
return 1;
419421
}

0 commit comments

Comments
 (0)