gatelineAPI reference

The engine surface runLoop actually drives, narrowed from the concrete Engine class (which the CLI and gateline up pass in) so tests can supply a fake without fighting Engine's private fields — an object literal can't structurally satisfy a class type carrying private state, but a real Engine instance satisfies this interface trivially.

interface EngineLike {
    onSettled: null | () => void;
    beginStop(): void;
    clearFault(): void;
    deferrals(): Deferral[];
    drain(): Promise<void>;
    healthFields(): object;
    inFlight(): number;
    noteFault(where: "tick", e: unknown): EngineFault;
    pushHealth(): ReadonlyMap<string, number>;
    subscribeWake(wake: () => Promise<void>): () => void;
    syncFromRemote(): Promise<void>;
    tick(): Promise<TickOutcome[]>;
}

Properties

onSettled: null | () => void

Methods

  • The fault boundary (#502): a pass that throws is recorded on the engine, which logs it with its repository and reports it in its health file; a pass that completes clears it. Optional for test doubles, whose failures are logged as tick failed: … as before.

    Parameters

    • where: "tick"
    • e: unknown

    Returns EngineFault

  • Be woken by the governor when a slot this engine was refused may be free (#501). The loop subscribes its own trigger, so a wake is one more tick through the one path — ticks still never overlap. Optional for test doubles.

    Parameters

    • wake: () => Promise<void>

    Returns () => void