/** * SCHEMA-REAL representative migration fixture (T11551 · DHQ-045 · AC3). * * The exodus zero-loss campaign happened because the original unit fixtures * used MATCHING NAMES + canonical enums (`CREATE TABLE x (id, val)`), so they * missed every real-schema failure: epoch-INTEGER timestamps in a `text`+GLOB * column, legacy enum aliases failing a CHECK, and unprefixed→prefixed table * names. This module builds a fixture that reproduces those exact hazards so * the migration is exercised against representative data — NOT a name-matched * toy. * * The fixture builds two legacy source DBs (`tasks.db`, `brain.db`) whose * tables carry: * * - **Unprefixed names** that must map to domain-prefixed targets * (`tasks` → `tasks_tasks`, `architecture_decisions` → * `tasks_architecture_decisions`). * - **Epoch-INTEGER timestamps** (seconds AND milliseconds) destined for a * TASKS-domain target `text` column with an ISO-8601 GLOB CHECK constraint. * - **Legacy enum aliases** (`'Accepted'`) that fail the TASKS-domain target * CHECK unless the migration normalises them, AND the real value `'mcp'` * (transport) which the consolidated CHECK now ACCEPTS verbatim — proving * exodus preserves it without coercion (T11649). (Brain enum values are no * longer CHECK-constrained at all — see the Brain-domain note below, T11647.) * - **A self-referential FK** (`tasks.parent_id → tasks.id`) copied * child-before-parent to exercise the FK-defer path. * * The matching consolidated TASKS-domain target schemas are built with the REAL * CHECK and GLOB constraints the production schema declares, so a regression in * the coercion/normalisation layer surfaces as a row deficit caught by * {@link verifyMigration}. * * **Brain domain (T11647):** the consolidated `brain_*` target now matches the * LEGACY RUNTIME shape — INTEGER epoch-ms timestamps and NO SQL CHECK * constraints. So the fixture's `brain_observations` target carries no `type` * CHECK and an INTEGER `created_at`: every legacy `type` value (`'observation'`, * `'proposal'`, `'pattern'`) and the raw epoch-ms timestamp copy through VERBATIM * — zero coercion, zero deficit. This is what proves the brain data-loss / * corruption fix end-to-end against representative data. * * @task T11551 (DHQ-045 — exodus zero-loss durable guard · AC3) * @epic T10878 * @saga T11242 */ /** * The number of base-table rows the fixture seeds per (source) table. * Exposed so the CI runner can assert an exact post-migration row count. * * @public */ export declare const FIXTURE_EXPECTED_ROWS: { readonly tasks_tasks: 30; readonly tasks_architecture_decisions: 12; readonly tasks_token_usage: 25; readonly brain_observations: 40; }; /** * Options for {@link buildRepresentativeFixture} that inject the derived/internal * + pre-existing-orphan hazards the T11572 parity-gate fixes guard. Default off * so the base zero-loss parity test is unaffected. * * @public */ export interface RepresentativeFixtureOptions { /** * When `true`, the legacy `brain.db` source also gets a real FTS5 virtual * table (`brain_decisions_fts` + its `_data/_idx/_docsize/_config` shadow * tables) and the `_conduit_meta` / `_conduit_migrations` internal bookkeeping * tables — none of which have a consolidated counterpart. A correct migration * SKIPS them (no N→0 deficit). The consolidated target schema additionally * gains a `brain_decisions` base table so the FTS source has real base data. * (T11572 BLOCKER 1.) */ readonly withDerivedAndInternalTables?: boolean; /** * When `true`, the legacy `tasks.db` source gets a `task_relations` table * carrying a PRE-EXISTING FK orphan (a row referencing a `tasks.id` that does * not exist — like the real `tasks_task_relations` rows pointing at deleted * tasks). The same orphan is faithfully copied to the target (zero loss); the * parity gate must TOLERATE it. (T11572 BLOCKER 2.) */ readonly withPreExistingSourceOrphan?: boolean; } /** * Base-table rows for the optional hazard tables (only seeded when the matching * {@link RepresentativeFixtureOptions} flag is set). Exposed so a test that * enables the hazards can assert exact parity on them too. * * @public */ export declare const FIXTURE_HAZARD_EXPECTED_ROWS: { /** brain_decisions base rows (content table behind the FTS5 index). */ readonly brain_decisions: 20; /** task_relations rows: 4 clean + 2 pre-existing orphans = 6. */ readonly tasks_task_relations: 6; }; /** * Materialise the full representative fixture: two legacy source DBs and the * consolidated target DBs with production-grade CHECK/GLOB/FK constraints. * * @param dir - Directory the fixture files are written into. Must already exist. * @param opts - Optional T11572 hazard injection (FTS5/meta derived tables + * pre-existing source FK orphan). Omitting it preserves the original * zero-loss base fixture exactly. * @returns Absolute paths of every fixture artifact. * * @task T11551 (DHQ-045 · AC3) * @task T11572 (parity-gate hazards — FTS5/meta exclusion + source-orphan tolerance) */ export declare function buildRepresentativeFixture(dir: string, opts?: RepresentativeFixtureOptions): { readonly tasksDbPath: string; readonly brainDbPath: string; readonly projectDbPath: string; readonly globalDbPath: string; }; //# sourceMappingURL=representative-fixture.d.ts.map