Files
mesh-delivery/contracts/ts/seats/meshdeliverychecker/src/index.ts
T
jschoubben ea0b6a075b The checker's seat serves a checking program's input, a verdict names the program that judged it, and the build step's part carries the run ask (issue 1921, milestone 47/G D1)
B0's run job, its input verb and judged-by move from mesh-sdk's go/delivery
into the Delivery domain's contracts, with B0's JSON names: the part
build-step carries StepAsk.run and the defs RunJob, RunProgram, RunHead,
RunInput and RunAnswer beside compose (the lead's ruling on Q1), and a
step's result the run's exit, output and said.

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
2026-11-07 02:27:44 +01:00

391 lines
12 KiB
TypeScript

// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "mesh-delivery-checker", defined whole (seats/mesh-delivery-checker/seat.json): The merge check's tries: start one, read one, end one. The checker's own events stay under its own subjects (ADR 0620 §2).
export const seat = "mesh-delivery-checker";
export const verbs = {
try: "try",
tryRead: "try-read",
tryEnd: "try-end",
input: "input",
} as const;
export const holderEvents = {
verdict: "verdict",
tagWanted: "tag-wanted",
previewWritten: "preview.written",
} as const;
export function verdictHolderSubject(holder: string): string {
return "mesh.stream." + holder + ".event.verdict";
}
export function tagWantedHolderSubject(holder: string): string {
return "mesh.stream." + holder + ".event.tag-wanted";
}
export function previewWrittenHolderSubject(holder: string): string {
return "mesh.stream." + holder + ".event.preview.written";
}
export const states = {
verdicts: "verdicts",
kept: "kept",
owed: "owed",
previews: "previews",
} as const;
/** The key of one value of the state verdicts under the form "<group>.<heads>". */
export function verdictsByGroupHeadsKey(group: string, heads: string): string {
return group + "." + heads;
}
/** The parts of a key of the form "<group>.<heads>", or undefined for a key of another form. */
export function parseVerdictsByGroupHeadsKey(_key: string): { group: string; heads: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const group = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const heads = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { group, heads };
}
/** The key of one value of the state kept under the form "<level>.<digest>". */
export function keptByLevelDigestKey(level: string, digest: string): string {
return level + "." + digest;
}
/** The parts of a key of the form "<level>.<digest>", or undefined for a key of another form. */
export function parseKeptByLevelDigestKey(_key: string): { level: string; digest: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const level = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
if (_rest === "") return undefined;
const digest = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { level, digest };
}
/** The key of one value of the state owed under the form "<repository>.<number>.<head>.<act>". */
export function owedByRepositoryNumberHeadActKey(repository: string, number: string, head: string, act: string): string {
return repository + "." + number + "." + head + "." + act;
}
/** The parts of a key of the form "<repository>.<number>.<head>.<act>", or undefined for a key of another form. */
export function parseOwedByRepositoryNumberHeadActKey(_key: string): { repository: string; number: string; head: string; act: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const repository = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
const _at2 = _rest.indexOf(".");
if (_at2 <= 0) return undefined;
const number = _rest.slice(0, _at2);
_rest = _rest.slice(_at2 + 1);
const _at4 = _rest.indexOf(".");
if (_at4 <= 0) return undefined;
const head = _rest.slice(0, _at4);
_rest = _rest.slice(_at4 + 1);
if (_rest === "") return undefined;
const act = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { repository, number, head, act };
}
/** The key of one value of the state previews under the form "<repository>.<head>.<trunk>". */
export function previewsByRepositoryHeadTrunkKey(repository: string, head: string, trunk: string): string {
return repository + "." + head + "." + trunk;
}
/** The parts of a key of the form "<repository>.<head>.<trunk>", or undefined for a key of another form. */
export function parsePreviewsByRepositoryHeadTrunkKey(_key: string): { repository: string; head: string; trunk: string } | undefined {
let _rest = _key;
const _at0 = _rest.indexOf(".");
if (_at0 <= 0) return undefined;
const repository = _rest.slice(0, _at0);
_rest = _rest.slice(_at0 + 1);
const _at2 = _rest.indexOf(".");
if (_at2 <= 0) return undefined;
const head = _rest.slice(0, _at2);
_rest = _rest.slice(_at2 + 1);
if (_rest === "") return undefined;
const trunk = _rest;
_rest = "";
if (_rest !== "") return undefined;
return { repository, head, trunk };
}
export interface TryInputMembersItem {
/** the full commit to try, 40 or 64 hex digits */
"head": string;
/** <owner>/<name> */
"repository": string;
/** the trunk commit to merge it onto, or the trunk's branch for its head now; the trunk's head when absent */
"trunk"?: string;
}
/** is what try takes. */
export interface TryInput {
/** the full commit to try, 40 or 64 hex digits, for a try of one member (instead of members) */
"head"?: string;
/** unit or integration: only this level; both when absent */
"level"?: string;
/** the group: one repository at most once, each at the exact commit asked and the trunk commit it is merged onto; instead of repository and head */
"members"?: TryInputMembersItem[];
/** <owner>/<name>, for a try of one member (instead of members) */
"repository"?: string;
/** a go test -run pattern: only those tests run, and nothing is kept */
"tests"?: string;
/** the trunk commit to merge it onto, or the trunk's branch for its head now; the trunk's head when absent */
"trunk"?: string;
}
/** is what try answers. */
export interface TryAnswer {
/** the try's id */
"id": string;
/** its state */
"state"?: string;
}
/** is what try-read takes. */
export interface TryReadInput {
/** the try's id, try-<digits> */
"id": string;
}
/** is what try-read answers. */
export type TryReadAnswer = Record<string, unknown>;
/** is what try-end takes. */
export interface TryEndInput {
/** the try's id, try-<digits> */
"id": string;
/** why it is ended, in words */
"why": string;
}
/** is what try-end answers. */
export interface TryEndAnswer {
/** it is ended */
"ended": boolean;
/** the try */
"id": string;
}
/** is what input takes. */
export interface InputInput {
/** the input's sha256, 64 lowercase hex digits, as the run ask names it */
"digest": string;
}
/** is what input answers. */
export interface InputAnswer {
/** the digest asked */
"digest": string;
/** the input's exact bytes, base64, so no encoding on the way changes a byte the digest covers */
"input": string;
}
export interface VerdictHolderEventSeriesItem {
/** its artifact, or the package's ecosystem name as the module's packages name it */
"artifact": string;
/** the series on trunk */
"from": string;
/** the module whose artifact's series changes */
"module": string;
/** the series the checked head gives it */
"to": string;
}
/** is the body of the holder's event verdict. */
export interface VerdictHolderEvent {
/** the commit checked */
"head": string;
/** the generated files out of step with their seat definitions, each path (design 26) */
"out-of-step"?: string[];
/** the pull request's number, for a pull request's check */
"pull"?: number;
/** owner/repo */
"repository": string;
/** each change of an artifact's series the checked head makes against trunk's manifests, once each (design 32); absent when it changes none */
"series"?: VerdictHolderEventSeriesItem[];
/** pass or fail */
"verdict": string;
}
/** is the body of the holder's event tag-wanted. */
export interface TagWantedHolderEvent {
/** the pull request's branch: its tag is removed when the branch ends */
"branch": string;
/** its head */
"head": string;
/** the group member */
"module": string;
/** the package it declares */
"package": string;
/** the pull request */
"pull"?: number;
/** owner/repo */
"repository": string;
/** the tag wanted */
"tag"?: string;
}
export interface VerdictsByGroupHeadsValueComposition {
"fpset"?: string;
"machines"?: string[];
"sdk"?: string;
/** not-run, pass or fail */
"state": string;
"words"?: string;
}
export interface VerdictsByGroupHeadsValueFailed {
"machine"?: string;
"test"?: string;
"words"?: string;
}
export interface VerdictsByGroupHeadsValueFailuresItem {
"machine"?: string;
"test"?: string;
"words"?: string;
}
export interface VerdictsByGroupHeadsValueJudgedByHeadsItem {
"commit": string;
"repository": string;
}
export interface VerdictsByGroupHeadsValueJudgedByProgram {
"commit": string;
"dir": string;
"package": string;
"repository": string;
}
/** the checking program that judged the check: where it was built, the key its build is kept under, whether this check's run built it, and the heads it read (ADR 0644, ADR 0656). Absent in a value written before it */
export interface VerdictsByGroupHeadsValueJudgedBy {
"built"?: boolean;
"heads": VerdictsByGroupHeadsValueJudgedByHeadsItem[];
/** program- and 16 hex digits */
"key": string;
"program": VerdictsByGroupHeadsValueJudgedByProgram;
}
export interface VerdictsByGroupHeadsValueLevelsValue {
"kept": number;
"run": number;
"skipped"?: number;
}
export interface VerdictsByGroupHeadsValueSeriesItem {
"artifact": string;
"from": string;
"module": string;
"to": string;
}
/** milliseconds */
export interface VerdictsByGroupHeadsValueTook {
"clone"?: number;
"composition"?: number;
"integration-run"?: number;
"integration-setup"?: number;
"lint"?: number;
"queue"?: number;
"unit"?: number;
}
/** is one value of the state verdicts under the key <group>.<heads>. */
export interface VerdictsByGroupHeadsValue {
"beside"?: Record<string, string>;
"carried-from"?: Record<string, string>;
"composition"?: VerdictsByGroupHeadsValueComposition;
"failed"?: VerdictsByGroupHeadsValueFailed;
"failures"?: VerdictsByGroupHeadsValueFailuresItem[];
"group": string;
/** 12 hex digits */
"heads": string;
/** the checking program that judged the check: where it was built, the key its build is kept under, whether this check's run built it, and the heads it read (ADR 0644, ADR 0656). Absent in a value written before it */
"judged-by"?: VerdictsByGroupHeadsValueJudgedBy;
/** by level, unit or integration */
"levels"?: Record<string, VerdictsByGroupHeadsValueLevelsValue>;
"machines"?: string[];
"over-bound"?: string[];
"sdk"?: string;
"series"?: VerdictsByGroupHeadsValueSeriesItem[];
/** running, pass or fail */
"state": string;
/** milliseconds */
"took"?: VerdictsByGroupHeadsValueTook;
/** repository to the trunk head merged onto */
"trunk"?: Record<string, string>;
/** the layout version */
"v"?: number;
}
/** is one value of the state kept under the key <level>.<digest>. */
export interface KeptByLevelDigestValue {
/** when (RFC 3339 time) */
"at"?: string;
"level": string;
"package": string;
"repository": string;
/** pass: a failure is never kept */
"state": string;
"tests"?: number;
"took"?: number;
"toolchain"?: string;
/** the layout version */
"v"?: number;
}
/** is one value of the state owed under the key <repository>.<number>.<head>.<act>. */
export interface OwedByRepositoryNumberHeadActValue {
/** status=<context>, view, note or comment.<seq> */
"act": string;
"context"?: string;
"ref"?: string;
"state"?: string;
"target"?: string;
"text"?: string;
/** the layout version */
"v"?: number;
}
export interface PreviewsByRepositoryHeadTrunkValueModulesValue {
"locks"?: Record<string, string>;
/** manifest digest */
"manifest": string;
"packages"?: string[];
"paths"?: Record<string, string>;
"tree": string;
}
/** is one value of the state previews under the key <repository>.<head>.<trunk>. */
export interface PreviewsByRepositoryHeadTrunkValue {
/** files in conflict */
"conflicts"?: string[];
"head": string;
/** the merge commit */
"merge"?: string;
/** by directory */
"modules"?: Record<string, PreviewsByRepositoryHeadTrunkValueModulesValue>;
"repository": string;
"trunk": string;
/** the layout version */
"v"?: number;
}