Connect expansion faction setup and saved Ixian auction decline

Add a local faction-only prototype profile for all seven nonempty expansion selections, genuine Basic/Advanced initialization and existing private setup, controls, AI and saved continuation. Ecaz allocates six forces across Imperial Basin sectors and retains fourteen reserves before later setup; preserve Fremen, Advanced BG and Moritani ordering with printed and inferred boundaries explicit. Keep optional Ecaz Treachery cards separate, ordinary deck counts 33/35/47, and Richese cache separate. Public start and publication gates remain closed.

Replace the Advanced Ixian/Richese pre-offer stop with an explicit per-lot Ixian decline. Bind the saved original offer to its round, turn, owner, independent event, exact card custody and terms before view/action/normalization. Decline resumes that unchanged lot once without using Technology; later normal lots still offer the exchange. Protect reserved cards across transfers, spending and random Harkonnen exchange, and preserve legitimate Gift/Truthtrance interruptions. The actual special-lot exchange still awaits replacement-custody interpretation.

Validation: focused setup, rules, UI/bot, private JSON/SQLite reload and concurrent CAS tests and independent custody/persistence review passed. Typecheck, lint, 4573 offline tests, production build and 43 HTTP tests passed. Browser Ecaz setup rejected an incomplete total, saved a 2/2/2 split, and refreshed to fourteen reserves and unchanged private cards. A separate genuine Advanced QA game restored the Ixian choice; explicit decline opened the unchanged cache lot with legal bidding and retained private hand, spice, pool count and unused Technology after refresh.

Five of six genuine four-profile samples finish: CHOAM Basic 1054 actions/28 JSON restores, CHOAM Advanced 225/6, Ecaz Basic 91/2, Ecaz Advanced 523/14, all-three Basic 476/12. Combined Advanced passes three former auction stops and reaches turn three/action614 with 16 restores, then hits an existing CHOAM movement/Ambassador arrival guard. Ecaz samples also include guarded arrival candidates with legal alternatives. Full combined play is not certified; arrival integration is the next gap. Retain initial failed logs, including a corrected private harness sold-card receipt alias.

After the outage, all 597 opening rooms and original seat/recovery records were preserved (632 after QA/HTTP). A stale development module cache required restart after a fresh 598-room backup; all 598 matched afterward and the QA seat restored. Final integrity and foreign keys passed. No database reset, recurring automation or publication.

Verified source tree: 5e2ff244a1167f2834bb46d609b8de914a34f7049ff7b06046243068c0935131
This commit is contained in:
Quintine committed 2026-09-13 22:51:19 +10:00
1 parent f067950f5e
commit cab2f1c42d
26 files changed
+3001 -58

No files matched your search

+22 -8
View File
@@ -3,10 +3,22 @@ import {
initializeIxGameForAudit,
initializeDiscoveryGameForAudit,
initializeLeaderSkillsGameForAudit,
initializeFactionExpansionsGameForAudit,
viewGame,
type Game,
} from '../game/engine';
export const PROTOTYPE_PROFILES = [
'ix',
'discovery',
'leader-skills',
'factions',
] as const;
export type PrototypeProfile = (typeof PROTOTYPE_PROFILES)[number];
export function isPrototypeProfile(value: string): value is PrototypeProfile {
return PROTOTYPE_PROFILES.some((profile) => profile === value);
}
/** Local development only. This cannot create a seat, change its owner, or
* redeal a started game. The caller backs up the database before invoking it. */
export function startIxPrototypeRoom(
@@ -20,7 +32,7 @@ export function startPrototypeRoom(
db: DatabaseSync,
code: string,
expectedVersion: number,
profile: 'ix' | 'discovery' | 'leader-skills',
profile: PrototypeProfile,
) {
if (
!/^[A-Z0-9]{8}$/.test(code) ||
@@ -38,17 +50,19 @@ export function startPrototypeRoom(
const initial = JSON.parse(row.state) as Game;
if (initial.code !== code)
throw new Error('The room identity is inconsistent.');
if (!['ix', 'discovery', 'leader-skills'].includes(profile))
if (!isPrototypeProfile(profile))
throw new Error('Unknown prototype profile.');
const game =
profile === 'ix'
? initializeIxGameForAudit(initial)
: profile === 'leader-skills'
? initializeLeaderSkillsGameForAudit(initial)
: initializeDiscoveryGameForAudit({
...initial,
discoveryEnabled: true,
});
: profile === 'factions'
? initializeFactionExpansionsGameForAudit(initial)
: profile === 'leader-skills'
? initializeLeaderSkillsGameForAudit(initial)
: initializeDiscoveryGameForAudit({
...initial,
discoveryEnabled: true,
});
// Exercise the same player projection before accepting the new saved state.
for (const player of game.players) viewGame(game, player.id);
const version = expectedVersion + 1;
+4 -9
View File
@@ -4,7 +4,7 @@ import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { parseArgs } from 'node:util';
import { captureSavedGames } from './saved-game-verification';
import { startPrototypeRoom } from './prototype-room';
import { isPrototypeProfile, startPrototypeRoom } from './prototype-room';
import { sourceSnapshot } from './verification';
async function main() {
@@ -20,12 +20,12 @@ async function main() {
});
if (values.help) {
console.log(
'Usage: node --import tsx tools/start-prototype.ts --profile ix|discovery|leader-skills --db PATH --room CODE --version NUMBER --out /private/new-directory\nStarts only a fresh ready lobby for the selected development prototype. Backs up all rooms first, preserves sessions and existing games, and rejects stale versions. Normal game-start and publication gates remain closed.',
'Usage: node --import tsx tools/start-prototype.ts --profile ix|discovery|leader-skills|factions --db PATH --room CODE --version NUMBER --out /private/new-directory\nStarts only a fresh ready lobby for the selected development prototype. Factions supports selected expansion factions without optional modules; the separate Ecaz Treachery variant stays disabled. Backs up all rooms first, preserves sessions and existing games, and rejects stale versions. Normal game-start and publication gates remain closed.',
);
return;
}
if (
!['ix', 'discovery', 'leader-skills'].includes(values.profile) ||
!isPrototypeProfile(values.profile) ||
!values.db ||
!values.room ||
!values.out ||
@@ -46,12 +46,7 @@ async function main() {
throw new Error('The requested lobby version is absent from the backup.');
const db = new DatabaseSync(values.db);
try {
const result = startPrototypeRoom(
db,
values.room,
version,
values.profile as 'ix' | 'discovery' | 'leader-skills',
);
const result = startPrototypeRoom(db, values.room, version, values.profile);
writeFileSync(
resolve(values.out, 'prototype.json'),
JSON.stringify(