Skip to content

New enter-picks cli tool - #182

Merged
danieldickison merged 3 commits into
mainfrom
enter-picks-cli
Sep 13, 2026
Merged

danieldickison merged 3 commits into
mainfrom
enter-picks-cli

Conversation

@danieldickison

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread src/enter_picks.rs
Comment thread src/bin/enter-picks.rs
Replacing picks after a basho is finalized would leave basho_result, awards, and player_rank stale with no torikumi import coming to fix them.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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_picks without 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, while save_player_picks still 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

Comment thread src/data/basho.rs
Comment on lines +263 to +265
let txn = db.transaction()?;
replace_player_picks(&txn, player_id, basho_id, picks)?;
txn.commit()?;

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary; this is an admin tool, and basho only ends with manual action also.

@danieldickison
danieldickison merged commit 17bfb19 into main Sep 13, 2026
5 checks passed
@danieldickison
danieldickison deleted the enter-picks-cli branch September 13, 2026 18:44
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.

2 participants