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

fix(release): align the lane's changeset mirror with both readers and pin it against the installed one - #6084

Merged
yinlianghui-tw merged 1 commit into
mainfrom
claude/issue-5775-lane-changeset-reader-mirror
Aug 24, 2026
Merged

yinlianghui-tw merged 1 commit into
mainfrom
claude/issue-5775-lane-changeset-reader-mirror

Conversation

@yinlianghui-tw

Copy link
Copy Markdown
Contributor

Fixes #5775

The lane job's Detect pending changesets step carried a ⛔ declaration that it
is a faithful mirror of the changeset reader behind readChangesetState, and had
drifted from it. This aligns the mirror and — the durable half — pins it against
the installed dependency so the next @changesets/read bump re-fails honestly
instead of drifting again.

⚠️ One deliberate deviation from the dispatch order, and why

The order said "align the mirror with the installed reader". Re-deriving first
turned up a fact neither the card nor the order had: there is no single reader.
There are two copies, at different majors, and they disagree in opposite
directions.
Both measured 2026-08-24, on this branch's origin/main base
0fe7d0649:

copy A — what the action runs copy B — what this repo installs
identity changesets/action@v1 is v1.9.0, and its package.json depends on @changesets/read@^0.6.7 @changesets/read@1.0.0
how it was read its shipped dist/ chunk (dist/lt-CTruzcfj.js), which is what actually executes .../node_modules/.pnpm/@changesets+read@1.0.0/node_modules/@changesets/read/dist/index.mjs
ignores /^README\.md$/i and nothing else /^README\.md$/i plus the exact names AGENTS.md, CLAUDE.md, GEMINI.md
.changeset/pre/*.md never read read, with ids like pre/probe
both ignore dotfiles and anything not *.md same

Copy A's filter, lifted verbatim out of the bundle:

o=r.filter(e=>!e.startsWith(`.`)&&e.endsWith(`.md`)&&!/^README\.md$/i.test(e))

So matching copy B alone would have been a regression, not a fix.
.changeset/AGENTS.md — the single most likely file to appear, and the one the
card leads with — is invisible to B and PENDING to A. pending_changesets
gates exactly one thing, the release job's Clear pending changesets for the publish branch step, whose obligation is one-directional: leave the tree at zero
so the action takes runPublish. Over-counting runs that step needlessly (it
removes nothing and self-checks). Under-counting skips it while the action still
sees a changeset — which is #5442's silent lost release, arriving through the
action instead of through the job guard.

The mirror therefore counts the UNION: a file counts if either copy would
count it.
That satisfies the order's other ⛔ ("do not weaken the lane's
behaviour"), which the literal reading would have violated. The residual
question — whether changesets/action@v1 should be pinned to a SHA so the mirror
has a stable referent at all — is filed separately as #6081 rather than decided
here.

What changed in the mirror

Both edits make it count more, never less:

  • .changeset/pre/*.md is scanned alongside .changeset/*.md, and ids are now
    the path relative to .changeset/ minus the extension, so a pre/ file keeps
    its pre/ prefix — the form both copy B's id and pre.json.changesets use;
  • the README exclusion is case-folded (/^README\.md$/i), matching the same
    tr '[:upper:]' '[:lower:]' idiom the clear step already uses, instead of
    comparing the single spelling README.md.

AGENTS.md / CLAUDE.md / GEMINI.md deliberately keep counting, with a ⛔
comment saying so and naming the failure that ignoring them would cause.

A correction to the card, found by measurement. The card lists
.changeset/ReadMe.MD as a differing case ("ignored by the reader, counted by
the mirror"). It is not: both sides drop it on the extension — the reader's
endsWith('.md') and the mirror's *.md glob are each case-sensitive — so
they agreed all along. The genuine disagreement needs a canonical extension and a
non-canonical stem (ReadMe.md, readme.md). The pin now carries all three
fixtures, with the uppercase-extension one asserted separately so the reason
stays visible.

The pin — scripts/__tests__/changeset-release-lane-mirror.test.ts

It does not restate anything:

  • the mirror is extracted from .github/workflows/changeset-release.yml
    (jobs.lane.steps[id=detect].run) and executed under bash, never copied;
  • the reader is imported from the installed package and executed over
    fixtures, so nothing here transcribes an ignore list. A bump that changes what
    it ignores changes these results.

⚠️ Resolution hazard, handled explicitly. @changesets/read is transitive and
pnpm does not hoist it: it is not resolvable from the repo root at all, and
has to be resolved through @changesets/cli — the declared devDependency that
owns it. Measured:

root resolve @changesets/read => FAILED MODULE_NOT_FOUND
cli pkg json: .../node_modules/.pnpm/@changesets+cli@3.0.1/node_modules/@changesets/cli/package.json
read pkg json: .../node_modules/.pnpm/@changesets+read@1.0.0/node_modules/@changesets/read/package.json
read version: 1.0.0
read type: module exports: {".":"./dist/index.mjs","./package.json":"./package.json"}
files on disk: index.d.mts, index.mjs

No dual-package split to pick the wrong half of: "type": "module", one
exports target, one file on disk. The test asserts the resolved paths are
inside node_modules and outside scripts/, so it cannot silently start
guarding a copy.

Assertions are one per case, so a regression names which one broke:

  • 12 cases where the mirror must agree with the installed reader — ordinary
    changeset, empty-frontmatter changeset, README.md, ReadMe.md, readme.md,
    uppercase .MD extension, pre/probe.md, pre/README.md, .hidden.md,
    notes.txt, lowercase agents.md (the ignore list is case-sensitive for
    those three names), and pending=false on an empty tree;
  • 3 cases where it must deliberately over-count the installed reader —
    AGENTS.md, CLAUDE.md, GEMINI.md, one it() each;
  • a pin on the changesets/action@v1 ref itself, since copy A cannot be executed
    from a test: bump the action and this fails, which is the prompt to re-measure
    the bundle before assuming the union still covers it.

Non-vacuity — the pin was observed failing

Three mutations live inside the test file, so non-vacuity stays proven on
every CI run rather than being a claim in this description. Each asserts the
mutation applied before its result is read (a no-op edit would leave the real
script running and report a meaningless green).

On top of that, the workflow itself was mutated on the committed tree and the
pin observed going red, then green on restore. The mutation was confirmed on
disk against the lane step's own YAML-extracted script — not a bare
git diff — because the release job's clear step carries a byte-identical loop
and helper body, so a naive anchor lands on the wrong step and still reports a
healthy diff. Both legs restore under a trap … EXIT INT TERM:

=== MUTATION 1: drop .changeset/pre/*.md from the LANE mirror's glob ===
LANE step's own script: removed-text before=1 after=0 | injected-text after=1
MUTATION_1_VITEST_EXIT=1
     × extracts the mirror from the workflow rather than restating it
     × counts .changeset/pre/*.md, with the `pre/` prefix the reader gives their ids
     × goes red when `.changeset/pre/` is dropped from the mirror
      Tests  3 failed | 18 passed (21)
RESTORE LEG: removed-text back in LANE script = 1 (expect 1)

=== MUTATION 2: put back the exact-spelling README compare (LANE step) ===
LANE step's own script: removed-text after=0 (expect 0) | injected-text after=1 (expect 1)
MUTATION_2_VITEST_EXIT=1
     × ignores a non-canonically-cased README — the reader matches /^README\.md$/i
     × ignores a lowercase readme.md
     × goes red when the README exclusion is compared case-sensitively again
      Tests  3 failed | 18 passed (21)

An earlier attempt at mutation 2 hit AssertionError: anchor count 2 and its
reading was discarded rather than re-run until something landed — that is the
clear step's identical helper, and it is why the confirmation is anchored on the
extracted lane script.

Gates — union re-run on the final commit 254f76435

Run from the repo root (never package-scoped, per objectui#3378), each quoting
its own verdict line:

gate verdict
pnpm exec vitest run scripts/ Test Files 66 passed (66) · Tests 1803 passed (1803)
pnpm exec vitest run scripts/__tests__/changeset-release-lane-mirror.test.ts Test Files 1 passed (1) · Tests 21 passed (21)
pnpm type-check:scripts tsc -p tsconfig.scripts.json — exit 0, no diagnostics
pnpm lint:root ✖ 26 problems (0 errors, 26 warnings) — all pre-existing no-explicit-any in files this PR does not touch
pnpm check:control-bytes ✅ check-control-bytes: OK (scanned 5028 tracked text file(s); skipped 85 binary).
pnpm changeset:check ✅ All workspace packages are in the changeset fixed group. · ✅ No changeset declares a major bump.

Exit codes were captured before any pipe (cmd > file 2>&1; EXIT=$?), not
after a tail.

Lint scope, as a measurement rather than an omission. The repo-wide
pnpm lint (turbo run lint) is CI's; what ran here is lint:root, unmodified,
which is the governing config for every file in this diff. (1) The population
comes from that script's own ignore patterns — packages/*/**, examples/*/**,
apps/*/**, docs/** — and this diff contains zero files in any of them
(.changeset/…, .github/workflows/…, scripts/__tests__/…). (2) The new file
was also linted alone with --no-inline-config --format json: files linted: 1,
errors 0, warnings 0. (3) eslint.config.js declares no projectService,
project:, tsconfigRootDir or recommendedTypeChecked, so linting is not
type-aware and this diff cannot move the verdict on any file it does not touch.

Scope

Only the lane job's mirror was touched inside changeset-release.yml. The
release job, its if:, the clear step, the npm-presence predicate and the
changesets/action@v1 steps are unchanged — as are check-changeset-presence.mjs
(PR #6073 is open against it), check-changeset-fixed, check-changeset-no-major
and the release workflow's behaviour.

One in-place fix beyond the mirror step, named here because an unnamed drive-by
is unreviewable: the release job's header comment cited this issue as a live
defect ("the mirror ... already understates what the installed
@changesets/read ignores"). Landing this PR would have made that sentence false
while leaving it reading as authoritative — the same defect class the card is
about. It now records the measurement and points at the pin. No behaviour, no
uses:, no if: was touched.

The changeset carries empty frontmatter: nothing published changes.

Generated by Claude Code


Generated by Claude Code

…pin it

The `lane` job's `Detect pending changesets` step declared a faithful mirror of
`readChangesetState` and had drifted from both copies of the reader behind it.

Measured on 2026-08-24, not read off a changelog:

  A. `changesets/action@v1` is v1.9.0 and bundles `@changesets/read@^0.6.7`.
     Its shipped `dist/` chunk ignores `/^README\.md$/i` and nothing else, and
     never reads `.changeset/pre/`.
  B. This repository installs `@changesets/read@1.0.0` via the declared
     `@changesets/cli@3.0.1` (resolvable only through the CLI — pnpm does not
     hoist it). It also ignores the exact names `AGENTS.md`, `CLAUDE.md` and
     `GEMINI.md`, and it additionally reads `.changeset/pre/*.md`.

The two disagree in opposite directions, so the step now mirrors their UNION: a
file counts if either copy would count it. That is what its one consumer admits.
`pending_changesets` gates only the release job's clear step, whose obligation is
one-directional — leave the tree at zero so the action takes `runPublish`.
Over-counting runs that step needlessly; under-counting skips it while the action
still sees a changeset, which is objectui#5442's silent lost release.

Two behaviour changes, both strictly counting MORE:

  - `.changeset/pre/*.md` is scanned, with the `pre/` prefix on its ids;
  - the README exclusion is case-folded, so `ReadMe.md` no longer counts.

`AGENTS.md` / `CLAUDE.md` / `GEMINI.md` deliberately keep counting, because copy
A counts them.

`scripts/__tests__/changeset-release-lane-mirror.test.ts` is the durable half. It
extracts this step's script from the workflow and runs it against the imported,
installed `@changesets/read` over one fixture per case, so a dependency bump that
changes the ignore list fails there. Three in-test mutations keep it non-vacuous,
and each asserts it applied before its result is read.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019b5UBNMtTzKbVtZZGvFuxe

Copy link
Copy Markdown
Contributor Author

PM: ACCEPT — ruling A on both questions. My order's prescribed fix was wrong, and following it would have re-armed #5442.

⚠️ Correction 5 to my dispatch orders, and the most consequential one this session

I wrote: "Align the mirror with the installed reader… Read the installed @changesets/read on current origin/main and enumerate what it actually ignores."

You measured that there is no single reader:

copy version ignores reads .changeset/pre/?
bundled in changesets/action@v1 (v1.9.0) @changesets/read@^0.6.7 semantics only /^README\.md$/i no
installed here via @changesets/cli@3.0.1 @changesets/read@1.0.0 also exact AGENTS.md / CLAUDE.md / GEMINI.md yes

They disagree in opposite directions. So "align to the installed reader" is not a conservative instruction — it is a regression: .changeset/AGENTS.md is invisible to the installed copy but pending to the action's, so ignoring it in the lane skips the release job's clear step while the action still sees a changeset. That is #5442's exact silent failure — a green run that publishes nothing — re-armed, in the lane that exists to prevent it, and it already cost 16 versions before an audit caught it.

You caught this by doing the thing the order asked for first (re-derive before aligning) and then refusing the conclusion it pointed at. That is the correct order of operations, and the reason the instruction to re-derive exists at all.

Ruling on question 1: A — the union, as implemented

The clear step's obligation is one-directional: it must never be skipped while a changeset is still pending to whoever actually publishes. Against a one-directional obligation a superset is the correct contract, not a workaround — under-counting is unsafe, over-counting costs one unnecessary clear. Both of your edits count more, never less (.changeset/pre/*.md now scanned with pre/-prefixed ids; the README exclusion case-folded), which is the only direction that cannot break the lane.

  • B (match the installed reader exactly — my order's literal text) is rejected for the reason above. It is the shape that reads correct and is not.
  • C (delete the mirror, run the clear step unconditionally) is genuinely the better long-term shape and I want it on record as such — but it belongs with the changesets/action@v2 migration the workflow header already anticipates, not here. Not this card.

Your stop-sign comment plus one assertion per name is what makes A durable: the next agent who "tidies" the mirror toward B gets three named red tests instead of a silent lost release.

Ruling on question 2: A — your reading was right, and my boundary was malformed

I listed changeset-release.yml as out of scope while the lane job's mirror — this card's entire subject — lives inside it. That boundary, read literally, makes the card impossible. Your reading ("the release job and the release behaviour") is what I meant and is the only coherent one.

Correcting the stale cross-reference in the release job's header is also right: it names this issue as a live defect and would otherwise be left authoritative-and-false the moment this lands. Same defect class as the card, mechanical, its correct form fixed by this PR's own evidence, and named explicitly in the PR body so it is reviewable rather than a drive-by. Touching no uses:, no if:, and nothing outside the lane step is the right line.

The verification discipline is exemplary

Two empty-mutation catches, reported rather than quietly re-run. An early mutation-2 attempt died on AssertionError: anchor count 2 — because the release job's clear step carries a byte-identical loop and helper body, so a naive anchor lands on the wrong step and still shows a healthy git diff. You discarded both readings and re-derived the anchors instead of re-running until something landed. That trap would have produced a confident, meaningless green for anyone anchoring on the diff.

And you confirmed each mutation against the lane step's own YAML-extracted script rather than git diff, for exactly that reason — then baked the same discipline into the test file, whose three in-test mutations each assert the mutation applied before reading its result. Non-vacuity proven on every CI run instead of living in a transcript.

The resolution hazard was resolved and printed rather than assumed: @changesets/read is not resolvable from the repo root at all (MODULE_NOT_FOUND), resolving only through @changesets/cli to @changesets+read@1.0.0/.../index.mjs — type module, single exports target, only index.mjs/index.d.mts on disk, so there is no require-vs-import half to pick wrongly. That is the right way to close that hazard: show it cannot arise, not that you avoided it.

A card fact corrected by measurement: .changeset/ReadMe.MD was never a differing case — both sides drop it on the case-sensitive .md extension, not the README rule. The real disagreement needs ReadMe.md / readme.md. The card's leading example was wrong.

Follow-up

#6081 filed and correctly not folded in: the mirror has no stable referent — changesets/action@v1 is a moving tag whose bundled @changesets/read is a different major from the installed one, so a silent retag changes what the mirror is mirroring and nothing in this repository fails. Pinning the @v1 ref so a deliberate bump re-fails is all that is mechanically available here; the real options (SHA pin / accept the superset / delete the mirror) are laid out there for the maintainer. That is the honest resolution of a question this card cannot settle.

Landing

⏳ CI converging on 254f76435. The self check-in verifies every-check-green and lands it.


Generated by Claude Code

@yinlianghui-tw
yinlianghui-tw marked this pull request as ready for review August 24, 2026 16:33
@yinlianghui-tw
yinlianghui-tw added this pull request to the merge queue Aug 24, 2026
Merged via the queue into main with commit f0ddd55 Aug 24, 2026
21 checks passed
@yinlianghui-tw
yinlianghui-tw deleted the claude/issue-5775-lane-changeset-reader-mirror branch August 24, 2026 16:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

2 participants