histoire
Version:
A fast story book powered by Vite
59 lines • 2.54 kB
TypeScript
import type { TestOperationDto, TestTarget } from '@histoire/cli/protocol/tests';
import type { CatalogSnapshot } from '../../catalog/types.js';
import type { AffectedSelection } from '../affected/types.js';
import type { PendingClaim } from './pending.js';
/** What one admission attempt should submit. */
export type AdmissionPlan = {
kind: 'none';
} | {
kind: 'scope';
} | {
kind: 'affected';
storyIds: string[];
};
/**
* Decides what a claimed pending set runs. The exact scope runs whenever it is
* owed whole, whenever the scope is a single story/variant, and when the
* affected stories already are the whole book or exceed the batch cap; otherwise only the affected
* stories run, in catalog order, with interrupted-batch targets included.
* Targets the catalog no longer has are dropped, never replaced by others.
* @param scope Captured scope.
* @param selection Selection of the claimed changes against the current catalog.
* @param claim Claimed pending set.
* @param snapshot Current completed catalog.
*/
export declare function planAdmission(scope: TestTarget, selection: AffectedSelection, claim: PendingClaim, snapshot: CatalogSnapshot): AdmissionPlan;
/** How the scheduler reacts to a refused admission. */
export type AdmissionRefusal = {
kind: 'queue-full';
reason: string;
} | {
kind: 'catalog';
reason: string;
} | {
kind: 'pause';
reason: string;
};
/**
* Maps a refused admission to a reaction. A full queue is retried with a
* bounded backoff; an unfinished catalog waits for the next collection event;
* everything else pauses visibly until a source change or explicit action.
* @param error Failure thrown by the test service.
*/
export declare function classifyRefusal(error: unknown): AdmissionRefusal;
/** What the scheduler does after an owned operation ended. */
export interface SettleDecision {
/** Targets the operation did not validate go back to the pending set. */
carry: boolean;
/** Pause until a source change or explicit action instead of continuing. */
pause?: string;
}
/**
* Judges a finished watch operation. Completed runs owe nothing (assertion
* failures are results). A run that lost its source or was cancelled by a
* fence owes its unvalidated targets; any other failure owes them too but
* pauses, so infrastructure trouble is never retried in a loop.
* @param final Final operation snapshot.
*/
export declare function judgeSettled(final: TestOperationDto): SettleDecision;
//# sourceMappingURL=plan.d.ts.map