build(typescript): Phase 3 completion — convert graphql.mjs + mcp-server.mjs to .ts - #7857
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
metagraphed-data-api | 843dfbb | Jul 24 2026, 04:02 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-registry-sync-api | 843dfbb | Jul 24 2026, 04:02 PM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7857 +/- ##
==========================================
- Coverage 97.58% 97.57% -0.02%
==========================================
Files 204 205 +1
Lines 26365 26502 +137
Branches 10452 10502 +50
==========================================
+ Hits 25729 25859 +130
Misses 150 150
- Partials 486 493 +7
🚀 New features to boost your workflow:
|
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-24 15:54:25 UTC
Review summary Nits — 2 non-blocking
Concerns raised — review before merging
📋 Copy for AI agents — paste into your coding agentDecision drivers
Context & advisory signals — never blocks the verdict
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.
|
…ver.mjs to .ts Converts the last two hand-written .mjs runtime files in src/ — the GraphQL layer and the MCP server — plus their test suites: - src/graphql.mjs (10409 lines) + tests/graphql.test.mjs (19999 lines) - src/mcp-server.mjs (16877 lines) + tests/mcp-server.test.mjs (20663 lines) and updates the .mjs import specifier in all ~170 referencing files (the 168 mcp-server importers are dominated by the per-subnet call-subnet-surface-verify test family). Typing approach mirrors the earlier conversions: a local Row/AnyFn + a per-file context interface (GqlContext for the graphql execute() contextValue; McpCtx for buildMcpContext's tool-handler context), resolver/tool-handler signatures annotated mechanically, and `as unknown as` bridges only where two already-shipped modules disagree about a shape (e.g. the MCP loaders' ctx interfaces requiring a readArtifact that GraphQL supplies through the loaders' own deps override instead). Dropped three silently-ignored excess options at call sites rather than widening the callee signatures — verified against each implementation: loadEconomicsTrends/loadGlobalIncidents never read windowDays, buildSubnetOhlc never reads days, loadSubnetUptime never reads minSamples. Behavior identical; the .mjs originals passed them as inert extra properties. One real mistype fixed in passing: DataApiMcpContext.clientIp claimed `string` but the graphql-ws path populates it as `string | null` — widened to match reality (it is only ever interpolated into a rate-limit key).
0abea31 to
b1ddf65
Compare
…api (0s fail, identical bundle builds clean locally)
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-ui | 843dfbb | Commit Preview URL Branch Preview URL |
Jul 24 2026, 04:04 PM |
Summary
Part of the TS migration epic (#7510). Completes Phase 3 (#7516,
src/): converts the last two hand-written.mjsruntime files in the repo's src/ tree — the GraphQL layer and the MCP server — plus their test suites:src/graphql.mjs(10409 lines) +tests/graphql.test.mjs(19999 lines)src/mcp-server.mjs(16877 lines) +tests/mcp-server.test.mjs(20663 lines)and updates the
.mjsimport specifier in all ~170 referencing files (the mcp-server importer count is dominated by the per-subnet*-call-subnet-surface-verifytest family).Together with #7856 (data-api, Phase 2 completion), this makes the entire backend/tooling stack TypeScript — zero hand-written
.mjs/.jsruntime files remain. Phase 7 (#7521: tsconfig lockdown, permanent no-mjs CI gate, doc updates) unblocks once both merge.Typing approach
Mirrors the earlier conversions: local
Row/AnyFnaliases, a per-file context interface (GqlContextfor the graphqlexecute()contextValue;McpCtxforbuildMcpContext's tool-handler context), resolver/tool-handler signatures annotated mechanically, andas unknown asbridges only where two already-shipped modules disagree about a shape (e.g. the MCP loaders' ctx interfaces requiring areadArtifactfield that the GraphQL call sites supply through the loaders' own deps override instead — never dereferenced through ctx).Behavior-verified cleanups (not blind casts)
loadEconomicsTrends/loadGlobalIncidentsnever readwindowDays,buildSubnetOhlcnever readsdays,loadSubnetUptimenever readsminSamples. The.mjsoriginals passed them as inert extra properties.DataApiMcpContext.clientIpclaimedstringbut the graphql-ws path populatesstring | null— widened to match reality (only ever interpolated into a rate-limit key).Test plan
npx tsc --noEmitclean (repo-wide)npx eslint+prettier --checkclean on all 175 touched filesnpx vitest runon the converted suites: 2126/2126 passing (graphql + mcp-server + sentry/docs-drift)