claude-configs/skills/save-doc/examples/troubleshooting.md
Cal Corum b464a10964 Sync config: add save-doc skill, update agents/skills/plugins, clean sessions
- Add skills/save-doc/ skill
- Add sessions/2121928.json
- Delete cognitive-memory skill, memory-saver agent, save-memories command
- Update CLAUDE.md, pr-reviewer, issue-worker agents
- Update mcp-manager, create-scheduled-task, paper-dynasty skills
- Update plugins (blocklist, installed, known_marketplaces, marketplaces)
- Remove old session files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 02:00:54 -05:00

1.3 KiB

title description type domain tags
Fix: Scout Token Purchase Not Deducting Currency Scout token buy flow silently failed to deduct 200₼ due to using db_patch instead of the dedicated money endpoint. troubleshooting development
paper-dynasty
discord
api
bug-fix

Fix: Scout Token Purchase Not Deducting Currency

Date: 2026-03-15 PR: #90 Severity: High — players getting free tokens

Problem

The /buy scout-token command completed successfully but didn't deduct the 200₼ cost. Players could buy unlimited tokens.

Root Cause

The buy handler used db_patch('/players/{id}', {'scout_tokens': new_count}) to increment tokens, but this endpoint doesn't trigger the money deduction side-effect. The dedicated /players/{id}/money endpoint handles balance validation and atomic deduction.

Fix

Replaced the db_patch call with a two-step flow:

  1. POST /players/{id}/money with {"amount": -200, "reason": "scout_token_purchase"}
  2. Only increment scout_tokens if the money call succeeds

Lessons

  • Always use dedicated money endpoints for currency operations — never raw patches
  • The db_patch helper bypasses business logic by design (it's for admin corrections)
  • Added integration test covering the full buy→deduct→verify flow