feat(tooling): add batch binary freshness objective doc

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-04-30 01:23:52 -04:00
parent def441c305
commit d4c5a693a6

View file

@ -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.