docs(@projects/@magic-civilization): 🔎 p3-23 — discovery: inter-player trade turn-integration is DISABLED in-game

Verify-first while scoping part B (strategic gating) surfaced that p3-23's premise
was wrong. The inter-player trade evaluation does NOT run in the played game:

- turn_manager.gd:287 has Diplomacy.process_turn() commented out under a stale
  "empty stub module" note (diplomacy.gd was rebuilt but never re-enabled).
- The only writer of GameState.trade_ledger_json is diplomacy.gd:32 inside that
  disabled call → the ledger is never populated → NO inter-player trades run
  (luxury, strategic, or gold).
- The diplomacy.gd <-> GdTrade.process_trades contract has drifted in 3 places:
  input shape ({index,traded_luxuries,personality} vs Vec<PlayerTradeInput>),
  return keys ({ledger} vs trade_ledger_json/relation_changes/new_trades), and
  relations advancement. So enabling is not a one-line uncomment.

Consequence: the part-A gold-flow wiring (last pass) is correct + GUT-tested but
INERT in-game until the integration is revived (it reads an always-empty ledger).

The mc-trade simulation logic remains complete + cargo-tested (66/0). p3-23's real
remaining work is now scoped: revive the diplomacy trade turn-integration
(reconcile the 3 contract drifts, re-enable carefully, add PlayerState.traded_strategics
+ unit-gating, verify headless+GUT) then the deal UI. Status stays partial.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Natalie 2026-06-25 20:41:24 -04:00
parent a8c01cb5e1
commit de983fac54
2 changed files with 33 additions and 16 deletions

View file

@ -10,12 +10,24 @@ updated_at: 2026-06-25
## Summary
Inter-player trade EXISTS but is **luxury-for-luxury swaps only**
(`mc-trade/src/lib.rs:139 evaluate_trades`; AI-driven, relation-gated, can't trade
your last copy). You **cannot trade gold or strategic resources** with opponents,
and the `tribute.rs` path is deferred to Game 2. That makes diplomacy/economy
thinner than the resource model implies (strategic resources gate units and are
tradeable in concept, but no exchange path exists).
> **DISCOVERY (2026-06-25, verify-first):** the original premise was wrong. The
> inter-player trade turn-integration is **DISABLED in the played game**, not
> "luxury-only". `turn_manager.gd:287` has `Diplomacy.process_turn()` commented out
> with a stale "empty stub module" note (diplomacy.gd was rebuilt but never
> re-enabled). The *only* writer of `GameState.trade_ledger_json` is diplomacy.gd:32
> inside that disabled call, so **no inter-player trades run at all** (luxury, strategic,
> or gold). Worse, the `diplomacy.gd ↔ GdTrade.process_trades` contract has drifted
> in 3 places: (1) `_serialize_players` emits `{index, traded_luxuries, personality}`
> but `process_trades` deserializes `Vec<PlayerTradeInput>` (`player_index`,
> `tile_luxuries`, `tile_strategics`, `trade_willingness`); (2) `process_trades`
> returns `{ledger}` but diplomacy.gd reads `result["trade_ledger_json"]`,
> `["relation_changes"]`, `["new_trades"]`, `["broken_trades"]`; (3) relations
> advancement isn't returned. So enabling is NOT a one-line uncomment.
The **simulation logic is complete + cargo-tested** (luxury/strategic swaps + gold
sales in `mc-trade`, 66/0) and the gold-flow application is wired (part A) — but it
is all **inert in-game until the diplomacy turn-integration is revived**. The
`tribute.rs` path stays Game-2 deferred.
## Acceptance
@ -36,12 +48,17 @@ tradeable in concept, but no exchange path exists).
`#[serde(default)]`. Wiring follow-up.)*
- [~] Logic in Rust (`mc-trade`): gold-for-luxury sale + strategic-for-strategic
swap + strategic sale all evaluate + activate (8 cargo tests; mc-trade 66/0).
**In-game application — part A (gold flow) DONE:** `GdTradeLedger.gold_flow_for`
+ `GdEconomy` `trade_gold` param + `economy.gd` sourcing → inter-player sales now
hit the treasury (GUT `test_trade_gold_flows_into_net_gold`, seller +/buyer ).
**[ ] Remaining: part B** (strategic-resource gating — FFI sources `tile_strategics`,
`PlayerState.traded_strategics`, unit-gating reads `incoming_strategics`) **+ deal
UI** → status stays `partial`.
**In-game application — part A (gold flow) wired but INERT:** `GdTradeLedger.gold_flow_for`
+ `GdEconomy` `trade_gold` param + `economy.gd` sourcing are correct and GUT-tested
(`test_trade_gold_flows_into_net_gold`, seller +/buyer ) — but they read
`GameState.trade_ledger_json`, which is **never populated in-game** (the only writer is
the disabled `Diplomacy.process_turn`). So gold flow works the instant the trade
integration is revived, but produces 0 until then.
**[ ] REAL remaining work — revive the diplomacy trade turn-integration** (see the
DISCOVERY note): reconcile the 3 `diplomacy.gd ↔ process_trades` contract drifts,
re-enable `Diplomacy.process_turn` in `turn_manager.gd` (carefully — disabled modules
there can abort the arena turn loop), add `PlayerState.traded_strategics` + unit-gating,
verify the full pipeline headless + GUT. Then the deal UI. → status stays `partial`.
## Progress (2026-06-25)

View file

@ -1,12 +1,12 @@
{
"generated_at": "2026-06-26T00:12:40Z",
"generated_at": "2026-06-26T00:41:24Z",
"totals": {
"in_progress": 0,
"oos": 31,
"partial": 2,
"done": 295,
"stub": 0,
"oos": 31,
"missing": 0,
"partial": 2,
"total": 328
},
"objectives": [
@ -3278,7 +3278,7 @@
"scope": "game1",
"owner": "warcouncil",
"updated_at": "2026-06-25",
"summary": "Inter-player trade EXISTS but is **luxury-for-luxury swaps only**\n(`mc-trade/src/lib.rs:139 evaluate_trades`; AI-driven, relation-gated, can't trade\nyour last copy). You **cannot trade gold or strategic resources** with opponents,\nand the `tribute.rs` path is deferred to Game 2. That makes diplomacy/economy\nthinner than the resource model implies (strategic resources gate units and are\ntradeable in concept, but no exchange path exists)."
"summary": "> **DISCOVERY (2026-06-25, verify-first):** the original premise was wrong. The\n> inter-player trade turn-integration is **DISABLED in the played game**, not\n> \"luxury-only\". `turn_manager.gd:287` has `Diplomacy.process_turn()` commented out\n> with a stale \"empty stub module\" note (diplomacy.gd was rebuilt but never\n> re-enabled). The *only* writer of `GameState.trade_ledger_json` is diplomacy.gd:32\n> inside that disabled call, so **no inter-player trades run at all** (luxury, strategic,\n> or gold). Worse, the `diplomacy.gd ↔ GdTrade.process_trades` contract has drifted\n> in 3 places: (1) `_serialize_players` emits `{index, traded_luxuries, personality}`\n> but `process_trades` deserializes `Vec<PlayerTradeInput>` (`player_index`,\n> `tile_luxuries`, `tile_strategics`, `trade_willingness`); (2) `process_trades`\n> returns `{ledger}` but diplomacy.gd reads `result[\"trade_ledger_json\"]`,\n> `[\"relation_changes\"]`, `[\"new_trades\"]`, `[\"broken_trades\"]`; (3) relations\n> advancement isn't returned. So enabling is NOT a one-line uncomment.\n\nThe **simulation logic is complete + cargo-tested** (luxury/strategic swaps + gold\nsales in `mc-trade`, 66/0) and the gold-flow application is wired (part A) — but it\nis all **inert in-game until the diplomacy turn-integration is revived**. The\n`tribute.rs` path stays Game-2 deferred."
},
{
"id": "p3-24",