InterruptConformanceHarness

What a runtime supplies to have its interrupts checked. The pause and the failure must come through the real session, from the backend or a fake of it, never from a snapshot the harness writes itself.

import type { InterruptConformanceHarness } from '@threadplane/core/testing';

Declaration

export interface InterruptConformanceHarness  {
  backendCancellationCount(): number;
  cleanup(): void | Promise<void>;
  deliverLateEvents(): Promise<void>;
  failNextDispatch(): void;
  pause(): Promise<void>;
  readonly requests: readonly InterruptConformanceRequest[];
  readonly responses: readonly AgentInterruptResponse[];
  restore?(): Promise<void>;
  readonly session: AgentSession;
  startLateDelivery(): Promise<void>;
}

Members

backendCancellationCount · overload 1

How many times the backend was told to cancel the paused work.

backendCancellationCount(): number;

Returns

number

cleanup · overload 1

Disposes the session and whatever the harness created. Safe to call twice.

cleanup(): void | Promise<void>;

Returns

void | Promise<void>

deliverLateEvents · overload 1

Releases the held delivery, also after the session is disposed.

deliverLateEvents(): Promise<void>;

Returns

Promise<void>

failNextDispatch · overload 1

Makes the next request fail before the backend accepts it, with an error that can be retried.

failNextDispatch(): void;

Returns

void

pause · overload 1

Runs the agent until it pauses on the fixture batch.

pause(): Promise<void>;

Returns

Promise<void>

requests

Every request sent so far, oldest first.

readonly requests: readonly InterruptConformanceRequest[];

responses

Answers every interrupt in interruptConformanceBatch, in the backend's terms.

readonly responses: readonly AgentInterruptResponse[];

restore · overload 1

Optional: restores the pause from backend history; never writes a local pause.

restore?(): Promise<void>;

Returns

Promise<void>

session

readonly session: AgentSession;

startLateDelivery · overload 1

Starts a run and holds what it delivers until deliverLateEvents is called.

startLateDelivery(): Promise<void>;

Returns

Promise<void>