Skip to content

Validate saved pending choices in one place - #471

Merged
valzargaming merged 1 commit into
mainfrom
claude/project-thread-unhs00
Nov 12, 2026
Merged

valzargaming merged 1 commit into
mainfrom
claude/project-thread-unhs00

Conversation

@valzargaming

Copy link
Copy Markdown
Member

Requested by Val · project thread

Item 4 of the structural review: the saved-continuation validator.

What changed

  • Game::fromArray() was 306 lines, about half of it validation of the saved pending choice. That validation moves unchanged into Game::validateSavedChoice(); fromArray() is now 155 lines and reads as plain loading.
  • The same "is this a list of [effect, target] steps" loop was written out four times and the followed-target loop twice. They are now assertSavedSteps() and assertSavedFollowed(), each taking the caller's error message.
  • Error messages, the order of checks within a choice kind, and which saves are accepted or rejected are unchanged.

What this does not do

The review also suggested one small class per choice kind (validate, options, apply, describe). OptionalChoices (#469) already covers the seven "you may" kinds that way. The other kinds (look, sacrifice, fabricate, entry_life, scry, discard, mode, …) differ enough that classes for them would be a larger change, and several open PRs add or alter choice kinds, so that part is left for after those land.

Verification

Full suite locally: 2591 tests, 2 skipped (the existing missing-import skips). Pint clean. Game.php pin refreshed with composer pins.


Generated by Claude Code

Game::fromArray() was 306 lines, half of it validation of the saved
pending choice with the same continuation checks written out four times.
The validation moves unchanged into validateSavedChoice(), and the
repeated step and followed-target loops become assertSavedSteps() and
assertSavedFollowed(). Error messages and accepted saves are unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WTP2SqPTWy8sMSFHkDL2C
Copilot AI balanced review requested due to automatic review settings November 12, 2026 23:14
@valzargaming valzargaming self-assigned this Nov 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@valzargaming
valzargaming merged commit f0b029c into main Nov 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants