fix: event filter dropped all events — GraphQL renders TypeName as plain string - #42
Conversation
…t filter dropped all events
|
operate.md review — PR #42 ( Fix verified correct against the current HEAD. 🟡 No regression guard for the failure mode this PR fixes.
🟢 Non-blocking, FYI: the filter still fails silently — a future rendering Security: secrets-in-diff scan clean; not a contract PR (no Update (same run): the 🟡 regression guard was added to this PR at the request of Because that commit is mine, this PR now needs two reviewers other than me — |
jangid
left a comment
There was a problem hiding this comment.
operate.md: clean — fix verified against current HEAD (GraphQL contents.json renders TypeName as a plain string; all four event types updated consistently, no other .typename readers in repo or downstream). CI green (lint/test/build). Non-blocking note in the review comment: the existing APR test only asserts toBeDefined(), so a total event drop passes CI — worth a non-empty/non-zero assertion or a fixture unit test on the filter. Approvals: 1/2 — needs 1 more before merge.
The typename shape change silently dropped every event while the suite
stayed green — the live tests only assert toBeDefined() and the callers
swallow an empty result as "0". Mock the GraphQL layer and assert the
filter keeps matching events, drops non-matching ones, and drops the
legacy {name} shape, so the next rendering change fails CI instead of
zeroing out APR in production.
jangid
left a comment
There was a problem hiding this comment.
Approving at head 425e0b3. Fix verified against the current branch: queryMoveEvents passes GraphQL's contents.json straight through as parsedJson, so the old .typename.name read evaluated "0x" + undefined and dropped every event; all four event types are updated consistently, and no other reader of .typename exists in this repo or in downstream consumers. CI green (lint/test/build).
Note on provenance: the regression test in 425e0b3 was added by this review pass at the maintainers' request, so this approval covers a commit authored during review — flagging it rather than leaving it implicit. The fix commit f5a592c is the author's.
Approvals: 1/2 — needs one more before merge.
The GraphQL migration kept the JSON-RPC-era
typename: {name}shape, but GraphQL'scontents.jsonrenders Move'sTypeNameas a plain string. The filter inevents.tsread.typename.name→undefined, so every event was silently dropped:fetchStSuiAPR/fetchStSuiAPYreturned 0 andgetMintEvents/updateTotalStakersfound nothing.Fixes the filter and corrects the four event types to match the actual runtime shape.
Verified against live GraphQL:
fetchStSuiAPR(7)now returns the same APR as the pre-shutdown JSON-RPC path (17-digit match). tsc/lint/tests clean.Needed before publishing 2.0.3.