Files
mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildimage/contract.go
T
jschoubben 4851475773 Asker rename R1: a build seat's streamed kind is sent on its queue's subject, the kind in the body
The generator wrote `accept.<stream>.<kind>` for a kind that rides a stream (step on check and delivery,
run on check), so the runner's step landed under the named worker `accept.check.*` with `step` read as
its asker. A-170 has the kind in the body only: the generated accept subject of a streamed kind is the
queue's, `accept.<stream>`; its generated names stay `<stream>.<kind>`. The three build seats'
contracts and fixtures are regenerated.

Builds: design 47 G §600, A-170, A-184

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
2026-11-12 18:23:48 +01:00

1134 lines
45 KiB
Go

// Code generated by seatgen from the seat definitions; DO NOT EDIT.
// Package nodebuildimage is the contract of the seat "node-build-image", defined whole (seats/node-build-image/seat.json): The image build module on a node: it takes the asks of the builder and the checker, runs them as steps and answers.
package nodebuildimage
import (
"bytes"
"encoding/json"
"errors"
"strings"
"time"
)
// Seat is the seat's name.
const Seat = "node-build-image"
const (
VerbCurrent = "current"
VerbPause = "pause"
VerbResume = "resume"
VerbDrop = "drop"
VerbKeptArtifact = "kept-artifact"
VerbSteps = "steps"
VerbOutput = "output"
)
const (
AcceptDelivery = "delivery"
AcceptCheck = "check"
AcceptCheckStep = "check.step"
AcceptDeliveryStep = "delivery.step"
AcceptRecheck = "recheck"
)
const (
EventStepEnded = "step-ended"
EventToolchainReported = "toolchain-reported"
EventStepProgress = "step-progress"
EventAskTaken = "ask-taken"
)
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
func Verbs() []string {
return []string{VerbCurrent, VerbPause, VerbResume, VerbDrop, VerbKeptArtifact, VerbSteps, VerbOutput}
}
// Events is every event published on the seat's subject: a new copy each call.
func Events() []string {
return []string{EventStepEnded, EventToolchainReported, EventStepProgress, EventAskTaken}
}
// Family is where the seat's events are kept: the shared events stream, filtered to the seat's subjects.
const (
Family = "node-build-image.events"
FamilyMaxAgeDays = 7
)
// StreamStepEnded is the stream step-ended is kept in.
const StreamStepEnded = "SEAT_node-build-image_step-ended"
// SubjectStepEnded is where step-ended is published, on mesh.seat.node-build-image.event.step-ended.<node>.
func SubjectStepEnded(node string) string {
return "mesh.seat.node-build-image.event.step-ended." + node
}
// SubjectStepEndedAll hears every step-ended.
const SubjectStepEndedAll = "mesh.seat.node-build-image.event.step-ended.*"
// StreamToolchainReported is the stream toolchain-reported is kept in.
const StreamToolchainReported = "SEAT_node-build-image_toolchain-reported"
// SubjectToolchainReported is where toolchain-reported is published, on mesh.seat.node-build-image.event.toolchain-reported.<node>.
func SubjectToolchainReported(node string) string {
return "mesh.seat.node-build-image.event.toolchain-reported." + node
}
// SubjectToolchainReportedAll hears every toolchain-reported.
const SubjectToolchainReportedAll = "mesh.seat.node-build-image.event.toolchain-reported.*"
// SubjectStepProgress is where step-progress is published, on mesh.seat.node-build-image.event.step-progress.<node>.
func SubjectStepProgress(node string) string {
return "mesh.seat.node-build-image.event.step-progress." + node
}
// SubjectStepProgressAll hears every step-progress.
const SubjectStepProgressAll = "mesh.seat.node-build-image.event.step-progress.*"
// SubjectAskTaken is where ask-taken is published, on mesh.seat.node-build-image.event.ask-taken.<node>.
func SubjectAskTaken(node string) string { return "mesh.seat.node-build-image.event.ask-taken." + node }
// SubjectAskTakenAll hears every ask-taken.
const SubjectAskTakenAll = "mesh.seat.node-build-image.event.ask-taken.*"
// AcceptSubjectDelivery is where delivery is sent.
const AcceptSubjectDelivery = "mesh.seat.node-build-image.accept.delivery"
// AcceptSubjectCheck is where check is sent.
const AcceptSubjectCheck = "mesh.seat.node-build-image.accept.check"
// AcceptSubjectCheckStep is where check.step is sent.
const AcceptSubjectCheckStep = "mesh.seat.node-build-image.accept.check"
// AcceptSubjectDeliveryStep is where delivery.step is sent.
const AcceptSubjectDeliveryStep = "mesh.seat.node-build-image.accept.delivery"
// AcceptSubjectRecheck is where recheck is sent.
const AcceptSubjectRecheck = "mesh.seat.node-build-image.accept.recheck"
const (
StateSteps = "steps"
StatePauses = "pauses"
StateToolchains = "toolchains"
StateDetectedSteps = "detected-steps"
)
// StepsByAskerNodeIDKey is the key of one value of the state steps under the form "<asker>.<node>.<id>".
func StepsByAskerNodeIDKey(asker, node, id string) string { return asker + "." + node + "." + id }
// ParseStepsByAskerNodeIDKey reads the parts of a key of the form "<asker>.<node>.<id>", in the order of the form; the last result is false for a key of another form.
func ParseStepsByAskerNodeIDKey(key string) (string, string, string, bool) {
rest := key
v0, after0, found0 := strings.Cut(rest, ".")
if !found0 || v0 == "" {
return "", "", "", false
}
rest = after0
v2, after2, found2 := strings.Cut(rest, ".")
if !found2 || v2 == "" {
return "", "", "", false
}
rest = after2
if rest == "" {
return "", "", "", false
}
v4 := rest
rest = ""
if rest != "" {
return "", "", "", false
}
return v0, v2, v4, true
}
// DecodeStepsByAskerNodeIDValue reads one value of the state steps under the form "<asker>.<node>.<id>", refusing a field StepsByAskerNodeIDValue does not know and any text after the value.
func DecodeStepsByAskerNodeIDValue(raw []byte) (StepsByAskerNodeIDValue, error) {
var v StepsByAskerNodeIDValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
}
// StepsByNodeIDKey is the key of one value of the state steps under the form "<node>.<id>".
func StepsByNodeIDKey(node, id string) string { return node + "." + id }
// ParseStepsByNodeIDKey reads the parts of a key of the form "<node>.<id>", in the order of the form; the last result is false for a key of another form.
func ParseStepsByNodeIDKey(key string) (string, string, bool) {
rest := key
v0, after0, found0 := strings.Cut(rest, ".")
if !found0 || v0 == "" {
return "", "", false
}
rest = after0
if rest == "" {
return "", "", false
}
v2 := rest
rest = ""
if rest != "" {
return "", "", false
}
return v0, v2, true
}
// DecodeStepsByNodeIDValue reads one value of the state steps under the form "<node>.<id>", refusing a field StepsByNodeIDValue does not know and any text after the value.
func DecodeStepsByNodeIDValue(raw []byte) (StepsByNodeIDValue, error) {
var v StepsByNodeIDValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
}
// PausesByPausedNodeKey is the key of one value of the state pauses under the form "paused.<node>".
func PausesByPausedNodeKey(node string) string { return "paused." + node }
// ParsePausesByPausedNodeKey reads the parts of a key of the form "paused.<node>", in the order of the form; the last result is false for a key of another form.
func ParsePausesByPausedNodeKey(key string) (string, bool) {
rest := key
if !strings.HasPrefix(rest, "paused.") {
return "", false
}
rest = rest[7:]
if rest == "" {
return "", false
}
v1 := rest
rest = ""
if rest != "" {
return "", false
}
return v1, true
}
// DecodePausesByPausedNodeValue reads one value of the state pauses under the form "paused.<node>", refusing a field PausesByPausedNodeValue does not know and any text after the value.
func DecodePausesByPausedNodeValue(raw []byte) (PausesByPausedNodeValue, error) {
var v PausesByPausedNodeValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
}
// PausesByDroppedIDKey is the key of one value of the state pauses under the form "dropped.<id>".
func PausesByDroppedIDKey(id string) string { return "dropped." + id }
// ParsePausesByDroppedIDKey reads the parts of a key of the form "dropped.<id>", in the order of the form; the last result is false for a key of another form.
func ParsePausesByDroppedIDKey(key string) (string, bool) {
rest := key
if !strings.HasPrefix(rest, "dropped.") {
return "", false
}
rest = rest[8:]
if rest == "" {
return "", false
}
v1 := rest
rest = ""
if rest != "" {
return "", false
}
return v1, true
}
// DecodePausesByDroppedIDValue reads one value of the state pauses under the form "dropped.<id>", refusing a field PausesByDroppedIDValue does not know and any text after the value.
func DecodePausesByDroppedIDValue(raw []byte) (PausesByDroppedIDValue, error) {
var v PausesByDroppedIDValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
}
// PausesByCapacityNodeKey is the key of one value of the state pauses under the form "capacity.<node>".
func PausesByCapacityNodeKey(node string) string { return "capacity." + node }
// ParsePausesByCapacityNodeKey reads the parts of a key of the form "capacity.<node>", in the order of the form; the last result is false for a key of another form.
func ParsePausesByCapacityNodeKey(key string) (string, bool) {
rest := key
if !strings.HasPrefix(rest, "capacity.") {
return "", false
}
rest = rest[9:]
if rest == "" {
return "", false
}
v1 := rest
rest = ""
if rest != "" {
return "", false
}
return v1, true
}
// DecodePausesByCapacityNodeValue reads one value of the state pauses under the form "capacity.<node>", refusing a field PausesByCapacityNodeValue does not know and any text after the value.
func DecodePausesByCapacityNodeValue(raw []byte) (PausesByCapacityNodeValue, error) {
var v PausesByCapacityNodeValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
}
// ToolchainsByNodeLanguageKey is the key of one value of the state toolchains under the form "<node>.<language>".
func ToolchainsByNodeLanguageKey(node, language string) string { return node + "." + language }
// ParseToolchainsByNodeLanguageKey reads the parts of a key of the form "<node>.<language>", in the order of the form; the last result is false for a key of another form.
func ParseToolchainsByNodeLanguageKey(key string) (string, string, bool) {
rest := key
v0, after0, found0 := strings.Cut(rest, ".")
if !found0 || v0 == "" {
return "", "", false
}
rest = after0
if rest == "" {
return "", "", false
}
v2 := rest
rest = ""
if rest != "" {
return "", "", false
}
return v0, v2, true
}
// DecodeToolchainsByNodeLanguageValue reads one value of the state toolchains under the form "<node>.<language>", refusing a field ToolchainsByNodeLanguageValue does not know and any text after the value.
func DecodeToolchainsByNodeLanguageValue(raw []byte) (ToolchainsByNodeLanguageValue, error) {
var v ToolchainsByNodeLanguageValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
}
// DetectedStepsByModuleArtifactKey is the key of one value of the state detected-steps under the form "<module>.<artifact>".
func DetectedStepsByModuleArtifactKey(module, artifact string) string { return module + "." + artifact }
// ParseDetectedStepsByModuleArtifactKey reads the parts of a key of the form "<module>.<artifact>", in the order of the form; the last result is false for a key of another form.
func ParseDetectedStepsByModuleArtifactKey(key string) (string, string, bool) {
rest := key
v0, after0, found0 := strings.Cut(rest, ".")
if !found0 || v0 == "" {
return "", "", false
}
rest = after0
if rest == "" {
return "", "", false
}
v2 := rest
rest = ""
if rest != "" {
return "", "", false
}
return v0, v2, true
}
// DecodeDetectedStepsByModuleArtifactValue reads one value of the state detected-steps under the form "<module>.<artifact>", refusing a field DetectedStepsByModuleArtifactValue does not know and any text after the value.
func DecodeDetectedStepsByModuleArtifactValue(raw []byte) (DetectedStepsByModuleArtifactValue, error) {
var v DetectedStepsByModuleArtifactValue
dec := json.NewDecoder(bytes.NewReader(raw))
dec.DisallowUnknownFields()
if err := dec.Decode(&v); err != nil {
return v, err
}
if dec.More() {
return v, errors.New("text after the value")
}
return v, nil
}
// AskArtifact is one artifact of a build ask: built from the fetched tree, or copied from an upstream pin.
type AskArtifact struct {
Artifact string `json:"artifact"`
From string `json:"from,omitempty"`
Seat string `json:"seat,omitempty"`
Version string `json:"version,omitempty"`
}
// AskTaken is an ask a build seat's holder took, said when it takes any ask, whatever its asker (design 47 G section 602).
type AskTaken struct {
// the ask's id
Ask string `json:"ask"`
Asker string `json:"asker"`
At time.Time `json:"at"`
// the node that took it, as in the subject
Node string `json:"node"`
}
// BuildAnswer is a type of the contract.
type BuildAnswer struct {
Artifacts []BuiltArtifact `json:"artifacts"`
Imports []string `json:"imports,omitempty"`
// the digest of the artifact this node kept for the artifact store's holder instead of storing it through the seat oci-artifact-registry (the verb kept-artifact serves it); the keeping node is the step's own; absent when every artifact was stored
Kept string `json:"kept,omitempty"`
OutOfStep []string `json:"out-of-step,omitempty"`
Toolchain *ToolchainUsed `json:"toolchain,omitempty"`
}
// BuiltArtifactResolvedItem is a type of the contract.
type BuiltArtifactResolvedItem struct {
// sha256: of the package's bytes as the build fetched them
Digest string `json:"digest"`
Package string `json:"package"`
Version string `json:"version"`
}
// BuiltArtifact is one artifact a build made: its digest and the reference it was published under.
type BuiltArtifact struct {
Artifact string `json:"artifact"`
Digest string `json:"digest"`
Reference string `json:"reference,omitempty"`
// one per mesh package the build resolved (the catalog graph entry's packages, the edges of kind 1)
Resolved []BuiltArtifactResolvedItem `json:"resolved,omitempty"`
}
// Capacity is how many steps the node runs at once.
type Capacity struct {
// when (RFC 3339 time)
At *time.Time `json:"at,omitempty"`
BuildHours string `json:"build-hours,omitempty"`
BuildHoursFault string `json:"build-hours-fault,omitempty"`
ByCpu int64 `json:"by-cpu,omitempty"`
Configured int64 `json:"configured"`
ConfiguredFrom string `json:"configured-from,omitempty"`
CoresPerStep float64 `json:"cores-per-step,omitempty"`
Effective int64 `json:"effective"`
Ineligible string `json:"ineligible,omitempty"`
OutsideHours bool `json:"outside-hours,omitempty"`
QuotaCores float64 `json:"quota-cores,omitempty"`
QuotaFrom string `json:"quota-from,omitempty"`
// the layout version
V int64 `json:"v,omitempty"`
Why string `json:"why"`
}
// CheckAnswer is a type of the contract.
type CheckAnswer struct {
Fetch FetchAnswer `json:"fetch"`
Levels []LevelAnswer `json:"levels,omitempty"`
}
// ComposeAnswer is a type of the contract.
type ComposeAnswer struct {
Built bool `json:"built"`
Key string `json:"key,omitempty"`
// the compose-candidate verdict
Verdict any `json:"verdict,omitempty"`
}
// DetectedStep is a type of the contract.
type DetectedStep struct {
// the packages the step runs, by the language's convention
Packages []string `json:"packages,omitempty"`
Step string `json:"step"`
}
// The values of DetectedStep's step.
const (
DetectedStepStepLint = "lint"
DetectedStepStepUnit = "unit"
DetectedStepStepIntegration = "integration"
)
// DetectedSteps is the steps detected for one artifact at its newest build-input fingerprint, replaced when a newer fingerprint is detected and by steps with again (design 47 G section 326).
type DetectedSteps struct {
At *time.Time `json:"at,omitempty"`
Fingerprint string `json:"fingerprint"`
Steps []DetectedStep `json:"steps"`
V int64 `json:"v"`
}
// Drop is an ask a caller no longer waits for.
type Drop struct {
// when (RFC 3339 time)
At *time.Time `json:"at,omitempty"`
By string `json:"by,omitempty"`
// the layout version
V int64 `json:"v,omitempty"`
Why string `json:"why"`
}
// FetchBesideItem is a type of the contract.
type FetchBesideItem struct {
Commit string `json:"commit"`
Repository string `json:"repository"`
}
// FetchBuildsItem is a type of the contract.
type FetchBuildsItem struct {
Artifact string `json:"artifact"`
// the member's build digest, sha256:
Digest string `json:"digest"`
Module string `json:"module"`
// the name in its ecosystem (the Go module path, the npm name)
Package string `json:"package"`
}
// Fetch is what a build module's fetch tool is asked: the repository and the full commit, the pull request's ref when only its head carries the commit, the trunk commit to merge onto for a merge preview, the module's directory and named paths, the mesh packages to build against, the group's TypeScript packages, and the sibling repositories placed beside.
type Fetch struct {
// the trunk commit a merge preview merges onto
Base string `json:"base,omitempty"`
// the sibling repositories placed beside the fetched tree
Beside []FetchBesideItem `json:"beside,omitempty"`
// a group run's package members, each by its build's digest: the build module reads each from the artifact store at artifact-store://<module>/<artifact>/blobs/<digest>, checks the bytes against the digest and lays them as the group package; a package named here is named in neither packages nor group-packages
Builds []FetchBuildsItem `json:"builds,omitempty"`
// the full commit
Commit string `json:"commit"`
// the module's directory in the repository ("." for its root), with paths
Dir string `json:"dir,omitempty"`
// a group's check: the TypeScript packages the group's members change, each a package of a member at its commit with its directory there; the build module packs each and places it by its package.json name in every module of the tree that names it, in place of the registry's (design 47 G A-284, A-285)
GroupPackages []FetchPackage `json:"group-packages,omitempty"`
// the version (a full commit) of each mesh package to build against, by its module path
Packages map[string]string `json:"packages,omitempty"`
// the paths the module names, relative to dir
Paths []string `json:"paths,omitempty"`
// the pull request's ref, when only its head carries the commit
Ref string `json:"ref,omitempty"`
// <owner>/<name>
Repository string `json:"repository"`
}
// FetchAnswer is what a build module's fetch tool answers, whole: the workspace it made, the commit in it, the module directories found; and, when the call gave a base, the merge preview (the trunk commit, the merge commit, the files that conflict, the paths the merge changes, the compiled programs among them, the tree of each module directory). A head that does not merge cleanly is an answer, not an error: merge is empty and conflicts names the files. The Go module adds the sibling repositories placed and the package versions taken; the TypeScript module the directories installed and refused and the group's package.
type FetchAnswer struct {
Base string `json:"base,omitempty"`
Beside []PlacedBeside `json:"beside,omitempty"`
Changed []string `json:"changed,omitempty"`
Commit string `json:"commit"`
Conflicts []string `json:"conflicts,omitempty"`
Group string `json:"group,omitempty"`
Installed []string `json:"installed,omitempty"`
Merge string `json:"merge,omitempty"`
Modules []string `json:"modules"`
Packages []TakenVersion `json:"packages,omitempty"`
Programs []Program `json:"programs,omitempty"`
Refused []FetchRefusal `json:"refused,omitempty"`
Trees map[string]ModuleTree `json:"trees,omitempty"`
Workspace string `json:"workspace"`
}
// FetchPackage is one TypeScript package of a group's member: the member's repository, the commit packed (the member's head), the pull request's ref when only its head carries it, and the package's directory in the member (empty for the member's root).
type FetchPackage struct {
// the full commit
Commit string `json:"commit"`
// the package's directory in the member, empty for the member's root
Path string `json:"path,omitempty"`
// the pull request's ref, when only its head carries the commit
Ref string `json:"ref,omitempty"`
// <owner>/<name>
Repository string `json:"repository"`
}
// FetchRefusal is a TypeScript module whose packages the fetch did not install, with why.
type FetchRefusal struct {
Module string `json:"module"`
Reason string `json:"reason"`
}
// KeptResult is a package's passing result the runner keeps, by the digest of what its tests read (ADR 0666 section 8): the step runs no package whose digest and level it names.
type KeptResult struct {
// sha256:<hex> of what the package's tests read
Digest string `json:"digest"`
// unit or integration
Level string `json:"level"`
Package string `json:"package"`
// the pipeline whose step kept it
Pipeline string `json:"pipeline,omitempty"`
Toolchain *ToolchainUsed `json:"toolchain,omitempty"`
}
// LevelAnswerDigestNeedsItem is a type of the contract.
type LevelAnswerDigestNeedsItem struct {
Needs []string `json:"needs,omitempty"`
Package string `json:"package,omitempty"`
}
// LevelAnswerDigestPackagesItem is a type of the contract.
type LevelAnswerDigestPackagesItem struct {
Digest string `json:"digest"`
Package string `json:"package"`
}
// LevelAnswerDigest is a type of the contract.
type LevelAnswerDigest struct {
Beside []string `json:"beside,omitempty"`
JudgedBy string `json:"judged_by,omitempty"`
Level string `json:"level,omitempty"`
Needs []LevelAnswerDigestNeedsItem `json:"needs,omitempty"`
Packages []LevelAnswerDigestPackagesItem `json:"packages,omitempty"`
WithoutTests []string `json:"without_tests,omitempty"`
}
// LevelAnswerKeptItem is a type of the contract.
type LevelAnswerKeptItem struct {
Digest string `json:"digest,omitempty"`
Package string `json:"package,omitempty"`
Tests int64 `json:"tests,omitempty"`
}
// LevelAnswerUnmetItem is a type of the contract.
type LevelAnswerUnmetItem struct {
Needs []string `json:"needs,omitempty"`
Package string `json:"package,omitempty"`
}
// LevelAnswer is one level of a check ask: the digest's answer, the kept verdicts taken, one test result per test step run, and the packages the node could not test.
type LevelAnswer struct {
Digest *LevelAnswerDigest `json:"digest,omitempty"`
Judged string `json:"judged,omitempty"`
Kept []LevelAnswerKeptItem `json:"kept,omitempty"`
Level string `json:"level"`
Tests []any `json:"tests,omitempty"`
Unmet []LevelAnswerUnmetItem `json:"unmet,omitempty"`
}
// ModuleTree is the tree of one module directory in a merge preview: its git tree, the digest of its manifest, the lock files' digests and the digests of the named paths.
type ModuleTree struct {
Locks map[string]string `json:"locks,omitempty"`
Manifest string `json:"manifest"`
// no longer filled (ADR 0593 section 2); kept so a preview written before still reads
Packages []string `json:"packages,omitempty"`
Paths map[string]string `json:"paths,omitempty"`
Tree string `json:"tree"`
}
// Pause is whether the node takes no new ask.
type Pause struct {
// when (RFC 3339 time)
At *time.Time `json:"at,omitempty"`
By string `json:"by,omitempty"`
Paused bool `json:"paused"`
// the layout version
V int64 `json:"v,omitempty"`
}
// PlacedBeside is a sibling repository placed as a plain directory under the workspace's beside directory.
type PlacedBeside struct {
Commit string `json:"commit"`
Dir string `json:"dir"`
Repository string `json:"repository"`
}
// Program is a changed file that is a compiled program (issue 1577): its path, its executable format, and the commit of the branch that added it when the merge's tree no longer holds it.
type Program struct {
Commit string `json:"commit,omitempty"`
// ELF, Mach-O or PE
Kind string `json:"kind"`
Path string `json:"path"`
}
// RunAnswer is what a run ask's step answers: whether this run built the program or took the one kept under its key, the key, the program's exit, the last line of its standard output and the first of its standard error.
type RunAnswer struct {
Built bool `json:"built"`
Exit int64 `json:"exit"`
Key string `json:"key"`
// raw when it is JSON, else a JSON string
Output any `json:"output,omitempty"`
Said string `json:"said,omitempty"`
}
// RunHead is one commit a run's program reads.
type RunHead struct {
Commit string `json:"commit"`
Repository string `json:"repository"`
}
// RunInput is a run's input by reference: the seat verb the asker serves it on (seat:<seat>.<verb>), the sha256 of its bytes and its size, at most 256 KiB.
type RunInput struct {
// 64 lowercase hex digits
Digest string `json:"digest"`
// bytes
Size int64 `json:"size"`
Verb string `json:"verb"`
}
// RunJob is a run ask's job: where its program is built, the heads it reads (each laid read-only at its repository's path), its input by reference, its arguments and what it is for.
type RunJob struct {
// the program's arguments, each a word or a flag
Args []string `json:"args,omitempty"`
// the commits the program reads, a repository at most once
Heads []RunHead `json:"heads"`
Input RunInput `json:"input"`
Program RunProgram `json:"program"`
// what the run is for, for a reader of the ask
Reader string `json:"reader,omitempty"`
}
// RunProgram is where a run's program is built: the repository and full commit fetched, the Go module's directory in it and the program's import path.
type RunProgram struct {
Commit string `json:"commit"`
Dir string `json:"dir"`
Package string `json:"package"`
Repository string `json:"repository"`
}
// Step is one step a build module runs on a node.
type Step struct {
// when the bus gives the ask again, for the state again (RFC 3339 time)
AgainAt *time.Time `json:"again-at,omitempty"`
// when (RFC 3339 time)
Ended *time.Time `json:"ended,omitempty"`
ID string `json:"id"`
Node string `json:"node"`
// the name of the object in the build module's outputs store that holds the step's answer when the step's value would be over what the steps state holds (design 47 G A-290): a check's whole answer, its result then empty; a run's output, its result the run's answer without it. Read through the verb output
OutputObject string `json:"output-object,omitempty"`
Owner string `json:"owner,omitempty"`
// true when the step ended on a fault that passes (a transport fault), so a failed end after the last run says so
Passing bool `json:"passing,omitempty"`
Phase string `json:"phase,omitempty"`
// when (RFC 3339 time)
PhaseAt *time.Time `json:"phase-at,omitempty"`
Reason string `json:"reason,omitempty"`
Result *StepResult `json:"result,omitempty"`
// which run of the ask this is, counted by the bus's delivery count (1 for the first)
Run int64 `json:"run,omitempty"`
// when (RFC 3339 time)
Started time.Time `json:"started"`
// running, again (ended on a transport fault, to be given again by the bus after again-at), passed, failed, refused or dropped (ended by the verb drop, its cause the reason)
State string `json:"state"`
Tool string `json:"tool"`
// the layout version
V int64 `json:"v,omitempty"`
What string `json:"what,omitempty"`
}
// StepAskBuild is a type of the contract.
type StepAskBuild struct {
Artifacts []AskArtifact `json:"artifacts"`
Fetch *Fetch `json:"fetch,omitempty"`
Fp string `json:"fp,omitempty"`
Module string `json:"module"`
Path string `json:"path,omitempty"`
Publish bool `json:"publish,omitempty"`
Toolchain *ToolchainUsed `json:"toolchain,omitempty"`
}
// StepAskCheck is a type of the contract.
type StepAskCheck struct {
Fetch Fetch `json:"fetch"`
Kept bool `json:"kept,omitempty"`
Levels []string `json:"levels"`
// the node names the check's tests run against
NodeNames []string `json:"node-names,omitempty"`
Packages []string `json:"packages,omitempty"`
Run string `json:"run,omitempty"`
Runner string `json:"runner,omitempty"`
RunnerWhen string `json:"runner_when,omitempty"`
// the toolchain the checker agreed for the language (ADR 0584 clause 2): a node on another declines the check
Toolchain *ToolchainUsed `json:"toolchain,omitempty"`
}
// StepAskCompose is a type of the contract.
type StepAskCompose struct {
Dir string `json:"dir"`
Fetch Fetch `json:"fetch"`
Package string `json:"package"`
Reader string `json:"reader,omitempty"`
// the compose-candidate request, in one of two forms: the request as a JSON object, or, for one near the bus's message limit, a JSON string "gzip+base64:" followed by the base64 of the request object gzip-compressed; a holder that does not know the packed form refuses it, naming that it holds no request object
Request any `json:"request"`
}
// StepAsk is one ask of a build module.
type StepAsk struct {
Asker string `json:"asker"`
// when (RFC 3339 time)
At *time.Time `json:"at,omitempty"`
Build *StepAskBuild `json:"build,omitempty"`
Check *StepAskCheck `json:"check,omitempty"`
Compose *StepAskCompose `json:"compose,omitempty"`
ID string `json:"id"`
// build, check, compose or step
Kind string `json:"kind"`
// go, typescript or image
Language string `json:"language"`
Needs []string `json:"needs,omitempty"`
// package to the tagged version a build pins
Packages map[string]string `json:"packages,omitempty"`
// a run: a program built from a change and run in the build seat's sandbox over the heads, its input asked of a verb of the asker's seat; the Go seat's check stream alone carries it, as a compose
Run *RunJob `json:"run,omitempty"`
// a pipeline step: lint, unit tests or integration tests of one artifact at one commit, sent by the runner as the accepted kind step (design 47 *The steps and who serves them*)
Step *StepRun `json:"step,omitempty"`
// the layout version
V int64 `json:"v,omitempty"`
// the version MAJOR.MINOR.PATCH the builder reserved for the build, passed to it as MESH_VERSION; empty for a build that reserves none, which stamps none (design 47 G section 573)
Version string `json:"version,omitempty"`
}
// StepEnded is an ask's end, said by the build seat's holder on the node that ran it, whatever its asker (design 47 G section 602): a pipeline step's end names the pipeline, the commit and the fingerprint it was asked at, which the runner takes only from that holder's account (ADR 0666 sections 7, 21); the end of any other ask names its asker, the ask, the node, the outcome and when, and neither commit nor fingerprint (design 47 G section 548).
type StepEnded struct {
Artifact string `json:"artifact,omitempty"`
// the ask's id, by which a reader takes only its own asks
Ask string `json:"ask"`
// who asked it
Asker string `json:"asker"`
// when it ended (RFC 3339 time)
At time.Time `json:"at"`
// for a rerun, the caller the runtime proved
By string `json:"by,omitempty"`
// the packages not run because the ask's kept results held them
Carried []KeptResult `json:"carried,omitempty"`
Commit string `json:"commit,omitempty"`
Ended *time.Time `json:"ended,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
// the ask's id
ID string `json:"id"`
// the packages that passed at their digest, for the runner to keep
Kept []KeptResult `json:"kept,omitempty"`
Module string `json:"module,omitempty"`
// the node that ran it, as in the subject
Node string `json:"node"`
// never passed for a step that ran nothing
Outcome string `json:"outcome"`
// the run's answer (its program's standard output's last line) when it fits the event (design 47 G A-254)
Output string `json:"output,omitempty"`
// the name of the object that holds the run's answer, kept by the build seat's holder, when the answer is over what the event carries (design 47 G A-254); read through the verb output
OutputObject string `json:"output-object,omitempty"`
Pipeline string `json:"pipeline,omitempty"`
Rerun bool `json:"rerun,omitempty"`
// why it failed or could not run, naming the part not heard
Said string `json:"said,omitempty"`
Started *time.Time `json:"started,omitempty"`
Step string `json:"step,omitempty"`
Tests *TestCounts `json:"tests,omitempty"`
// the layout version
V int64 `json:"v,omitempty"`
}
// The values of StepEnded's outcome.
const (
StepEndedOutcomePassed = "passed"
StepEndedOutcomeFailed = "failed"
StepEndedOutcomeNothingToRun = "nothing to run"
StepEndedOutcomeCouldNotRun = "could not run"
)
// The values of StepEnded's step.
const (
StepEndedStepLint = "lint"
StepEndedStepUnit = "unit"
StepEndedStepIntegration = "integration"
)
// StepProgress is a running ask's progress, said once a minute while the holder runs it (design 47 G section 496).
type StepProgress struct {
Ask string `json:"ask"`
Asker string `json:"asker"`
At time.Time `json:"at"`
Phase string `json:"phase"`
}
// The values of StepProgress's phase.
const (
StepProgressPhaseFetch = "fetch"
StepProgressPhaseBuild = "build"
StepProgressPhaseRun = "run"
StepProgressPhaseReport = "report"
)
// StepResult is what a step answered, by the kind of ask: a build's artifacts, toolchain, imports, out-of-step modules and the artifact it kept; a check's fetch and levels; a compose's built, key and verdict; a run's built, key, exit, output and said; a declined ask's declined, needs and lacks. The fields of the kinds do not meet, so one layout holds the five.
type StepResult struct {
Artifacts []BuiltArtifact `json:"artifacts,omitempty"`
Built bool `json:"built,omitempty"`
// the holder declined the ask: its node lacks what the ask needs
Declined bool `json:"declined,omitempty"`
// a run's program's exit status
Exit int64 `json:"exit,omitempty"`
Fetch *FetchAnswer `json:"fetch,omitempty"`
Imports []string `json:"imports,omitempty"`
// the digest of the artifact this node kept for the artifact store's holder instead of storing it through the seat oci-artifact-registry (the verb kept-artifact serves it); the keeping node is the step's own; absent when every artifact was stored
Kept string `json:"kept,omitempty"`
Key string `json:"key,omitempty"`
// what the holder's node lacks of it
Lacks []string `json:"lacks,omitempty"`
Levels []LevelAnswer `json:"levels,omitempty"`
// what the declined ask needs
Needs []string `json:"needs,omitempty"`
OutOfStep []string `json:"out-of-step,omitempty"`
// a run's program's last line of standard output: raw when it is JSON, else a JSON string
Output any `json:"output,omitempty"`
// a run's program's first line of standard error, or why the step could not run it
Said string `json:"said,omitempty"`
Toolchain *ToolchainUsed `json:"toolchain,omitempty"`
// the compose-candidate verdict (the composer's own layout)
Verdict any `json:"verdict,omitempty"`
}
// StepRun is one pipeline step of one artifact at one commit (ADR 0666 sections 7, 8, 17): the step a build seat runs in its sandbox from the change's own heads, the names the lint step needs and the kept results it may skip.
type StepRun struct {
// the artifact reference, <module>:<artifact>
Artifact string `json:"artifact"`
// the watched branch, or the branch of a run on request
Branch string `json:"branch,omitempty"`
// for a rerun, the caller the runtime proved
By string `json:"by,omitempty"`
// the commit the step runs at
Commit string `json:"commit"`
// where the step reads the change's heads
Fetch Fetch `json:"fetch"`
// the artifact's build-input fingerprint at the commit
Fingerprint string `json:"fingerprint"`
// the kept results of the artifact's packages, by digest and level (design 47 *Carried, not run*)
Kept []KeptResult `json:"kept,omitempty"`
Module string `json:"module"`
// the runner's pipeline key, <branch>.<revision>.<module>, a branch escaped as a key's name is
Pipeline string `json:"pipeline"`
// the step is asked again by the runner's rerun
Rerun bool `json:"rerun,omitempty"`
// the source revision of the watched branch the pipeline runs for; absent for a run on request
Revision int64 `json:"revision,omitempty"`
// the pipeline step
Step string `json:"step"`
Toolchain *ToolchainUsed `json:"toolchain,omitempty"`
}
// The values of StepRun's step.
const (
StepRunStepLint = "lint"
StepRunStepUnit = "unit"
StepRunStepIntegration = "integration"
)
// TakenVersion is of a directory whose go.mod requires an asked mesh package, the version it is built against: the asked one, or go.mod's when it names a newer one, said.
type TakenVersion struct {
Asked string `json:"asked"`
Built string `json:"built"`
Dir string `json:"dir"`
Named string `json:"named"`
Package string `json:"package"`
Said string `json:"said,omitempty"`
Sum string `json:"sum,omitempty"`
}
// TestCounts is how many tests a step ran and carried, per level (ADR 0666 section 8: the pipeline's end names any repository or catalog module over the test budget).
type TestCounts struct {
Integration int64 `json:"integration,omitempty"`
Unit int64 `json:"unit,omitempty"`
}
// Toolchain is the toolchain a node reports.
type Toolchain struct {
// when (RFC 3339 time)
At *time.Time `json:"at,omitempty"`
// the sha256: digest of the language's toolchain program as the build module runs it: the program of the module that provides that language's toolchain, never the build module's own (design 47 G section 472)
Digest string `json:"digest,omitempty"`
// go or typescript
Language string `json:"language"`
Recipe string `json:"recipe"`
// the layout version
V int64 `json:"v,omitempty"`
Version string `json:"version"`
}
// ToolchainReported is a node's toolchain of a language, said at the build module's start and each time its toolchains key of the language changes (design 47 G section 492).
type ToolchainReported struct {
// the digest of the program of the provision the build module requires for that language's toolchain, never the build module's own
Digest string `json:"digest"`
Language string `json:"language"`
Node string `json:"node"`
Recipe string `json:"recipe"`
Version string `json:"version"`
}
// ToolchainUsed is the toolchain a build was made with: the language, the installed version and the build module's recipe.
type ToolchainUsed struct {
// the building node's digest of its toolchain program (kind 3's entry), never the build module's own program
Digest string `json:"digest,omitempty"`
Language string `json:"language"`
Recipe string `json:"recipe"`
Version string `json:"version"`
}
// CurrentInput is what current takes.
type CurrentInput struct {
}
// CurrentAnswer is what current answers.
type CurrentAnswer = map[string]any
// PauseInput is what pause takes.
type PauseInput struct {
}
// PauseAnswer is what pause answers.
type PauseAnswer = map[string]any
// ResumeInput is what resume takes.
type ResumeInput struct {
}
// ResumeAnswer is what resume answers.
type ResumeAnswer = map[string]any
// DropInput is what drop takes.
type DropInput struct {
// who drops it
By string `json:"by,omitempty"`
// the ask's id
ID string `json:"id"`
// why the caller no longer waits
Why string `json:"why"`
}
// DropAnswer is what drop answers.
type DropAnswer = map[string]any
// KeptArtifactInput is what kept-artifact takes.
type KeptArtifactInput struct {
// the artifact's sha256, 64 lowercase hex digits, as the builder's done key names it
Digest string `json:"digest"`
// its build's fingerprint
Fp string `json:"fp"`
// the module, the holder of oci-artifact-registry
Module string `json:"module"`
}
// KeptArtifactAnswer is what kept-artifact answers.
type KeptArtifactAnswer struct {
// the digest of the bytes kept
Digest string `json:"digest,omitempty"`
// why it could not answer
Error string `json:"error,omitempty"`
// the fingerprint asked
Fp string `json:"fp"`
// the module asked
Module string `json:"module"`
// the object's name in it: the digest
Object string `json:"object,omitempty"`
// why nothing is answered: the module claims no oci-artifact-registry, this node keeps no build of it at that fingerprint (never kept, or swept), or keeps it under another digest
Refused string `json:"refused,omitempty"`
// bytes
Size int64 `json:"size,omitempty"`
// the object store the bytes are in, the build module's kept builds, as its manifest's objects names it on the bus
Store string `json:"store,omitempty"`
// the refusal in words, naming the module
Words string `json:"words,omitempty"`
}
// The values of KeptArtifactAnswer's refused.
const (
KeptArtifactAnswerRefusedClaimsNoOciArtifactRegistry = "claims no oci-artifact-registry"
KeptArtifactAnswerRefusedNotKept = "not kept"
KeptArtifactAnswerRefusedDigestDiffers = "digest differs"
)
// StepsInput is what steps takes.
type StepsInput struct {
// find them anew, not from the kept answer
Again bool `json:"again,omitempty"`
// the key of detected-steps, <module>.<artifact>
Artifact string `json:"artifact"`
// delete the artifact's kept key instead of detecting; needs why
Drop bool `json:"drop,omitempty"`
Fetch *Fetch `json:"fetch,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
Module string `json:"module"`
// with drop, why: a non-empty text, written in the hand-act log with the caller the bus proved
Why string `json:"why,omitempty"`
}
// StepsAnswer is what steps answers.
type StepsAnswer struct {
Artifact string `json:"artifact,omitempty"`
// the artifact whose key a drop deleted
Dropped string `json:"dropped,omitempty"`
// why a drop deleted nothing, naming the hand-act log when it refused
Error string `json:"error,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
// answered from the kept answer
Kept bool `json:"kept,omitempty"`
Steps []DetectedStep `json:"steps,omitempty"`
}
// OutputInput is what output takes.
type OutputInput struct {
// the ask's id, the `output-object` of its step key or its step-ended naming it
Ask string `json:"ask"`
// 128 random bits the caller chooses: the subject token of this send's chunks and acknowledgements
Call string `json:"call"`
}
// OutputAnswer is what output answers.
type OutputAnswer struct {
// the ask's id
Ask string `json:"ask"`
// how many chunks are sent; 0 when this node keeps no answer of that ask
Chunks int64 `json:"chunks"`
}
// DeliveryAccept is the body of delivery.
type DeliveryAccept = StepAsk
// CheckAccept is the body of check.
type CheckAccept = StepAsk
// CheckStepAccept is the body of check.step.
type CheckStepAccept = StepAsk
// DeliveryStepAccept is the body of delivery.step.
type DeliveryStepAccept = StepAsk
// RecheckAccept is the body of recheck.
type RecheckAccept = StepAsk
// StepEndedEvent is the body of the event step-ended.
type StepEndedEvent = StepEnded
// ToolchainReportedEvent is the body of the event toolchain-reported.
type ToolchainReportedEvent = ToolchainReported
// StepProgressEvent is the body of the event step-progress.
type StepProgressEvent = StepProgress
// AskTakenEvent is the body of the event ask-taken.
type AskTakenEvent = AskTaken
// StepsByAskerNodeIDValue is one value of the state steps under the key <asker>.<node>.<id>.
type StepsByAskerNodeIDValue = Step
// StepsByNodeIDValue is one value of the state steps under the key <node>.<id>.
type StepsByNodeIDValue = Step
// PausesByPausedNodeValue is one value of the state pauses under the key paused.<node>.
type PausesByPausedNodeValue = Pause
// PausesByDroppedIDValue is one value of the state pauses under the key dropped.<id>.
type PausesByDroppedIDValue = Drop
// PausesByCapacityNodeValue is one value of the state pauses under the key capacity.<node>.
type PausesByCapacityNodeValue = Capacity
// ToolchainsByNodeLanguageValue is one value of the state toolchains under the key <node>.<language>.
type ToolchainsByNodeLanguageValue = Toolchain
// DetectedStepsByModuleArtifactValue is one value of the state detected-steps under the key <module>.<artifact>.
type DetectedStepsByModuleArtifactValue = DetectedSteps