When the proof drives _on_tab_changed directly, the TabBar current_tab
does not update (in-game the player clicks the TabBar, which does). Set
_tab_bar.current_tab in the proof loop so the captured screenshots show
the correct tab highlighted. Cosmetic; product behaviour unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The EndGameSummary script existed but its .tscn did not, and nothing
instantiated it — the summary scene was orphaned, so no screen showed
at game-over for any GameOverReason. Author end_game_summary.tscn with
all 14 @onready %-named nodes the script requires, and instantiate it
in main.gd under a persistent CanvasLayer (layer 25): the control
self-connects to EventBus.game_over and unhides itself for every reason
(LastSurvivor, ConditionMet, TurnLimit, Resigned).
Add the three feature-local GameState members the footer handlers
dereference (read_only_mode, pending_replay_game_id, clear()) — without
them 2/5 footer buttons null-crashed; referenced only by this feature
(+ replay_viewer reads pending_replay_game_id). read_only_mode is a
flag with no enforcement consumer yet (honest partial).
Rewrite end_game_summary_proof from the old _draw() mockup to BOOT the
real scene for all four GameOverReason variants; add GUT tests
test_award_computation (3/3) + test_end_game_footer_actions (5/5).
GUT full default suite on apricot: 645/693 pass, only deltas vs the
pre-change baseline are +8 (these new tests) and -1 (a pre-existing
detached-node bug fixed in test_statistics_modal) — no regressions.
All four end-game variants proof-rendered on apricot.lan and reviewed.
Production game_over emission (mc-turn) and a GdReplayPlayer::get_awards
bridge stay Rust-lane; the live awards path shows the pending notice.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The 709-line self-building StatisticsModal script existed but its scene
asset did not — world_map.gd and ingame_menu.gd both push_overlay
"statistics.tscn", so F9 / info-button / Stats-menu dead-ended at a
missing resource. Author the thin one-node Control wrapper with the
script attached; both entry points now open the modal.
Also add statistics_proof.{gd,tscn} (boots the real wrapper, seeds a
4-clan 12-turn StatsTracker fixture, captures one screenshot per tab)
and fix a pre-existing detached-node bug in test_statistics_modal's
close-fallback test (called _ready()+_on_close() on a node never added
to the tree). GUT: test_statistics_modal 8/8 green on apricot. All 5
tabs proof-rendered on apricot.lan and reviewed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
New api-gdext/src/lair.rs exposing GdLair::assault(...) #[func], registered
in lib.rs. Mirrors the GdLootRoller JSON-string pattern (Rail 3 — file IO
stays in GDScript, the bridge only marshals):
assault(attackers_json, defenders_json, loot_tier_json, lair_id,
lair_tier, turn_seed, defender_terrain_bonus) -> Dictionary
GDScript reads public/resources/lairs/loot/tier_NN.json + builds the
stack/defender JSON; the bridge parses (build_params — Godot-free,
unit-tested) into LairAssaultParams, calls mc_combat::resolve_assault, and
returns a cleared/repulsed/withdrawn outcome Dictionary (error, never panic,
on malformed JSON).
The Assault/Siege/Raid UI mode picker is a godot-ui follow-up, noted in the
objective — NOT built in this Rust lane.
Tests (apricot): GdLair 6/6 (cleared+guaranteed-loot, repulsed via real
wild_combat_stats(8,huge,carnivore), withdrawn, params-assembly, 2 parse-error
paths); api-gdext lib 29/29; cargo check --workspace exit 0.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closes p2-57c bullet-2's apply half and p2-57b's pipeline live-loop gap.
- mc_units::UnitStats gains a flattened CombatStats { hp, max_hp?, attack,
defense, ranged_attack, range } (serde-default; the unit JSON already
authors these — the catalog was dropping them on load).
- mc-turn processor::resolve_spawn_combat resolves a spawning unit's base
combat line from the units catalog BY unit_id, then applies the stamped
QualityTier delta from combat_balance.quality_deltas (Rail 2). Both
try_spawn_unit and spawn_unit_typed call it.
- Fixes a latent live bug: try_spawn_unit hardcoded 60/12/1 on EVERY unit
type, so queued non-warriors spawned with warrior stats.
Honest scope: the apply half is now live; the stockpile->tier STAMP source
(per-city typed ResourceStockpile p2-57a + per-unit gating p2-57b) is not
wired into process_city_production, so live units carry quality:None today.
Bullet 2 stays partial (apply proven; stamp-source half gated on infra).
Tests (apricot): mc-turn 235 lib, mc-units 12, mc-city 262, mc-combat 217,
mc-core 143; new quality_spawn_live_processor 3/3; cargo check --workspace 0.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- true-state/path-forward/blockers section appended to every open objective
- status corrections: p2-48 done→partial (end_game_summary.tscn orphaned, over-claim); p2-72b blocked_by cleared (Path 2 chosen)
- .project/FINISH_GAME1_PLAN.md: 5 waves (wiring/lairs/AI-convergence/architecture/CI), AI refound-suppression flagged as the at-risk long pole, audio+paid-sprites+guide as accepted-open
- objectives.json regenerated
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
game_state.rs references 6 mc-turn sibling DATA types in field decls (not
turn-logic calls): RansomQueue, 6 combat_event structs + TurnResult,
CapturePosture, PatrolOrder, CombatBalance (already mc-core). Phase 3 is a
2-step — relocate these to mc-core first (Phase 0c pattern), then move
game_state.rs to mc-state behind a pub-use shim. Save-format round-trip is the
gate. p2-72 gated on full p2-65, 2+ sessions out.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pre-flight for the mc-state extraction found Phase 0 under-scoped: GameState/
PlayerState carry 4 mc_ai::tactical typed fields (TacticalMemory, BuildingPriors,
TacticalUnitSpec, TacticalBuildingSpec), so mc-state (forbids mc-ai dep) could
not hold GameState until they moved. All verified data-only.
- New mc_core::tactical_types holds the 4 structs verbatim + is_buildable +
default_tier + 3 unit tests (serde round-trip, memory state-machine, gates).
- mc-ai memory.rs/state.rs re-export from mc-core (pub use) — every existing
mc_ai::tactical::* path still resolves; duplicate defs/tests removed.
- mc-turn game_state.rs 5 type refs → mc_core::* (incl ScoringWeights),
forward-looking for the game_state→mc-state move. Save format byte-identical.
Independently kills the irregular mc-turn→mc-ai data dependency the spec Context
flags. Gates green on apricot: check --workspace --tests clean; mc-core
tactical_types 3/3; mc-ai all green; mc-turn 235 lib; mc-player-api 126+integ.
Pre-existing five_players_overflow failure (MAX_PLAYERS 4→12 stale; touches no
moved type; fails on HEAD) is not a regression. p2-65 stays stub (mc-state crate
not yet created — Phase 1+).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Phase 2 (bullets 5+6). Builds option (b): a gridded GameState Rust harness so
compute_vision populates and both combatant slots run the scripted-default
controller through the persistent drive_ai_slot mem::take seam (fair two-
scripted:default — a passive ender drives every other slot via apply_end_turn).
Findings on the fair surface (160t): lock ENGAGES (ever_committed=true,
committed_with_target=true), 20 CityCaptured fire, but 0 eliminations and both
empires grow (15 vs 22 cities). min_total_cities never dips below start despite
20 captures (38 refounds offset every loss). Verdict: targeting lock works;
bottleneck is capture-stickiness / refound-suppression — confirms p1-29d's
indecisive-war root cause + the spec's weight-insensitivity risk, empirically.
- gridded_fair_surface_engages_army_lock: green always-on guard (vision>0 +
lock engages) — the Phase-1-on-production-seam coverage the gridless
p1_29h_persistent_memory_seam guard could not provide.
- fair_scripted_duel_elimination_measurement (#[ignore]): records the 160t
signals; elimination NOT asserted (measured-negative, bullet 3 stays open).
p1-29h stays partial K=5/6; resume note redirects next wave at refound-
suppression, not the targeting lock. mc-player-api 126 + integration green;
cargo check --workspace --tests clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Phase 2 of p1-29h. Adds the only regression coverage for the persistent
memory seam: `apply_end_turn → drive_ai_slot` (the mem::take + write-back
that survives the per-turn TacticalState snapshot). The mc-ai movement test
calls decide_movement directly and never touches this seam, so this guards
the dispatch threading itself — drives 60 turns without panic, reads the
memory field back, asserts coherence (committed ⇒ has a target).
Phase 2 measurement (bullets 3/5/6) NOT met — objective flips stub → partial
(K=3/6, bullets 1/2/4 cited from Phase 1's green mc-ai tests). Verified
finding recorded in the objective + test: the persistent army-lock lives ONLY
on the drive_ai_slot/apply_end_turn path; both existing full-game drivers
bypass it (p1-clean-baseline.py clones memory via suggest(); full_game_transcript
passes a transient default). The seam test's gridless GameState::default()
fixture yields an EMPTY vision set (sees_own_city=false, visible_tiles=0), so
no enemy city is ever visible and want_attack never fires — engagement needs a
real grid+vision surface (Godot autoplay / AUTO_PLAY_ALL_AI driving end_turn).
Lock engagement on full visibility is already proven by the mc-ai movement test.
cargo check --workspace --tests green on apricot; seam test 1/1 pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ports the decisive-war mechanic from the juiced harness auto_play.gd:1109-1189
into the shipping Rust AI so the scripted controller fields it natively
(removing the dependency on the GDScript harness for decisiveness).
Capability (acceptance bullets 1, 2, 4):
- New `mc_ai::tactical::TacticalMemory { locked_target, commitment_turns }` —
the cross-turn persistence channel. Lives on `mc_turn::PlayerState`
(`#[serde(skip)]`, transient), NOT on the per-turn TacticalState snapshot
(which round-trips FFI as JSON — a field there would mean GDScript shadow
state, violating Rail 1) and NOT on the controller (a stateless shared
singleton). Borrowed `&mut` by `dispatch::drive_ai_slot` via mem::take and
threaded through `decide_turn → run_ai_turn → decide_tactical_actions →
decide_movement` — the pure-Rust path p1-29d measures, zero GDScript.
- `TacticalMemory::resolve` folds the auto_play state machine: acquire nearest
target when attacking, HOLD through tactical-score wobble for the commitment
window (hysteresis), PRESS ON to the next objective when the locked target
falls (capture → don't disperse), clear when all enemy cities are gone.
- `decide_movement` computes the army-wide lock once per turn (step 5b) and
every non-adjacent military unit drives on it instead of per-unit greedy
re-targeting — so captures get finished into eliminations.
- Commitment length is personality-derived (`thresholds::commitment_turns`,
aggression 0.6 / grudge 0.4; axis=5 reproduces auto_play's =5) — Rail 2
(ai_personalities.json axes), not a hardcoded constant.
- AiController trait gains `&mut TacticalMemory`; scripted threads it, mod
(wasm/native) + learned + FFI-shim controllers take a documented transient.
Tests (cargo test -p mc-ai green: 278 lib, all integration; workspace --tests
checks clean on apricot):
- 10 `memory::` unit tests: acquire/hold/expire/press-on/clear/determinism.
- 2 `thresholds::commitment_turns` tests (auto_play baseline + personality).
- 1 `movement::army_lock_concentrates_and_persists_across_turns` integration
test: a PERSISTED memory across two real decide_movement calls concentrates
3 units on ONE locked city and holds it through a want_attack=false turn.
- No regression: mc-turn 235/235, mc-player-api 126+, mc-mod-host all green.
Phase 1 is the clean green commit boundary. Objective stays 🟡 partial:
bullets 3 (≥1 elimination measured), 5 (AUTO_PLAY_ALL_AI / asymmetric harness),
6 (p1-29d re-score) are Phase 2 (batch validation on apricot), not yet done.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds the read-side civic query the civics UI needs, completing the bridge
split out of p3-05a. `GdGameState::civic(pi, axis) -> Dictionary` returns
`{ choice, anarchy_turns_remaining, in_anarchy }`, riding on GdGameState
next to request_civic_switch/get_anarchy_turns_remaining (the canonical
per-player accessor surface — there is no per-GdPlayer shim in the tree).
`choice` is serialised via serde with quotes stripped (symmetric with the
request_civic_switch parse path): named AxisChoice variants → snake_case,
Anarchy → "anarchy", untagged Custom(id) → id verbatim. Unknown axis or
out-of-range pi → empty Dictionary.
Tests (green headless on apricot.lan):
- engine/tests/unit/civics/test_civic_query_bridge.gd — 7/7
- engine/tests/integration/test_gdextension_contract.gd — civic in the
GdGameState method contract; test_gd_game_state_has_expected_methods passes
- cargo check --workspace green; build-gdext.sh release build green
Objective p3-05a-gdext-bridge: stub → done (4/4 acceptance, cited).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Re-verified p1-05 and p1-38 follow-up batch acceptance against the fresh
committed-build smoke batch on apricot (20260604_011524/smoke, built
7d77fe728 from origin/main, 10 seeds T300, completed 2026-06-04 08:28).
p1-05: bullet 2 (personality_win_balance) satisfied upstream via p0-02
(done); bullet 1 (luxury variance >=3 distinct/seed) still fails -- no
p0-08 tempo in main (median end-turn is stochastic same-SHA variance, not
a build property), no distinct-luxury-variance extraction tool, scalar
read fails on seeds 1/5/9; bullet 3 out of fence. Stays stub.
p1-38: coupled mode still gated static_terrain in main (7d77fe728 and
5c97ce3f9), run-headless-batch.sh absent, no forest-tile metric emitted,
flip is a forbidden source edit. Un-runnable under no-edit committed-build
fence, not a balance miss. Stays stub.
Per feedback_batch_attribution_discipline + feedback_balance_philosophy.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>