Fix/use variant specific parser and blank#191
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.