/**
 * Schema lag repair service — fixes raw_fragments rows that were misrouted
 * due to the schema-projection-lag bug (issue #142).
 *
 * Root cause: register() with activate:true did not deactivate prior active
 * schema versions, so new fields were classified as unknown and written to
 * raw_fragments instead of observations. Fixed in v0.13.0.
 *
 * This service provides:
 *   - auditEntityType()  — returns misfiled fragment_keys for one entity type
 *   - repairEntityType() — promotes misfiled fragments to observations
 *   - auditAll()         — audit all entity types in raw_fragments
 *   - repairAll()        — repair all affected entity types
 *
 * Every observation created here carries a _migration_run_id sentinel in its
 * fields JSON so the run is fully rollback-safe via rollbackRun().
 */
export interface RepairAuditResult {
    entity_type: string;
    user_id: string | null;
    misfiled_fields: string[];
    fragment_count: number;
}
export interface RepairRunResult {
    run_id: string;
    repaired_entity_types: number;
    inserted_observations: number;
    recomputed_snapshots: number;
    errors: string[];
}
export interface RollbackResult {
    run_id: string;
    deleted_observations: number;
    recomputed_snapshots: number;
}
/** Returns misfiled fragment_keys for one entity type — fragments whose key is
 *  now a declared field in the active schema. */
export declare function auditEntityType(entityType: string, userId?: string | null): Promise<RepairAuditResult | null>;
/** Audit all entity types present in raw_fragments. */
export declare function auditAll(): Promise<RepairAuditResult[]>;
/** Promote misfiled raw_fragments to observations for one entity type.
 *  Every observation created carries _migration_run_id for rollback. */
export declare function repairEntityType(entityType: string, userId: string | null, runId: string, fieldNames: string[]): Promise<{
    inserted: number;
    recomputed: number;
    errors: string[];
}>;
/** Repair all affected entity types. Returns a run_id usable for rollback. */
export declare function repairAll(filterEntityTypes?: string[]): Promise<RepairRunResult>;
/** Roll back a prior repair run by deleting its sentinel observations and
 *  recomputing affected snapshots. */
export declare function rollbackRun(runId: string): Promise<RollbackResult>;
/**
 * Queue a background schema-lag repair job for a single entity type.
 * Best-effort — failures are logged but not thrown.
 * Used by the store path to lazily trigger repair when misfiled fragments are detected.
 */
export declare function queueSchemaLagRepair(entityType: string, userId: string | null): Promise<void>;
//# sourceMappingURL=schema_lag_repair.d.ts.map