import './assert_dev_env.js';
/**
 * Cross-impl schema parity — structural diff + assertion over two
 * `SchemaSnapshot`s captured via `query_schema_snapshot`.
 *
 * Two live impls (TS fuz_app vs Rust spine) are each other's parity
 * reference. After both bootstrap, snapshot each, diff, fail loudly on
 * drift. The diff entries name the specific divergence (column type,
 * missing index, constraint absent on one side) so the error
 * message points at the source.
 *
 * Consumer pattern (in zzz's integration runner or fuz_app's own
 * cross-backend tests):
 *
 * ```ts
 * const snapshot_a = await query_schema_snapshot(db_after_deno_bootstrap);
 * const snapshot_b = await query_schema_snapshot(db_after_rust_bootstrap);
 * assert_schema_snapshots_equal(snapshot_a, snapshot_b, {a: 'deno', b: 'rust'});
 * ```
 *
 * Non-coverage — drift the gate does **not** detect:
 *
 * - enum types (`CREATE TYPE ... AS ENUM`)
 * - regular triggers (`pg_trigger`); `CONSTRAINT TRIGGER` is captured via
 *   pg_constraint, but standalone `CREATE TRIGGER` is not
 * - views, materialized views, functions, procedures
 * - table storage parameters (fillfactor, tablespace, autovacuum settings)
 * - column physical order — the snapshot keys columns by name, so two
 *   impls with the same columns in different declaration order compare
 *   equal (functional parity is preserved; `SELECT *` ordering is not)
 * - `COMMENT ON ...`
 * - the `schema_version` migration tracker (always excluded — framework
 *   bookkeeping, not domain schema)
 * - permissions / `GRANT`s
 *
 * None of these are used by the current fuz_app auth schema. Extend
 * `query_schema_snapshot` + `SchemaDiff` if a consumer's schema reaches
 * for them; omitting them today keeps the diff surface focused on what
 * fuz_app actually emits.
 *
 * @module
 */
import type { ColumnSnapshot, SchemaSnapshot } from './schema_introspect.js';
/** Structured drift entry. `where` is the named source impl ('a' or 'b'). */
export type SchemaDiff = {
    readonly kind: 'table_only_in';
    readonly where: 'a' | 'b';
    readonly table: string;
} | {
    readonly kind: 'column_only_in';
    readonly where: 'a' | 'b';
    readonly table: string;
    readonly column: string;
} | {
    readonly kind: 'column_field_differs';
    readonly table: string;
    readonly column: string;
    readonly field: keyof ColumnSnapshot;
    readonly a: unknown;
    readonly b: unknown;
} | {
    readonly kind: 'index_only_in';
    readonly where: 'a' | 'b';
    readonly table: string;
    readonly index: string;
} | {
    readonly kind: 'index_definition_differs';
    readonly table: string;
    readonly index: string;
    readonly a: string;
    readonly b: string;
} | {
    readonly kind: 'constraint_only_in';
    readonly where: 'a' | 'b';
    readonly table: string;
    readonly constraint: string;
} | {
    readonly kind: 'constraint_differs';
    readonly table: string;
    readonly constraint: string;
    readonly a: {
        type: string;
        definition: string;
    };
    readonly b: {
        type: string;
        definition: string;
    };
} | {
    readonly kind: 'sequence_only_in';
    readonly where: 'a' | 'b';
    readonly sequence: string;
} | {
    readonly kind: 'sequence_data_type_differs';
    readonly sequence: string;
    readonly a: string;
    readonly b: string;
};
/**
 * Structural diff between two snapshots — empty array means parity holds.
 *
 * Order of diffs is deterministic: tables in sorted order (with
 * column/index/constraint sub-diffs grouped per table), then sequences.
 * Consumers can rely on this for stable diff output.
 */
export declare const diff_schema_snapshots: (a: SchemaSnapshot, b: SchemaSnapshot) => Array<SchemaDiff>;
/** Labels used in formatted output — defaults to `'a'` and `'b'`. */
export interface SchemaDiffLabels {
    readonly a?: string;
    readonly b?: string;
}
/**
 * Render a diff list as a human-readable multi-line string. Empty diffs
 * produce an empty string.
 */
export declare const format_schema_diffs: (diffs: ReadonlyArray<SchemaDiff>, labels?: SchemaDiffLabels) => string;
/**
 * Throw if the two snapshots disagree. The error message names the impls
 * (via `labels`) and lists every diff, so the failure is self-diagnosing.
 *
 * Consumers wire this after bootstrapping each impl against an isolated DB:
 *
 * ```ts
 * await drop_recreate_db('zzz_test');
 * await spawn_backend(deno_config);
 * const snapshot_deno = await query_schema_snapshot(db, {});
 * await drop_recreate_db('zzz_test');
 * await spawn_backend(rust_config);
 * const snapshot_rust = await query_schema_snapshot(db, {});
 * assert_schema_snapshots_equal(snapshot_deno, snapshot_rust, {a: 'deno', b: 'rust'});
 * ```
 */
export declare const assert_schema_snapshots_equal: (a: SchemaSnapshot, b: SchemaSnapshot, labels?: SchemaDiffLabels) => void;
//# sourceMappingURL=schema_parity.d.ts.map