fix(snapshots): serve zeronet from the API again, hide it only in the UI - #46
Merged
Conversation
"Cobalt and fixes" (#14) removed zeronet to take it off the snapshots page, but it deleted the chain descriptor from app/snapshots/r2.ts as well. That also stopped /api/snapshots serving it — ?network=zeronet has been answering 400 Unknown network — so zeronet nodes can no longer sync from a snapshot. Restore the descriptor and make visibility a separate, explicit concern: - NetworkConfig gains `hiddenFromUi`, set on zeronet. The data layer keeps serving every network; only the page filters. - isNetworkVisibleInUi() is applied in app/snapshots/page.tsx, at the render boundary, so hidden networks never reach the client. - Sample data carries zeronet again, so the dev fallback mirrors what the API returns and the filter is exercised locally. - Tests cover both halves: zeronet is in NETWORK_IDS but not visible in the UI, and an unrecognized network defaults to visible so a future network is not hidden by accident. Deployment prerequisite: BASE_ZERONET_R2_ACCESS_KEY_ID / _SECRET_ACCESS_KEY must be set in Vercel before this merges. loadSnapshots throws if any network fails, so an unconfigured zeronet would 502 the whole endpoint, mainnet and sepolia included.
Collaborator
🟡 Heimdall Review Status
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Nothing caught #14 dropping zeronet from /api/snapshots. The page looked right, every test passed, and the breakage only surfaced when zeronet nodes could not sync from a snapshot. Adds app/snapshots/networks.contract.test.ts, asserting the API surface rather than the rendered page: every expected network is served, hiding one from the UI is a `hiddenFromUi` flag rather than a deletion, each network carries the config the loader needs, and ids/buckets/env prefixes stay unique. Verified it has teeth by replaying #14's deletion — three assertions fail with messages naming the missing network. It also asserts each network's R2 env prefix appears in .env.example. Because loadSnapshots throws when any network fails, a network added without documented credentials 502s the whole endpoint, so this catches at PR time the config half of a failure that otherwise only shows up in production. Runs as its own `snapshots API contract` check so it can be required in branch protection and is legible in the PR list. NETWORK_CONFIGS is exported read-only for the test.
The contract test already runs in the `test` job — the separate job re-ran the same nine assertions behind a second npm ci for no added enforcement. `test` is the gate, and a failure there names the assertion and the missing network. Keeps the test itself; documents the invariant under `test` in the README, where it actually runs.
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.
The bug
We wanted zeronet hidden from the snapshots page. #14 "Cobalt and fixes" (2026-07-22) removed it from the page — but it also deleted the chain descriptor from
app/snapshots/r2.ts, which is what/api/snapshotsenumerates.Net effect:
?network=zeronethas been returning400 Unknown network, and the all-networks response omits it. Zeronet nodes can no longer sync from a snapshot.The fix
Restore the descriptor, and make visibility an explicit concern separate from what we serve:
NetworkConfiggainshiddenFromUi, set only on zeronet.isNetworkVisibleInUi()is applied inapp/snapshots/page.tsx— at the render boundary, so hidden networks never reach the client, and the data layer stays untouched.The R2 bucket and public URL are restored to their original values (
base-zeronet-reth-v2-snapshots,https://zeronet-v2-snapshots.base.org).Verification
typecheck,lint,test(32),build,docs:checkall pass/snapshotsrenders Base Mainnet and Base Sepolia, zero occurrences of "Base Zeronet" — while zeronet is present in the underlying data?network=zeronetis accepted (fails only on missing local creds) where it previously returned400 Unknown network?network=bogusstill correctly returns400NETWORK_IDS, not visible in UI, public networks still visible, unknown network defaults to visible