Skip to content

Draw only seated projects, time each pair, and let judges skip one - #34

Merged
pradhamk merged 2 commits into
mainfrom
require-table-for-draw
Oct 4, 2026
Merged

pradhamk merged 2 commits into
mainfrom
require-table-for-draw

Conversation

@pradhamk

@pradhamk pradhamk commented Oct 4, 2026

Copy link
Copy Markdown
Member

Summary

Two changes to the judge flow, one commit each.

1. Draw only projects that have a table

  • POST /pairs (a fresh draw, and the replacement pair after an absence) only picks projects whose Project Url has a table number in the PUT /tables mapping. A project with no table has nowhere for a judge to go.
  • Until a mapping is sent, or with fewer than two seated projects, the response is 409 POOL_EXHAUSTED.
  • PUT /tables gets its own rate-limit bucket (MDREDD_TABLES_CAPACITY 30, MDREDD_TABLES_REFILL_PER_SECOND 1.0). The dashboard now re-sends tables as assignments change, and those syncs must not use up the admin bucket that upload and start/stop share.

2. Time each pair and let a judge skip one unjudged

  • Assignments store assigned_at. POST /pairs returns it along with server_time, so a client can run a timer from MDredd's clock that a refresh, another device or a restart can't reset.
  • POST /pairs with skip: [id, id] gives up the open pair: no comparison and no strikes. Both projects get back the appearance the draw counted, so a timed-out pair doesn't count toward MDREDD_MIN_JUDGMENTS. The replacement avoids both skipped projects when enough others can be drawn.
  • If skip no longer matches the judge's open pair, MDredd returns the current pair instead of skipping again, so a retry is safe. skip with absent is 422.
  • Existing databases gain the assignments.assigned_at column at startup, the same way strikes was added. Pairs handed out before that count from startup.

Testing

  • Seated draws: with 2 of 8 projects mapped, the response is POOL_EXHAUSTED. With 3 mapped, 20 judges only ever got those 3, including the replacement after an absence. After 30 table syncs the tables bucket returns 429, while admin calls still succeed.
  • Timing: assigned_at is stable across reloads and restarts. A skip gives a non-overlapping pair with a later assigned_at and no strike changes. A retried skip keeps the replacement. Voting on the replacement works. An old database is migrated and keeps serving.
  • Refunds: entity_state.frequency goes back to its value before the draw after a skip, and stays incremented after a vote. With 20 projects and 50% random timeouts over 120 pairs, actual judgments per project ranged from 6 to 8.
  • basedpyright: no new errors. The responses= warnings from error_responses were already there.

Deploy

Deploy before mhacks/dashboard's matching PR. The dashboard's judge page needs assigned_at, server_time and skip.

🤖 Generated with Claude Code

pradhamk and others added 2 commits October 3, 2026 21:50
A project with no table in the mapping from PUT /tables has nowhere for a
judge to go, so the draw skips it until one is mapped. Table syncs get
their own rate limit, since the dashboard now resends them as
assignments change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Assignments record when they were handed out, and POST /pairs returns
that time with MDredd's clock so a client can run a timer that a refresh
cannot reset. POST /pairs with skip gives up the open pair without a
comparison or strikes, refunds its appearances, and draws another; a
stale skip returns the current pair instead of skipping twice. Existing
databases gain the assigned_at column at startup.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@pradhamk
pradhamk merged commit bd461a0 into main Oct 4, 2026
1 check passed
@pradhamk
pradhamk deleted the require-table-for-draw branch October 4, 2026 02:02
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