fix: re-fetch existing transactions on each validation #72
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-v2#72
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/refresh-existing-transactions-on-validation"
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
TransactionBuilder.load_existing_transactions()cached results on first call and never refreshed, even across a multi-hour session_existing_transactions_loadedcache gate so the method always re-fetches from the APIRelated
team_abbrevfilter)Test plan
/dropaddsession, adds FA player to MiL — should project correct count (accounting for Myers/Ross releases)🤖 Generated with Claude Code
AI Code Review
Files Reviewed
services/transaction_builder.py(modified)Findings
Correctness
The fix is correct and well-targeted. Removing the
_existing_transactions_loadedguard means every call tovalidate_transaction(next_week=...)re-fetches transactions from the API, capturing moves submitted by other users or sessions during the lifetime of the builder.The
_existing_transactionsfield correctly remains asOptional[List[Transaction]] = Nonein__init__— it's now a per-call write target rather than a session cache. The guard invalidate_transaction(if self._existing_transactions:) correctly handles theNonecase whennext_weekis not provided, so no regression there.Error path is sound: the
exceptblock setsself._existing_transactions = [], which is falsy and skips the loop invalidate_transaction. Same as before.Security
No issues found.
Style & Conventions
try:block (artifact of removing the two-line guard). Cosmetic only, not a blocker.services/CLAUDE.mdunder "Transaction Builder Enhancements" still documents the old caching behavior: "Performance Optimization: Pre-existing transactions loaded once and cached". This is now inaccurate. Not blocking, but worth a follow-up edit.Suggestions
services/CLAUDE.mdnote from "cached" to "re-fetched on each validation" to match the new behavior.Verdict: APPROVED
Minimal, correct fix. The cache invalidation approach (removing the gate entirely rather than adding explicit invalidation logic) is the right call here — the builder session is long-lived but the underlying data changes frequently in a multi-user environment. 39/39 tests passing confirms no regressions.
Automated review by Claude PR Reviewer