From d4c5a693a69833b8d06c4ba8e5a91c48c89473fd Mon Sep 17 00:00:00 2001 From: Natalie Date: Thu, 30 Apr 2026 01:23:52 -0400 Subject: [PATCH] =?UTF-8?q?feat(tooling):=20=E2=9C=A8=20add=20batch=20bina?= =?UTF-8?q?ry=20freshness=20objective=20doc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- .../p1-45-batch-binary-freshness.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .project/objectives/p1-45-batch-binary-freshness.md diff --git a/.project/objectives/p1-45-batch-binary-freshness.md b/.project/objectives/p1-45-batch-binary-freshness.md new file mode 100644 index 00000000..50004eef --- /dev/null +++ b/.project/objectives/p1-45-batch-binary-freshness.md @@ -0,0 +1,53 @@ +--- +id: p1-45 +title: "Batch binary freshness: rebuild GDExt before every autoplay batch" +priority: p1 +status: missing +scope: game1 +tags: [tooling, batch, gdext, ci] +owner: simulator-infra +updated_at: 2026-04-30 +--- +## Summary + +Autoplay batches (`tools/autoplay-batch.sh`) run Godot against the installed GDExtension binary +(`engine/addons/magic_civ_physics/libmagic_civ_physics.x86_64.so`). When multiple agents or +developers land Rust changes between batches, the `.so` silently goes stale — the GDScript wrappers +call methods that don't exist yet in the binary, producing cryptic errors like: + +``` +Invalid call. Nonexistent function 'process_culture_with_modifier' in base 'RefCounted (City)'. +``` + +This was observed on 2026-04-30 during the p1-29 anti-snowball batch cycle when the culture-port +teammate's `process_culture_with_modifier` and p1-30's `set_map`/`update_tile` GDExt methods were +landed after the last build, causing R12 test failures at T22. + +## Root cause + +`autoplay-batch.sh` has no pre-flight build step. It trusts the pre-installed `.so` is current. +On a shared host (apricot) with multiple parallel agents, this assumption breaks on every +cross-team Rust landing. + +## Acceptance + +- ✓ `tools/autoplay-batch.sh` (or a wrapper) rebuilds `libmagic_civ_physics.x86_64.so` from + source before launching seeds, OR emits a blocking error if the `.so` is older than any `.rs` + file in `src/simulator/`. +- ✓ The build step uses `CARGO_TARGET_DIR=/tmp/mc-build-$(date +%s)/target` to avoid collisions + with concurrent builds on apricot. +- ✓ Wrapper documented in `canonical-commands.md` under "10-seed parallel batch". +- ✓ CI smoke test (`tools/ci-autoplay-smoke.sh`) also pre-builds. + +## Implementation sketch + +Option A — add to `autoplay-batch.sh` preamble (local mode only; remote mode already delegates to run_ap3.sh): +```bash +if [ -z "$AUTOPLAY_HOST" ]; then + (cd src/simulator && CARGO_TARGET_DIR=/tmp/mc-build-$(date +%s)/target bash build-gdext.sh) +fi +``` + +Option B — separate `tools/batch-with-build.sh` wrapper that builds then delegates. + +Option A is simpler; Option B keeps `autoplay-batch.sh` focused. Either satisfies the gate.