From e7db68f3a5be5a50bf643363191348fed01d3021 Mon Sep 17 00:00:00 2001 From: John McDowell Date: Fri, 14 Nov 2025 15:40:58 +0000 Subject: [PATCH 1/2] Fix: Use variant-specific parser and blank function in Phase.State() 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. --- gae/common.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gae/common.go b/gae/common.go index 8975e520..d14ce5e4 100644 --- a/gae/common.go +++ b/gae/common.go @@ -3,7 +3,6 @@ package main import ( "github.com/zond/godip" "github.com/zond/godip/state" - "github.com/zond/godip/variants/classical" "github.com/zond/godip/variants/common" ) @@ -42,11 +41,11 @@ func NewPhase(state *state.State) *Phase { } func (self *Phase) State(variant common.Variant) (*state.State, error) { - parsedOrders, err := classical.Parser.ParseAll(self.Orders) + parsedOrders, err := variant.Parser.ParseAll(self.Orders) if err != nil { return nil, err } - return classical.Blank(variant.Phase( + return variant.Blank(variant.Phase( self.Year, self.Season, self.Type, From 89582e071ea1754586a7d14fd44f384ed0596372 Mon Sep 17 00:00:00 2001 From: John McDowell Date: Fri, 14 Nov 2025 15:59:37 +0000 Subject: [PATCH 2/2] Add deployment instructions to readme --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 0f28e4cb..6bb1c986 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,36 @@ $ curl -X POST --data '{"Season":"Spring","Year":1901,"Type":"Movement","Units": See https://github.com/zond/godip/tree/master/gae for exact implementation details. +### Deploying to production + +The production service runs on Google App Engine. To deploy changes manually: + +#### Prerequisites + +- Google Cloud SDK (`gcloud` CLI) installed +- Authentication with appropriate permissions to the `godip-adjudication` project + +#### Deployment steps + +```bash +# Navigate to the GAE directory +cd gae + +# Authenticate with Google Cloud (if not already logged in) +gcloud auth login + +# Set the correct project +gcloud config set project godip-adjudication + +# Deploy to production +gcloud app deploy app.yaml + +# Verify deployment +gcloud app logs read --limit 50 +``` + +Note: There is no automated deployment from CI/CD. GitHub Actions only runs tests on push/PR. + ### Variant support Currently only a few variants are supported.