/** * Full-store snapshots taken before an in-place repair or migration of the * project `cleo.db`. * * The repairs that run while a domain binds (the T12346 legacy-lineage * rebuild, the T12535 twin collapses) are synchronous and run before any * caller sees the handle, so they cannot use the async, debounced snapshot * gate (`snapshot-gate.ts`): a `routine` request inside the debounce window * would be skipped, and a skipped snapshot is exactly the case a repair must * never proceed under. They take one unconditional `VACUUM INTO` instead, * the same primitive the gate's snapshots use. * * {@link writeMigrationSnapshot} additionally registers the snapshot as a * `migration` system backup (`.cleo/backups/sqlite/cleo.db.` plus a * `.meta.json` sidecar), so `cleo backup list` shows it and the * per-type rotation applies, and checks the free space BEFORE writing: the * snapshot costs the whole store. * * @module * @task T12346 * @task T12535 */ import type { DatabaseSync } from 'node:sqlite'; /** * Write a `VACUUM INTO` snapshot of the whole database next to it, under * `/backups/cleo-pre-