Repository navigation
Conversation
The build monitor shows a country's 60 most recent hosted runs (STAGING_RUN_LIMIT), but loadCollectorRuns asked the telemetry collector for 200-run pages and followed every cursor, so each list request read the country's whole run history and then discarded all but 60. The cost grew with every build the collector recorded. loadCollectorRuns now takes the number of runs its caller uses and asks each page only for the runs still needed, capped at the collector's 200-run page maximum. It stops once it holds that many runs or the history ends, so the build monitor makes one limit=60 request. The collector lists runs newest first with keyset cursors, so the first 60 runs are the same ones the full read used to keep. Pagination, page validation and error handling are unchanged. The tests use an in-memory collector that follows the real listing rules: newest-first order, limits of 1 to 200, opaque cursors, and a cursor on every full page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Oct 15, 2026
This branch was successfully deployed
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.
Fixes #215
Summary
The build monitor shows a country's 60 most recent hosted runs (
STAGING_RUN_LIMITinfrontend/lib/microcosm/build-runs.ts). Until now,loadCollectorRunsasked the telemetry collector for 200-run pages and followed every cursor, reading the country's whole run history on each list request, andloadCollectorthen threw away all but 60.loadCollectorRuns(country, limit)now asks each page only for the runs still needed, capped at the collector's 200-run page maximum, and stops once it holdslimitruns or the history ends. The build monitor passesSTAGING_RUN_LIMIT, so a list request is now oneGET /v1/runs?country=XX&limit=60.The collector already supported this:
GET /v1/runsacceptslimitfrom 1 to 200 and abeforekeyset cursor, lists runs newest first by(registered_at, run_id), and setsnext_beforeon every full page (telemetry-service/telemetry_collector/app.py,storage.py). The collector is unchanged.Commits
1762951Fetch only the collector runs the build monitor showsAdds
lib/microcosm/test-support/fake-telemetry-collector.ts, an in-memory collector behind afetchstub. It follows the collector's listing rules (newest first, limits from 1 to 200 with a 422 outside them, opaque cursors, a cursor on every full page) and records each list and document request.New tests:
requests only the most recent runs in one bounded collector request(500 runs: onelimit=60request);the build monitor reads only its 60 most recent collector runs(end to end throughloadBuildRunson thezzfixture country, which has no staging repository: one list request withlimit=60, 60 document requests, the 60 newest runs).returns the same most recent runs as reading the entire historycompares the result with the first 60 runs of the old read-everything path over 250 runs.The existing
loads every collector list page and authenticates server-sidetest is renamedauthenticates every collector list request server-sideand passes the limit. Its assertions are unchanged.200instead of60), or a result longer than 60 runs. 17 passed: the 10 existing tests, plus 7 that were expected to pass on both versions (the error-handling tests and the end-of-history boundary).telemetry-collector-client.test.ts,build-runs.test.ts).bun test, full frontend suite: 618 passed, 0 failed, across 77 files;bun run lint(tsc --noEmit): clean;bun run build(next build): succeeded;bun run test:dev-port: 4 passed.Findings
STAGING_RUN_LIMIT = 60inbuild-runs.ts. It bounds both the collector list and the Hugging Face staging history list. The collector's own defaultlimitis also 60.limit=60page holds exactly the first 60 runs of the full history.ceil(history / 200)per country every 30 seconds and are now one.Risks
GET /v1/runscontract as it stands onmain(limitup to 200, newest-first keyset cursors). A later read API change (the collector's v2 read API) must keep that order and the limit parameter, or update this client with it.Deploy implications
deploy.ymlruns on CI'sworkflow_runcompletion for pushes tomain. It deploys the Modal backend, then builds, verifies and promotes the Vercel frontend.MICROCOSM_TELEMETRY_COLLECTOR_URLandMICROCOSM_TELEMETRY_READ_SECRET_VERSION.🤖 Generated with Claude Code