Repository navigation
ci(changesets): refuse breaking work until a minor is scheduled - #6889
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
|
There was a problem hiding this comment.
Thanks for closing the silent-retarget gap — deriving the target from the tree and refusing with both remedies spelled out is the right shape, and the one-to-one cleanup mapping in both directions is well tested.
Approval needs a maintainer decision first. Current spec requires a frozen, owner-approved plan before a removal ships, but it does not yet establish the derived-target admission rule or .changeset/minor-plan.json as that plan's record, and the proposed spec update for the rule has not landed. A maintainer needs to settle both: approve or land the governing spec for the gate, and confirm the plan file and its schema as the frozen-plan record (or name the record that governs instead). No rewrite is being asked for on that point — the mechanism can stand as proposed once the authority is settled.
Independent of that decision, three gate bypasses need fixes before this can merge:
- A lone breaking Changeset declared with no bump currently passes both validators instead of being refused.
- A plan file that is present is skipped entirely on trees with no pending bump, so an invalid plan can sit unchecked — the case the change sets out to prevent.
- A major bump is admitted by the new gate without any plan; only the separate 0.x check catches it today.
The refusal message should also name which signal fired (the breaking category or the declared bump) so contributors know which field to fix.
[Automated review]
Implements `spec:AST-017` FR46-FR50 inside the existing authoritative gate, `pnpm check:changesets`, which already runs in `check:repo` and `lint:strict`. No new workflow and no new CI job. The publishable packages are a `fixed` group, so one `[breaking]` Changeset moves every package to a new minor. Nothing checked that at merge time, so a release could change shape without the owner deciding it. The rule is two states: main targets a PATCH by default -> incompatible work is refused an owner SCHEDULES a minor first -> incompatible work may land The schedule is `.release/target.json`, carrying exactly `version` and `scheduledFor` and nothing else. `.release/` is already this repository's release-intent namespace — `active-release.mjs` keeps `active.json` and `plan.json` there on a release branch — but nothing resident on main said what main is heading for, so this adds the one small file that does. It cannot collide: `active-release.mjs` guards only on those two file names. Order matters and is enforced: pending Changesets never set the mode. The entry being judged cannot be its own authorization, which is the circularity that would let a release retarget itself. Fail-closed. The schedule is refused, and main stays on its patch default, when it is malformed, carries any field beyond the two, names a version that is not the minor successor of the published version, has a day that has passed, or cannot be checked because the published packages disagree. A prerelease or canary identifier is never read as the published version. Returning to the default is just deleting the file. Scope is one question. No per-change record, no cleanup or lifecycle ids, no second approval path, no manifest. FR28's deprecation lifecycle, FR31's cleanup mapping, FR37's release planning, and ordinary review continue on their own terms and are not enforced here. The base version is read only when a schedule exists or incompatible work is pending, so this gate stays quiet about state that is not its business. Generic: no version, package, surface, or contributor is named in the source, and a test asserts the refusal text contains none either. Replaces the earlier derived-target implementation, which computed the target from pending bumps and enforced a frozen `.changeset/minor-plan.json` with cleanup-id mapping. That file and its module are gone. Test plan: - `npx vitest run --root . scripts/` — 1512 passed, 83 files, including 21 cases in scripts/release-admission.test.mjs - `pnpm check:repo` — passes - end to end against the merged main tree: - no schedule -> pass, "main targets a patch (published at 0.6.4)" - + a [breaking] Changeset -> fail, with the FR50 remediation text - + schedule 0.7.0 for a future day -> pass, "main targets 0.7.0, a minor scheduled for ..." - schedule expired -> fail closed - schedule names 0.8.0 -> fail closed (next minor is 0.7.0) - schedule carries an extra field -> fail closed
f874e22 to
291da70
Compare
There was a problem hiding this comment.
Thanks for rewriting this down to two states and one tiny file — and for fixing the two bypasses from the earlier revision: a [breaking] entry with no bump is now refused by its category, and a schedule that is present is now validated even when nothing incompatible is pending. The refusal naming the target version and both ways forward is exactly what a contributor who has never read the spec needs.
Approval needs a maintainer decision first. The current spec requires a frozen, owner-approved plan before a removal ships, but it does not yet establish the patch-default admission rule, and the proposed spec update for that rule has not landed. A maintainer needs to settle both parts: land or approve the governing spec for the gate, and confirm .release/target.json with exactly version and scheduledFor as the schedule statement that spec governs (distinct from the fuller minor plan the current spec describes). No rewrite is being asked for on that point — the mechanism can stand as proposed once the authority is settled.
Independent of that decision, a few fail-closed edges need fixes before this can merge:
- The admission check itself lets a
majorbump through (it reads[breaking]orminoronly); the separate 0.x ban catches that shape today, but the gate should not depend on it, especially past 1.0. - A member of the fixed publishing group with no version in the map is silently skipped when deriving the shared base, so a schedule can be checked against a partial group.
- A schedule file containing JSON
nullis treated as if the file were absent and passes silently, while other unreadable schedules are correctly reported.
Adding tests for those three shapes (and one locking in the breaking-with-no-bump refusal) would close them out.
[Automated review]
Maintainer impact
The publishable packages are a
fixedgroup, so one[breaking]Changeset moves every package to a new minor. Nothing checked that at merge time, so a release could change shape without the owner deciding it — the release owner found out at cut time, with the work already onmain.Intended invariant
spec:AST-017FR46–FR50 (#6888):Nothing about the authoring vocabulary changes: the
[category]set, the category↔bump coupling, and every existing check behave exactly as before.Change
One pure module plus a call site in the existing
pnpm check:changesets, which already runs insidecheck:repoandlint:strict. No new workflow, no new CI job.The schedule is
.release/target.jsonwith exactly two fields:{ "version": "0.7.0", "scheduledFor": "2026-12-01" }Why
.release/: it is already this repository's release-intent namespace —scripts/release/active-release.mjskeepsactive.jsonandplan.jsonthere on a release branch. But nothing resident onmainsaid what main is heading for (.release/is untracked on main), so this adds the one small file that does. It cannot collide:active-release.mjsguards only on those two file names. The file is tracked, so scheduling a minor is a reviewable one-file commit.Order is enforced. Pending Changesets never set the mode — the entry being judged cannot be its own authorization. That is the circularity that would let a release retarget itself.
Scope is one question. No per-change record, no cleanup or lifecycle ids, no second approval path, no manifest. FR28's deprecation lifecycle, FR31's cleanup mapping, FR37's release planning, and ordinary review continue on their own terms and are not enforced here. The base version is read only when a schedule exists or incompatible work is pending, so the gate stays quiet about state that is not its business.
Generic by construction. No version, package, surface, or contributor appears in the source; a test asserts the refusal text contains none either, and the fixtures use arbitrary versions (
1.2.3).Evidence
End to end against the merged
maintree:main targets a patch (published at 0.6.4)[breaking]Changeset0.7.0for a future daymain targets 0.7.0, a minor scheduled for 2026-12-010.8.00.7.0The refusal:
node scripts/check-changesets.mjsreported changesets valid and said nothing about the release silently becoming a minor.check-changesetstests pass untouched.Narrow test cases (21)
Denied:
[breaking]under the patch default · aminorbump with a non-breaking category · schedule with an extra field · malformed version · malformed day · an impossible day (2026-02-30, whichDate.parsesilently rolls forward — caught by a round-trip check) · a version that is not the minor successor · an expired day · disagreeing published versions · a canary identifier read as the published version.Allowed: compatible work under the default · no Changesets at all · a scheduled minor admitting one or several breaking entries with no per-change record · the scheduled day itself.
Also covered: returning to the patch default when the schedule is removed; the gate staying silent about the published version when nothing asks.
Two real bugs were found by these tests during development and fixed: the impossible-date rollover above, and (in the superseded revision) a plan that went unvalidated when nothing incompatible was pending.
Scope
Testing
CONTRIBUTING.mdgains the same rule where version bumps are already explained, including that contributors never author the schedule or decide it — they state intent and a maintainer handles it.