hotfix: make ScorecardTracker methods async to match await callers #117
No reviewers
Labels
No Label
ai-changes-requested
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
in-next-release
status/in-progress
status/pr-open
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-v2#117
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "hotfix/scorecard-tracker-async"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Production is broken —
/scorebugand the live scorebug tracker are throwingTypeErrorbecause PR #106 addedawaittoscorecard_trackercalls but the tracker methods were still sync.Errors in production
Changes
commands/gameplay/scorecard_tracker.py— all 6 public methods madeasynccommands/voice/cleanup_service.py— 5unpublish_scorecardcalls now useawaittests/test_scorebug_bugs.py— 2 tests updated to asyncTest results
28/28 affected tests pass.
🤖 Generated with Claude Code
8e984d1d07to4e75656225AI Code Review
Files Reviewed
commands/gameplay/scorecard_tracker.py(modified)commands/voice/cleanup_service.py(modified)tests/test_scorebug_bugs.py(modified)Findings
Correctness
The fix is accurate and complete. All 6 public methods on
ScorecardTrackerthat were called withawaitby external callers are now properly declaredasync:publish_scorecard— called withawaitinscorebug.py:96unpublish_scorecard— called withawaitin 5 places acrosscleanup_service.pyget_scorecard— called withawaitinscorebug.py:167get_all_scorecards— called withawaitinlive_scorebug_tracker.py:98update_timestamp— called withawaitinscorebug.py:210cleanup_stale_entries— madeasyncfor consistency (not called externally viaawaitincleanup_service.py— see note below)A full grep of the codebase confirms there are no remaining callers of these methods that are missing
await. The two productionTypeErrormessages cited in the PR body map precisely toget_all_scorecards(returns a list) andget_scorecard(returnsNonewhen no scorecard published) — both are fixed.Note on
cleanup_stale_entries: The method is declaredasyncin this PR, but its only caller incleanup_service.py(line 144:self.tracker.cleanup_stale_entries(valid_channel_ids)) is calling a different object —self.trackeris aVoiceChannelTracker, not aScorecardTracker. TheScorecardTracker.cleanup_stale_entrieshas no external async callers today, but making itasyncis defensive and consistent — not a problem.The five
unpublish_scorecardcall sites incleanup_service.pyare all correct. The two that were reformatted to the multi-line parenthesizedawait (...)style are functionally identical to the single-line pattern used at the other three sites.Security
No issues. No new inputs, no new external calls, no secrets.
Style & Conventions
No issues. All methods retain their existing docstrings, return types, and logic unchanged. The test file correctly adds
@pytest.mark.asyncioandasync defto both affected test methods and updates all four call sites within those tests to useawait. This matches the project's established async test pattern.Suggestions
None that would block merging. The
save_data()andload_data()methods remain sync, which is correct — they do blocking file I/O but there are no async alternatives being bypassed here and the files are small JSON blobs. If file I/O ever becomes a concern,aiofilescould be introduced, but that is out of scope for this hotfix.Verdict: COMMENT (APPROVED)
The fix is correct, complete, and minimal. Every caller that previously received a non-awaitable object from a sync method now correctly awaits an
asynccoroutine. Tests are updated and passing (28/28 per PR body). This is a clean, targeted hotfix with no unintended side effects. Approving — Gitea blocks self-approval so posting as COMMENT.Automated review by Claude PR Reviewer