Skip to content

polo: switch to /api/public-stats + drop growth-% + lifetime requests#19

Merged
TeoSlayer merged 1 commit into
mainfrom
feat/polo-public-stats-migrate
Jun 7, 2026
Merged

polo: switch to /api/public-stats + drop growth-% + lifetime requests#19
TeoSlayer merged 1 commit into
mainfrom
feat/polo-public-stats-migrate

Conversation

@TeoSlayer
Copy link
Copy Markdown
Contributor

Companion to pilot-protocol/rendezvous#50. `/api/stats` is now admin-gated on polo.pilotprotocol.network; this PR migrates the polo public website to the new curated `/api/public-stats` endpoint.

Changes

location before after
index.astro frontmatter fetch `/api/stats` → 30-day history + total_requests `/api/public-stats` → curated payload only
index.astro client `refresh()` `/api/stats` every 60 s `/api/public-stats` every 60 s
for/networks.astro fetch `/api/stats` `/api/public-stats`
'Growth +X% in the past 7 days' tile (hero) rendered removed — daily[] no longer in payload
'Growth, past 7 days' big-number stat rendered removed — same reason
Lifetime 'requests' counter client-driven from total_requests static fallback only (no source)
growth7d() helper + fmtRequests() helper present removed (unused)

Knobs intact

  • Hero 'agents' figure continues to update from `total_nodes` / `active_nodes` — the new payload has both.
  • All static copy unchanged.
  • Build size: 297 pages, 17.4 s, no errors.

Coordination

This PR must merge after rendezvous#50 ships to prod, OR Cloudflare-Pages can deploy this revision first (graceful: the migrated fetch hits `/api/public-stats` which doesn't exist yet → 404 → quiet `.catch` → fallback markup renders). Either order is safe.

Test plan

  • `npm install && npx astro build` clean (297 pages, 17.4 s)
  • `grep -rn /api/stats src/` returns 0 hits (only `/api/public-stats` remains)
  • `grep -rn growth src/` shows only a comment reference + no rendered widgets

Companion to pilot-protocol/rendezvous#50. /api/stats is now admin-
gated on polo.pilotprotocol.network; this page consumes the new
/api/public-stats endpoint instead.

The new payload is intentionally minimal — server_time, uptime_seconds,
active_nodes, total_nodes, components{}. No daily/hourly history, no
total_requests lifetime counter, no per-IP breakdown, no badge values,
no trust links, no networks count.

Consequence on the live page:
  - Hero stats: 'agents' figure stays (driven by total_nodes/active_nodes).
  - 'requests' figure: was driven by stats.total_requests. Lifetime
    count is no longer published. The static fallback ('5B+') stays in
    the markup; the JS no longer overwrites it because the data is
    gone. Acceptable until we ship a curated rate metric.
  - 'Growth +X% in the past 7 days' tile: removed. Was computed
    client-side from stats.daily[] which is no longer published.
  - 'Growth, past 7 days' big-number tile: removed.
  - growth7d() helper + fmtRequests() helper: removed (now unused).

Both pages tested with 'npm install && npx astro build' — 297 pages
generated in 17.4s, no errors.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 7, 2026

🚀 Preview deployed to Cloudflare Pages

  • Commit deploy URL: https://ea0dc39f.pilotprotocol.pages.dev
  • Branch alias: https://feat/polo-public-stats-migrate.pilotprotocol.pages.dev (may take ~30s to propagate)
  • Commit: 4040b0234f472893056e19d1e5ebbe8366d6c30d

@TeoSlayer TeoSlayer merged commit 1dcb105 into main Jun 7, 2026
2 checks passed
@TeoSlayer TeoSlayer deleted the feat/polo-public-stats-migrate branch June 7, 2026 13:01
TeoSlayer added a commit that referenced this pull request Jun 7, 2026
#19 migrated this page to /api/public-stats which doesn't expose the
lifetime total_requests counter; the static fallback ('5B+') was
rendered at build time and never updated, leaving a fixed string
that didn't match anything live.

Two removals:
  - hero meta strip: 'X agents · 5B+ requests' → 'X agents'
  - stats block:     '5B+ Requests routed' tile removed

No other call sites — fmtRequests + the JS .requests assignment were
already removed in #19.

Co-authored-by: Teodor Calin <teodor@vulturelabs.io>
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.

2 participants