Skip to content

feat(queen): the leaderboard is all time, and a window narrows it - #512

Merged
gHashTag merged 1 commit into
feat/queen-supervisorfrom
feat/leaderboard-all-time
Sep 23, 2026
Merged

gHashTag merged 1 commit into
feat/queen-supervisorfrom
feat/leaderboard-all-time

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

The board asked for thirty days, which is the wrong default for a record of who carried the swarm. A lender whose lanes worked hard last month and rested this one read as having done nothing — and the board shrank on its own as time passed, rather than growing with the work.

Owner's word today: show the whole record.

What changed

days is now number | null, and null means no time predicate at all rather than a very large number of days — so the query has nothing to be off-by-one about, and the archive's own rows decide how far back the answer goes. ?days=N still narrows it, up to ten years.

A days that is not a number is treated as a mistake in the request rather than a request for everything: only an absent parameter means the whole record.

The branch SQL decides, pinned

Two new tests drive keyWork with a fake pool, because the windowing is the one decision made in SQL rather than TypeScript:

  • the default writes no interval and passes no parameter;
  • days=30 narrows both halves — the live dispatches and the archive — because a half-windowed answer would silently undercount every retry, and a retry is exactly what the archive holds.

bun test apps/server/tests/api/queen-leaderboard.test.ts — 11 pass.

Board side: gHashTag/trinity#1141.

🤖 Generated with Claude Code

The board asked for thirty days, which is the wrong default for a record of who
carried the swarm. A lender whose lanes worked hard last month and rested this
one read as having done nothing, and the board quietly SHRANK as time passed
rather than growing with the work. Owner's word today: show the whole record.

`days` is now `number | null`, null meaning no time predicate at all rather
than a very large number of days - so the query has nothing to be off-by-one
about, and the archive's own rows decide how far back the answer goes.
`?days=N` still narrows it, up to ten years.

A `days` that is not a number is treated as a mistake in the request rather
than a request for everything: only an ABSENT parameter means the whole record.

Two tests pin the branch SQL decides rather than TypeScript, with a fake pool:
the default writes no `interval` and passes no parameter, and `days=30` narrows
BOTH halves - the live dispatches and the archive - because a half-windowed
answer would silently undercount every retry.

11 tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

⚠️ No test results were produced

View workflow run

@gHashTag
gHashTag merged commit 3d841de into feat/queen-supervisor Sep 23, 2026
3 of 18 checks passed
@github-actions
github-actions Bot deleted the feat/leaderboard-all-time branch September 27, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant