Reject a currency code that isn't one #49

Open
opened 2026-08-15 18:58:45 +00:00 by rosa · 0 comments
Owner

What to build

The currency is stored as a bare string and validated nowhere. Reading it back
converts the code and unwraps the result, so a config naming USDD parses
cleanly, the casino opens, and the game panics at whatever point first asks what
the tables deal in — some arbitrary distance into a hand, with nothing pointing
at the config file as the cause.

Settle it where the file is read. A code that is not a currency fails the load,
naming the file and the code it could not make sense of, and the player is told
what to fix before anything else happens.

An empty value keeps meaning the house default. That is not the same defect: an
empty key reads as "I have not decided", the existing test says as much, and the
distinction survives the change intact. What is wrong is a code that looks
plausible, passes, and detonates later.

Acceptance criteria

  • A config naming a code that is not a currency fails to load, and the error
    names both the file and the code
  • A config naming no currency at all still deals in the house default
  • A config naming an empty currency still deals in the house default
  • A named currency is still what the tables deal in
  • Asking what the tables deal in cannot panic
  • CHANGELOG notes that a bad currency code now fails at load rather than
    mid-game

Blocked by

## What to build The currency is stored as a bare string and validated nowhere. Reading it back converts the code and unwraps the result, so a config naming `USDD` parses cleanly, the casino opens, and the game panics at whatever point first asks what the tables deal in — some arbitrary distance into a hand, with nothing pointing at the config file as the cause. Settle it where the file is read. A code that is not a currency fails the load, naming the file and the code it could not make sense of, and the player is told what to fix before anything else happens. An empty value keeps meaning the house default. That is not the same defect: an empty key reads as "I have not decided", the existing test says as much, and the distinction survives the change intact. What is wrong is a code that looks plausible, passes, and detonates later. ## Acceptance criteria - [ ] A config naming a code that is not a currency fails to load, and the error names both the file and the code - [ ] A config naming no currency at all still deals in the house default - [ ] A config naming an empty currency still deals in the house default - [ ] A named currency is still what the tables deal in - [ ] Asking what the tables deal in cannot panic - [ ] CHANGELOG notes that a bad currency code now fails at load rather than mid-game ## Blocked by - #45
Sign in to join this conversation.
No description provided.