Prototype Discovery spice encounters, private tokens and stash rewards

Connect real Basic/Advanced base-faction audit setup to all seven Discovery
Spice Cards and eight physical tokens. Add Great Maker's ordered majority
vote and Fremen reserve ride, destructive Discovery blows, private faction
peeks and Collection inspection/reveal, stash rewards and mandatory saved
card overflow, and revealed nested board locations. Share private legal
choices with human controls and all four AI profiles. Preserve normal gates.

Independent review repairs orphaned worm/vote/ride controls, retargeted
reserve arrivals, actor bindings and incomplete overflow discard receipts.
Harden room-aware admission against unrevealed nested locations. Extend the
backed-up local prototype starter with a Discovery profile; preserve seats.

Still missing: next-turn free entry, five special location benefits and
Ornithopter movement spending. Current prototype playthroughs do not certify
those effects or complete module/expansion compliance.

Verification: npm run check passed 4264 offline tests plus types/lint;
npm run build passed; npm run test:integration passed 40 tests. The single
source-bound broad run took 129358ms / 6782ms / 23918ms respectively.
Report: /home/quintine/.local/share/dune/checkpoints/20260913-discovery-prototype/verification/report.json
Source fingerprint: 4ea7b5209a58c369b0b1f8dc239b5dd2f3302bb759d83c32ba5406e80d8ae154

Two seeded Basic/Advanced games complete with component custody intact.
SQLite races pay stashes once and resume committed discards without replay.
Browser 3RJBH26Y verifies genuine human Fremen setup, a Discovery blow from
one reordered physical card, native private Hiereg visibility, enlarged
card/rules reading and refresh. Room remains paused at spice acceptance.
All 125 opening saved rooms unchanged; 31 added, 156 total. No server restart.

Efficiency: three reused bounded helpers; aggregate counter 60591430 to
61812513 after verification, 1221083 tokens before final Git/push overhead.
47 added offline tests. One stable broad run after focused review fixes;
no calibration or exhaustive optional-module interaction matrix.
This commit is contained in:
Quintine committed 2026-09-13 13:27:58 +10:00
1 parent 4af6e08b3a
commit f0256c1b38
44 files changed
+4924 -104

No files matched your search

+20 -2
View File
@@ -1,5 +1,10 @@
import type { DatabaseSync } from 'node:sqlite';
import { initializeIxGameForAudit, viewGame, type Game } from '../game/engine';
import {
initializeIxGameForAudit,
initializeDiscoveryGameForAudit,
viewGame,
type Game,
} from '../game/engine';
/** 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. */
@@ -7,6 +12,14 @@ export function startIxPrototypeRoom(
db: DatabaseSync,
code: string,
expectedVersion: number,
) {
return startPrototypeRoom(db, code, expectedVersion, 'ix');
}
export function startPrototypeRoom(
db: DatabaseSync,
code: string,
expectedVersion: number,
profile: 'ix' | 'discovery',
) {
if (
!/^[A-Z0-9]{8}$/.test(code) ||
@@ -24,7 +37,12 @@ export function startIxPrototypeRoom(
const initial = JSON.parse(row.state) as Game;
if (initial.code !== code)
throw new Error('The room identity is inconsistent.');
const game = initializeIxGameForAudit(initial);
if (!['ix', 'discovery'].includes(profile))
throw new Error('Unknown prototype profile.');
const game =
profile === 'ix'
? initializeIxGameForAudit(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;
+11 -4
View File
@@ -4,13 +4,14 @@ import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { parseArgs } from 'node:util';
import { captureSavedGames } from './saved-game-verification';
import { startIxPrototypeRoom } from './prototype-room';
import { startPrototypeRoom } from './prototype-room';
import { sourceSnapshot } from './verification';
async function main() {
const { values } = parseArgs({
options: {
db: { type: 'string' },
profile: { type: 'string', default: 'ix' },
room: { type: 'string' },
version: { type: 'string' },
out: { type: 'string' },
@@ -19,11 +20,12 @@ async function main() {
});
if (values.help) {
console.log(
'Usage: node --import tsx tools/start-prototype.ts --db PATH --room CODE --version NUMBER --out /private/new-directory\nStarts only a fresh ready Ix expansion lobby for local prototyping. 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 --db PATH --room CODE --version NUMBER --out /private/new-directory\nStarts only a fresh ready Ix expansion or base-faction Discovery lobby for local prototyping. 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'].includes(values.profile) ||
!values.db ||
!values.room ||
!values.out ||
@@ -44,14 +46,19 @@ async function main() {
throw new Error('The requested lobby version is absent from the backup.');
const db = new DatabaseSync(values.db);
try {
const result = startIxPrototypeRoom(db, values.room, version);
const result = startPrototypeRoom(
db,
values.room,
version,
values.profile as 'ix' | 'discovery',
);
writeFileSync(
resolve(values.out, 'prototype.json'),
JSON.stringify(
{
format: 1,
startedAt: new Date().toISOString(),
profile: 'ix',
profile: values.profile,
source,
beforeVersion: version,
...result,