Files
Dune/docs/ECAZ_VICTORY_IMPLEMENTATION.md
2026-09-08 07:37:52 +10:00

32 lines
6.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Ecaz joint stronghold victory and public progress
Implemented and reviewed 7 September 2026 within the gated Ecaz development scope. The full game goal remains active. This slice adds the three jointly occupied stronghold win; it does not complete Ecaz, its Fremen special-endgame exception, Advanced rules or expansion/module acceptance.
## Source and behavior
[Source contract](ECAZ_VICTORY_RULES.md) records GF9 E3 pp.8,15–16 and applicable base/E1/E2 rules. Both Ecaz and its current reciprocal ally must have effective non-advisor presence in each of three distinct uncontested strongholds. Their ordinary four-stronghold union remains available. One faction holding all three Tech Tokens supplies one ordinary stronghold equivalent; split ownership does not, and tokens never supply a jointly occupied territory. A concealed No-Field supplies public presence without revealing its denomination. Only a placed Hidden Mobile Stronghold counts. Existing storm/control, advisor release and private BG prediction precedence are retained.
`game/victory-progress.ts` is the shared pure public calculation. It returns ordered member IDs, uncontested stronghold IDs, the ordinary threshold, complete-set bonus, jointly occupied IDs, the Ecaz threshold and prospective eligibility. It validates the entire faction/alliance roster, public board, advisor shapes/locations and token ownership. It reads no predictions, hands, traitors, resources, concealed token inventories or token spice. Arrays are detached.
`game/victory-quote.ts` uses these qualifiers before the existing private BG interception and distinct final-turn fallbacks. The existing commit path awards the result once and settles final Stronghold Cards from the same board. An actual Ecaz joint win adds a chronicle explanation naming its strongholds. A BG replacement win does not falsely receive the Ecaz explanation.
`viewGame` projects public progress from the original board, before local advisor normalization; malformed public state produces no unreliable preview while authoritative victory rejects it. `components/victory-progress.tsx` displays one row per side, separates ordinary and joint counts, and explicitly describes a prospective board calculation. It awards no early win. Its native disclosure supports keyboard controls and responsive layout. The internal victory and faction/movement guides describe the supported boundary.
AI destination threats, Trip to Gamont target assessment and Guild timing now consume the same public progress. Hard/Brutal additionally value joining their Ecaz ally in an incompletely shared stronghold. These scores grant no movement permission or hidden information; legal entry and shipment controls still apply. This is a verified policy behavior, not an AI strength calibration claim.
## Verification
- `tests/victory-progress.test.ts`: 11 tests of thresholds, ordinary alliances/player counts, union versus joint occupation, tech ownership, storm survivors, advisor releases, public marker presence, placed HMS, malformed state, private-field getters and detached outputs.
- `tests/ecaz-victory.test.ts`: 17 tests with actual Basic/Advanced Collection-to-Mentat actions, prediction replacement, force preservation, No-Field 0/3/5 and final cards, printed and BG-converted Moritani placement cancellation, Hard/Brutal third-joint shipments and real Guild timing.
- `tests/ecaz-victory-recovery.test.ts`: 3 production room/authentication/SQL tests in memory. Includes Basic/Advanced races with exactly one successful CAS and winner log, stale/current duplicate rejection with zero writes, final card ownership, card/force conservation, restarted module/JSON restoration, unrelated room preservation and identical complete rival views under private prediction changes.
- Full registered suite: **2,758 rules/client/component +245 multiplayer =3,003 passing tests**. TypeScript, lint and production build pass. Logs: `/tmp/dune-ecaz-victory-{rules,multiplayer,type,lint,build}-final.log`. Rules 80.698 seconds; multiplayer 25.559 seconds.
- Independent integration review: `/tmp/dune-ecaz-victory-integration-review.md`. It found a malformed-advisor preview mismatch, corrected by strict stance validation and original-state projection. Exact reproductions now reject/suppress the preview. No further concrete privacy, winner-order or post-cost defect was reproduced. Root reviewed all new helpers and tests.
The browser used only the existing named QA room. Its prior contested Carthag correctly showed zero qualifying holdings. A backed-up, conserved three-joint position was staged at Collection, version 116; the real final readiness action produced version 117, the Ecaz/Emperor win and exactly one explanatory chronicle entry. Phone 390×844 layout, keyboard Space disclosure and real refresh passed; the viewport was reset. All **2,526 pre-existing non-QA** room versions/state hashes remain unchanged; the regression suite created 30 additional rooms. No human room was modified. Restricted artifacts are `/tmp/dune-victory-qa-{before,staged,final}.json` and `/tmp/dune-victory-other-rooms.json`.
Twenty balanced Basic full games (seed 20261023, two through six players, all four homogeneous difficulties) completed **12,818 accepted actions, zero rejected candidates/stalls/exceptions/invariant failures and 568 JSON round trips** in 120.643 seconds. The source fingerprint `5b63c390f73da1ef0f66239c87f6a53acce34f422f1fc9cd3380ba3724c0f788` was unchanged during the run and matched the root’s post-run file check. Artifacts: `/tmp/dune-ecaz-victory-fullgames-final.{json,log}`; runner `/tmp/dune-sapho-base-fullgames.ts`. These are base-game regression results; they do not demonstrate full Ecaz/Advanced/expansion play or comparative AI strength.
## Remaining boundaries
The Fremen special-endgame exception remains unimplemented in this slice. The user has a pending interpretation question about co-occupation in Habbanya and Ecaz-only occupation; elapsed time is not an answer. The explicit source permission for co-occupied Tabr is recorded separately. Combined Occupy combat still needs a participant model and resolution of the documented numerical source conflict; shared desert collection, Tleilaxu Ambassador integration and broader faction/module interactions remain unfinished. No public mode gate or deployment changed. The removed automation remains removed.