/** Steps `setupTestDatabases` passes through, in the order it reaches them. */ export type SetupPhase = 'rls-probe' | 'run-prepare' | 'template-pin' | 'template-wait' | 'template-build' | 'template-migrate' | 'template-ready' | 'queue-check' | 'clone-start' | 'clone-done' | 'ready'; export interface SetupProgress { readonly phase: SetupPhase; /** The configured database this step is about, or null for whole-run steps. */ readonly database: string | null; /** Free-form detail — a migration tag, a poll count. Never parsed. */ readonly detail?: string; /** Milliseconds since setup started. */ readonly elapsedMs: number; /** The phase this one displaced, and how long it held. Null on the first. */ readonly previous: { readonly phase: SetupPhase; readonly database: string | null; readonly heldMs: number; } | null; } export type SetupProgressListener = (progress: SetupProgress) => void; /** Setup made no progress for the configured bound. Names the last phase reached. */ export declare class SetupStalled extends Error { readonly phase: SetupPhase; readonly database: string | null; readonly stalledMs: number; readonly elapsedMs: number; constructor(phase: SetupPhase, database: string | null, stalledMs: number, elapsedMs: number); } /** * Records the phase setup is in and when it got there. The watchdog reads it; * the listener is told about every advance. */ export declare class PhaseTracker { private readonly listener; private readonly clock; phase: SetupPhase; database: string | null; private started; private at; private readonly start; constructor(listener?: SetupProgressListener, clock?: () => number); /** How long the current phase has held. */ idleMs(): number; elapsedMs(): number; reached(phase: SetupPhase, database?: string | null, detail?: string): void; } export declare const DEFAULT_SETUP_STALL_MS = 120000; export interface StallWatchOptions { stallMs?: number; /** How often the watchdog looks. Defaults to a tenth of the bound. */ pollMs?: number; } /** * Run `work`, failing it if `tracker` reports no phase advance for `stallMs`. * * The watchdog only ever REJECTS earlier than `work` would settle — it cannot * make a completed setup fail, and its timer is unref'd so it never holds the * process open. */ export declare function withStallWatchdog(work: () => Promise, tracker: PhaseTracker, options?: StallWatchOptions): Promise; /** Prefix for the stderr lines `auto-setup` writes about slow phases. */ export declare const SETUP_PROGRESS_LOG_PREFIX = "pipework:test-setup"; /** * A phase that held this long is worth a line. Below it setup is silent: a * healthy run must not spray forty lines per test file. */ export declare const SLOW_PHASE_MS = 10000; /** * The listener `auto-setup` installs. Silent while setup is quick, one * key=value line per phase that took long enough to explain a late hook. */ export declare function logSlowPhases(write?: (line: string) => void, slowMs?: number): SetupProgressListener; //# sourceMappingURL=progress.d.ts.map