Add repeatable verification and establish fresh save checkpoint
Consolidate current readiness and existing rule decisions, preserve selective subagents and automatic verified Git pushes, and record the efficiency pilot. Add source-bound compact checks, private saved-game snapshots/online backups, and bounded HTTP seat-restoration checks with 15 meaningful regressions. At the user's explicit request, archive and clear 3,644 old local rooms and related records while retaining schema/migrations; preserve future games from a fresh empty baseline. Private backups and credentials are outside Git. Validation: npm run check passes types, lint and all 4,177 offline tests. Full report: 20260913-efficiency-check-3, 130.147 seconds; source fingerprint 344ce1d44475b0cd4ff10a915f28331cb4e2fcacbc7595636fbaa645c0568f64. Two earlier broad attempts stopped at new type/lint errors before tests; both were fixed. Independent review found cancellation falsely passing; SIGINT/SIGTERM regressions and review confirm the fix. Documentation links, example test selection, private backup integrity and empty baseline verified. No app/build/dependency/HTTP implementation changed; no production build, HTTP suite, browser acceptance or AI calibration claimed for this checkpoint. The full game goal and existing release gates remain unfinished.
This commit is contained in:
1 parent
06d0a66fc5
commit
6e26ba5daa
17 files changed
+1242
-2
No files matched your search
@@ -0,0 +1,67 @@
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { parseArgs } from 'node:util';
|
||||
import {
|
||||
captureSavedGames,
|
||||
compareSavedGames,
|
||||
loadSavedGameSnapshot,
|
||||
readSavedGames,
|
||||
} from './saved-game-verification';
|
||||
|
||||
async function main() {
|
||||
const { values, positionals } = parseArgs({
|
||||
allowPositionals: true,
|
||||
options: {
|
||||
db: { type: 'string' },
|
||||
out: { type: 'string' },
|
||||
baseline: { type: 'string' },
|
||||
backup: { type: 'boolean' },
|
||||
help: { type: 'boolean' },
|
||||
},
|
||||
});
|
||||
if (values.help) {
|
||||
console.log(
|
||||
'Usage: node --import tsx tools/saved-games.ts snapshot --db PATH --out /tmp/new-snapshot [--backup]\nOr: compare --db PATH --baseline /tmp/new-snapshot/snapshot.json\nRead-only source access. New rooms are allowed; any changed or missing original room fails. Backup requires Node >=22.16.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!values.db || positionals.length !== 1)
|
||||
throw new Error('Provide a database and operation.');
|
||||
if (positionals[0] === 'snapshot' && values.out && !values.baseline) {
|
||||
const result = await captureSavedGames(
|
||||
fileURLToPath(new URL('../', import.meta.url)),
|
||||
values.db,
|
||||
values.out,
|
||||
values.backup,
|
||||
);
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
captured: result.rooms.length,
|
||||
backup: !!values.backup,
|
||||
}),
|
||||
);
|
||||
} else if (
|
||||
positionals[0] === 'compare' &&
|
||||
values.baseline &&
|
||||
!values.out &&
|
||||
!values.backup
|
||||
) {
|
||||
const result = compareSavedGames(
|
||||
loadSavedGameSnapshot(values.baseline),
|
||||
readSavedGames(values.db),
|
||||
);
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
...result,
|
||||
missing: result.missing.length,
|
||||
changed: result.changed.length,
|
||||
}),
|
||||
);
|
||||
process.exitCode = result.preserved ? 0 : 1;
|
||||
} else throw new Error('Invalid operation.');
|
||||
}
|
||||
main().catch(() => {
|
||||
console.error(
|
||||
'Saved-game verification failed. Check arguments, schema and file access; see --help.',
|
||||
);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
Reference in new issue
Block a user