Skip to content

feat(leaderboard): pure verified-earnings board + Club row chips + 5-min cadence (#978)#988

Merged
biwasxyz merged 2 commits into
mainfrom
feat/pure-earnings-leaderboard
Jun 8, 2026
Merged

feat(leaderboard): pure verified-earnings board + Club row chips + 5-min cadence (#978)#988
biwasxyz merged 2 commits into
mainfrom
feat/pure-earnings-leaderboard

Conversation

@biwasxyz

@biwasxyz biwasxyz commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

The leaderboard rewrite that missed #987. #987 was merged at its profile-only state, before this leaderboard work was pushed — so main still serves the old #986 board (Trades / Volume / P&L, "TRADING LEADERBOARD"). This PR makes /leaderboard a pure verified-earnings board.

Changes

  • LeaderboardClient — earnings-only. Columns: Rank · Agent (+ Club chip) · Earnings (30d) · Payers · Latest; sort chips Earnings (default) / Payers / Latest. Removed the entire client-side Tenero price-fetch + Volume/P&L/Trades compute.
  • page.tsxrebuildLeaderboard now reads new getEarningsBoard (one index-served scan: 30d + lifetime + payers + latest + metadata), dropping the LEADERBOARD_AGGREGATE_SQL swap scan (the code's "largest D1 read surface") and the earnings overlay. Header/metadata rewritten for earnings; competition countdown removed. Cache key v2→v3, TTL 5min.
  • reads.tsgetEarningsBoard (per-agent 30d + lifetime, HAVING lifetime>0).
  • ClubBadge now renders per leaderboard row (lifetime earnings).
  • constants.tsEARNINGS_INTERVAL_MS5 min (every cron tick) for fast backfill.
  • Deleted orphaned CompetitionCountdown.tsx.

Net: far less D1 (no swap scan) + zero client price calls.

Review

/code-review (high) ran on this exact changeset. It caught a build blocker — a */5 inside a JSDoc comment closed the block early — now fixed (line comments). Correctness pass otherwise clean (SQL binds/units, cache-key bump, exhaustive sort, null guards). tsc + lint clean, full suite 1512 passing.

Once merged + deployed, /leaderboard becomes the pure earnings board. Part of #978.

biwasxyz added 2 commits June 8, 2026 16:00
…min cadence (#978)

Phase 4: make /leaderboard a pure earnings board (per request — the trading
competition's P&L/Volume/Trades scoreboard is retired from this page).

- LeaderboardClient: earnings-only. Columns Rank · Agent (+Club chip) ·
  Earnings (30d) · Payers · Latest; sort chips earnings(default)/payers/latest.
  Removed the entire client-side Tenero price-fetch + Volume/P&L/Trades compute.
- page.tsx: rebuildLeaderboard now reads the new getEarningsBoard (one
  index-served scan, 30d + lifetime + payers + latest + metadata), dropping the
  LEADERBOARD_AGGREGATE_SQL swap scan (the code's "largest D1 read surface") and
  the separate earnings overlay. Header/metadata rewritten for earnings;
  competition countdown removed. Cache key v2→v3 (earnings-only shape), TTL 5min.
- reads.ts: getEarningsBoard (per-agent 30d + lifetime, HAVING lifetime>0).
- ClubBadge now also renders per leaderboard row (lifetime earnings).
- constants: EARNINGS_INTERVAL_MS → 5min (every cron tick) for fast backfill.

Net: far less D1 (no swap scan) + zero client price calls.
… comments

Addresses the pre-push /code-review:
- BLOCKER: the EARNINGS_INTERVAL_MS doc comment contained "*/5" which closed the
  JSDoc block early and broke compilation. Switched to // line comments.
- Deleted app/leaderboard/CompetitionCountdown.tsx — orphaned after the
  pure-earnings rewrite (no importers repo-wide).
- Refreshed stale page.tsx comments that referenced LEADERBOARD_AGGREGATE_SQL /
  the per-sender rollup / the removed scheduler kick → now describe
  getEarningsBoard.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
landing-page 2c8498e Commit Preview URL

Branch Preview URL
Jun 08 2026, 10:17 AM

@biwasxyz biwasxyz merged commit 8b4cf89 into main Jun 8, 2026
8 checks passed
@biwasxyz biwasxyz deleted the feat/pure-earnings-leaderboard branch June 8, 2026 10:18
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