Skip to content

Conversation

@johnpooch
Copy link
Collaborator

No description provided.

The Phase.State() method in gae/common.go was hardcoded to use
classical.Parser and classical.Blank(), causing order validation
failures for non-Classical variants like Hundred and Sengoku.

Problem:
When resolving orders via the /resolve or /resolve-with-options
endpoints, the code would:
1. Accept a variant parameter (e.g., hundred.HundredVariant)
2. But then create a State using classical.Blank() which uses the
   Classical Diplomacy graph
3. When validating orders, province IDs like "nom", "dev", "cal"
   (from Hundred) would fail with ErrInvalidSource because they
   don't exist in the Classical graph

Solution:
Replace hardcoded classical.Parser and classical.Blank() with the
variant's own Parser and Blank functions. This ensures:
- The correct graph is used (Hundred graph for Hundred variant)
- The correct parser is used (BuildAnywhereParser for Hundred)
- Province validation checks against the correct set of provinces

This bug has existed since gae/common.go was created in 2018 but
only manifested when clients began using the HTTP resolve endpoints
instead of directly calling variant functions in Go code.
@johnpooch johnpooch merged commit cd24442 into master Nov 14, 2025
1 check failed
@johnpooch johnpooch deleted the fix/use-variant-specific-parser-and-blank branch November 14, 2025 16:07
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.

2 participants