fix(recruitment): order invited candidates by player_id#155
Merged
Conversation
selectInvitedByRun and selectInvitedToday had no ORDER BY, so PostgreSQL returned invited candidates in arbitrary heap order — the same run could render its usernames differently on re-report, and no stable order at all across runs. Sorting by username would bias the list toward shorter/earlier handles; player_id gives a stable, neutral order instead. Fixes #154. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
What
Add
ORDER BY player_idtoRecruitmentCandidate.selectInvitedByRunandselectInvitedToday, which previously had noORDER BYand so returned invited candidates in arbitrary PostgreSQL heap order.selectInvitedByRunuses bare columns (ORDER BY player_id);selectInvitedTodayaliases the table asrc(ORDER BY rc.player_id). Both feed the recruitment output list,--cumulative, andshowReport.Sorting by username would bias the list toward shorter/earlier-alphabet handles;
player_idgives a stable, neutral order.Fixes
Fixes #154.
Testing
pid2, pid0, pid1) return ascending[pid0, pid1, pid2]viaselectInvitedByRun.sbt "testOnly ...TestRecruitmentAppCore"— 23/23.sbt test(pre-push) — 1019 passed.Note
Open follow-up:
selectInvitedTodayspans multiple runs/day, whereplayer_idalone is only a total order if invite-dedup guarantees one invited row per player per day. Tie-break tracked against the delivery redesign in #153.🤖 Generated with Claude Code