fix(data-api): port neurons-derived concentration/performance/yield/portfolio handlers to Postgres#4837
Merged
Merged
Conversation
…ortfolio handlers to the Postgres tier Tier 2a of #4832: handleSubnetConcentration, handleSubnetPerformance, handleChainConcentration, handleChainPerformance, handleChainYield, handleSubnetYield, handleAccountPortfolio, and handleAccountsList were still D1-only despite reading the same live `neurons` snapshot already served by the Postgres tier for /metagraph and /neuron. Adds the 8 matching routes to the data Worker and wires tryPostgresTier into each handler with the established fallback contract. Also fixes a real bug caught by the new accounts-list tests: an absent `?limit=` coerced through Number() evaluates to 0 (finite), silently returning an empty leaderboard instead of the intended default. Refs #4832
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-data-api | ca108fe | Commit Preview URL Branch Preview URL |
Jul 11 2026, 03:36 AM |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4837 +/- ##
=======================================
Coverage 97.76% 97.76%
=======================================
Files 162 162
Lines 19004 19038 +34
Branches 7122 7141 +19
=======================================
+ Hits 18579 18613 +34
Misses 59 59
Partials 366 366
🚀 New features to boost your workflow:
|
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
neuronssnapshot that hadn't been ported yet —handleSubnetConcentration,handleSubnetPerformance,handleChainConcentration,handleChainPerformance,handleChainYield,handleSubnetYield,handleAccountPortfolio,handleAccountsList.workers/data-api.mjs, wirestryPostgresTierinto each handler inworkers/request-handlers/entities.mjswith the established fallback-to-D1-on-any-failure contract.handleAccountsList:Number(url.searchParams.get("limit"))silently evaluates an absent?limit=to0(finite), returning an empty leaderboard page instead of the intended default — guarded with an explicit presence check.Test plan
npx vitest run tests/data-api.test.mjs tests/request-handlers-entities.test.mjs— 470 + 165 tests pass, including 16 new postgres-wins/falls-back-to-D1 pairs for the 8 handlersnpx vitest run(full repo) — 259 files / 7330 tests passnpm run lint/npx prettier --checkon touched files — cleannpm run scan:public-safety— cleannpm run test:coverage+ manualcodecov/patch-style branch-coverage isolation on the diff — all uncovered branches confirmed pre-existing/outside the patch's added-line rangesRefs #4832