The seat verb try gains members (ADR 0637 section 6); the try's group name and the missing-preview reason are one definition of mesh-delivery-sdk (ADR 0637 section 8). Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
451 lines
16 KiB
Go
451 lines
16 KiB
Go
// Code generated by seatgen from the seat definitions; DO NOT EDIT.
|
|
|
|
// Package meshdeliverychecker is 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).
|
|
package meshdeliverychecker
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"errors"
|
|
"strings"
|
|
)
|
|
|
|
// Seat is the seat's name.
|
|
const Seat = "mesh-delivery-checker"
|
|
|
|
const (
|
|
VerbTry = "try"
|
|
VerbTryRead = "try-read"
|
|
VerbTryEnd = "try-end"
|
|
)
|
|
|
|
// Verbs is every verb the seat serves, in its definition's order: a new copy each call.
|
|
func Verbs() []string {
|
|
return []string{VerbTry, VerbTryRead, VerbTryEnd}
|
|
}
|
|
|
|
// The holder's own events, listed beside the seat and published under the holder's subjects (ADR 0620 §2).
|
|
const (
|
|
HolderEventVerdict = "verdict"
|
|
HolderEventTagWanted = "tag-wanted"
|
|
HolderEventPreviewWritten = "preview.written"
|
|
)
|
|
|
|
// HolderSubjectVerdict is where the holder publishes verdict, kept in checker.asks.
|
|
func HolderSubjectVerdict(holder string) string { return "mesh.stream." + holder + ".event.verdict" }
|
|
|
|
// HolderSubjectTagWanted is where the holder publishes tag-wanted, kept in checker.asks.
|
|
func HolderSubjectTagWanted(holder string) string {
|
|
return "mesh.stream." + holder + ".event.tag-wanted"
|
|
}
|
|
|
|
// HolderSubjectPreviewWritten is where the holder publishes preview.written, kept in checks.
|
|
func HolderSubjectPreviewWritten(holder string) string {
|
|
return "mesh.stream." + holder + ".event.preview.written"
|
|
}
|
|
|
|
const (
|
|
StateVerdicts = "verdicts"
|
|
StateKept = "kept"
|
|
StateOwed = "owed"
|
|
StatePreviews = "previews"
|
|
)
|
|
|
|
// VerdictsByGroupHeadsKey is the key of one value of the state verdicts under the form "<group>.<heads>".
|
|
func VerdictsByGroupHeadsKey(group, heads string) string { return group + "." + heads }
|
|
|
|
// ParseVerdictsByGroupHeadsKey reads the parts of a key of the form "<group>.<heads>", in the order of the form; the last result is false for a key of another form.
|
|
func ParseVerdictsByGroupHeadsKey(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
|
|
}
|
|
|
|
// DecodeVerdictsByGroupHeadsValue reads one value of the state verdicts under the form "<group>.<heads>", refusing a field VerdictsByGroupHeadsValue does not know and any text after the value.
|
|
func DecodeVerdictsByGroupHeadsValue(raw []byte) (VerdictsByGroupHeadsValue, error) {
|
|
var v VerdictsByGroupHeadsValue
|
|
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
|
|
}
|
|
|
|
// KeptByLevelDigestKey is the key of one value of the state kept under the form "<level>.<digest>".
|
|
func KeptByLevelDigestKey(level, digest string) string { return level + "." + digest }
|
|
|
|
// ParseKeptByLevelDigestKey reads the parts of a key of the form "<level>.<digest>", in the order of the form; the last result is false for a key of another form.
|
|
func ParseKeptByLevelDigestKey(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
|
|
}
|
|
|
|
// DecodeKeptByLevelDigestValue reads one value of the state kept under the form "<level>.<digest>", refusing a field KeptByLevelDigestValue does not know and any text after the value.
|
|
func DecodeKeptByLevelDigestValue(raw []byte) (KeptByLevelDigestValue, error) {
|
|
var v KeptByLevelDigestValue
|
|
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
|
|
}
|
|
|
|
// OwedByRepositoryNumberHeadActKey is the key of one value of the state owed under the form "<repository>.<number>.<head>.<act>".
|
|
func OwedByRepositoryNumberHeadActKey(repository, number, head, act string) string {
|
|
return repository + "." + number + "." + head + "." + act
|
|
}
|
|
|
|
// ParseOwedByRepositoryNumberHeadActKey reads the parts of a key of the form "<repository>.<number>.<head>.<act>", in the order of the form; the last result is false for a key of another form.
|
|
func ParseOwedByRepositoryNumberHeadActKey(key string) (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
|
|
v4, after4, found4 := strings.Cut(rest, ".")
|
|
if !found4 || v4 == "" {
|
|
return "", "", "", "", false
|
|
}
|
|
rest = after4
|
|
if rest == "" {
|
|
return "", "", "", "", false
|
|
}
|
|
v6 := rest
|
|
rest = ""
|
|
if rest != "" {
|
|
return "", "", "", "", false
|
|
}
|
|
return v0, v2, v4, v6, true
|
|
}
|
|
|
|
// DecodeOwedByRepositoryNumberHeadActValue reads one value of the state owed under the form "<repository>.<number>.<head>.<act>", refusing a field OwedByRepositoryNumberHeadActValue does not know and any text after the value.
|
|
func DecodeOwedByRepositoryNumberHeadActValue(raw []byte) (OwedByRepositoryNumberHeadActValue, error) {
|
|
var v OwedByRepositoryNumberHeadActValue
|
|
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
|
|
}
|
|
|
|
// PreviewsByRepositoryHeadTrunkKey is the key of one value of the state previews under the form "<repository>.<head>.<trunk>".
|
|
func PreviewsByRepositoryHeadTrunkKey(repository, head, trunk string) string {
|
|
return repository + "." + head + "." + trunk
|
|
}
|
|
|
|
// ParsePreviewsByRepositoryHeadTrunkKey reads the parts of a key of the form "<repository>.<head>.<trunk>", in the order of the form; the last result is false for a key of another form.
|
|
func ParsePreviewsByRepositoryHeadTrunkKey(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
|
|
}
|
|
|
|
// DecodePreviewsByRepositoryHeadTrunkValue reads one value of the state previews under the form "<repository>.<head>.<trunk>", refusing a field PreviewsByRepositoryHeadTrunkValue does not know and any text after the value.
|
|
func DecodePreviewsByRepositoryHeadTrunkValue(raw []byte) (PreviewsByRepositoryHeadTrunkValue, error) {
|
|
var v PreviewsByRepositoryHeadTrunkValue
|
|
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
|
|
}
|
|
|
|
// TryInputMembersItem is a type of the contract.
|
|
type TryInputMembersItem struct {
|
|
// the full commit to try, 40 or 64 hex digits
|
|
Head string `json:"head"`
|
|
// <owner>/<name>
|
|
Repository string `json:"repository"`
|
|
// the trunk commit to merge it onto, or the trunk's branch for its head now; the trunk's head when absent
|
|
Trunk string `json:"trunk,omitempty"`
|
|
}
|
|
|
|
// TryInput is what try takes.
|
|
type TryInput struct {
|
|
// the full commit to try, 40 or 64 hex digits, for a try of one member (instead of members)
|
|
Head string `json:"head,omitempty"`
|
|
// unit or integration: only this level; both when absent
|
|
Level string `json:"level,omitempty"`
|
|
// 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 `json:"members,omitempty"`
|
|
// <owner>/<name>, for a try of one member (instead of members)
|
|
Repository string `json:"repository,omitempty"`
|
|
// a go test -run pattern: only those tests run, and nothing is kept
|
|
Tests string `json:"tests,omitempty"`
|
|
// the trunk commit to merge it onto, or the trunk's branch for its head now; the trunk's head when absent
|
|
Trunk string `json:"trunk,omitempty"`
|
|
}
|
|
|
|
// TryAnswer is what try answers.
|
|
type TryAnswer struct {
|
|
// the try's id
|
|
ID string `json:"id"`
|
|
// its state
|
|
State string `json:"state,omitempty"`
|
|
}
|
|
|
|
// TryReadInput is what try-read takes.
|
|
type TryReadInput struct {
|
|
// the try's id, try-<digits>
|
|
ID string `json:"id"`
|
|
}
|
|
|
|
// TryReadAnswer is what try-read answers.
|
|
type TryReadAnswer = map[string]any
|
|
|
|
// TryEndInput is what try-end takes.
|
|
type TryEndInput struct {
|
|
// the try's id, try-<digits>
|
|
ID string `json:"id"`
|
|
// why it is ended, in words
|
|
Why string `json:"why"`
|
|
}
|
|
|
|
// TryEndAnswer is what try-end answers.
|
|
type TryEndAnswer struct {
|
|
// it is ended
|
|
Ended bool `json:"ended"`
|
|
// the try
|
|
ID string `json:"id"`
|
|
}
|
|
|
|
// VerdictHolderEventSeriesItem is a type of the contract.
|
|
type VerdictHolderEventSeriesItem struct {
|
|
// its artifact, or the package's ecosystem name as the module's packages name it
|
|
Artifact string `json:"artifact"`
|
|
// the series on trunk
|
|
From string `json:"from"`
|
|
// the module whose artifact's series changes
|
|
Module string `json:"module"`
|
|
// the series the checked head gives it
|
|
To string `json:"to"`
|
|
}
|
|
|
|
// VerdictHolderEvent is the body of the holder's event verdict.
|
|
type VerdictHolderEvent struct {
|
|
// the commit checked
|
|
Head string `json:"head"`
|
|
// the generated files out of step with their seat definitions, each path (design 26)
|
|
OutOfStep []string `json:"out-of-step,omitempty"`
|
|
// the pull request's number, for a pull request's check
|
|
Pull int64 `json:"pull,omitempty"`
|
|
// owner/repo
|
|
Repository string `json:"repository"`
|
|
// 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 `json:"series,omitempty"`
|
|
// pass or fail
|
|
Verdict string `json:"verdict"`
|
|
}
|
|
|
|
// TagWantedHolderEvent is the body of the holder's event tag-wanted.
|
|
type TagWantedHolderEvent struct {
|
|
// the pull request's branch: its tag is removed when the branch ends
|
|
Branch string `json:"branch"`
|
|
// its head
|
|
Head string `json:"head"`
|
|
// the group member
|
|
Module string `json:"module"`
|
|
// the package it declares
|
|
Package string `json:"package"`
|
|
// the pull request
|
|
Pull int64 `json:"pull,omitempty"`
|
|
// owner/repo
|
|
Repository string `json:"repository"`
|
|
// the tag wanted
|
|
Tag string `json:"tag,omitempty"`
|
|
}
|
|
|
|
// VerdictsByGroupHeadsValueComposition is a type of the contract.
|
|
type VerdictsByGroupHeadsValueComposition struct {
|
|
Fpset string `json:"fpset,omitempty"`
|
|
Machines []string `json:"machines,omitempty"`
|
|
Sdk string `json:"sdk,omitempty"`
|
|
// not-run, pass or fail
|
|
State string `json:"state"`
|
|
Words string `json:"words,omitempty"`
|
|
}
|
|
|
|
// VerdictsByGroupHeadsValueFailed is a type of the contract.
|
|
type VerdictsByGroupHeadsValueFailed struct {
|
|
Machine string `json:"machine,omitempty"`
|
|
Test string `json:"test,omitempty"`
|
|
Words string `json:"words,omitempty"`
|
|
}
|
|
|
|
// VerdictsByGroupHeadsValueFailuresItem is a type of the contract.
|
|
type VerdictsByGroupHeadsValueFailuresItem struct {
|
|
Machine string `json:"machine,omitempty"`
|
|
Test string `json:"test,omitempty"`
|
|
Words string `json:"words,omitempty"`
|
|
}
|
|
|
|
// VerdictsByGroupHeadsValueLevelsValue is a type of the contract.
|
|
type VerdictsByGroupHeadsValueLevelsValue struct {
|
|
Kept int64 `json:"kept"`
|
|
Run int64 `json:"run"`
|
|
Skipped int64 `json:"skipped,omitempty"`
|
|
}
|
|
|
|
// VerdictsByGroupHeadsValueSeriesItem is a type of the contract.
|
|
type VerdictsByGroupHeadsValueSeriesItem struct {
|
|
Artifact string `json:"artifact"`
|
|
From string `json:"from"`
|
|
Module string `json:"module"`
|
|
To string `json:"to"`
|
|
}
|
|
|
|
// VerdictsByGroupHeadsValueTook is milliseconds.
|
|
type VerdictsByGroupHeadsValueTook struct {
|
|
Clone int64 `json:"clone,omitempty"`
|
|
Composition int64 `json:"composition,omitempty"`
|
|
IntegrationRun int64 `json:"integration-run,omitempty"`
|
|
IntegrationSetup int64 `json:"integration-setup,omitempty"`
|
|
Lint int64 `json:"lint,omitempty"`
|
|
Queue int64 `json:"queue,omitempty"`
|
|
Unit int64 `json:"unit,omitempty"`
|
|
}
|
|
|
|
// VerdictsByGroupHeadsValue is one value of the state verdicts under the key <group>.<heads>.
|
|
type VerdictsByGroupHeadsValue struct {
|
|
Beside map[string]string `json:"beside,omitempty"`
|
|
CarriedFrom map[string]string `json:"carried-from,omitempty"`
|
|
Composition *VerdictsByGroupHeadsValueComposition `json:"composition,omitempty"`
|
|
Failed *VerdictsByGroupHeadsValueFailed `json:"failed,omitempty"`
|
|
Failures []VerdictsByGroupHeadsValueFailuresItem `json:"failures,omitempty"`
|
|
Group string `json:"group"`
|
|
// 12 hex digits
|
|
Heads string `json:"heads"`
|
|
// by level, unit or integration
|
|
Levels map[string]VerdictsByGroupHeadsValueLevelsValue `json:"levels,omitempty"`
|
|
Machines []string `json:"machines,omitempty"`
|
|
OverBound []string `json:"over-bound,omitempty"`
|
|
Sdk string `json:"sdk,omitempty"`
|
|
Series []VerdictsByGroupHeadsValueSeriesItem `json:"series,omitempty"`
|
|
// running, pass or fail
|
|
State string `json:"state"`
|
|
// milliseconds
|
|
Took *VerdictsByGroupHeadsValueTook `json:"took,omitempty"`
|
|
// repository to the trunk head merged onto
|
|
Trunk map[string]string `json:"trunk,omitempty"`
|
|
// the layout version
|
|
V int64 `json:"v,omitempty"`
|
|
}
|
|
|
|
// KeptByLevelDigestValue is one value of the state kept under the key <level>.<digest>.
|
|
type KeptByLevelDigestValue struct {
|
|
// when (RFC 3339 time)
|
|
At string `json:"at,omitempty"`
|
|
Level string `json:"level"`
|
|
Package string `json:"package"`
|
|
Repository string `json:"repository"`
|
|
// pass: a failure is never kept
|
|
State string `json:"state"`
|
|
Tests int64 `json:"tests,omitempty"`
|
|
Took int64 `json:"took,omitempty"`
|
|
Toolchain string `json:"toolchain,omitempty"`
|
|
// the layout version
|
|
V int64 `json:"v,omitempty"`
|
|
}
|
|
|
|
// OwedByRepositoryNumberHeadActValue is one value of the state owed under the key <repository>.<number>.<head>.<act>.
|
|
type OwedByRepositoryNumberHeadActValue struct {
|
|
// status=<context>, view, note or comment.<seq>
|
|
Act string `json:"act"`
|
|
Context string `json:"context,omitempty"`
|
|
Ref string `json:"ref,omitempty"`
|
|
State string `json:"state,omitempty"`
|
|
Target string `json:"target,omitempty"`
|
|
Text string `json:"text,omitempty"`
|
|
// the layout version
|
|
V int64 `json:"v,omitempty"`
|
|
}
|
|
|
|
// PreviewsByRepositoryHeadTrunkValueModulesValue is a type of the contract.
|
|
type PreviewsByRepositoryHeadTrunkValueModulesValue struct {
|
|
Locks map[string]string `json:"locks,omitempty"`
|
|
// manifest digest
|
|
Manifest string `json:"manifest"`
|
|
Packages []string `json:"packages,omitempty"`
|
|
Paths map[string]string `json:"paths,omitempty"`
|
|
Tree string `json:"tree"`
|
|
}
|
|
|
|
// PreviewsByRepositoryHeadTrunkValue is one value of the state previews under the key <repository>.<head>.<trunk>.
|
|
type PreviewsByRepositoryHeadTrunkValue struct {
|
|
// files in conflict
|
|
Conflicts []string `json:"conflicts,omitempty"`
|
|
Head string `json:"head"`
|
|
// the merge commit
|
|
Merge string `json:"merge,omitempty"`
|
|
// by directory
|
|
Modules map[string]PreviewsByRepositoryHeadTrunkValueModulesValue `json:"modules,omitempty"`
|
|
Repository string `json:"repository"`
|
|
Trunk string `json:"trunk"`
|
|
// the layout version
|
|
V int64 `json:"v,omitempty"`
|
|
}
|