fix(demo): keep a demo baseline per engine and check it before every reset

The baseline was travel-baseline.db on both engines and went straight into
the swap, so a SQLite baseline left in the data directory made every hourly
reset of a Postgres demo fail inside pg_restore, and never got replaced. It
is now named after the engine's archive entry (travel-baseline.db on
SQLite, travel-baseline.pgdump on Postgres), and the backup port's new
checkCopy refuses one the engine cannot restore before the swap; the reset
then saves a fresh baseline and logs the reason instead of failing hourly.
This commit is contained in:
Maurice
2026-11-17 12:19:13 +01:00
parent 693acd5580
commit 9e5379d092
11 changed files with 144 additions and 4 deletions
@@ -49,6 +49,15 @@ export interface DatabaseBackupStrategy {
*/
verify(extractDir: string): Promise<void>;
/**
* Why `file`, a copy kept on disk (the demo baseline), cannot be put in place
* by `replace` on this engine, or null when it can: SQLite wants a SQLite
* file, Postgres a dump with TREK's migration history from this or an older
* TREK. Checked before every swap, so a file another engine left behind is
* refused with a reason instead of failing inside the swap.
*/
checkCopy(file: string): Promise<string | null>;
/**
* Keeps a copy of the database a restore is about to replace. Best effort: a
* database broken enough to need the restore may not copy, and that must not