Regenerate test fixtures during release - #83
Open
sophieleewu wants to merge 1 commit into
Open
Conversation
`yarn build` regenerates `generated/` from the live schema at https://api.us-west-2.fragment.dev/schema.graphql, but the four generated clients under `tests/fixtures/` are only refreshed by `yarn update-test-schema`, which the release workflow never ran. Both read the same live schema, so they match only when they run together. When the schema changed between the last `Update SDK queries` run and a release, the release committed a fresh `generated/` alongside stale fixtures. `tests.yml` verifies both, so the release PR failed on "Verify test schema generated files are up-to-date" while "Verify generated methods" passed. This happened on the 2.2.0 release (#82), where a `typeVersion` doc comment changed in the 15 minutes between #80 merging and the release running. Run `yarn update-test-schema` alongside `yarn build` so both sets of generated files come from the same fetch of the schema, and install the Fragment CLI, which the script needs for `fragment gen-graphql`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Problem
release.ymlrunsyarn build, which regeneratesgenerated/from the live schema athttps://api.us-west-2.fragment.dev/schema.graphql. The four generated clients undertests/fixtures/are regenerated by a different command —yarn update-test-schema— which the release workflow never ran.Both read the same live schema, so they only agree when they run together:
yarn build→gen-clientsgenerated/yarn update-test-schematests/fixtures/updateSDKQueries.ymlruns both.release.ymlran only the first.What that caused
If the schema changes between the last
Update SDK queriesrun and a release, the release commits a freshgenerated/next to stale fixtures.tests.ymlverifies both sets, so the release PR fails:Verify generated methods are up-to-date→ passes, the release rebuilt itVerify test schema generated files are up-to-date→ fails, nothing rebuilt itThis hit the 2.2.0 release (#82). The
LedgerEntryInput.typeVersiondoc comment changed server-side in the ~15 minutes between #80 merging (17:38 UTC, everything consistent) and the release running (17:53 UTC):generated/generated.tspicked up the new wording; all four fixtures kept the old one. The fixtures had to be regenerated by hand to unblock the release.Fix
Run
yarn update-test-schemaalongsideyarn buildso both sets of generated files come from the same fetch of the schema, and install the Fragment CLI, whichscripts/update-test-schema.shneeds forfragment gen-graphql(matching howupdateSDKQueries.ymlinstalls it).peter-evans/create-pull-requestalready commits everything in the working tree, so any regenerated fixtures ride along in the release PR automatically.Notes
tests/fixtures/test-schema-queries.graphqlcomes from the statictest-schema.json, not the live schema, so it doesn't drift; it's regenerated here anyway since it's part of the existing script.🤖 Generated with Claude Code