variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
|
|
|
// test/restart-check.mjs -- after a server restart: the token
|
2026-11-14 23:48:27 +00:00
|
|
|
// survives, the boot-rebuild reopened the unhousekept sessions, the
|
|
|
|
|
// runs list is whole. Reads the token + run ids smoke.mjs left in
|
|
|
|
|
// the temp file; run against the restarted --mock server:
|
|
|
|
|
// node test/restart-check.mjs
|
|
|
|
|
|
|
|
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
|
import { join } from 'node:path';
|
|
|
|
|
import { tmpdir } from 'node:os';
|
|
|
|
|
|
|
|
|
|
const BASE = process.env.RP_BASE ?? 'http://127.0.0.1:7350';
|
2026-11-15 14:46:00 +00:00
|
|
|
const [token, reforkId, secondId] = readFileSync(join(tmpdir(), 'tiny-worlds-smoke-token.txt'), 'utf8').trim().split(' ');
|
2026-11-14 23:48:27 +00:00
|
|
|
const call = async (path, tok) => {
|
|
|
|
|
const res = await fetch(`${BASE}/api${path}`, {
|
|
|
|
|
headers: tok ? { authorization: `Bearer ${tok}` } : {},
|
|
|
|
|
});
|
|
|
|
|
return { status: res.status, data: await res.json().catch(() => ({})) };
|
|
|
|
|
};
|
|
|
|
|
let failures = 0;
|
|
|
|
|
const ok = (name, cond, extra = '') => {
|
variant round: roll retired, chance is variant literature (strict parse, crypto pick on reception, picked-only rendering, /story variance metric); entity round: /story the whole deliverable, /table the play projection, the slidwin carry (smart contwin cutoff, whole exchanges, housekeeper reads session-minus-tail); dormant-session rework: universal session lifecycle (dormant->live->finished, sessions/<n> storage), move-at-stop, start lint + auto-send rule, rebaseable housekeeping, turn-0 -> carryover.jsonl, seed -> memory.json, draft-only save-package; format house rules enforced by the nine-rule check-repo (ascii bytes, no text-mutating css); smoke 105/105 + restart + reminder + browser pass green, irene hand-migrated to the new layout
2026-11-15 14:35:00 +00:00
|
|
|
console.log(`${cond ? 'PASS' : 'FAIL'} ${name}${extra ? ` -- ${extra}` : ''}`);
|
2026-11-14 23:48:27 +00:00
|
|
|
if (!cond) failures++;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let r = await call('/session', token);
|
|
|
|
|
ok('token survives restart', r.status === 200 && r.data.user?.name === 'Op');
|
|
|
|
|
|
|
|
|
|
r = await call(`/runs/${reforkId}`, token);
|
|
|
|
|
ok('forked session rebuilt', r.status === 200 && r.data.open === true, JSON.stringify({ open: r.data.open, owner: r.data.run.owner }));
|
|
|
|
|
|
|
|
|
|
r = await call(`/runs/${secondId}`, token);
|
|
|
|
|
ok('draft intact', r.status === 200 && r.data.draft === true);
|
|
|
|
|
|
|
|
|
|
r = await call('/runs', token);
|
|
|
|
|
ok('runs listed', r.status === 200 && Array.isArray(r.data) && r.data.length >= 4, `${r.data.length} runs`);
|
|
|
|
|
|
|
|
|
|
console.log(failures ? `\n${failures} FAILURES` : '\nALL PASS');
|
|
|
|
|
process.exit(failures ? 1 : 0);
|