Skip to content

fix: rust starter kit refresh + ci - #112

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

fix: rust starter kit refresh + ci#112
thegalah merged 4 commits into
masterfrom
fix/rust-starter-kit-refresh

Conversation

@thegalah

Copy link
Copy Markdown
Contributor

No description provided.

thegalah added 4 commits July 25, 2026 09:36
The Rust kit (flagged not-up-to-date in the README) had drifted from the
current engine wire protocol. Because it uses typed serde structs, the drift
caused hard failures rather than the silent no-ops seen in the untyped Go kit.

Protocol fixes:
- Add the `info` ServerPacketType variant. The engine broadcasts `info` packets
  while waiting for players; without this variant serde fails to parse them and
  the agent panics on connect (start() propagates the error via `?`).
- Rename the bomb-owner field `owner_unit_id` -> `unit_id` (entity.rs,
  game_state.rs). The stale name never populated, so get_bomb_for_unit always
  returned None and the agent could never detonate.
- Fix create_detonate_bomb_action to send type "detonate" (was "bomb", which
  would place a bomb instead of detonating).
- Add `stunned` to Unit and `agent_id` to Entity, both present in the current
  schema (freeze mechanic), and copy them in update_state.

Tests (the kit had none):
- Add src/tests.rs with serde-conformance tests (info parses, stunned/unit_id/
  agent_id deserialize, detonate serializes correctly) and a schema-validation
  test that checks the fixtures against the engine's canonical ServerPacket
  schema via a jsonschema dev-dependency. The schema path is taken from
  BOMBERLAND_SCHEMA_PATH (CI points it at the engine schema) and defaults to a
  bundled copy for local runs and standalone clones.

Tooling:
- Bundle the engine's canonical validation.schema.json.
- Modernize the Dockerfile base images (rust:1.57-slim-buster -> rust:1-slim-
  bookworm, debian:buster-slim -> bookworm-slim) so the toolchain can resolve
  the updated dependency graph; the release build still compiles only the bin
  target, so the jsonschema dev-dependency is not built into the image.
Mirrors the Go kit's CI. The engine's JSON schema is the source of truth: the
workflow validates the Rust fixtures against the engine's canonical schema and
re-runs whenever that schema changes.

- Triggers on changes to agents/rust/**, the engine schema, and the workflow.
- Fails if the kit's bundled schema copy has drifted from the engine's.
- Runs `cargo test --locked` with BOMBERLAND_SCHEMA_PATH pointed at the engine
  schema. GitHub-hosted runners only.
The Rust kit now matches the current engine wire protocol and is validated
against the engine's canonical JSON schema in CI (test-rust-agent.yaml).
Public repo — CI only ever runs on GitHub-hosted runners, so the note about
never using self-hosted homeserver runners was misleading. Reworded both
workflow header comments to just state the runner, keeping the engine
workflow's PR-build/no-push note.
@thegalah
thegalah force-pushed the fix/rust-starter-kit-refresh branch from 8d51012 to c2e94d3 Compare July 25, 2026 17:04
@thegalah
thegalah merged commit 865fd2c into master Jul 25, 2026
3 checks passed
@thegalah
thegalah deleted the fix/rust-starter-kit-refresh branch July 25, 2026 17:13
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