feat(api): add REST filter parity to GraphQL subnet_gaps#8048
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
The subnet_gaps field returned the baked gap report as an unparameterized
JSON blob while GET /api/v1/subnets/{netuid}/gaps pages the same artifact
through csvListQuery("review-gap-priorities", { exclude: ["netuid"] }).
Accept curation_level, missing_kinds, review_state, sort, order, fields,
limit and cursor, and run them through applyQueryFilters against the
review-gap-priorities collection -- the same helper the REST pipeline
uses, so the filter/sort allowlists cannot drift. An unsupported value is
a BAD_USER_INPUT GraphQL error rather than a silently substituted
default, and the response carries REST's pagination meta (total,
returned, limit, cursor, next_cursor, sort, order).
Only `priorities` is filtered; the rest of the report envelope, including
`enrichment_queue`, is returned unchanged so existing consumers of the
unparameterized field keep working.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8048 +/- ##
=======================================
Coverage 97.67% 97.67%
=======================================
Files 219 220 +1
Lines 27104 27192 +88
Branches 10745 10789 +44
=======================================
+ Hits 26473 26561 +88
Misses 140 140
Partials 491 491
🚀 New features to boost your workflow:
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-24 20:44:55 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk 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.
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.
|
Closes #7880
What
subnet_gapsreturned the baked gap report as an unparameterized JSON blob, whileGET /api/v1/subnets/{netuid}/gapspages the same artifact throughcsvListQuery("review-gap-priorities", { exclude: ["netuid"] }). This adds the missing arguments so the two surfaces agree.curation_level,missing_kinds,review_state— the exact three the REST route exposes (netuidis the path param, excluded there and here).sort,order,fields,limit,cursor.total,returned,limit,cursor,next_cursor,sort,order, matching REST's envelope.An unsupported filter or sort value is a
BAD_USER_INPUTGraphQL error, not a silently substituted default — the conventionsubnet_evidenceandsubnet_candidatesalready follow in this file.How
The resolver passes the report to
applyQueryFilters(report, url, "review-gap-priorities", [...])— the same shared helper the REST pipeline runs, sourced from the sameAPI_QUERY_COLLECTIONSentry, so the filter and sort allowlists cannot drift from REST.Only
prioritiesis filtered; the rest of the envelope is returned unchanged. This is deliberate. The artifact also carriesenrichment_queue, which is part of the documented response and which existing consumers of the unparameterized field read today. Routing the field throughloadSubnetGapsListinstead would have returned that loader's narrower result and silently droppedenrichment_queue— a breaking change well outside the scope of adding filter parity. No loader or MCP file is touched by this PR, so MCPlist_subnet_gapsand its error classification are byte-for-byte unchanged.Tests
tests/graphql.test.ts— filter + sort +fieldsprojection +limit/cursorin one query, asserting the envelope (enrichment_queueincluded) survives; truncated-pagenext_cursorround-trip; unsupported enum value →BAD_USER_INPUT. The pre-existing passthrough and cold-artifact-null tests are unmodified and still pass.All 988 tests in
tests/graphql.test.tspass.tsc --noEmitclean,eslintclean,validate-api/validate-mcp/validate-graphql-types-driftall pass, generated types regenerated and committed. Localvitest --coverageover the changedsrc/graphql.tslines: 0 uncovered statements, 0 partial branches across all 56 changed source lines.