/** * Declared footprints of guards and post-apply checks (journal spec ยง3.5 * Rule 3, R7-6; T13193 R-4a). * * A scoped rebase rewinds only the unsequenced local transactions whose * footprint meets the incoming one's. The rows an op writes and references * are not enough: a guard trigger or a post-apply check also READS other * rows (a parent chain, the children of a retyped task, a dependency * closure), and a local transaction whose verdict depends on those rows must * be rewound and replayed around a foreign write that changes them, or the * replicas decide it differently. Every guard trigger and post-apply check * declares what it reads here; a Gate test fails on a guard without a * declaration and on a declaration for a guard that no longer exists. * * A UNIQUE index reads the rows sharing its key; those reads are derived * from the schema ({@link uniqueKeyFootprint}), not declared. * * @task T13193 * @module store/sync/apply/footprints */ import type { DatabaseSync } from 'node:sqlite'; import type { LedgerOp } from '@cleocode/contracts/ledger'; import { type CaptureTableDef } from '../capture.js'; /** * What a guard or a check reads beyond the op's own row: * - `row`: the written row only (nothing beyond the base footprint); * - `refs`: the rows the op's references name (already in the base footprint); * - `parent-chain`: every ancestor of the row's new parent (tasks); * - `children`: the row's current children (tasks); * - `dependency-closure`: every task the new dependency's target reaches. */ export type FootprintRead = 'row' | 'refs' | 'parent-chain' | 'children' | 'dependency-closure'; /** A declared footprint: the table the guard or check fires on, and what it reads. */ export interface DeclaredFootprint { readonly table: string; readonly reads: readonly FootprintRead[]; } /** * Every guard trigger's footprint (the owned guards of `trigger-classes.ts`). * The Gate test in `footprints.test.ts` keeps this in step with the store. */ export declare const GUARD_FOOTPRINTS: Readonly>; /** * Every post-apply check the apply runs (`post-apply.ts`), by the `check` * name its violations carry. */ export declare const POST_APPLY_FOOTPRINTS: Readonly>; type Add = (table: string, uid: string) => void; /** * Widen `ops`' footprint by what their guards and checks read (the declared * reads beyond rows written and referenced, which the caller adds). * * @param db - The store. * @param ops - The ops. * @param defs - Capture definitions by table. * @param add - Adds a row to the footprint. */ export declare function widenFootprint(db: DatabaseSync, ops: readonly LedgerOp[], defs: (table: string) => CaptureTableDef | null, add: Add): void; export {}; //# sourceMappingURL=footprints.d.ts.map