Repository navigation
feat(home): fill hero terminal and fleet panel from live testnet stats - #253
Merged
Merged
Conversation
Replace the invented fetch sessions and fleet figures with data read in the browser from https://data.decdn.org/stats-421614.json, the file the decdn/stats indexer writes every five minutes. The site stays a static export: both panels render a loading state into the HTML and fill in after mount from one shared fetch. - hero terminal replays the newest FeeRouter Settled logs (tx, block, epoch, operator + region, bytes delivered, USDC paid, age) - fleet panel shows CapacityBond-registered nodes by region with all-time bytes served, plus bytes served and USDC settled over the last 24h with hourly spark strips in place of the decorative bars - allow the origin under connect-src in the CSP - captions, check-out guard, llms-full note and tests now describe live testnet readings instead of sample values; DemoFigure -> PanelFigure Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WcV6xKjiFqssRsGAWGcjEJ
Deploying website with
|
| Latest commit: |
2a17f02
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5bacaed0.website-70y.pages.dev |
| Branch Preview URL: | https://claude-mock-data-stats-endpo.website-70y.pages.dev |
One row per CapacityBond-registered node instead of per-region groups,
matching the original panel: region, operator address, and the node's most
recent settlement ("settled 4 min ago"), or "idle" when it has none in the
stats file's recent window. The pulse marks nodes that settled recently.
Nodes past eight fold into a "+N more nodes" line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WcV6xKjiFqssRsGAWGcjEJ
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The stats schema guard currently accepts settlement rows without validating logIndex, even though the UI depends on it for stable keys.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR updates the homepage’s hero terminal and Contact fleet panel to display live Arbitrum Sepolia testnet stats fetched client-side from https://data.decdn.org/stats-421614.json, while keeping the site as a static export (loading state in HTML, hydrate + fetch after mount, shared fetch across panels).
Changes:
- Introduces
lib/stats.ts(schema guard, formatting, view models, shared fetch) andlib/use-stats.ts(client hook). - Updates
HeroTerminalandFleetStatusto render live-derived terminal sessions and fleet aggregates/sparks, and renamesDemoFigure→PanelFigurewith updated captions. - Updates CSP and build/test guards to reflect the live stats source and new captions/mirroring behavior.
| File | Description |
|---|---|
| types/css.d.ts | Adds --level CSS custom property typing for spark-strip inline styles. |
| scripts/check-out.mjs | Updates caption checks and messaging for live panel captions in built index.html. |
| public/_headers | Allows client fetch to https://data.decdn.org via connect-src CSP directive. |
| lib/use-stats.ts | Adds client hook returning a StatsResult and triggering fetch after mount. |
| lib/stats.ts | Adds stats constants, schema guard, formatting helpers, view models, and shared fetch with timeout. |
| lib/stats.test.ts | Adds unit coverage for schema guard, formatting, view models, and load retry/sharing behavior. |
| lib/copy.ts | Renames and updates captions to describe live testnet readings and source/disclaimer text. |
| lib/copy.test.ts | Updates string-collection and caption assertions for PANEL_CAPTIONS. |
| components/ui/PanelFigure.tsx | Renames figure wrapper and updates docs to match live-panel behavior. |
| components/ui/PanelFigure.test.ts | Updates structural test to use PanelFigure and new caption wording. |
| components/site/HeroTerminal.tsx | Replaces invented demo sessions with live settlement sessions derived from stats. |
| components/site/FleetStatus.tsx | Converts to client component; splits FleetPanel for testability; adds spark strips and live aggregates. |
| components/site/FleetStatus.test.ts | Adds render-state tests (loading/error/ok/catching-up) for FleetPanel. |
| components/site/demo-caption.test.ts | Removes obsolete demo-caption test tied to the old server-component FleetStatus and demo figures. |
| app/llms-full.txt/route.ts | Points mirror readers at the live stats file instead of mirroring live panel readings. |
| app/llms-full.txt/route.test.ts | Updates tests to assert presence of STATS_URL rather than absence of old demo figures. |
| app/globals.css | Updates terminal/fleet panel styling docs and replaces animated bars with spark-strip styles. |
| AGENTS.md | Documents new lib/stats.ts module and CSP coupling, and renames caption constant reference. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
terminalSessions() keys each row on txHash:logIndex, so a row without a numeric logIndex now fails the shape check instead of rendering an undefined key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WcV6xKjiFqssRsGAWGcjEJ
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.

Replaces the invented figures in the hero terminal and the Contact fleet panel with real Arbitrum Sepolia data from
https://data.decdn.org/stats-421614.json(written every 5 min by thedecdn/statsindexer; schema taken from itsworker/src/stats.ts).The site stays a static export. Both panels put a loading state into the HTML, then fill in after mount. They share a single fetch.
What each panel shows now
Hero terminal (
arbitrum sepolia ~ settled) steps through the 8 newest FeeRouterSettledlogs. For each it shows the tx, the block and epoch, the operator with its registered region, the bytes delivered, the USDC paid and how long ago it happened. The file has no content hash, peer probe/latency or fetch duration, so the olddecdn fetch blake3:… / probing N peers / … in 1.27slines are gone. In their place are fields we can actually read from the file.Fleet panel (
decdn · fleet · arbitrum sepolia):Both panels show "catching up" while the index is backfilling. They show "stats unavailable" if the fetch fails, and "no settlements / nodes yet" when the file is empty.
Plumbing
lib/stats.tsis pure and unit-tested: the URL, a shape check (which rejects a wrong chain or old schema), exact formatting of bytes and USDC, the terminal and fleet view models, andloadStats(), a single shared fetch with a timeout.lib/use-stats.tsis the client hook.public/_headers: the CSP getsconnect-src 'self' https://data.decdn.org. Without it,default-src 'self'would block the fetch in production.DemoFigure→PanelFigureandDEMO_CAPTIONS→PANEL_CAPTIONS. The captions now describe live testnet readings ("Testnet figures, not mainnet revenue") and still point at the disclaimer.check-out.mjsgreps for the new caption text.FleetStatusis split into a hook wrapper plusFleetPanel, a plain render function, so the tree-walker test can cover the loading, error, ok and catching-up states.Testing
pnpm typecheck,pnpm lint,pnpm format:checkandpnpm testall pass (507 tests).next build+check:out+check:og-imagealso pass.data.decdn.org. I checked rendering in Chromium against the builtout/with the request intercepted and fed a fixture in the real schema, plus a forced-failure run. Please check against the live file on the preview deploy.🤖 Generated with Claude Code
https://claude.ai/code/session_01WcV6xKjiFqssRsGAWGcjEJ