feat(queen): the leaderboard is all time, and a window narrows it - #512
Merged
Merged
Conversation
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>
|
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 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
daysis nownumber | 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=Nstill narrows it, up to ten years.A
daysthat 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
keyWorkwith a fake pool, because the windowing is the one decision made in SQL rather than TypeScript:intervaland passes no parameter;days=30narrows 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