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

38 lines
7.4 KiB
Markdown

# Combat and terminal cancellation checks — 7 September 2026
This partial checkpoint strengthens saved Karama continuations. It does not certify complete Advanced or expansion compliance or open their start gates. The maintenance automation remains removed.
## Shared cancellation prerequisites
`game/combat-response-quote.ts` validates the current battle, seated faction owners, canonical territory, combatants, preparation and ordered remaining power checks. The engine consumes this same finite result when advancing responses or finishing preparation. It does not regenerate checks whose opportunities have already passed, simulate future choices, draw cards, or require resources for an effect being canceled.
The queue retains Basic Ixian elite strength, the Emperor/Fremen exception, Advanced Fremen support, Atreides Kwisatz Haderach and mutually allied CHOAM aid. Voice binds its actual Bene Gesserit provider and opposing target, preserving the Prescience preparation already opened by its declaration. Prescience cancellation clears the unanswered element and follows the same preparation completion path, including the existing Advanced Atreides full-plan offer. Canceled elite strength does not remove physical elite forces.
`game/terminal-cancellation.ts` validates terminal advisor, Emperor gift/extra-revival, Guild income, Tleilaxu revival income, Bene Gesserit charity, CHOAM charity/inflation, Fremen storm preview, Atreides spice/ordinary-auction preview and Face Dancer replacement responses. These checks use their declared identities and applicable phase, owner and amount. They intentionally do not require funds, reserves, revival tanks or a random replacement candidate for the denied effect. Own Tleilaxu payer rewards and Ghola timing remain valid. Canceled knowledge is not revealed, and canceled charity retains its consumed opportunity.
`game/karama-no-field-cancellation.ts` handles both Richese and its ally's declared No-Field shipment. It binds the active shipment opportunity, original declaration, canonical token inventory and event, destination and accepted allied offer. A cancellation blocks that use and clears the pending shipment. It does not require the denied route, funds, reserves or stronghold capacity, disclose the concealed value, or erase an existing valid marker.
`game/choam-sale-cancellation.ts` validates the saved market and sale declaration before removing the sale and recording the blocked card. The same quote reopens the CHOAM market decision. A denied sale does not need its card or witness to remain available, and pays no sale income.
All four validations run before supported Karama costs and again in actual cancellation execution. The engine also now rejects unknown saved response kinds explicitly. Previously, the final fallback could treat an unrecognized allowed response as an advisor placement.
## Verification
The checkpoint adds 110 registered rule tests and three production SQLite recovery tests. Genuine battle declarations cover printed Karama and Bene Gesserit Worthless conversion, Voice, Prescience, Basic Ix elites and invalid remaining queues. Terminal cases cover genuine producers, legacy-compatible declarations, malformed saved sources and absence of denied resources. No-Field and CHOAM sale cases check cancellation without performing the denied benefit. Evaluation tests check unchanged input, card custody and no random/event allocation.
SQLite tests recover authenticated seats through fresh modules. Racing final passes commit once; stale or duplicate submissions cannot repeat material changes. Malformed combat successors cause no database write before a new conversion or after its cost has already been saved. Subsequent sealed plans remain private to their owner.
Historical fixtures were corrected to use actual producer states: Guild income occurs in Shipment & Movement and belongs to Guild; paused gift/Distrans parents retain their original passes; Voice uses an eligible allied provider; a battle promise uses a genuine Prescience declaration. Gameplay assertions were retained.
The full registered suites passed **2,154 rules/client/component and 204 multiplayer tests (2,358 total)**. Logs: `/tmp/dune-terminal-rules-final.log` (62.318 seconds), `/tmp/dune-terminal-multiplayer-final.log` (19.569 seconds). TypeScript, lint and production build passed in `/tmp/dune-terminal-{type,lint,build}-final.log`. The subsequent ownership display correction adds eight passing registered tests (`/tmp/dune-table-turn-test.log`), bringing verified registered coverage to **2,162 rules/client/component +204 multiplayer, 2,366 total**. The full suites preceded this display-only change; focused ownership tests and TypeScript/named lint checks passed afterward. The final production build passed in `/tmp/dune-terminal-display-build-final.log`.
The unchanged-source public Basic matrix completed **20/20 games**, covering two through six seats and each of four homogeneous AI profiles: **11,552 accepted actions, zero rejected candidates or stalls, and 521 JSON round trips**, in 56.816 seconds. No gameplay resources were injected. Source fingerprint: `f6a692cb9b85f7cb35eb00d95039853f12e2bc4ee1d21209fc9efadcbf83b0bd`; all file hashes matched the workspace after the run. Full traces: `/tmp/dune-terminal-fullgames-final.json`. This sample does not measure relative AI strength or certify expansion games.
## Browser and remaining work
The existing isolated QA room retained both authenticated seats. A genuine battle opened Fremen full-strength support. The browser spent Baliset as Karama, displaying the saved nested conversion and reducing its own hand from three to two cards. The other controlled QA seat allowed conversion using the production engine. The saved battle blocked Fremen's free support, preserved both armies and spice, and opened Bene Gesserit's Voice. Reload recovered the same private hand and actual Voice controls at room version 69. Visual inspection identified and verified a fix for the top banner and highlighted seat incorrectly naming the attacker during preparation. Both now consume `game/table-turn.ts`, selecting explicit decisions and battle preparation owners. Shared plans, traitor votes and pre-leader readiness remain neutral until one participant remains; selection uses public submission status only. Eight tests cover actual Voice/Prescience declarations, special full-plan ownership, shared plans and votes, overlay precedence and private-view independence. The final browser screenshot shows the Bene Gesserit name and blue seat highlight, matching its Voice controls.
The controlled manual restart at approximately 07:50 UTC backed up all 2,197 rooms to `/tmp/dune-maintenance-20260907T0750/database.sqlite` before stopping the previous server. HTTP health returned 200; every saved version and state hash matched afterward. The known human room remained v14 and idle. The QA room retained v69 and its pending Voice controls. Current server session: 90387; next manual maintenance is due about 08:50 UTC if active development and human play permit. This does not recreate the removed automation.
Exhaustive later automatic continuations, owner-promise feasibility and durable Karama cost/discard frames remain unfinished. In particular, remaining auction, faction placement, Worthless, substitution and restored-parent paths are not certified by these finite quotes. Full Advanced, all expansions/modules, component acceptance and comparative AI calibration remain outstanding. The overall goal remains active.