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
This commit is contained in:
+20
-11
@@ -1,31 +1,40 @@
|
||||
// test/check-reminder.mjs — unit-verifies the reminder elision
|
||||
// test/check-reminder.mjs -- unit-verifies the reminder elision
|
||||
// policy: the live context carries exactly one reminder (the newest),
|
||||
// sitting at the freshest end, next to the one system trio from the
|
||||
// bundle. Run against a run id that has GM turns:
|
||||
// node test/check-reminder.mjs <runId>
|
||||
|
||||
import { loadSession, renderView } from '../server/session.mjs';
|
||||
import { readdirSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { join, dirname } from 'node:path';
|
||||
import { loadSession, renderView, listSessions } from '../server/session.mjs';
|
||||
|
||||
const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const runId = process.argv[2];
|
||||
const dir = join(ROOT, 'runs', runId, 'sessions');
|
||||
const latest = readdirSync(dir).filter((f) => f.endsWith('.jsonl')).sort().pop().replace(/\.jsonl$/, '');
|
||||
const s = loadSession(runId, latest);
|
||||
if (!runId) {
|
||||
console.error('usage: node test/check-reminder.mjs <runId>');
|
||||
process.exit(1);
|
||||
}
|
||||
// the newest session that has a log (a dormant latest has none)
|
||||
let s = null;
|
||||
for (const n of [...listSessions(runId)].reverse()) {
|
||||
try {
|
||||
s = loadSession(runId, n);
|
||||
break;
|
||||
} catch {}
|
||||
}
|
||||
if (!s) {
|
||||
console.error(`no session log under runs/${runId}/sessions/*/log.jsonl`);
|
||||
process.exit(1);
|
||||
}
|
||||
const view = renderView(s);
|
||||
const sys = view.filter((m) => m.role === 'system');
|
||||
let fails = 0;
|
||||
const ok = (name, cond, extra = '') => {
|
||||
console.log(`${cond ? 'PASS' : 'FAIL'} ${name}${extra ? ` — ${extra}` : ''}`);
|
||||
console.log(`${cond ? 'PASS' : 'FAIL'} ${name}${extra ? ` -- ${extra}` : ''}`);
|
||||
if (!cond) fails++;
|
||||
};
|
||||
const logged = s.lines.filter((e) => e.reminder).length;
|
||||
ok(`log keeps every copy (${logged})`, logged >= 5, `${logged}`);
|
||||
ok('view carries exactly two system chunks (the trio + the newest reminder)', sys.length === 2, `${sys.length}`);
|
||||
// mid-call the reminder is the last message; after the model's reply it
|
||||
// sits immediately before that reply — either way it follows the newest
|
||||
// sits immediately before that reply -- either way it follows the newest
|
||||
// GM turn at the freshest end of the context
|
||||
const ri = view.findIndex((m) => m.role === 'system' && /How to compose your turn/i.test(m.content));
|
||||
const tail = view.slice(-3).map((m) => m.role).join(',');
|
||||
|
||||
Reference in New Issue
Block a user