mesh-delivery-contracts: the part build-step and the three build seats defined whole with their states (D-4, ADR 0634 §6; issue 1966)

This commit is contained in:
2026-11-05 14:11:31 +01:00
parent 07bd0472b9
commit 7b4a469a3f
32 changed files with 3918 additions and 0 deletions
@@ -0,0 +1,153 @@
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The contract of the seat "node-build-node", defined whole (seats/node-build-node/seat.json): The Node build module on a node: it takes the asks of the builder and the checker, runs them as steps and answers.
import type * as buildStep from "./parts/build-step.js";
export const seat = "node-build-node";
export const verbs = {
current: "current",
pause: "pause",
resume: "resume",
} as const;
export const accepts = {
delivery: "delivery",
check: "check",
recheck: "recheck",
} as const;
export const deliverySubject = "mesh.seat.node-build-node.accept.delivery";
export const checkSubject = "mesh.seat.node-build-node.accept.check";
export const recheckSubject = "mesh.seat.node-build-node.accept.recheck";
export const states = {
steps: "steps",
pauses: "pauses",
toolchains: "toolchains",
} as const;
/** The key of one value of the state steps under the form "<node>.<id>". */
export function stepsByNodeIDKey(node: string, id: string): string {
return node + "." + id;
}
/** The parts of a key of the form "<node>.<id>", or undefined for a key of another form. */
export function parseStepsByNodeIDKey(key: string): { node: string; id: string } | undefined {
let rest = key;
const at0 = rest.indexOf(".");
if (at0 <= 0) return undefined;
const node = rest.slice(0, at0);
rest = rest.slice(at0 + 1);
if (rest === "") return undefined;
const id = rest;
rest = "";
if (rest !== "") return undefined;
return { node, id };
}
/** The key of one value of the state pauses under the form "paused.<node>". */
export function pausesByPausedNodeKey(node: string): string {
return "paused." + node;
}
/** The parts of a key of the form "paused.<node>", or undefined for a key of another form. */
export function parsePausesByPausedNodeKey(key: string): { node: string } | undefined {
let rest = key;
if (!rest.startsWith("paused.")) return undefined;
rest = rest.slice(7);
if (rest === "") return undefined;
const node = rest;
rest = "";
if (rest !== "") return undefined;
return { node };
}
/** The key of one value of the state pauses under the form "capacity.<node>". */
export function pausesByCapacityNodeKey(node: string): string {
return "capacity." + node;
}
/** The parts of a key of the form "capacity.<node>", or undefined for a key of another form. */
export function parsePausesByCapacityNodeKey(key: string): { node: string } | undefined {
let rest = key;
if (!rest.startsWith("capacity.")) return undefined;
rest = rest.slice(9);
if (rest === "") return undefined;
const node = rest;
rest = "";
if (rest !== "") return undefined;
return { node };
}
/** The key of one value of the state toolchains under the form "<node>.<language>". */
export function toolchainsByNodeLanguageKey(node: string, language: string): string {
return node + "." + language;
}
/** The parts of a key of the form "<node>.<language>", or undefined for a key of another form. */
export function parseToolchainsByNodeLanguageKey(key: string): { node: string; language: string } | undefined {
let rest = key;
const at0 = rest.indexOf(".");
if (at0 <= 0) return undefined;
const node = rest.slice(0, at0);
rest = rest.slice(at0 + 1);
if (rest === "") return undefined;
const language = rest;
rest = "";
if (rest !== "") return undefined;
return { node, language };
}
export type BuildAnswer = buildStep.BuildAnswer;
export type BuildAnswerArtifactsItem = buildStep.BuildAnswerArtifactsItem;
export type BuildAnswerToolchain = buildStep.BuildAnswerToolchain;
export type Capacity = buildStep.Capacity;
export type CheckAnswer = buildStep.CheckAnswer;
export type CheckAnswerLevelsItem = buildStep.CheckAnswerLevelsItem;
export type CheckAnswerLevelsItemDigest = buildStep.CheckAnswerLevelsItemDigest;
export type CheckAnswerLevelsItemDigestNeedsItem = buildStep.CheckAnswerLevelsItemDigestNeedsItem;
export type CheckAnswerLevelsItemDigestPackagesItem = buildStep.CheckAnswerLevelsItemDigestPackagesItem;
export type CheckAnswerLevelsItemKeptItem = buildStep.CheckAnswerLevelsItemKeptItem;
export type CheckAnswerLevelsItemUnmetItem = buildStep.CheckAnswerLevelsItemUnmetItem;
export type ComposeAnswer = buildStep.ComposeAnswer;
export type CurrentAnswer = buildStep.CurrentAnswer;
export type CurrentInput = buildStep.CurrentInput;
export type Pause = buildStep.Pause;
export type PauseAnswer = buildStep.PauseAnswer;
export type PauseInput = buildStep.PauseInput;
export type ResumeAnswer = buildStep.ResumeAnswer;
export type ResumeInput = buildStep.ResumeInput;
export type Step = buildStep.Step;
export type StepAsk = buildStep.StepAsk;
export type StepAskBuild = buildStep.StepAskBuild;
export type StepAskBuildArtifactsItem = buildStep.StepAskBuildArtifactsItem;
export type StepAskBuildToolchain = buildStep.StepAskBuildToolchain;
export type StepAskCheck = buildStep.StepAskCheck;
export type StepAskCompose = buildStep.StepAskCompose;
export type Toolchain = buildStep.Toolchain;
/** is the body of delivery. */
export type DeliveryAccept = StepAsk;
/** is the body of check. */
export type CheckAccept = StepAsk;
/** is the body of recheck. */
export type RecheckAccept = StepAsk;
/** is one value of the state steps under the key <node>.<id>. */
export type StepsByNodeIDValue = Step;
/** is one value of the state pauses under the key paused.<node>. */
export type PausesByPausedNodeValue = Pause;
/** is one value of the state pauses under the key capacity.<node>. */
export type PausesByCapacityNodeValue = Capacity;
/** is one value of the state toolchains under the key <node>.<language>. */
export type ToolchainsByNodeLanguageValue = Toolchain;
@@ -0,0 +1,232 @@
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// The part "build-step" several seats include whole: What the three build seats share: the verbs that read and steer a node's builds, and the layouts of the asks they accept and the steps they keep. A seat lists its states against these (a part carries no states).
export const verbs = {
current: "current",
pause: "pause",
resume: "resume",
} as const;
export interface BuildAnswerArtifactsItem {
"artifact": string;
"digest": string;
"reference"?: string;
}
export interface BuildAnswerToolchain {
"language": string;
"recipe": string;
"version": string;
}
export interface BuildAnswer {
"artifacts": BuildAnswerArtifactsItem[];
"imports"?: string[];
"out-of-step"?: string[];
"toolchain"?: BuildAnswerToolchain;
}
/** how many steps the node runs at once */
export interface Capacity {
/** when (RFC 3339 time) */
"at"?: string;
"build-hours"?: string;
"build-hours-fault"?: string;
"by-cpu"?: number;
"configured": number;
"configured-from"?: string;
"cores-per-step"?: number;
"effective": number;
"ineligible"?: string;
"outside-hours"?: boolean;
"quota-cores"?: number;
"quota-from"?: string;
/** the layout version */
"v"?: number;
"why": string;
}
export interface CheckAnswerLevelsItemDigestNeedsItem {
"needs"?: string[];
"package"?: string;
}
export interface CheckAnswerLevelsItemDigestPackagesItem {
"digest": string;
"package": string;
}
export interface CheckAnswerLevelsItemDigest {
"beside"?: string[];
"judged_by"?: string;
"level"?: string;
"needs"?: CheckAnswerLevelsItemDigestNeedsItem[];
"packages"?: CheckAnswerLevelsItemDigestPackagesItem[];
"without_tests"?: string[];
}
export interface CheckAnswerLevelsItemKeptItem {
"digest"?: string;
"package"?: string;
"tests"?: number;
}
export interface CheckAnswerLevelsItemUnmetItem {
"needs"?: string[];
"package"?: string;
}
export interface CheckAnswerLevelsItem {
"digest"?: CheckAnswerLevelsItemDigest;
"judged"?: string;
"kept"?: CheckAnswerLevelsItemKeptItem[];
"level": string;
"tests"?: unknown[];
"unmet"?: CheckAnswerLevelsItemUnmetItem[];
}
export interface CheckAnswer {
/** what the build module fetches: the repository, commit and directory, as the indexer states it */
"fetch": unknown;
"levels"?: CheckAnswerLevelsItem[];
}
export interface ComposeAnswer {
"built": boolean;
"key"?: string;
/** the compose-candidate verdict */
"verdict"?: unknown;
}
/** whether the node takes no new ask */
export interface Pause {
/** when (RFC 3339 time) */
"at"?: string;
"by"?: string;
"paused": boolean;
/** the layout version */
"v"?: number;
}
/** one step a build module runs on a node */
export interface Step {
/** when (RFC 3339 time) */
"ended"?: string;
"id": string;
"node": string;
"owner"?: string;
"phase"?: string;
/** when (RFC 3339 time) */
"phase-at"?: string;
"reason"?: string;
/** what the step answered */
"result"?: unknown;
/** when (RFC 3339 time) */
"started": string;
/** running, passed, failed or refused */
"state": string;
"tool": string;
/** the layout version */
"v"?: number;
"what"?: string;
}
export interface StepAskBuildArtifactsItem {
"artifact": string;
"from"?: string;
"seat"?: string;
"version"?: string;
}
export interface StepAskBuildToolchain {
"language": string;
"recipe": string;
"version": string;
}
export interface StepAskBuild {
"artifacts": StepAskBuildArtifactsItem[];
/** what the build module fetches: the repository, commit and directory, as the indexer states it */
"fetch"?: unknown;
"fp"?: string;
"module": string;
"path"?: string;
"publish"?: boolean;
"toolchain"?: StepAskBuildToolchain;
}
export interface StepAskCheck {
/** what the build module fetches: the repository, commit and directory, as the indexer states it */
"fetch": unknown;
"kept"?: boolean;
"levels": string[];
"packages"?: string[];
"run"?: string;
"runner"?: string;
"runner_when"?: string;
}
export interface StepAskCompose {
"dir": string;
/** what the build module fetches: the repository, commit and directory, as the indexer states it */
"fetch": unknown;
"package": string;
"reader"?: string;
/** the compose-candidate request */
"request": unknown;
}
/** one ask of a build module */
export interface StepAsk {
"asker": string;
/** when (RFC 3339 time) */
"at"?: string;
"build"?: StepAskBuild;
"check"?: StepAskCheck;
"compose"?: StepAskCompose;
"id": string;
/** build, check or compose */
"kind": string;
/** go, typescript or image */
"language": string;
"needs"?: string[];
/** package to the tagged version a build pins */
"packages"?: Record<string, string>;
/** the layout version */
"v"?: number;
}
/** the toolchain a node reports */
export interface Toolchain {
/** when (RFC 3339 time) */
"at"?: string;
/** go or typescript */
"language": string;
"recipe": string;
/** the layout version */
"v"?: number;
"version": string;
}
/** is what current takes. */
export interface CurrentInput {
}
/** is what current answers. */
export type CurrentAnswer = Record<string, unknown>;
/** is what pause takes. */
export interface PauseInput {
}
/** is what pause answers. */
export type PauseAnswer = Record<string, unknown>;
/** is what resume takes. */
export interface ResumeInput {
}
/** is what resume answers. */
export type ResumeAnswer = Record<string, unknown>;