Single-source codegen freshness checks via pnpm codegen scripts#7732
Draft
dmerand wants to merge 3 commits into
Draft
Single-source codegen freshness checks via pnpm codegen scripts#7732dmerand wants to merge 3 commits into
dmerand wants to merge 3 commits into
Conversation
Contributor
Author
This was referenced Jun 5, 2026
09cebb5 to
5d90b53
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

About this stack
This stack came out of reviewing recent contributor and agent sessions in
Shopify/cli, where the same avoidable friction kept recurring: failures found only after pushing, generated files regenerated by hand, local checks drifting from what CI actually enforces, and setup conventions relearned every time. The goal is to make the local dev loop mirror CI and keep the two single-sourced so they can't drift — then document it so people and agents stop rediscovering it.WHY are these changes introduced?
Two of our PR checks —
Check graphql-codegen has been runandCheck OCLIF manifests & readme & docs— spell out their regenerate-and-verify steps right insidetests-pr.yml. There's no local command that does the same thing, so the usual way you learn a generated file is stale is by watching CI go red. Then you re-runrefresh-manifests,graphql-codegen, andbuild-dev-docsone at a time and push again. In effect the "what to regenerate" list lives in two heads — the workflow's and yours — and they drift.WHAT is this pull request doing?
Making
package.jsonthe one place that defines codegen freshness, for people and CI alike:pnpm codegenregenerates everything.pnpm codegen:check:graphql/:oclifregenerate, then check the tree came back clean.bin/check-codegen-clean.jsowns each check's paths and the message you see when it fails (now pointing you atpnpm codegen). The two gate jobs simply call these scripts instead of repeating the steps inline.It's deliberately a no-op in behavior — same generators, same order, same messages — and the job names, runners, and the oclif build step are untouched, so required checks and the merge queue don't notice the difference. Dev tooling only, nothing user-facing.
How to test your changes?
pnpm codegenshould produce no diff (it's idempotent).pnpm codegen:check:oclif— it fails and points you atpnpm codegen; running that puts you back to clean.Notes
codegen:check: the whole-repogit statuschecks step on each other in a single working tree, which is why CI keeps them as separate, fresh-checkout jobs.pnpm codegenisn't quite idempotent onmaintoday — it drops some orphanedconfig:autoupgradedocs that the OCLIF gate doesn't watch (it only checksgenerated/*.json). That's pre-existing and worth a separate fix.Post-release steps
None.