Repository navigation
feat(graphql): export schema SDL artifact, add drift guard and breaki… - #476
Conversation
|
@Bigclavsfx Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
The drift guard this PR adds caught its own artifact going stale:
× committed schema.graphql matches the code-defined schema exactly
Between this branch being cut and now, Divinity-Labs#380 (invalid/unknown/empty pair
distinctions), Divinity-Labs#381 (the oracle query and OracleSourceStatus enum) and
Divinity-Labs#390 (from/to on getPriceHistory) all changed the code-defined schema.
npm run graphql:schema:gen
Which is the guard doing exactly what it was written for, on its first
outing.
graphqlSchemaDrift.test.ts: 6 passed.
Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB
Miracle656
left a comment
There was a problem hiding this comment.
Merging. This closes #372 and the guard proved itself before it even landed.
The drift test caught its own artifact going stale, which is the best possible demonstration of why it exists:
× committed schema.graphql matches the code-defined schema exactly
Between your branch being cut and now, #380 (invalid/unknown/empty pair distinctions), #381 (the oracle query and the OracleSourceStatus enum) and #390 (from/to on getPriceHistory) all changed the code-defined schema. The committed SDL described a GraphQL API that no longer existed — in under a day. I regenerated it with npm run graphql:schema:gen and pushed that to your branch; 6 tests pass.
That is the whole argument for this PR, delivered by accident. A schema living only as a template literal inside src/api/graphql.ts drifts from what clients were generated against and nothing says so.
Three tests, three different jobs, which is what makes this more than a file dump:
committed schema.graphql matches the code-defined schema exactly— the drift guard.regenerates deterministically— without it, a generator with unstable ordering makes the guard fail at random and someone eventually deletes it.produces valid GraphQL SDL that client generators and validators can parse, asserting a realQueryandSubscriptiontype — so the artifact is actually consumable, not just byte-equal to itself.
That middle test is the one people skip, and it is the one that keeps the other two alive.
The repo already had this pattern for .env.example and for the OpenAPI document; GraphQL was the surface without it.
Closes #372
Summary
Related issue
Type of change
Checklist
npx tsc --noEmitpassesnpm run buildpasses