Skip to content

feat(api): add call_hash/block/time filters to extrinsics GraphQL field #8047

Merged
loopover-orb[bot] merged 2 commits into
JSONbored:mainfrom
andriypolanski:feat/graphql-extrinsics-filters-7872
Jul 24, 2026
Merged

feat(api): add call_hash/block/time filters to extrinsics GraphQL field #8047
loopover-orb[bot] merged 2 commits into
JSONbored:mainfrom
andriypolanski:feat/graphql-extrinsics-filters-7872

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Summary

Adds call_hash, block_start, block_end, from, and to to the GraphQL extrinsics field so it matches list_extrinsics / GET /api/v1/extrinsics.

Closes #7872

Why previous PRs were closed

PR Closed reason
#8020 Base-branch conflicts (dirty) — CI green, content OK; gate auto-closed
#8040 Base-branch conflicts (dirty) again after resubmit with SDL + types — same disposition

Reimplementation on a fresh branch off current main (no competing open PR).

What changed (4 files)

src/graphql-sdl.ts

  • extrinsics args: call_hash: String, block_start: Int, block_end: Int, from: String, to: String
  • from / to are String because epoch-ms overflows GraphQL Int32 (same as account_history / blocks)

src/graphql.ts

  • Resolver destructures the new args and forwards them as query params to /api/v1/extrinsics (no local filter logic)

generated/graphql/types.ts

  • Regenerated (npm run build:graphql-types) — QueryExtrinsicsArgs includes the new fields

tests/graphql.test.ts

  • Forwards call_hash + block-range + time-range to the Postgres tier
  • Introspection asserts arg types (String vs Int)

Validation

  • vitest run tests/graphql.test.ts -t '#7872' — 2/2 passed
  • Local patch coverage on changed src/graphql.ts lines: 100% statements, 100% branches (10/10)
  • Gittensory Gate + full CI green (incl. codecov/patch ≥99%)

Test plan

  • extrinsics(call_hash: "0x…") reaches /api/v1/extrinsics?call_hash=…
  • extrinsics(block_start:, block_end:) and extrinsics(from:, to:) forward correctly
  • Introspection: call_hash/from/to are String; block_start/block_end are Int
  • Existing extrinsics filter/cursor tests still pass

andriy-polanski and others added 2 commits July 24, 2026 20:19
Mirror list_extrinsics / GET /api/v1/extrinsics so GraphQL clients can narrow by call_hash, block_start/block_end, and from/to (String epoch-ms). Closes JSONbored#7872.

Co-authored-by: Cursor <cursoragent@cursor.com>
@superagent-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.67%. Comparing base (9d0b380) to head (0ba4082).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8047   +/-   ##
=======================================
  Coverage   97.67%   97.67%           
=======================================
  Files         220      220           
  Lines       27206    27211    +5     
  Branches    10783    10788    +5     
=======================================
+ Hits        26574    26579    +5     
  Misses        140      140           
  Partials      492      492           
Files with missing lines Coverage Δ
src/graphql-sdl.ts 100.00% <ø> (ø)
src/graphql.ts 99.65% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 24, 2026
@loopover-orb

loopover-orb Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-24 20:41:59 UTC

4 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
Adds call_hash/block_start/block_end/from/to filter args to the extrinsics GraphQL field, mirroring list_extrinsics/GET /api/v1/extrinsics. The resolver in src/graphql.ts simply forwards each present arg as a query param to /api/v1/extrinsics with no local validation, consistent with the existing pattern for call_module/call_function/success in the same function; SDL and regenerated types.ts are updated in lockstep and a test covers both the forwarding and introspection shape. This is a straightforward, well-scoped surface addition closing #7872, with the from/to-as-String rationale (epoch-ms overflowing Int32) correctly matching the account_history precedent.

Nits — 4 non-blocking
  • The large pre-existing files (graphql.ts, graphql-sdl.ts, generated/graphql/types.ts) are flagged as long by the size-smell scan, but that's pre-existing structure, not something this diff should be asked to fix.
  • No test asserts that block_start/block_end/call_hash validate range/format before being forwarded to the REST endpoint — currently any string value is passed through verbatim, matching existing sibling args' permissiveness.
  • Consider a follow-up test verifying an invalid block_start > block_end combination behaves the same as the REST route (whether that's a passthrough error or silent no-match).
  • None needed for src/graphql.ts/tests/graphql.test.ts full diffs since they weren't included in full file content, but the visible hunks are internally consistent with the SDL/types changes.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #7872
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 220 registered-repo PR(s), 139 merged, 22 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 220 PR(s), 22 issue(s).
Linked issue satisfaction

Addressed
The diff adds call_hash, block_start, block_end, from, and to arguments to the extrinsics field in both the SDL and resolver, forwarding them as query params to the same /api/v1/extrinsics loader, and includes new tests covering call_hash and block/time-range filtering plus introspection checks.

Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, Rust, Cuda, JavaScript, Kotlin, MDX, Scala
  • Official Gittensor activity: 220 PR(s), 22 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 355efb9 into JSONbored:main Jul 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GraphQL parity: extrinsics field missing call_hash/block_start/block_end/from/to filters

2 participants