Complete forced Harkonnen returns with private saved inspection

Automatically return the full combined hand when it is the only legal
special-Karama return. Preserve real choices and restore the suspended
response or auction payment through the same settlement. Record the actual
blind draw as owner-only historical card faces, with a bound integrity
receipt; legacy forced saves describe held-card history truthfully.

Add readable private history and enlarged inspectors. Both manual and
forced returns publish only a faction/action completion tag. Wake idle
legacy exchanges through production recovery without writes for real
choices. Keep provisional auction funding rules and release gates.

Validation: types, lint, 5150 offline tests, build and 49 HTTP tests
passed. Independent review resolved history substitution and root review
completed idle recovery wiring. New tests cover 1-4 forced draws, real
choices, overlays, exact saved history, immutable rejection, all four legal
AI paths, production competing actions/recovery, private views and custody.
One genuine Advanced four-player sample completed 158 actions with
4 JSON restores and no rejected action; no difficulty tuning.

Browser QA QUTHVPTT used genuine Advanced setup and conserved Bidding
positions. The actual power returned four cards without a prompt; private
history/enlargement and exact refresh worked. Phone panel fit without
horizontal overflow with 44px inspector controls. Screenshot capture timed
out; complete visual acceptance and transient notice capture remain open.
Preserved every prior row across all ten tables, including 1586
rooms and 3354 seats. New QA/integration records bring totals to
1626 rooms and 3442 seats. No reset, restart or automation.
This commit is contained in:
Quintine committed 2026-09-21 16:45:20 +10:00
1 parent a3bc0ac837
commit 0f79f28ccb
21 files changed
+847 -52

No files matched your search

+31 -8
View File
@@ -6,7 +6,6 @@ import {
normalizeAutomaticGame,
viewGame,
type Action,
type Decision,
type Game,
} from '../game/engine';
import { richeseCards } from '../game/richese-cards';
@@ -362,15 +361,9 @@ void test('forged or missing saved Ixian lot decisions fail before projection, a
(game) => {
game.ixRicheseTechnologyEvent += '-forged';
},
(game) => {
const duplicate = structuredClone(game.decision) as Decision;
game.pendingExchange = { response: null, decision: duplicate };
},
];
for (const corrupt of corruptions) {
const game = structuredClone(genuine);
corrupt(game);
async function rejectSaved(game: Game) {
f.sqlite
.prepare('UPDATE rooms SET state = ?, version = ? WHERE code = ?')
.run(JSON.stringify(game), game.version, f.code);
@@ -387,6 +380,36 @@ void test('forged or missing saved Ixian lot decisions fail before projection, a
);
assert.deepEqual(snapshot(f, f.code), before);
}
for (const corrupt of corruptions) {
const game = structuredClone(genuine);
corrupt(game);
await rejectSaved(game);
}
// A real paid Box search holds this exact Ix decision. Duplicating the live
// decision now exercises Ix uniqueness without fabricating a Harkonnen parent.
const staged = structuredClone(genuine);
const boxIndex = staged.richeseCache!.findIndex(card => card.effect === 'nullentropyBox');
assert.ok(boxIndex >= 0);
const box = staged.richeseCache!.splice(boxIndex, 1)[0];
player(staged, f.observerAuth.playerId).hand.push(box);
// Two eligible physical cards keep the paid search as a genuine private choice.
staged.discard.push(take(staged, card => card.kind === 'worthless'),
take(staged, card => card.kind === 'worthless'));
assert.deepEqual(physicalCards(staged), physicalCards(genuine));
f.sqlite.prepare('UPDATE rooms SET state = ?, version = ? WHERE code = ?')
.run(JSON.stringify(staged), staged.version, f.code);
await f.act(f.observerAuth, { type: 'card', card: box.id });
const suspended = await f.restart().readRoom(f.code);
assert.equal(suspended.decision?.kind, 'nullentropy');
assert.equal(player(suspended, f.observerAuth.playerId).spice,
player(staged, f.observerAuth.playerId).spice - 2);
assert.deepEqual(suspended.pendingNullentropy!.resume.decision, genuine.decision);
assert.deepEqual(physicalCards(suspended), physicalCards(genuine));
assert.doesNotThrow(() => viewGame(suspended, f.ixAuth.playerId));
const duplicated = structuredClone(suspended);
duplicated.decision = structuredClone(genuine.decision);
await rejectSaved(duplicated);
});
void test('concurrent authenticated declines persist one Richese lot continuation behind the room CAS', async (t) => {