feat(ql3): establish 3.0 incubation baseline

This commit is contained in:
whyour
2026-08-12 00:25:26 +08:00
parent 4bf92dcfeb
commit c699c32461
2817 changed files with 779642 additions and 653 deletions
@@ -0,0 +1,50 @@
import type {
CancellationDispatchRecord,
CancellationDispatchResult,
} from '../domain/cancellationDispatch';
import type { RunEventRecord } from '../domain/run';
export interface ClaimCancellationDispatchCommand {
runId: string;
attemptId: string;
requestedAtMs: number;
owner: string;
leaseToken: string;
nowMs: number;
leaseDurationMs: number;
}
export type ClaimCancellationDispatchResult =
| { status: 'claimed'; dispatch: CancellationDispatchRecord }
| { status: 'not_eligible' }
| {
status: 'not_due' | 'leased' | 'dispatched' | 'blocked';
dispatch: CancellationDispatchRecord;
};
export interface RecordCancellationDispatchResultCommand {
runId: string;
attemptId: string;
owner: string;
leaseToken: string;
expectedVersion: number;
result: CancellationDispatchResult;
atMs: number;
nextAttemptAtMs?: number;
eventId: string;
}
export interface RecordCancellationDispatchResult {
dispatch: CancellationDispatchRecord;
event: RunEventRecord;
}
export interface CancellationDispatchRepository {
findByRunId(runId: string): Promise<CancellationDispatchRecord | null>;
claim(
command: ClaimCancellationDispatchCommand,
): Promise<ClaimCancellationDispatchResult>;
recordResult(
command: RecordCancellationDispatchResultCommand,
): Promise<RecordCancellationDispatchResult>;
}