fix: go starter kit refresh + ci - #111
Merged
Merged
Conversation
The Go kit (flagged not-up-to-date in the README) had drifted from the current engine wire protocol in two ways: a runtime bug and a stale schema. Runtime: - Detonation looked up bombs by "owner_unit_id", which the engine renamed to "unit_id" — so the agent could never detonate. Fix the field and relax the edge guard (x >= 0 && y >= 0) so bombs on row/column 0 can be detonated. - Add main_test.go covering getBombToDetonate (own-bomb lookup, sentinel, edge bombs) — the main package previously had no tests. Schema + fixtures: - Replace the bundled validation.schema.json with the engine's canonical schema (adds freeze mechanic: fp/bp entity types, invulnerable/stunned). - TestJSONSchema now validates against #/definitions/ServerPacket instead of the document root. The root is definitions-only (no constraints), so the old test accepted any payload — a silent no-op. It now checks real shapes. - Update fixtures to the current contract: invulnerable+stunned (was invulnerability), required game_id on game state, and fp/bp powerup entities. Verified the schema test now fails on the old field names.
The engine's JSON schema is the source of truth for the wire protocol. Rather than let the kit's bundled copy silently drift, CI validates the Go fixtures against the engine's canonical schema and re-runs whenever that schema changes. - Test resolves the schema path from BOMBERLAND_SCHEMA_PATH, defaulting to the bundled ../validation.schema.json. CI points it at the engine's canonical file so fixtures are checked against the live contract; the bundled copy remains the fallback for the Docker build and standalone clones. - New workflow test-go-agent.yaml (GitHub-hosted runners only): * triggers on changes to agents/go/**, the engine schema, and the workflow; * fails if the bundled schema copy has drifted from the engine's; * runs `go test ./...` against the engine schema.
The Go kit now matches the current engine wire protocol and is validated against the engine's canonical JSON schema in CI (test-go-agent.yaml).
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.