Skip to content

refactor(coordinator): isolate public network views and refresh state - #1018

Closed
Gajesh2007 wants to merge 2 commits into
refactor/coordinator-read-cachefrom
refactor/coordinator-network-views
Closed

Gajesh2007 wants to merge 2 commits into
refactor/coordinator-read-cachefrom
refactor/coordinator-network-views

Conversation

@Gajesh2007

@Gajesh2007 Gajesh2007 commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Public network statistics, geography, earnings totals, traffic series and leaderboards currently share refresh state with the main API server. This change gives them one api/network.Controller, with files named for each aggregation, privacy rule and refresh responsibility. The API server constructs the owner and binds the same four public routes.

Stacked on #1006 (refactor/coordinator-read-cache), which supplies the shared cache and refresh coalescing primitives.

The controller owns the two stats refresh flights and the totals window map, including the single mutex that serializes earnings queries across every window. Narrow dependencies read the server's current store, fleet and shared cache. Stats and geography keep independent 30-second refresh loops; totals keep their one-minute loop and five-minute safety TTL. Query ordering, source timestamps, partial geography availability, privacy floors, pseudonym tables, response bytes, status codes and cancellation behavior are preserved.

Tests now live beside the network operations they exercise. The API still tests provider registration/catalog invalidation through real routes. A new route test verifies store, fleet and cache replacement after route registration; it also passes against the original source. Maintained navigation and code citations follow the new owners, including correcting the existing leaderboard TTL description to the five minutes used for every window in both implementations.

flowchart TD
  subgraph Before
    H[Four public GET routes] --> S[api.Server handlers]
    L[StartCacheRefreshers] --> R[Server refresh flights and totals query mutex]
    S --> R
    R --> Q[Store aggregates and live fleet]
    Q --> C[Shared read cache]
    C --> O[Same cached JSON, source age and privacy rules]
    Q --> E[Core failure: retain unexpired success or 503]
    G[Independent geography refresh] --> P[Available or unavailable sections]
    P --> O
  end
Loading
flowchart TD
  subgraph After
    H[Same four public GET routes] --> W[api.Server route bindings]
    W --> S[network.Controller Stats, Totals, Series, Leaderboard]
    L[Server.StartCacheRefreshers] --> R[Controller owns flights and totals query mutex]
    S --> R
    R --> Q[Current Store and Fleet dependencies]
    Q --> C[Same shared readcache.Cache]
    C --> O[Same cached JSON, source age and privacy rules]
    Q --> E[Core failure: retain unexpired success or 503]
    G[Controller independent geography refresh] --> P[Same availability and privacy rules]
    P --> O
  end
Loading

Validation: Go 1.25 production build; pinned golangci-lint 2.1.6 with zero issues; full API subtree race suite (1,589 top-level cases / 2,796 including subtests, API 225.760s); focused concurrency/freshness/privacy tests; original-source and current-route boundary regressions; all 280 documentation pages checked. The two existing opt-in skips are unchanged. All 1,611 prior test/benchmark/fuzz/example symbols remain, plus the new route test. Declaration checks cover all 32 moved operations, 3,719 retained functions, and 22 constants/types/aliases, with explicit dependency and fixture mappings. Independent source, fixture and documentation review is clean.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@vercel

vercel Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Ready Ready Preview Sep 14, 2026 3:37am UTC
d-inference-console-ui-dev Ready Ready Preview Sep 14, 2026 3:37am UTC
d-inference-landing Ready Ready Preview Sep 14, 2026 3:37am UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-14T03:41:45.696564Z 57165e8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Gajesh2007

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 57165e8a8c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Gajesh2007

Copy link
Copy Markdown
Member Author

Consolidated into #1056 for review and merge after #1094, #1095 and #1096. #1056 contains this branch's exact head (57165e8a8c1bd2c5d072708288033dae078a32dc), including its reviewed fixes, with implementations and regressions reconciled into the coordinator subsystem owners. Closing the component PR to collapse the stack; its branch, commits and review history are retained. Follow #1056 for combined validation and merge status.

@Gajesh2007 Gajesh2007 closed this Sep 16, 2026

This branch had an error being deployed

1 failed and 3 active deployments
Preview – d-inference-console-ui-dev — 57165e8a Deployed Sep 14, 2026 by vercel[bot]
Preview – d-inference — 57165e8a Deployed Sep 14, 2026 by vercel[bot]
Preview – d-inference-landing — 57165e8a Deployed Sep 14, 2026 by vercel[bot]
benchmarks — 57165e8a Deployed Sep 14, 2026 by Gajesh2007 via E2E Benchmarks #1174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant