Skip to content

ci(changesets): check Changeset coverage on pull requests with the release classifier - #7195

Merged
cixzhang merged 8 commits into
mainfrom
ci/pr-changeset-coverage
Oct 8, 2026
Merged

cixzhang merged 8 commits into
mainfrom
ci/pr-changeset-coverage

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Primary intent

Add one pull-request check that fails a change shipping to consumers without a Changeset naming the package, using the same classifier the release coverage audit runs. This is CI with a policy edge (what counts as shipped), so neither maintenance.md nor a product template fits exactly.

User or maintainer impact

  • Builders reading release notes. Shipped changes sometimes reach npm with no release note. #7125 rewrote the Layout docs that ship in @astryxdesign/cli and are read through astryx docs, and added no Changeset. The release audit treated anything under /docs/ as exempt, so nothing caught it until a fix-up Changeset landed in #7171. #7134 and #7141 did the same thing and still have no Changeset.
  • Scripts reading --json. #7154 added a [fix] Changeset saying "astryx doctor's themes check is now theme-management". That is a rename of a released doctor check id, filed as a patch. #7179 later restored the id. Nothing mechanical caught the rename.
  • Contributors now hear about it on their own pull request. The failure names the package and gives the exact command, instead of a release owner finding the gap days later.

Problem and solution fit

  1. Why did the gaps ship? The only coverage check ran at release time, with its own path list.
  2. Why didn't that list catch them? It exempted /docs/ and .md everywhere, including docs that ship inside a package. It also had no notion of released JSON ids.
  3. Why does that matter? Shipped docs and JSON ids are what builders and their scripts read. A silent change to either is a change they cannot see coming.

Change, one primary delta plus supporting pieces:

  • Primary: scripts/release/changeset-coverage.mjs, run on every pull request by the required lint job.
    • Rule 1, coverage. A changed path ships when its package is in the stable cut and the path lands in the npm tarball:

      • the cut is not private, not canary-only, not Changesets-ignored, using the release branch's own isStableReleasePackage;
      • the tarball is files, the root README, or consumer-facing package.json fields.

      That covers packages/*/src, CLI api/clients/foundation/authoring/assets (including assets/docs), and *.doc.mjs. A path is judged on both sides of the change, so a deleted shipped file counts, and a package leaving the stable cut in the same change cannot exempt its own edits. A shipped path needs a Changeset that the change adds or edits and that names the package.

      These are exempt:

      • tests, fixtures, snapshots and spec records (the existing change-scope rule, plus *.spec.ts browser tests);
      • stories, generated CHANGELOGs, and files outside the tarball;
      • private, canary-only and ignored packages (lab, charts, richtext, vega, Storybook, sandbox);
      • the docsite app, CI, and repository tooling;
      • fixed-group version-only co-bumps (AST-017 FR7).
    • Rule 2, released CLI JSON ids. It compares the latest vX.Y.Z tag with head for response type values, response typedef fields (composed typedefs resolved), golden JSON field paths, and doctor check ids. A missing id is this pull request's to classify when either:

      Ids are named by full identity (themes, DoctorCheck.fix, docs.list.data[].topic), never by a bare field name that unrelated fields share. It clears with a [breaking] Changeset naming the id or a Compatibility: paragraph naming it. Catalog values (template slugs, docs routes, theme slugs) are not compared (FR9, FR11, FR45), so docs: split Layout into a namespace with five focused guides #7125's docs-route rename in the golden is not flagged.

    • release mode. It walks a release range commit by commit through the same evaluateChange, so PR and release answers agree by construction. A fix-up Changeset that names the package and cites #N covers that pull request, matching the release process's fix-up step.

  • Supporting: small exports so the check reuses existing logic instead of copying it:
    • isStableReleasePackage from active-release.mjs;
    • isPackageReleasePath from change-scope.cjs;
    • parseWorkspaceGlobs from workspace-globs.mjs.
  • Supporting: a "When CI requires one" section in CONTRIBUTING.
  • Same gate, second shipped-surface guard: the required lint job also runs node packages/cli/scripts/generate-cli-readme.mjs --check on the merge result. The CLI README's generated tables ship in @astryxdesign/cli, and a merge from main can silently drop a generated row, such as the DEP-0006 marker #7175 added to the layout command. A workflow test pins both steps.

Authority

  • spec:AST-017 FR43: pull-request CI compares latest stable to head to find released victims, and base to head to attribute deltas; failures name the victim and the repair. FR3/FR13 make CLI machine schemas contractual. FR2 excludes never-released surfaces. FR7 exempts fixed-group co-bumps.
  • Release Process wiki, "When to create a changeset": a user-consumed documented package surface needs a Changeset; Storybook, sandbox, and tests/tooling do not.
  • Maintainer direction for this check: package-shipped docs are a shipped surface. AST-017 FR7's "Documentation-only … changes need no Changeset" is read here as repository-only documentation; the record is not changed in this PR.

Change and evidence

Replayed against the real merge commits (pr --base <sha>^ --head <sha> --released v0.6.6):

Pull request Result
#7125 ✗ @astryxdesign/cli ships shipped documentation without a Changeset → pnpm changeset:new --packages @astryxdesign/cli --category docs
#7154 ✗ doctor check id themes is in the released v0.6.6 JSON contract and missing → [breaking] naming themes, or a Compatibility: note
#6874 (removed themes) ✗ same id
#7179 (restored themes) ✓
#7155 (release bookkeeping sync) ✓

The last 150 commits on main give 143 passes and 7 failures. Every failure is a real shipped change with no Changeset naming the package: #7125, #7134, #7141, #6832 (CLI token docs changed under a core-only Changeset), #6942 (translations shipped in @astryxdesign/core/locales), #7154, and #6874. release --since v0.6.6 --until origin/main reports #7134 and #7141; #7125 counts as covered by #7171's fix-up. Current main has no released CLI JSON id missing against v0.6.6.

Expected follow-on: a translation-sync pull request now needs a @astryxdesign/core Changeset (translations are user-visible), and a change to CLI docs needs @astryxdesign/cli named even when the main change is elsewhere.

Scope

  • This PR has one primary intent.
  • Independently removable deltas were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec vitest run scripts/release .github/scripts/change-scope.test.mjs scripts/check-changesets.test.mjs scripts/release-admission.test.mjs scripts/lib: 19 files pass, including 58 new tests, with red arms for the docs: split Layout into a namespace with five focused guides #7125 and [CLI] Name the theme package on import and teach import in the theme list #7154 shapes and their passing repairs.
  • node scripts/release/changeset-coverage.mjs pr --base origin/main: this PR ships nothing to consumers and passes its own check.
  • pnpm check:repo (pre-commit) passes.
  • README guard: generate-cli-readme.mjs --check passes at this head; dropping the DEP-0006 marker from the layout row fails it (exit 1, "README generated tables are out of date").
  • Authored size: 1,920 changed lines across 7 files.

@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 8, 2026 11:16pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 8, 2026
@astracat-bot

astracat-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🔄 In progress (for maintainers only) Oct 8, 2026, 11:40 PM UTC

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. The gate catches exactly the gaps it was built for and nothing else in the recent history.

  • Replayed the classifier on the real merge commits with --released v0.6.6: #7125 fails for @astryxdesign/cli shipped documentation with the pnpm changeset:new --packages @astryxdesign/cli --category docs repair; #7154 and #6874 fail for the removed doctor check id themes with the [breaking] / Compatibility: options; #7179 (restored), #7155, #7175, #7182, #7188 and today's five core fixes all pass. The last 60 first-parent merges on main give 55 passes and those same 5 failures — no false positive among stories, tests, Lab, docsite, CI and spec-only changes. Four open heads (#7183, #7199, #6885, #6963) pass too.
  • release --since v0.6.6 --until origin/main reports the same two uncovered merges (#7134, #7141) the pull-request mode flags, so the two modes agree; current main has no released CLI JSON id missing against v0.6.6.
  • README guard: --check passes at this head, and removing the DEP-0006 marker from the layout row fails it (exit 1), which is the #7175 regression a merge dropped earlier today.
  • Tests: the 19 release/changeset/scope files pass (427 tests). The messages name the package or id, the rule, and the exact command or note.
  • Authority: FR43 already assigns pull-request CI the docs and package-files checks against latest stable with named repairs, so I read the Rule 1 scope as consistent with FR7 — a doc asset in a package's tarball is that package's shipped surface, not "documentation-only". A one-line FR7 clarification ("documentation-only" = repository documentation outside any tarball) would remove the ambiguity; a spec follow-up, not a block here.

[Automated review]

@cixzhang
cixzhang merged commit d8becc8 into main Oct 8, 2026
45 checks passed
@cixzhang
cixzhang deleted the ci/pr-changeset-coverage branch October 8, 2026 23:41

This branch was successfully deployed

1 active deployment
Preview — b3dfcca0 Deployed Oct 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant