New enter-picks cli tool - #182
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The executable is not deployed, and historical edits can leave derived results, awards, and rankings inconsistent.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds a Rust CLI for administratively entering or replacing player picks after the deadline.
Changes:
- Adds argument parsing, validation, confirmation, and database updates.
- Extracts deadline-free pick replacement logic.
- Removes the former shell script.
File summaries
| File | Description |
|---|---|
src/lib.rs |
Exposes the CLI module and default database path. |
src/enter_picks.rs |
Implements the administrative picks workflow. |
src/data/basho.rs |
Adds deadline-free transactional pick replacement. |
src/bin/enter-picks.rs |
Defines the CLI executable. |
scripts/admin-picks.sh |
Removes the previous SQLite-based tool. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Replacing picks after a basho is finalized would leave basho_result, awards, and player_rank stale with no torikumi import coming to fix them.
There was a problem hiding this comment.
🟡 Changes recommended
Finalized-state checks must be atomic with pick replacement, and the deadline summary should account for the grace period.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
src/enter_picks.rs:82
- The finalized-basho check runs before the interactive confirmation, but this write is performed later by
force_save_player_pickswithout checking finalization. If the prompt remains open while the web admin finalizes the basho, this command can still insert picks after awards/results/ranks are committed, creating the stale state this guard is intended to prevent. Enforce the finalized-state check in the same transaction as the replacement (with appropriate transaction locking) rather than relying on this earlier check.
force_save_player_picks(&mut db, player.id, basho.id, pick_ids)?;
src/enter_picks.rs:281
has_started()becomes true at the scheduled start, whilesave_player_picksstill accepts picks for the 15-minute grace period (src/data/basho.rs:243-245). During that window this summary incorrectly says the pick deadline has passed. Either use the same grace-period predicate here or describe only that the basho has started.
if basho.has_started() {
println!(" Started: {start_date} — past the pick deadline!");
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
| let txn = db.transaction()?; | ||
| replace_player_picks(&txn, player_id, basho_id, picks)?; | ||
| txn.commit()?; |
There was a problem hiding this comment.
Unnecessary; this is an admin tool, and basho only ends with manual action also.
No description provided.