Skip to content

fix: go starter kit refresh + ci - #111

Merged
thegalah merged 3 commits into
masterfrom
fix/go-starter-kit-refresh
Jul 25, 2026
Merged

fix: go starter kit refresh + ci#111
thegalah merged 3 commits into
masterfrom
fix/go-starter-kit-refresh

Conversation

@thegalah

Copy link
Copy Markdown
Contributor

No description provided.

thegalah added 3 commits July 25, 2026 09:07
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).
@thegalah
thegalah merged commit 23f5ffb into master Jul 25, 2026
1 check passed
@thegalah
thegalah deleted the fix/go-starter-kit-refresh branch July 25, 2026 16:14
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.

1 participant