Fix GET_ACCOUNT_WITH_TOKEN type + refresh schema snapshot#26
Merged
Conversation
- GET_ACCOUNT_WITH_TOKEN: change `$token: UInt64!` to `$token: TokenId!`. The Mina daemon's account(token:) field has always expected a TokenId scalar. The drift check (added in the follow-up PR) catches this against a live lightnet daemon. - src/mina_sdk/schema/graphql_schema.json: regenerated against devnet. The previous snapshot was stale by ~49 introspection diffs (mostly ofType nullability normalization on list-typed fields). No SDK behavior change; only a fresh local schema for the drift checker to compare against. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two-layer schema-drift checker for the SDK: 1. Introspection diff: compare src/mina_sdk/schema/graphql_schema.json to the live __schema; now also detects argument-type changes (e.g. UInt64 -> TokenId) and inputField-type changes that the previous version silently passed. 2. Live query check: parse src/mina_sdk/daemon/queries.py, send each operation with sentinel variables, classify GraphQL errors as either schema drift (parse/validation) or runtime (auth, value- validation). Drift patterns are matched against the message BEFORE the path-based runtime fallback - Mina attaches `path` to many validation errors, so a path-first short-circuit silently drops real drift to the runtime bucket. Bare "expected type" was removed from drift patterns (false-positives on value coercion); a regex for the "expected on field X, found Y" shape now routes those to runtime explicitly. Hardening from internal review: - httpx.Client with 30s timeout (was bare httpx.post call per request) - HTTP status check (non-2xx -> error; was relying on raise_for_status in one path and silently treating empty errors[] as OK in another) - normalize_schema raises on error envelopes - no silent fake-empty schema that then flags every type as REMOVED - _name_of sort key safe against null / non-dict entries - kind nil-guard avoids spurious "<None> -> X" diffs - _OP_RE filters to bodies that actually start with an operation keyword, so unrelated triple-quoted constants don't get probed - _VARS_RE anchored to body start, so inner field-arg parens like `bestChain(maxLength: 1)` can't bind - Connection / HTTP errors counted as infra failures, not "drift"; always exits 1 (we can't trust the result either way) - SKIPped ops (stale sentinel table) fail in --strict Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
Drift check: harden classifier and add coverage/infra-failure buckets
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
Two small data fixes the new drift check (follow-up PR) caught:
\$token: UInt64!→\$token: TokenId!. The daemon'saccount(token:)field has always expected a TokenId; any caller passing a non-empty token would getArgument 'token' of type 'TokenId' expected on field 'account', found "...".A second PR (stacked on this branch) adds the upgraded two-layer drift checker that surfaced these.
Test plan
python scripts/check_schema_drift.py --endpoint <lightnet>on this branch: schema diff goes from 49 → 0.account(publicKey:, token:)GraphQL request withTokenIdagainst lightnet succeeds (no value-coercion error).🤖 Generated with Claude Code