Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

feat(changeset): re-read a pending changeset when a later change touches a file it names - #9112

Merged
baozhoutao merged 3 commits into
mainfrom
claude/issue-9003-pending-changeset-prose
Sep 11, 2026
Merged

baozhoutao merged 3 commits into
mainfrom
claude/issue-9003-pending-changeset-prose

Conversation

@claude

@claude claude Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #9003

A .changeset/*.md body publishes verbatim into the CHANGELOG at the next release. Between authoring and release nothing re-reads it: the four gates that read .changeset/ judge presence, bump level, workspace classification and whether a change touched one it does not own — all structure, none of them a claim in a body. Three instances were filed and worked one at a time before the mechanism was carded.

This adds a fifth reader that asks one mechanical question and hands the answer to a human.

What it does

scripts/check-changeset-claims.mjs, report-only, wired as a second job in changeset-presence.yml:

Does a pending changeset body name, in backticks, a file this change touches?

If yes, it prints the changeset, the name, the file it resolves to, and the paragraph that names it — then says in its own output that it is not claiming the paragraph is false, and that answering that is the reader's job.

Name resolution, never meaning. A backticked span is resolved against the tree at the merge base and only an unambiguous resolution counts — exactly one tracked file. package.json resolves to 47 files here and therefore names nothing definite; flow-node-config.spec-reconciliation.test.ts resolves to one. That is the whole filter, and it needs no hand-maintained denylist of common names.

The unit quoted is the paragraph, not the sentence. Both false halves of the #8617 claim sat in one paragraph, and correcting either alone would have left it asserting the same wrong thing.

Which shape, and the argument against 955

The card's two candidate shapes are not comparably priced. 1,384 changesets are pending in the tree; 957 declare a bump and will therefore publish a body verbatim; 427 are empty-frontmatter no-release declarations whose prose never reaches a CHANGELOG (re-measured on this branch's base, 689953ae9).

  • Surface them at release for a human read puts 957 bodies in front of one person, at the moment when nobody remembers which later merge falsified what. A reviewer asked to re-read 957 paragraphs re-reads none.
  • Re-read when a later merge touches what they describe is a filter over the same 957. Measured over the 25 most recent first-parent commits on main: median 1 changeset asked for per commit, mean 2.2, max 13, and 12 of 25 commits are told nothing at all. And it asks the one person who can answer cheaply — the seat whose own diff is the thing that might have falsified it.

957 → 1. That is the whole argument, and it is why this is the filter and not the wall.

The coordinate is a file name because of a measurement, not taste. Four candidates, same 25 commits, same 1,384-changeset population, counting how many pre-existing changesets each commit would have been asked to re-read:

coordinate median max
a symbol mentioned anywhere in the diff 191 309
a workspace package the diff changes a file in 25 200
an identifier declared in exactly one file the diff edits 8 56
a file the diff edits, named unambiguously 1 23

Only the last is readable. 191 paragraphs per commit is the release-time wall in a different costume. The runner-up would have caught one more historical instance, and that trade is named in the gate's own header and output rather than quietly dropped.

Which sub-shape it covers — and which it does not

Also explicitly not covered, printed in the gate's own output so nobody reads it as more: a claim about a symbol, a package, an installed dependency's version or a count; and a file named ambiguously.

Honest limit worth stating separately: on the real instance below it points at the right changeset, and the paragraph it quotes is the one containing the file name — which is not necessarily the paragraph that went false. That is the correct behaviour for a mechanism that does not judge prose, and the reason the output says "read the paragraph" rather than "this sentence is wrong".

How it reckons with the discouragement gate

The card's sharpest observation is that the one gate reading a foreign changeset exists to discourage correcting it. Nothing here weakens, narrows or carves an exemption into check-changeset-overwrite.mjs. The correction path is made explicit and additive instead: this gate's output names that gate, says it will report the correction, and says that report is that gate's own case 2 — "correcting a declaration on purpose … legitimate, and the reason this gate reports instead of failing" — which is report-only today. It also points at the two prose-only corrections already on main (the docs(changeset) commit that corrected two present-tense claims a later PR falsified, and the one that dropped the stale cardinal from the #8315 changeset), so the repair reads as precedented rather than forbidden.

The two gates are meant to fire together on a correction: one asks for the read, the other records the write.

Re-measured, since the card's framing understates it: two of the three instances' changesets have since been corrected in place, both prose-only, both leaving frontmatter untouched. The repair path is used, not theoretical.

It can fail, and it is not vacuous

Red on a real instance. PR #8615 is the later merge that falsified the #8617 changeset. Run against exactly that range, the gate names it:

Compared b1a14f28e with 9f5de79dd: 5 file(s) changed outside .changeset/, read against
800 pending declaration(s) that publish a body (1155 pending in total).
⚠️  2 pending changeset(s) describe a file this change touches.
      .changeset/6794-notify-submitter-default.md
             names `flow-node-config.spec-reconciliation.test.ts`  ->  …  (edited by this change)

Green when the condition is absent. The same gate over the commit immediately before this branch's base reports ✅ No pending changeset names a file this change touches. So does the PR you are reading.

Firing control, so a silent run is not an unread run. --audit over the whole tree: 1,384 pending declarations, 957 publishing a body, 439 of those naming at least one file in backticks, and 881 file names that resolve to exactly one tracked file (244 resolve to none or to many). The gate is silent on this PR because this PR touches none of those 881, not because it read nothing. The unit suite pairs every report with the identical fixture with the named file left alone.

Ablation, from the committed implementation, restored by hash.

leg result
unmutated, real instance b1a14f28e 2 changesets reported, including the #8617 one
invert the "this change touches it" condition 339 reported — the narrowness is the condition, and the gate is loud when it has cause
admit ambiguous file names 25-commit total 34 → 64, worst commit 13, commits over 5 1 → 5

Each mutation was proved on disk before it was read (anchor counts plus a git hash-object differing from the HEAD blob — one attempt was caught as a no-op by exactly that check and redone), each leg restored with git checkout HEAD -- <path> under an EXIT INT TERM trap, and restoration proved by the blob hash matching HEAD and git diff HEAD being empty, not by a exit code.

Cost

Measured on the tree as it stands (1,384 pending changesets): ~1.1 s median, 1.24 s max, including node startup. One tree listing, one git diff, and one batched git cat-file --batch for the whole pending queue rather than a subprocess per file. No install, no build — which is why it lives beside the declaration gate rather than in ci.yml.

Why this workflow

changeset-presence.yml carries no path filter. changeset-guard.yml can afford one because a change that modifies a changeset touches .changeset/** by definition; this gate's subject is the opposite — an ordinary source change that falsifies somebody else's pending claim, under no obligation to touch .changeset/** at all. That absence is pinned in the test suite, because adding a filter there would blind this gate with no red anywhere.

It is a second job, not a step, so a finding can never turn the declaration gate's context red. It is classified NOT_A_GATE in the Dependabot merge gate with its reason — a check that cannot say no must not be able to stop a merge. dependabot-merge-gate.test.ts is what caught the omission.

Verification

All run on 92ecb52c3.

check verdict
scripts/__tests__/check-changeset-claims.test.ts 25 passed
vitest run scripts/ (whole gate suite) 143 files, 4246 passed, 2 skipped
check-changeset-presence.mjs ✅ No source or published contract of a released package changed in this range, so no changeset is owed. (5 files changed, 0 published source, 1 changeset added)
check-changeset-no-major.mjs ✅ No changeset declares a major bump.
check-changeset-overwrite.mjs ✅ No pre-existing changeset was modified or deleted.
check-control-bytes.mjs ✅ OK (scanned 7307 tracked text file(s))
check-entry-guard.mjs ✓ 89 scripts/ file(s) — no entry guard outside the baseline
check-new-cross-file-line-citations.mjs VERDICT: 0 new citation(s) -> exit 0
check-governed-queue-guard.mjs --test <the five paths> ✅ NOT GOVERNED — none matched
eslint --no-inline-config on the changed scripts exit 0
check-changeset-claims.mjs on this PR ✅ No pending changeset names a file this change touches.

The changeset is an empty-frontmatter no-release declaration: the presence gate reports none is owed (nothing published changed), and the repo's rule is to declare that explicitly rather than to stay silent.

Not done here, deliberately

  • ⛔ No pending changeset body was rewritten. The card says plainly it is not a claim that any changeset pending today is false, and this card is about the mechanism. The gate reports nothing on this PR, so there is nothing found to report either way.
  • ⛔ check-changeset-overwrite.mjs is untouched — not a byte, not a flag, not an exemption.
  • ⛔ No new dependency, runtime or otherwise. The gate imports node: builtins and the existing base-ref/frontmatter readers from the presence gate rather than growing a third copy of them.
  • The 244 file names in pending bodies that resolve to none or to many are reported as a population reading, not as a defect list. A changeset that retired a file names it correctly and the file is correctly gone.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr


Generated by Claude Code

…hes a file it names

A `.changeset/*.md` body publishes VERBATIM into the CHANGELOG at the next
release. Between authoring and release nothing re-reads it: the four gates that
read `.changeset/` all judge structure (presence, bump level, workspace
classification, whether a change touched one it does not own), and none reads a
claim in a body. Three instances were filed and worked one at a time before the
mechanism was carded (objectui#9003).

`check-changeset-claims.mjs` asks one mechanical question — does a pending body
NAME, in backticks, a file this change touches — and hands the PARAGRAPH to the
seat whose own diff might have falsified it. It judges name resolution, never
meaning; only an unambiguous resolution counts, which needs no denylist of common
names. Report-only with no enforcing switch.

The coordinate is a file name because of a measurement, not taste: over the 25
most recent first-parent commits, matching a symbol anywhere in the diff would
have asked for a median of 191 paragraphs per commit, a workspace package 25, an
identifier declared in exactly one edited file 8, and an unambiguously named file
1 (mean 2.2, max 13, silent on 12 of 25). Runtime ~1.1s against the 1,384
changesets pending today.

Covers claims that WENT false (objectui#7721, objectui#8617); ⛔ does not cover
ones BORN false (objectui#8759), and says so in its own output. Nothing here
weakens `check-changeset-overwrite.mjs` — the report names it, says the
correction it discourages is that gate's own legitimate case 2, and points at the
two prose-only corrections already on `main`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
`Changeset Claim Re-read` runs on every pull request — the workflow it lives in
carries no path filter, deliberately — so the Dependabot gate has to say what it
is. It is report-only with no enforcing switch, so it is classified `NOT_A_GATE`
with the reason rather than enrolled as a required context: a check that cannot
say no must not be able to stop a merge.

That table exists so a new check is classified by a human instead of defaulting
into silence, and `dependabot-merge-gate.test.ts` is what noticed the omission.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
@baozhoutao
baozhoutao marked this pull request as ready for review September 11, 2026 05:18
@baozhoutao
baozhoutao added this pull request to the merge queue Sep 11, 2026
Merged via the queue into main with commit d8b4739 Sep 11, 2026
37 checks passed
@baozhoutao
baozhoutao deleted the claude/issue-9003-pending-changeset-prose branch September 11, 2026 05:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

2 participants