feat: GraphQL schema drift validator with CI and query fixes#77
Merged
jonathanprozzi merged 7 commits intomainfrom Apr 1, 2026
Merged
feat: GraphQL schema drift validator with CI and query fixes#77jonathanprozzi merged 7 commits intomainfrom
jonathanprozzi merged 7 commits intomainfrom
Conversation
Introspection-based validator that catches field-level bugs in documented GraphQL queries (wrong fields, missing selection sets) without executing queries. Validates against committed schema snapshots from both mainnet and testnet endpoints. - Phase 1: Schema introspection + type map building (--update-schema) - Phase 2: Query extraction from playground exports + code blocks - Phase 3: Minimal recursive descent GraphQL parser for field walking - Phase 4: Reporting with mainnet errors (blocking) + testnet warnings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- npm run validate-queries: full validation against both schemas - npm run update-schema: refresh schema snapshots from live endpoints - lint-staged: runs query validator on graphql-api and tutorial query docs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two jobs: - PR checks: validates queries against committed snapshots on doc changes - Schema drift: nightly cron + repository_dispatch (Phase 4 ready) fetches fresh schemas, opens draft PR if drift detected Triggers: pull_request, schedule (8am UTC), repository_dispatch, workflow_dispatch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix all documented queries to match the live mainnet schema:
- accounts: remove non-existent created_at, following, follower fields
- signals: atom→term, block_timestamp→created_at, shares_delta→delta
- terms: term_id→id, label/image/creator→atom { label image creator }
- events: block_timestamp→created_at, remove sender_id/receiver_id/data
- vaults: atom/triple→term relationship
- deposits: assets_for_receiver→assets_after_fees, shares_for_receiver→shares
- redemptions: assets_for_receiver→assets, shares_from_receiver→shares
- PinOutput: remove hash/name/size, keep only uri
- share_price_changes: old_price/new_price/price_change→share_price
- stats: updated_at→last_updated
- fee_transfers: block_timestamp→created_at
- PnL charts: add selection sets for data field (AccountPnlChartPoint, etc.)
Validator now passes with 0 mainnet errors (19 testnet-only warnings
from expected schema divergence).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cates The nightly schema drift workflow was creating a new branch and draft PR every run, resulting in 27+ identical stale PRs. Now uses a stable branch name (auto/schema-update) and checks for an existing open PR before creating a new one — force-pushes updates to the same PR instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fresh introspection reveals schema drift: PnL and volume fields now use _formatted/_raw suffixes, and get_vault_leaderboard_period was renamed to get_pnl_leaderboard_period. Updates schema snapshots and fixes all 14 broken queries across 3 leaderboard docs. 242/242 queries now pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (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.
Summary
Key files
scripts/validate-graphql-queries.js— core validator (introspection, query extraction, field-level validation)scripts/graphql-schema-{mainnet,testnet}.json— committed schema snapshots.github/workflows/validate-graphql.yml— PR checks + nightly drift detection with single-PR reusepackage.json— npm scripts (validate-queries,update-schema) + lint-staged configHow it works
GraphQLPlayground.tsxauto/schema-updatebranch and creates/updates a single draft PR (not a new PR per run)Test plan
--dry-runextracts 242 queries across all doc files--update-schemafetches fresh schemas from both endpoints🤖 Generated with Claude Code