Skip to content

staging-next 2026-09-05 - #560469

Merged
vcunat merged 780 commits into
masterfrom
staging-next
Sep 11, 2026
Merged

vcunat merged 780 commits into
masterfrom
staging-next

Conversation

SFrijters and others added 30 commits August 31, 2026 20:23
Resolves #516936

Assisted-by: GitHub Copilot (Claude Opus 4.8)
Build with the default OCaml again as upstream has added OCaml 5.5
support.
Drop the pa_j chooser patch as it was merged upstream.

Signed-off-by: Matthias J. Kannwischer <[email protected]>
@vcunat

vcunat commented Sep 11, 2026

Copy link
Copy Markdown
Member Author

@vcunat vcunat mentioned this pull request Sep 11, 2026
4 of 13 tasks
@OPNA2608 OPNA2608 mentioned this pull request Sep 11, 2026
3 of 13 tasks
@sikmir sikmir mentioned this pull request Sep 11, 2026
2 of 13 tasks
@vcunat
vcunat added this pull request to the merge queue Sep 11, 2026
Merged via the queue into master with commit 35b1ffc Sep 11, 2026
46 checks passed
@vcunat vcunat mentioned this pull request Sep 12, 2026
4 tasks done
prismatic-koi added a commit to prismatic-koi/nixos-config that referenced this pull request Sep 13, 2026
Discord was pinned to nixpkgs-master in 8d73426 (28 Jan 2026) with the
comment "they block older versions". Discord's server refuses a client
below a minimum version. At that time the last stable discord bump in
nixpkgs was 2025-11-27 (0.0.115 -> 0.0.116), two months old, so the pin
gave a current client.

The comment was dropped in 6f95667 (1 Mar 2026), which grouped the master
pins under one heading: "packages where we use master by default for
bleeding edge". That heading is correct for claude-code and wrong for
discord. Discord was never a bleeding-edge want.

The reason no longer holds. nixpkgs now bumps discord about once a week.
At the currently locked revisions, all four discord package files
(sources.json, default.nix, linux.nix, wrapper.nix) are byte-identical
between nixos-unstable (8ce4ef6c) and nixpkgs-master (d5dde4c8). Both give
linux-stable 1.0.156. The pin gives no version lead.

The pin does have a cost. discord is a buildFHSEnvBubblewrap package with a
1.3 GiB rootfs closure. While master and unstable share a base, that closure
deduplicates against the rest of the system and costs nothing. When master
absorbs a staging-next merge, the base diverges and the whole closure lands
as a second private copy. PR #2992 showed this: after master took
"staging-next 2026-09-05" (NixOS/nixpkgs#560469), the system closure grew
1.25 GiB on navi and tui.

Re-pin if Discord locks out the version in nixos-unstable again.

Co-authored-by: prismatic-koi <[email protected]>
@kuflierl kuflierl mentioned this pull request Sep 14, 2026
4 tasks done
dustfeather added a commit to dustfeather/shared-workflows that referenced this pull request Sep 14, 2026
The shortfall check compares the subjects read against the PR object's
`.commits` integer, and the comment asserted that integer is not capped.
It isn't: measured on NixOS/nixpkgs#560469, `.commits` is 780 while
`--paginate` over the commits listing returns exactly 250. Past the cap
the two sides disagree and the refusal fires, rather than both sides
reading 250 and the guard failing open at the boundary it exists for.
github-actions Bot pushed a commit to dustfeather/shared-workflows that referenced this pull request Sep 14, 2026
…tle #major (#42)

* docs(contributing): the versioning section still described v1/v2 by hand

* docs(contributing): bump tokens go in the PR title now

The token is deliberately not written verbatim in this subject: under the
squash merge this repo now uses, a token on a commit subject is exactly what
merge-on-approval.yml refuses, and the convention this commit documents is
that it belongs in the PR title instead.

* fix(merge-on-approval): the guard missed a token stranded in the PR title

The guard shipped in v5.3.0 only caught a token on a commit subject that a
squash would move into the body. It exempted the single-commit case outright,
and that exemption hid the mirror-image mistake: under COMMIT_OR_PR_TITLE, a
single-commit PR uses THAT COMMIT's subject and discards the PR title, so a
token placed only in the title is the one that vanishes. The guard allowed it
and CONTRIBUTING.md actively recommended it.

Resolve the landing subject first, then compare ranks once. One rule, both
directions, no exemption to keep in sync with the docs. Twelve stub cases now
cover every combination of merge method, commit count and repo setting, four of
them controls that must exit 1.

Found by the review agent on PR #42, which read the guard and the prose and
noticed they disagreed for a case neither of them had exercised.

* fix(merge-on-approval): control the squash subject instead of predicting it

The guard inferred which text would become the squash commit's subject from
`squash_merge_commit_title` plus the PR's commit count, then compared against
that. The inference was correct but conditional on a per-repo setting nobody
audits, and it forced the docs to teach "put the token in both places,
because it depends".

Pass `--subject "$pr_title"` on the squash instead. The landing subject is
then a fact, the single-commit special case disappears, and the guard reduces
to one comparison: does the PR title carry the largest bump asked for
anywhere. The `gh api` read and the commit-count read go away with it.

Merge arguments move into an array so the title, which contains spaces, can
be passed; `$del` and `$match` still rely on word splitting and cannot.

The error message now names the only remediation that works. Telling someone
to put the token on the commit subject was self-defeating: complying meant
pushing another commit, whose subject also becomes body text. Editing the PR
title needs no new commit, so the approving review survives.

Extracted and run against a stubbed gh: 10 cases, 4 of them positive
controls, and flipping the comparison turns exactly those 4 red. The stub's
catch-all never fired, which is what proves the two dropped API reads are
really gone.

* docs: the bump token goes in the PR title

README still said to put it on the commit subject, which the squash merge
discards; CONTRIBUTING and CLAUDE.md said to put it in both places, which was
only true while the landing subject was inferred. All three now state the one
rule: PR title when it lands through a PR, commit subject when pushed straight
to main.

The `squash_merge_commit_title` table is gone from CONTRIBUTING, replaced by a
short note on why the subject is passed explicitly — the asymmetry is now a
rationale for the flag rather than something a contributor has to reason about.

* fix(merge-on-approval): keep the PR backlink in the squash subject

Passing --subject replaces GitHub's own squash-title composition wholesale,
and that composition appends "(#<number>)". Dropping it stripped the PR
backlink from every commit landing through this workflow, for every caller --
which is what `git log --oneline` and the blame UI key off. The suffix is now
reproduced explicitly.

The guard compares the suffixed subject rather than the bare title, so the
value it ranks is the value that lands and the two cannot drift. The suffix
carries no bump token of its own, so nothing can be smuggled in through it;
there is a case for that.

Also records, in the comment next to the array, that --subject reaches the
`--auto` path too. gh builds one MergePullRequestInput and sets CommitHeadline
on it BEFORE choosing the mutation; the auto branch sends
EnablePullRequestAutoMergeInput{input}, embedding that same struct. Read out
of cli/cli v2.55.0 pkg/cmd/pr/merge/http.go rather than assumed, because the
previous comment asserted the guarantee without having checked it.

Suite re-extracted and re-run: 11 cases, 4 positive controls, all green.

* docs: roll documented pins to v6

The subject override changes behaviour every caller sees, so this lands as a
major. tag-release.yml re-points only the CURRENT major, which means cutting
v6 freezes v5 where it stands: every caller keeps running frozen code until
its uses: reference is moved by hand.

Rolled here: README usage examples, SECURITY.md, the PR template, k8s and
runner-image READMEs, the doc-comment examples inside the workflows, and the
real intra-repo uses: lines in release-extension.yml.

Two files are deliberately NOT rolled, both for reasons already recorded in
CLAUDE.md:

- pr-merge.yml pins one major behind on purpose. A uses: job validates its
  inputs against the PINNED ref, and v6 does not exist until this very merge
  cuts it — rolling it here would be startup_failure and the PR could not
  land itself. It moves in a separate push once the tag exists.
- pr-checks.yml names itself in its own paths-ignore, so bundling its edit
  with any other path produces a run that exists but reviews nothing (the
  action rejects its own OIDC exchange and exits 0). It needs its own direct
  push to main.

Caller re-pinning is tracked separately; it cannot start until v6 is cut.

* docs: the v6 replace corrupted two claims in CLAUDE.md

Both found in review, both mine, and both from the hazard I had just written
down: a blind version replace is safe on `uses:` lines and unsafe on prose,
because prose describes events that already happened at a version that did not
move.

- Line 45 claimed pr-merge.yml pins the new major. It does not, deliberately --
  the same commit that wrote that sentence left the pin alone on purpose, so
  the file contradicted itself.
- Line 61 claimed the historical pin bump went v4 -> v6. That bump was
  v4 -> v5. There was never a v4 -> v6 bump; the sentence documented an event
  that never occurred.

The first bullet also asserted "the lag self-heals at the next tag", which was
true only within one major and is now false: cutting the new major freezes the
old one, so pr-merge.yml keeps merging through frozen code until it is
repointed by hand. That is now stated explicitly, along with the consequence --
the explicit squash subject this release documents is NOT in effect for this
repo's own merges until that repoint lands.

* fix(merge-on-approval): report the bump this merge will cut, always

Review found the mirror of the hazard this change was written to close.
Forcing the squash subject means the PR title is now ALWAYS what lands, so a
bump token written incidentally in a title -- quoting an error, naming the
convention in prose, describing what a change does -- cuts that release for
real. The guard only tested for a bump being LOST (title rank below what was
asked anywhere); it was blind to one being gained.

tag-release.yml excludes commit bodies for precisely this reason: prose
discussing a bump once matched itself and cut a spurious release. A PR title
has no equivalent exclusion available, because under this convention it is the
only channel the token can travel on -- an incidental token and an intended one
are identical text, and no check can separate them.

So the guard does the one useful thing left: it now states which release the
merge will cut on EVERY squash, not only when a bump was requested, at the
point where the fix is still free (edit the title, no new commit, approving
review survives). Verified against the extracted block: a title reading
"docs: explain the major token" reports PATCH, which is the evasion the docs
recommend; the literal forms report MINOR and MAJOR.

Docs aligned on the same point. CONTRIBUTING.md had no warning at all and
CLAUDE.md's was written for commit subjects; both now name the PR title as the
riskiest place to write a token by accident.

Also fixes README.md:141, which still said a default arrived "in v5" after the
uses: line above it moved to v6 -- the third casualty of the same blind
version replace, and the same class as the two CLAUDE.md lines last round.

Suite re-extracted and re-run: 11 cases, 4 positive controls, all green.

* fix(merge-on-approval): idempotent PR-number suffix, wider gh evidence

Three round-7 findings.

The suffix append was unconditional, so a title copied from a `git log
--oneline` line landed as "... (#42) (#42)". Now strips an existing exact
suffix first. Only the exact one: a title citing a DIFFERENT pull request
keeps that reference and still gets its own appended, which is the behaviour
you want.

The auto-merge comment cited one gh version, which read as though the
guarantee were version-dependent and invited exactly that objection. Checked
across releases instead: v2.0.0, v2.20.0, v2.40.0 and v2.55.0 all set
CommitHeadline before branching on auto, so the floor is "any gh 2.x", which
every runner exceeds. A version check would guard a case that cannot arise,
so none was added; the comment now says what to re-check if gh ever splits
the two paths.

CLAUDE.md's frozen-pin paragraph now names the tracking issue. The plan
existed but only in a filed issue and a resolved review thread, so a reader of
the diff had no way to see the breakage was already sequenced rather than
merely observed.

* fix(merge-on-approval): the consequence report was false on mode: auto

Round 8 review: the log line said the release was "still free to fix by
editing the title". True on `mode: direct`, where the merge runs a few
steps later in the same job. False on `mode: auto`, which is the default
and what most callers are on.

`enablePullRequestAutoMerge` STORES the subject rather than re-reading it
at merge time. GraphQL's AutoMergeRequest carries `commitHeadline`
alongside `enabledAt`, and gh sets it in EnablePullRequestAutoMergeInput
when auto-merge is enabled. So on the auto path the landing subject is
frozen a few lines below the guard, and a title edit made afterwards
changes nothing about the release that gets cut — the remedy is a re-run,
which needs a fresh approving review or a manual dispatch.

The report is now mode-dependent: ::warning:: naming the freeze and the
re-run on auto, a plain line on direct. The refusal path above is
unchanged and was already accurate — it exits before auto-merge is
enabled, so "edit the title, then re-run" holds there.

Recorded a second bound the same schema states: commitHeadline is ignored
when the base branch merges through a merge queue, which returns the
subject to GitHub's own composition and voids the control this guard
rests on. No caller uses a merge queue; one that adopts one needs a check.

Suite is 16 cases, 5 of them mode assertions including a negative one
(no ::warning:: on direct). Two mutation checks: flipping the rank
comparison turns the 6 refusal cases red, flipping the mode test turns
exactly the 4 mode cases red.

* fix(merge-on-approval): read commit subjects from a source that is not truncated

Round 9 review: `pr_subjects` came from `gh pr view --json commits`, whose
`messageHeadline` is GraphQL's truncated form — GitHub clips a subject
around 72 characters to 69 plus an ellipsis. The bump token is appended
by convention, so truncation eats exactly the substring bump_rank
searches for. `asked_rank` then reads 0, the guard says "no bump token in
the PR title", the merge proceeds, the token lands in the squash body
where tag-release.yml is designed not to look, and the release silently
degrades to a patch. Three commit subjects on this branch are long enough
to trip it (75, 73 and 72 characters).

A false negative, so nothing goes red and nothing appears in the log —
the precise failure this guard was added to prevent, reachable through
the one input nobody had hardened.

Subjects now come from `gh api repos/$REPO/pulls/$PR_NUMBER/commits`,
which returns the raw message; the jq takes the first line only, so
commit bodies stay excluded as tag-release.yml's own scan requires.

That endpoint caps at 250 commits however far it is paginated, so a
token on a later commit would be equally invisible. The guard refuses
rather than scan a list it knows is incomplete.

Also, from the second thread in the same round: the consequence report
now prints the landing subject verbatim, not only the bump it implies.
Auditing the log for an incidental token, or checking the "(#N)"
de-duplication, had nothing to read before.

Suite is 20 cases. The stub now answers ONLY the two calls the guard
should make, so green also proves the GraphQL read is gone rather than
merely unused. Four mutation checks: rank comparison -> 6 red, mode test
-> 4 red, a stub that truncates at 72 like messageHeadline -> exactly the
long-subject case red, removing the 250 cap -> exactly the cap case red.

Not independently reproduced at commit time: the exact truncation
threshold and ellipsis form, which come from the review's example on this
PR's own commit list. The fix does not depend on it — the REST message is
unconditionally untruncated.

* fix(merge-on-approval): detect a short commit read by count, not by the cap

Round 10, two findings.

The cap test could not fire. `gh api --paginate` defaults to per_page=30,
and the pull-request commits endpoint stops at the last whole page below
its 250 cap — so the list ends at 240 and `n_commits -ge 250` is never
true. The guard would have scanned a silently truncated list and reported
clean, which is the failure it was added to prevent, dressed as its own
fix.

Comparing against a cap is arithmetic to get wrong twice, so the check no
longer does. It reads the PR's own declared commit count — a plain
integer on the PR object, not capped — and refuses on any shortfall,
whether from the cap, a failed page, or a future change to either.
per_page=100 is passed as well, which also cuts the round trips.

Truncation is now measured, not quoted. Reading the same commits through
both sources on this PR: every subject longer than 72 characters comes
back from GraphQL as exactly 70 — 69 characters plus U+2026 — however
much longer the real one is, while 72 and under are untouched. The three
tripping subjects are 73, 75 and 80. The earlier note said 75, 73 and 72;
72 is not truncated, and the third is this branch's own last commit.

Also: scratchpad/ no longer ships. The guard harness, the re-pin rollout
script and the PR-body drafts were committed here and would have landed
on main. This repo holds reusable workflows only. A test suite no CI step
runs is worse than none because it reads as coverage, and a one-shot
rollout script with an --apply mode that pushes to twenty repos is not
something to leave in a tree. All of it lives outside the repo now, and
.gitignore keeps it out.

Wiring the harness into CI needs a step in pr-checks.yml, which cannot
ride this PR — that file names itself in its own paths-ignore, so a PR
touching it gets no run, no review and no approval. It needs its own
direct push to main, tracked separately.

Suite is 21 cases. Five mutation checks now: rank comparison -> 6 red,
mode test -> 4 red, stub truncating at 72 -> exactly the long-subject case
red, cap removed -> the cap case red, and count-vs-cap substituted for
count-vs-declared -> exactly the one-commit-short case red.

* fix(merge-on-approval): -F flipped the commit read to POST, breaking every squash

My own regression from 06945c0, caught in round 11. `gh api` defaults to
GET only while no parameters are supplied; a single `-f`/`-F` flips the
default method to POST, and POST on the pull-request commits route is a
404. The step runs under `set -euo pipefail`, so the failed command
substitution kills it before `gh pr merge` — every squash merge through
this workflow would have failed, for every caller, with the error
pointing at the guard rather than at the merge.

per_page now rides in the path instead:
`repos/$REPO/pulls/$PR_NUMBER/commits?per_page=100`. `-X GET` fixes it
equally, but a query string cannot be undone by a flag added later.

The reviewer's other point is the more important one: a stub that returns
canned output cannot catch this, because it answers the same whatever
method the real CLI would have used. So the stub now asserts the argv
SHAPE before answering — any `gh api` carrying `-f`/`-F` without an
explicit `-X` exits 98 with the command quoted. Putting the `-F` form
back turns 20 of 21 cases red, which is the correct blast radius: it is
not one case failing, it is every squash path.

Not fixed here, and not fixable here: pr-checks.yml:24 still describes
@v5/@v4 after the v6 cut. That file self-excludes in its own
paths-ignore, so it needs the hand-push tracked in #43.

* fix(merge-on-approval): an empty commit subject killed the read, then miscounted it

Round 12 reported that a trailing empty subject is eaten by command
substitution, leaving the count one short and refusing a good merge under
an error about the 250 cap. Correct, and testing it found the step never
reaches that point: `"" | split("\n")` is the EMPTY ARRAY, so `[0]` is
null, and `sub` on null is a hard jq error —

  jq: error (at <stdin>:5): null (null) cannot be matched, as it is not a string

Under `set -euo pipefail` that kills the step outright, with the log
blaming the guard rather than the empty commit. So the reported miscount
was the second failure, reachable only once the first is fixed.

Both arms are now in the program: `// ""` restores the null to a string,
and an empty subject maps to a placeholder so every commit keeps its own
non-empty line through the capture. An empty subject can carry no token,
so neither arm can mask one.

Testing this needed a second harness. The stubbed suite tests the guard's
SHELL and is structurally blind here: the jq program lives in the argv the
stub only pattern-matches, so it is never executed. The new check extracts
the program verbatim from the YAML and runs real jq over a fixture holding
an empty message, a CRLF subject with a token, a subject-plus-body and a
subject-only commit — 5 assertions and 2 controls, one per failure mode:
without `// ""` jq exits 5, and with the null fixed but no placeholder the
count drops from 4 to 3.

Both suites green: 21 shell cases, 7 jq assertions.

* fix(merge-on-approval): the freeze point is the title READ, not the merge

Round 13, and it lands on the fix from d0d5502. That commit corrected the
`mode: auto` claim and left the `direct` one equally false, just less
visibly so: the log told direct-mode users "the merge runs later in this
same job, so editing the PR title before it does still changes what
lands". It does not. `pr_title` is read once at the top of this step,
baked into `squash_subject`, and passed as `--subject`; nothing re-reads
the title afterwards. An edit made after that read changes nothing on
either mode.

MODE governs only the length of the window between the read and the
merge — seconds on direct, indefinite on auto, where GitHub then holds
the value itself. That is still why auto warns and direct does not: the
auto window is long enough that someone will try to edit the title inside
it and believe it worked. Both log lines and CLAUDE.md now say the
subject was captured at the top of the step, which is the true and
mode-independent statement.

Second finding, same round: `declared_commits` is a second API call, so a
push landing between the two reads makes the declared count larger and
the mismatch gets blamed on the 250-commit cap. Wrong diagnosis for a
reachable event — this workflow ships `match-head-commit` precisely
because heads move mid-merge. On mismatch the guard now re-reads and lets
the two readings name the cause: a count that changed under us is a
moving head, a count that did not is the cap. This narrows the race
rather than closing it, and the comment says so; the merge closes it, via
`--match-head-commit` when the caller sets it.

Suite is 24 shell cases plus the 7 jq assertions. Two existing assertions
failed on the reworded log lines, which is what they are for. New:
a negative assertion that no line claims the title is still live, a
control where the head moves mid-read and the error must name the head,
and one where a stable count still reports the cap. Mutation: making the
re-read unreachable turns exactly the moving-head control red.

* fix(merge-on-approval): stop stating the landing subject as settled fact

Round 14. The code comment already records that a base branch behind a
merge queue discards the subject passed here and composes its own, and
the guard has no check for that — but the log line above it announced the
landing subject flatly, so in exactly that configuration it would be
confidently wrong about a release nobody would think to re-check. A wrong
log is worse than no log.

Hedged rather than detected. A merge-queue check would need another API
call on a condition no caller is in, which is the same "a check that can
never fire implies a risk was handled" argument that kept a gh version
check out earlier. The hedge costs a word: "would land", plus the caveat
naming the one configuration that breaks it.

The bump line beneath it still reads plainly. The caveat sits directly
above it and applies to both; repeating it on every line would bury the
signal it exists to give.

Two tests: a negative assertion that the line no longer asserts, and one
that the caveat is present. 26 shell cases, 7 jq assertions, both green.

The other round-14 thread — whether the PR object's `.commits` integer is
capped at 250 like the commits listing — is being measured against a real
public PR rather than reasoned about. If it is capped, the shortfall check
added in 9f8aadf fails open at exactly the boundary it exists for, which
would be the first fail-open in this guard and is not something to write
a comment about until it is known either way.

* docs(merge-on-approval): record the uncapped .commits total as measured

The shortfall check compares the subjects read against the PR object's
`.commits` integer, and the comment asserted that integer is not capped.
It isn't: measured on NixOS/nixpkgs#560469, `.commits` is 780 while
`--paginate` over the commits listing returns exactly 250. Past the cap
the two sides disagree and the refusal fires, rather than both sides
reading 250 and the guard failing open at the boundary it exists for.

* fix(merge-on-approval): three round-15 objections, all real

The shortfall message named the cap as fact in an ordering where the cap
cannot be the cause. The re-read only catches a push landing between the
declared-count read and the re-read; a push landing between the commit list
and the declared-count read leaves both later reads equal and the pre-push
subjects short, so a twenty-commit PR was told its list capped at 250 —
the same wrong diagnosis the re-read exists to prevent, mirrored. Discriminate
on the declared count, which is uncapped: at or below 250 the listing could
have returned everything, so truncation cannot explain the shortfall. 250
picks wording only and never gates the refusal, so moving the cap can at
worst hedge the wrong way.

The gh version floor cited http.go setting CommitHeadline before branching on
auto. That bounds the payload field, not the -t/--subject CLI flag the script
actually invokes, and the two have different floors. Measured in cli/cli
history: the flag first shipped in v2.4.0 (f2d23d8c8), absent from v2.3.0,
with -t and --subject on one StringVarP. Recorded with why it matters — an
unknown flag fails the step outright on auto, the default mode, while direct
swallows it into "It may still have merged".

The >250-commit refusal is caller-visible on default settings and lived only
in a code comment. Documented in CLAUDE.md with the remedy.

The .gitignore rule excluded the harness that is the only evidence these 162
lines of shell are correct, while #44 tracks wiring that same harness into
CI — which the rule made impossible. The harness moves into tests/guard/:
both suites re-extract from the shipped YAML, anchor the repo root to their
own location rather than cwd, and a failed extraction is now fatal instead of
silently running against a stale copy. 28 shell cases plus the jq program;
reverting the new discriminator turns two of them red.

* fix(tests): the suite could not see the flag it exists to protect

The extraction slice ended at `del=""`, so `args+=(--subject "$squash_subject")`
and the `gh pr merge` that consumes it were outside the tested range. Neutralise
that append and every case stayed green, "log prints the landing subject
verbatim" included, because it asserts the guard's own echo rather than the
flag. Every caller would have fallen back to squash_merge_commit_title while
the log went on claiming otherwise — the silent degradation this PR exists to
close, invisible to the suite written to close it.

The slice now ends after the merge call. The stub records `gh pr merge` argv
verbatim and assertions can target it with an `argv:` prefix, so four new cases
bind the flag itself: it reaches the argv on squash, on both auto and direct,
and is absent on rebase. Neutralising the append now turns exactly those three
positive cases red and leaves the echo test green, which is the point.

Wiring: guard-tests.yml runs both suites on every push and pull request. Its
own file rather than a job in pr-checks.yml, which names itself in its own
paths-ignore and so cannot be changed by a PR that touches only it. The
.gitignore comment claimed CI already ran the suite; now it does.

* test(guard): bind the (#N) de-dup; align the checkout pin

The `%` strip in squash_subject exists so a title copied off a `git log
--oneline` line does not land as "... (#42) (#42)", and nothing bound it: every
fixture title was suffix-free, so dropping the strip left the whole suite green.
Two cases now cover it, and the second is the load-bearing one — the positive
assertion is a substring match, so it passes against the doubled text as well;
only the negative control fails. Verified by mutation: replacing the expansion
with a plain "${pr_title} (#$PR_NUMBER)" turns exactly the control red and
nothing else.

guard-tests.yml pinned actions/checkout@v6 while the other thirteen references
in this repo are @v7. Nothing breaks, but the only stale pin in the tree is the
one a repo-wide bump sweep skips.

* test(guard): "$*" hid the exact regression the args array prevents

The stub recorded the merge call with "$*", which joins on a space and so
destroys argument boundaries before any assertion sees them. Unquoting the
append to `args+=(--subject $squash_subject)` makes gh receive --subject,
feat:, y, #minor, (#42) — the subject becomes "feat:" and the rest arrive as
stray positionals — yet "$*" renders that identically to the correct call and
all four argv cases stayed green. The array exists to prevent precisely that
split, and the recorder could not see it.

Record "$@" pipe-delimited instead, and write the expected form with its own
pipes so a lost boundary fails the match. Verified: the unquoted mutation now
turns four cases red, and the suite is green on the real code.

Third round running where the defect was in the test rather than the guard,
each one found by asserting on something adjacent to the behaviour instead of
the behaviour: the echo rather than the flag, the flag's presence rather than
its boundaries.

* fix(merge-on-approval): the mismatch is not always a shortfall

Commits can be removed between the two reads as well as added — a force-push
or a base rebase — leaving more subjects in hand than the PR declares. The
recheck only fires if the count moves a second time, so the message reported
"declares 3 commits but only 5 subjects could be read" and then hung a cap
diagnosis off it: nothing was truncated and nothing was short. Refusing stays
right in both directions; the diagnosis is what had to stop assuming one.

A -gt arm now names the shrink and says the cap plays no part in it, and the
shared wording drops "only" so it reads correctly whichever way the counts
differ. Two cases cover it, the control asserting the cap is NOT named;
neutralising the arm turns exactly those two red.

* docs(merge-on-approval): measure the auto-path subject instead of arguing it

The default mode rested on the last claim in this PR backed by reading cli/cli
rather than by observation: that --subject survives enablePullRequestAutoMerge
and lands as the squash subject when the merge finally fires. Measured end to
end on a throwaway repo instead.

Auto-merge enabled with `--subject "STORED HEADLINE probe (#1)"` against a PR
titled "ORIGINAL TITLE probe", blocked behind a required status check so the
merge had to wait. autoMergeRequest.commitHeadline held the subject verbatim.
The title was then edited to "EDITED TITLE probe" and commitHeadline did not
move. Releasing the check landed a squash commit reading "STORED HEADLINE
probe (#1)" — neither title.

That settles both halves at once: the subject reaches the auto path, and the
freeze this repo documents for humans is observed behaviour, not an inference
from the shape of the mutation input. The source reading stays in the comment
as the mechanism, no longer as the evidence.

* fix(docs,tests): CLAUDE.md said there is no test suite, in the PR adding one

The file every agent session here loads first still said "No build/test; only
local check = YAML parse", while this PR adds tests/guard/all.sh and wires it
into CI. An agent asked to change the guard would read that, run a yaml parse
and ship — precisely the gap the suite exists to close. Verifying changes now
names `bash tests/guard/all.sh` as the required local check for the guard block,
says the suite re-extracts from the shipped YAML, and says to assert on the
recorded merge argv rather than the guard's own log lines. The "two exceptions,
neither callable" count was already wrong before this PR and is now four.

Dropped `suffix carries no token of its own`: argument-for-argument identical to
`CONTROL: #minor stranded on subject`, no assertion, and a fixture with no
suffix in it — a name promising coverage it did not provide, in a suite whose
whole claim is that deleting the code turns cases red. The behaviour it named is
covered by the de-dup pair. Fixed the t() signature comment, which documented
seven parameters while reading an eighth.

Swept for the same defect rather than waiting to be told. Two more found:
`rebase: guard skipped entirely` asserted only exit 0, which is equally what
running-and-passing looks like, and the 249-commit case asserted only exit 1,
which a miscount also produces. Both now assert the thing their name claims.

Mutating the first of those exposed a blind spot in the harness itself: the
`--squash` condition WAS extract.sh's slice anchor, so it was the one line the
suite structurally could not mutate — rewriting it deleted the anchor, index()
matched the next occurrence 290 lines down, and every case failed against a
meaningless slice in a way that looked like a strong signal. The slice is now
delimited by dedicated guard-slice-begin/end markers and extract.sh exits with a
message if they are missing. With that fixed the mutation runs properly and
turns exactly one case red.

* docs(merge-on-approval): drop a cause the comparison cannot reach

Both the code comment and the error text listed "a page of the listing failed"
among the causes of a count mismatch. It cannot be one. pr_subjects is assigned
from a command substitution, and under the set -euo pipefail at the top of the
step a nonzero gh api exits before the comparison — verified locally: under
those flags `x=$(false)` never reaches the next statement and returns 1. What
can reach the comparison is truncation at the cap and a head that moved between
the reads, and the comment now says only that.

Listing an unreachable cause is the same defect as asserting a reachable one
flatly: it tells the next reader the code handles a case it never sees, and the
handling is what they will trust.

* fix(merge-on-approval): gate the freeze annotation on a token being present

The `::warning::` fired on every squash merge under `mode: auto` -- the
default -- including the common case where no bump token appears in the
title or on any subject. Every merge in every caller repo rendered yellow
for a message whose sharp edge, an incidental token cutting a release
nobody asked for, needs a nonzero title rank to exist at all.

The message is not gated, only the annotation: the other hazard it names,
a title edited after the guard's read doing nothing, is real at rank 0 too
and still prints. Same words, same log, no yellow.

Three mutations bind the gate: always-warn fails the rank-0 control,
a `= "2"` gate fails the rank-1 case, and suppressing the message itself
fails three.

* fix(merge-on-approval,tests): annotate on direct too, and stop leaking temp files

The rank gate and the mode split answer different questions, and tying the
annotation to both conflated them. An incidental token cutting a release
nobody asked for is mode-independent -- `direct` cuts it just as hard, only
sooner -- while the two wordings are about the other hazard, a title edited
after the guard's read, whose window is what the mode governs. Gating the
annotation on the mode exempted exactly the wrong repo: this one's
`pr-merge.yml` passes `direct`, and a workflow library is where PR titles
are likeliest to discuss bump tokens in prose.

`direct` now carries `${ann}` on the same rank condition. Nothing bound that
before: the rank-0 direct control passes whether or not `direct` can annotate
at all, and the other direct case asserts a substring starting at
"Bump-token guard:", which still matches with a prefix. A rank-1 direct
control pins it, and fails when the interpolation is removed.

The harness mktemp'd two files per case and removed neither -- 76 per run,
and 2429 had accumulated on this machine, so the cost was real rather than
theoretical. One run-scoped `mktemp -d` with a script-scope trap replaces
them; the per-case truncation matters, because reusing the paths without it
would carry the previous case's recorded argv into any case whose guard
exits before the merge.

* docs: CONTRIBUTING stated a rule this repo does not follow yet

The PR-title rule is written unconditionally, and it is not true here.
`pr-merge.yml` is pinned to `@v5`, which has no bump-token guard and passes
no `--subject` -- it merges with a bare `gh pr merge "$PR_URL" "$method"`.
GitHub then composes the subject from `squash_merge_commit_title`, and on
the default COMMIT_OR_PR_TITLE a single-commit PR lands the commit's own
subject. A one-commit PR titled `add X input #minor` over commit subject
`add X input` cuts a patch, and nothing reports it: the guard that refuses
this ships in v6 and this repo is not running v6.

CLAUDE.md recorded the frozen pin; CONTRIBUTING.md is the file a contributor
opens, and it did not. Remedy until #43: put the token in both places.

The pin comment in pr-merge.yml called `@v5` floating, which the v6 cut ends.
Its own rationale inverts with it -- tracking the major was justified by not
wanting this repo's automation to be the only thing not exercising what it
ships, which is exactly what a frozen pin now makes it.

pr-checks.yml carries the same stale "floating" wording and is deliberately
left alone: a PR that edits the workflow triggering its own review gets an
OIDC rejection that is swallowed as a green run, so the fix belongs on the
direct push to main that repoints it.

* fix(docs,githooks): enforce the check CLAUDE.md called mandatory

Two defects, both in CLAUDE.md, both introduced by me.

The paragraph on the annotation contradicted itself: it said the warning is
raised "only on `auto` AND only when the PR title carries a bump token", then
three sentences later said the gate is on the rank and `direct` annotates on
the same condition. The code and `tests/guard/run.sh` agree with the second.
The first clause is what c4a4e97 should have deleted when it appended the
correction, and it was wrong about precisely the mode this repo's own
`pr-merge.yml` uses.

The other: `bash tests/guard/all.sh` was declared a mandatory pre-push check
while `.githooks/pre-push` ran only `check-workflows.py`. The hook now runs
both as independent checks. That ordering matters -- the old hook exited
outright when PyYAML was missing, so appending the suite would have let an
unrelated missing dependency silently drop the check called non-optional.
Each block now probes its own dependencies and skips only itself.

Verified the gate fires rather than decorating: with the rank gate mutated to
always-warn the hook aborts with rc=1 and names the guard suite; restored, it
exits 0.

* fix(release-extension): three live uses: refs pointed at a tag that does not exist

`docs: roll documented pins to v6` moved more than documentation. Lines 64,
205 and 215 of release-extension.yml are intra-repo `uses:` resolution, not
caller examples, and v6 does not exist -- this PR's own merge is what creates
it. Reverted to `@v5`; the caller example at the top stays on `@v6`, since
that is the tag an external repo will ask for.

The failure is asymmetric, which is what decides it. If `#major` reaches the
squash subject, v6 is cut and the refs would have resolved. If it does not,
tag-release cuts a patch and re-points FLOATING v5 onto this tree -- and then
every caller on `release-extension.yml@v5` resolves `node-test.yml@v6`, which
does not exist: startup_failure, zero jobs, empty logs, all callers at once.
Nothing guards that bet here, because this repo merges through frozen `@v5`
merge-on-approval, which passes no `--subject` and has no bump guard. The PR
has 30 commits so COMMIT_OR_PR_TITLE should use the title, but "should" is
not worth every caller when waiting costs one follow-up commit.

Swept the rest of the tree: every other `@v6` is a comment line. The three
belong with the other by-hand repoints once the tag exists (#43), which also
keeps them off a frozen major.

Also restores the override command in the pre-push failure tail. It was
dropped in 63b7221 to get a literal past a local tool gate, which left the
one line a contributor reads on a red push unable to say how to proceed.

* fix(merge-on-approval): the refusal named one remedy and it is the wrong one half the time

The guard cannot tell an intended token from an incidental one -- a subject
like `docs: explain the #minor token` trips it with no bump meant, and an
intended token is identical text. The message named only "edit the PR title",
which under `--subject` makes the title the landing subject: following that
advice when the token was incidental cuts a release nobody asked for. That is
the exact mirror hazard the block below this one exists to log about, arriving
through the guard's own instructions.

Now names both, keyed on what the author actually meant, and prices the second:
rewording the commit subject costs a force-push and the approving review, which
an author who learns it afterwards has already paid.

Four cases bind it -- the intended arm, the incidental arm, the force-push cost,
and a negative control on the old single-remedy wording. Reverting the message
fails all four.

* fix(merge-on-approval): a PR title is untrusted input and reached the log unfiltered

MEASURED against the extracted guard, not argued: a title of
`feat: y\n::error::SPOOFED ANNOTATION` produced a real `::error::` line in the
step output AND put it in the `--subject` argv. GitHub parses workflow
commands at the start of any stdout line, and this step holds a write-scoped
GH_TOKEN, so a forged annotation is available to anyone who can set a PR
title. Whether GitHub accepts a newline in a title is a separate question the
guard now does not need answered.

The same truncation is a correctness fix independent of the injection. A
commit subject is single-line by definition: `--subject` with a newline sends
the remainder to the commit BODY, and tag-release.yml scans subjects only --
so a token below line one would be read here and land where the release scan
is designed not to look. Truncating makes the guard's view identical to what
git actually lands. CRs go too, since a lone CR would let a forged line
overwrite the text it replaced in a terminal.

Also corrects how CLAUDE.md names the guard region. It described the block by
`if [ "$method" = "--squash" ]`, which is the anchor the marker comments exist
to replace -- a contributor reading that as the contract could rewrite the
condition and drop the markers, reintroducing the silent mis-slice this PR
already fixed once. Described by the markers now, with the reason.

45 shell cases; neutralising the sanitizer reddens exactly the four new ones.

* fix: a generated guard.sh was committed at the repo root

`tests/guard/extract.sh` writes the extracted guard to `tests/guard/guard.sh`,
which the .gitignore next to it excludes. A copy landed at the repo root in
9dc7b0f and was tracked: `tests/guard/.gitignore` does not reach the root, and
the root .gitignore did not name it.

Nothing on the branch reads the root copy, so its only possible future is to go
stale against merge-on-approval.yml and be read as if it were current -- which
is precisely the failure the suite avoids by re-extracting on every run. A
frozen snapshot of the guard is the one artifact this PR should not ship.

Removed, and the root .gitignore now excludes it with a leading slash so the
rule cannot shadow tests/guard/guard.sh, which the suite genuinely writes.

* docs: disclose the >250-commit merge refusal to callers

The guard refuses to merge a PR whose commit listing comes back short of the
PR's own `.commits` total, because GitHub's pull-request commits endpoint caps
at 250 and a bump token past that point would be invisible. Deciding a release
from a partial list is the failure the guard exists to prevent, so it exits
rather than guessing.

That behaviour was caller-visible and undocumented. It ships on the default
settings, so a caller overriding neither `merge-method` nor `mode` inherits it,
and there is no input to switch it off -- the remedy is a manual merge or a
split. Both facts now appear where a caller and a contributor will each look:
README under Versioning, CONTRIBUTING next to the token rules.

Also records that the refusal happens before `gh pr merge` is called, so it can
never strand a merged-but-untagged commit, and that the same comparison covers
a failed page or a push landing mid-read.

* docs: the refusal cannot see a failed page, and three files said it could

merge-on-approval.yml argues the point in its own comment: `pr_subjects` is
assigned from a command substitution, so under the step's `set -euo pipefail` a
nonzero `gh api` kills the step before the count comparison is ever reached.
"What reaches it is truncation at the cap and a head that moved between the
reads -- nothing else." The three `cause` branches bear that out: shrink,
truncation past 250, mid-read push. There is no fourth arm and none that could
name a failed page.

CLAUDE.md has carried the wrong claim for several rounds, and the README and
CONTRIBUTING paragraphs added in 6b7066b copied it. All three now list the three
causes the code can actually report and say explicitly that a failed page is not
among them, with the reason, so the next edit does not helpfully restore it.

CLAUDE.md is the spec the next agent reads. Prose there asserting coverage the
implementation deliberately disclaims is worse than no prose: it gets acted on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.severity: security Issues which raise a security issue, or PRs that fix one 4.workflow: staging A staging-next or staging-next-XX.YY branch 8.has: package (update) This PR updates a package to a newer version 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 10.rebuild-nixos-tests This PR causes rebuilds for all NixOS tests and should normally target the staging branches. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.