Skip to content

Check stable-line pull requests with Patch QA and Patch provenance - #9196

Merged
craigmichaelmartin merged 16 commits into
mainfrom
patch-qa-and-provenance
Dec 4, 2026
Merged

craigmichaelmartin merged 16 commits into
mainfrom
patch-qa-and-provenance

Conversation

@craigmichaelmartin

@craigmichaelmartin craigmichaelmartin commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Patch releases ship from stable/X.Y as fixes land, instead of waiting for the next minor. Two things then need checking on every pull request into a stable line, by machine rather than by memory:

  • that the line only takes changes main already has, plus its own version bumps;
  • that the tarball a release would publish installs and runs on the platforms users have, and ships the same files as the line's last release.

Today a stable line's pull requests run unit tests, but nothing installs the packed CLI or checks where a backport's changes come from. After a release publishes, nothing checks the published package either.

WHAT is this pull request doing?

  • Patch QA (patch-qa.yml), on pull requests into stable/**, including ones retargeted there:

    • builds the @shopify/cli tarball the way a release does, through .github/actions/build-cli-tarball, which Release QA package now uses too. Release QA package loads the action from its own commit, so a run from main still builds lines that don't have it, such as stable/4.9;
    • installs it with npm install -g on ubuntu-latest, ubuntu-24.04-arm, windows-latest, windows-11-arm and macos-latest;
    • runs the checks that need no Shopify account (.github/scripts/smoke-test-cli.sh): version, help, the app, theme and Hydrogen topics, the JSON output schemas of hydrogen check and app info (which load those commands' code, as help doesn't), and theme init (from a pinned Skeleton release), theme check and theme package;
    • compares the tarball's files with the line's last release on npm, in a job of its own. Different files fail. A different number of hashed bundle chunks only warns, since a real patch can split the bundle differently.
  • Patch provenance (patch-provenance.yml), on pull_request for stable/**. Each stable line runs its own copy, and the check never checks out or runs the pull request's code: it only reads commits. It passes only for:

    • a backport that builds on the line's head, adds only patch changesets for the fixed version group, changes no path outside main's mirrored files, and whose tree is exactly what landed on main when its changesets first did, applied to the line's head: the landing's diff against its first parent, so a pull request's own earlier commits never count. A commit that batches a fix with other changes therefore goes to a maintainer. That landing must come after the line's cut from main, and main must still have each changeset as a patch (or have had, when a release consumed it) and still contain all of the landing's change: applying the landing to main's head again must change nothing outside changesets, so a revert, also one at a path main has since moved the file to, a later change to the same lines, or any later change to a file the landing added goes to a maintainer. A changeset main added more than once since the cut (a revert and a reland) fails, and none of the landing can be on the line already: a changeset the line has had since its cut fails, and undoing the landing on the backport must give back the line's head exactly, so a line that already has any of the landing's changes, even one of several in a file, fails. A fix is never released twice;
    • the line's Version Packages pull request, when it's one commit on the line's head that moves every package in the fixed group up one patch version within the line's own X.Y, consumes the line's pending changesets, all of them patch, sets version.ts and every oclif manifest to the new version, and otherwise changes only package versions and pins, the lockfile's workspace specifiers, and changelog sections exactly as the line's own .changeset/changelog.cjs writes them for the consumed changesets and dependency updates. Every pin of a released package must move to its new version, and the lockfile must link each workspace package at the version its dependents pin. Only lines that use that formatter are supported.

    Any other pull request into a stable line fails it, and a maintainer reviews and merges it. A pull request that changes .github/ runs its own version of these checks, so they vouch for nothing on it: a maintainer reviews it either way.

  • Release smoke test: after Publish to npm succeeds, release.yml installs the published version from npm on Linux, Windows and macOS and runs the same checks.

Both workflows are inert on main (they only trigger for pull requests into stable/**). They land here first so new stable lines inherit them, then on stable/5.2.

How to manually test your changes?

  • Run the smoke checks against a published CLI: npm install -g @shopify/cli@5.1.0 --prefix /tmp/shopify-cli-smoke, put /tmp/shopify-cli-smoke/bin first on PATH, then bash .github/scripts/smoke-test-cli.sh 5.1.0.
  • The provenance rules were run locally against past and constructed pull requests:
    • Backports: on stable/5.1's head, a0c9f53 applied whole passes. Only its changeset fails, and so does a9f1d13 without its minor changeset, or with only one of the fixes it batches. Hand backports such as [5.0] Backport: fetch the app client secret only in commands that use it #9145 and Fix Cloudflare tunnel shutdown errors on Windows (5.0) #9066 fail. a23c474 replayed onto stable/4.9, which released that fix in 4.9.4, fails, and so does a0c9f53 onto a line that already has its code under another changeset. Support JSON flags for the theme language server #9006's first commit, replayed onto a line cut at its base, fails: its changeset became a minor before the pull request merged. So do backports whose changeset main later removed, made a minor (before or after a release consumed it), or removed and added again, and backports of a fix main later reverted, while Update from World (5.0.0) #9164 onto stable/5.0, whose changeset the 5.1.0 catch-up consumed, passes. A backport also fails when main later moved a file the fix changes and reverted the fix there, when main later replaced a file the fix added, or when the line already has part of the fix's change to a file; it passes when main only moved the file, or when the line has its own change elsewhere in that file.
    • Version Packages: a real 5.1.1 bump made locally with changeset version passes. Versions of it with an entry dropped, a line added, a dependency version changed, an entry in the wrong package, @shopify/plugin-cloudflare's @shopify/cli-kit pin or its lockfile specifier left at 5.1.0, or version.ts or both oclif manifests left at 5.1.0, fail, and so do a 5.1.1 bump that consumes a minor changeset and the same 5.1.1 bump proposed into a stable/5.2. Version Packages - stable/5.1 #9186 (5.1.0, a minor) fails, and Version Packages - stable/5.0 #9064 and Version Packages - stable/5.0 #9158 fail because stable/5.0 uses another changelog formatter.
  • The file comparison: 4.9.2 against 4.9.1 warns about one fewer chunk, and 5.1.0 against 5.0.2 fails.
  • The backport of this pull request to stable/5.2, [stable/5.2] Check stable-line pull requests with Patch QA and Patch provenance #9217, runs Patch QA on its own head. Patch provenance fails there, as it should for a change that isn't a backport of main.

🤖 Generated with Claude Code

Patch QA builds the @shopify/cli tarball a release of the pull request's head would publish,
installs it on Linux, Windows and macOS (x64 and arm64), runs the checks that need no Shopify
account, and fails if its files differ from the line's last release.

Patch provenance passes only for a backport whose changes main already has (pinned to the main
commit that added its patch changesets) and for the line's Version Packages pull request when it
only versions the packages on top of the line's head. It runs from the stable line's own copy of the
workflow and reads commits without running the pull request's code.

After a release publishes, release.yml installs it from npm on Linux, Windows and macOS and runs the
same checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@craigmichaelmartin
craigmichaelmartin requested a review from a team as a code owner November 25, 2026 13:29
@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Nov 25, 2026
craigmichaelmartin and others added 2 commits November 25, 2026 08:31
A JSON comparison of package.json and oclif manifests misses changes that parsing normalizes
away, such as a duplicated key. Require the same lines, with only version lines changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A backport now has to build on the line's head, and each file it changes has to be, whole, what
the main commit that added its changesets does to that file when applied to the line. That commit
must have reached main after the line's cut. Before, a backport could reuse an old changeset to
bring back old main code, or apply only part of a main commit's change.

A Version Packages pull request's new changelog section may only hold the consumed changesets'
entries and dependency updates, and no versioned file may change mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/workflows/patch-qa.yml Resolved
Comment thread .github/scripts/smoke-test-cli.sh Resolved
Comment thread .github/workflows/patch-qa.yml Resolved
Comment thread .github/scripts/smoke-test-cli.sh Resolved
Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/workflows/patch-qa.yml Resolved
Comment thread .github/workflows/release.yml Resolved
craigmichaelmartin and others added 4 commits November 30, 2026 08:49
- Patch QA also runs when a pull request is edited, so a pull request retargeted to a stable line
  gets it. It runs in full on every edit: a skipped run would count as passing.
- The file comparison runs in its own job, so a difference no longer stops the platform installs.
  A difference only in the number of hashed bundle chunks warns instead of failing.
- Patch QA and Release QA package build the tarball through one composite action.
- The smoke test pins the Skeleton theme release instead of following its latest tag, and no
  longer turns off auto-upgrade, which CI=1 already skips.
- The release smoke job gets 60 minutes: the wait for npm alone can take 30.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tter

Patch provenance now builds each package's new changelog section with the changelog formatter at
the line's head, never the pull request's, and requires the section to match it, apart from the
order of entries. A missing entry, an extra line, a wrong dependency version or an entry in the
wrong package fails. A line whose changesets config doesn't use ./changelog.cjs isn't supported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pull_request_target always loads the workflow from main, whatever the pull request's base, and
from December 2, 2026 public repositories block it unless an Actions event policy allows it. On
pull_request each stable line runs its own copy. The check still only reads the pull request's
commits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A backport passed when every file it changed matched main's commit, so one that left files out
could ship a changeset without its fix, or one change of a batched commit without the changeset
that makes it a minor. Its tree must now be exactly main's commit applied to the line's head, so a
fix that reached main together with other changes goes to a maintainer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@gonzaloriestra gonzaloriestra 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.

Thanks for fixing the previous suggestions! But my agent found a few more 😅

Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/workflows/patch-provenance.yml Resolved
craigmichaelmartin and others added 3 commits December 2, 2026 07:43
Release QA package ran the shared build action from the commit it builds, and stable/4.9 and
stable/5.0 don't have it, so a run from main for those lines stopped there. It now checks out the
action from the workflow's own commit, and still builds the requested commit with that commit's own
dependency setup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A backport fails when the line has had one of its changesets since its cut, or when main's commit
  changes anything the line already has, so a fix backported before, by hand or under another
  changeset, isn't released twice.
- A Version Packages pull request fails when it consumes a minor or major changeset, or releases a
  version outside the line's own X.Y.
- Every workspace package's pins of a released package must move to the new version, whether or not
  its package.json changed, and pnpm-lock.yaml must link each workspace package at the version its
  dependents pin.
- The header says that a pull request that changes .github/ runs its own version of these checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A changeset can reach main on its own, for example when it's added after the fix that landed
without it. A backport of that commit alone passed as all of main's commit, and would release a
changelog entry for code the line may not have. It now fails, and a maintainer backports the fix
together with its changeset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@gonzaloriestra gonzaloriestra 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.

Thanks! A few more comments 🫣

Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/scripts/smoke-test-cli.sh Resolved
craigmichaelmartin and others added 2 commits December 3, 2026 11:33
Topic help comes from the oclif manifest, so `shopify hydrogen --help` passed without importing
Hydrogen. The smoke test now also prints the JSON output schemas of `shopify hydrogen check` and
`shopify app info`, which load those commands' code from the plugins that provide them and need no
account, and checks that each is the command's own schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed versions

- A backport's origin is the landing on main that added its changesets: the commit on main's
  first-parent chain since the line's cut, compared with its first parent. A merged pull request's
  own commits no longer count, since one of them can carry a changeset that the merge changed.
- main must still have each of the backport's changesets as a patch for the fixed group, unless a
  release's catch-up consumed it, and a changeset main added more than once since the cut (a revert
  and a reland) fails.
- A Version Packages bump must set version.ts and every oclif manifest to the new version, whether
  or not it changed them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/workflows/patch-provenance.yml Resolved
craigmichaelmartin and others added 2 commits December 3, 2026 12:21
…s last bump

- A changeset a release's catch-up consumed must have been a patch for the fixed group in main's
  last copy before that release.
- main's head must still have all of the landing's change: applying it to main's head changes
  nothing outside its changesets, and every file it added is still there. A revert, or a later change
  to the same lines, fails, and a maintainer decides whether the line takes the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/workflows/patch-provenance.yml Resolved
Comment thread .github/workflows/patch-provenance.yml Resolved

@gonzaloriestra gonzaloriestra 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.

Thanks!

@craigmichaelmartin
craigmichaelmartin added this pull request to the merge queue Dec 4, 2026
Merged via the queue into main with commit e142e54 Dec 4, 2026
29 checks passed
@craigmichaelmartin
craigmichaelmartin deleted the patch-qa-and-provenance branch December 4, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants