fix: use money endpoint for scout token wallet deduction #90
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
ai-working
bug
enhancement
feature
in-queue
performance
security
tech-debt
todo
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-discord#90
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/scout-token-deduction"
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
db_patch("teams", params=[("wallet", new_wallet)])was silently ignored by the API — thewalletfield is not mutable via generic PATCH paramsdb_post(f'teams/{id}/money/-{SCOUT_TOKEN_COST}'), the dedicated money endpoint used by all other wallet mutations (marketplace purchases inselectors.py, daily check-ins inpacks.py)Test plan
🤖 Generated with Claude Code
db_patch with wallet param was silently ignored by the API — wallet mutations require the dedicated teams/{id}/money/{amount} endpoint. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>AI Code Review
Files Reviewed
discord_ui/scout_view.py(modified)Findings
Correctness
db_patch("teams", params=[("wallet", new_wallet)])was silently ignored by the API sincewalletis not mutable via generic PATCH params.db_post(f'teams/{team["id"]}/money/-{SCOUT_TOKEN_COST}')uses the dedicated money endpoint, consistent with all other wallet mutations in the codebase:selectors.py(lines 372, 438),packs.py(line 218),economy.py(line 637),gameplay_queries.py(lines 1199–1200).new_walletlocal state update (self.scouter_team["wallet"] = new_wallet) is preserved and still correct — the parent view refreshes frombuy_view.scouter_teamafter purchase, so the local dict must reflect the deducted balance.db_patchcleanly removed from import — confirmed no other usages in the file.Security
-{SCOUT_TOKEN_COST}) is a constant (200), not user-supplied input.Style & Conventions
f'teams/{id}/money/-{cost}'pattern exactly.Suggestions
Verdict: APPROVED
Minimal, correct fix. The dedicated money endpoint is the right approach and is already the established pattern for all wallet deductions in this codebase. Import cleanup is clean.
Automated review by Claude PR Reviewer — Gitea blocks self-approval, posting as COMMENT