BM4b (sdk): an end over the steps state's value is read through the verb answer

A step's end is an event, not a verb's answer, so an end over what the steps
state's value or step-ended carries has a reader of its own: keepOver keeps it
in the steps objects as answer.<ask>, the step key and step-ended carry
answer-object in place of output-object, and the build seats gain the read
verb answer (ask and call, marked chunks); output stays the run text's reader.
Step.Whole and StepEnded.ReadOutput read through answer.

Builds: design 47 H2 §791; H-A-412 (2) and its addendum
This commit is contained in:
2026-11-22 01:08:58 +01:00
parent 8617b521a6
commit fad9f059ee
40 changed files with 442 additions and 171 deletions
@@ -23,7 +23,7 @@ const FormBuildStep = 2
// whose fields changed while its forms did not (design 47 H2 §780).
const (
generatedForms = "1 build-step:2"
generatedFieldsDigest = "AskArtifact=35eb85c27e97 AskTaken=8c917075eed4 AskTakenEvent=e4fc9b81e066 BuiltArtifact=b5fcef7a8b58 BuiltArtifactResolvedItem=3bcbbcfd1a1f Capacity=b40cca7ccdfa CheckAccept=ef89c6962ae4 CheckRunAccept=ef89c6962ae4 CheckStepAccept=ef89c6962ae4 CurrentAnswer=e39824e012cb CurrentAsk=ac167e5ee11f DeliveryAccept=ef89c6962ae4 DeliveryStepAccept=ef89c6962ae4 DetectedStep=a6fcd7d0eca4 DetectedSteps=05198185c776 DetectedStepsByModuleArtifactValue=cb35b5775cc6 Drop=fb4637978e86 DropAnswer=7538f2f5e68e FailingTest=f3fb3f1a3ca8 Fetch=6e12677bbc2c FetchAnswer=46fc3d5bd7ee FetchBesideItem=774b4bf88ba4 FetchBuildsItem=aee5adc97246 FetchPackage=20d1668a0eee FetchRefusal=de1518848b4c InstallAsk=9f965aa5b30b KeptArtifactAnswer=706729f8ccb9 KeptResult=8657683cdcd7 LevelAnswer=143c69c28a6a LevelAnswerDigest=d54b7fd7b1da LevelAnswerDigestNeedsItem=946b37d1d4a1 LevelAnswerDigestPackagesItem=a7d30558470d LevelAnswerKeptItem=85d3c2f78632 LevelAnswerUnmetItem=946b37d1d4a1 ModuleTree=00bb59e9f262 NotRun=d322fb1eb153 OutputAnswer=97ba4bd92bf9 Pause=d6521e0cdd1e PauseAnswer=7538f2f5e68e PausesByCapacityNodeValue=5392cf505c80 PausesByDroppedIDValue=0e15ac9cacbd PausesByPausedNodeValue=d111aad0f0cf PlacedBeside=53479337ff18 Program=b48ae74f34e0 RecheckAccept=ef89c6962ae4 ResumeAnswer=7538f2f5e68e RunHead=774b4bf88ba4 RunInput=3dc41505a4b7 RunJob=88af2a7f432b RunProgram=6fd636999d54 Step=607e5f1a91cc StepAsk=a22b1f717fc3 StepAskBuild=de784b6c05da StepAskCheck=b77941df6dea StepAskCompose=4c6a08e10231 StepEnded=a49b1cbd0c12 StepEndedEvent=207787118dac StepProgress=d25781cc895a StepProgressEvent=179344ce0ca2 StepResult=67f88be36d0e StepRun=a7a81f25515f StepsAnswer=2c02cac2df23 StepsByAskerNodeIDValue=50ccfd4cebd8 StepsByNodeIDValue=50ccfd4cebd8 TakenVersion=1b8d0547f61e TestCounts=9c1332427159 Toolchain=8ecb7debf9ad ToolchainReported=d26392767c50 ToolchainReportedEvent=fa0a431c9c7b ToolchainUsed=6cc7ccabc9f8 ToolchainsByNodeLanguageValue=f97d1dd27613"
generatedFieldsDigest = "AnswerAnswer=a3b42bd5e791 AskArtifact=35eb85c27e97 AskTaken=8c917075eed4 AskTakenEvent=e4fc9b81e066 BuiltArtifact=b5fcef7a8b58 BuiltArtifactResolvedItem=3bcbbcfd1a1f Capacity=b40cca7ccdfa CheckAccept=ef89c6962ae4 CheckRunAccept=ef89c6962ae4 CheckStepAccept=ef89c6962ae4 CurrentAnswer=e39824e012cb CurrentAsk=ac167e5ee11f DeliveryAccept=ef89c6962ae4 DeliveryStepAccept=ef89c6962ae4 DetectedStep=a6fcd7d0eca4 DetectedSteps=05198185c776 DetectedStepsByModuleArtifactValue=cb35b5775cc6 Drop=fb4637978e86 DropAnswer=7538f2f5e68e FailingTest=f3fb3f1a3ca8 Fetch=6e12677bbc2c FetchAnswer=46fc3d5bd7ee FetchBesideItem=774b4bf88ba4 FetchBuildsItem=aee5adc97246 FetchPackage=20d1668a0eee FetchRefusal=de1518848b4c InstallAsk=9f965aa5b30b KeptArtifactAnswer=706729f8ccb9 KeptResult=8657683cdcd7 LevelAnswer=143c69c28a6a LevelAnswerDigest=d54b7fd7b1da LevelAnswerDigestNeedsItem=946b37d1d4a1 LevelAnswerDigestPackagesItem=a7d30558470d LevelAnswerKeptItem=85d3c2f78632 LevelAnswerUnmetItem=946b37d1d4a1 ModuleTree=00bb59e9f262 NotRun=d322fb1eb153 OutputAnswer=97ba4bd92bf9 Pause=d6521e0cdd1e PauseAnswer=7538f2f5e68e PausesByCapacityNodeValue=5392cf505c80 PausesByDroppedIDValue=0e15ac9cacbd PausesByPausedNodeValue=d111aad0f0cf PlacedBeside=53479337ff18 Program=b48ae74f34e0 RecheckAccept=ef89c6962ae4 ResumeAnswer=7538f2f5e68e RunHead=774b4bf88ba4 RunInput=3dc41505a4b7 RunJob=88af2a7f432b RunProgram=6fd636999d54 Step=75190430d510 StepAsk=a22b1f717fc3 StepAskBuild=de784b6c05da StepAskCheck=b77941df6dea StepAskCompose=4c6a08e10231 StepEnded=14b484f0ffa2 StepEndedEvent=207787118dac StepProgress=d25781cc895a StepProgressEvent=179344ce0ca2 StepResult=67f88be36d0e StepRun=a7a81f25515f StepsAnswer=2c02cac2df23 StepsByAskerNodeIDValue=50ccfd4cebd8 StepsByNodeIDValue=50ccfd4cebd8 TakenVersion=1b8d0547f61e TestCounts=9c1332427159 Toolchain=8ecb7debf9ad ToolchainReported=d26392767c50 ToolchainReportedEvent=fa0a431c9c7b ToolchainUsed=6cc7ccabc9f8 ToolchainsByNodeLanguageValue=f97d1dd27613"
)
const (
@@ -33,6 +33,7 @@ const (
VerbDrop = "drop"
VerbKeptArtifact = "kept-artifact"
VerbSteps = "steps"
VerbAnswer = "answer"
VerbOutput = "output"
)
@@ -54,7 +55,7 @@ const (
// 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}
return []string{VerbCurrent, VerbPause, VerbResume, VerbDrop, VerbKeptArtifact, VerbSteps, VerbAnswer, VerbOutput}
}
// Events is every event published on the seat's subject: a new copy each call.
@@ -729,15 +730,15 @@ type RunProgram struct {
type Step struct {
// when the bus gives the ask again, for the state again (RFC 3339 time)
AgainAt *time.Time `json:"again-at,omitempty"`
// the name of the object in the build module's steps objects that holds the step's answer when the step's value would be over what the steps state holds (design 47 G A-290, H2 H-A-412): 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 answer
AnswerObject string `json:"answer-object,omitempty"`
// when (RFC 3339 time)
Ended *time.Time `json:"ended,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,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"`
Form int64 `json:"form,omitempty"`
ID string `json:"id"`
Node string `json:"node"`
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"`
@@ -823,6 +824,8 @@ type StepAsk struct {
// 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 {
// the name of the object that holds the run's answer, kept by the build seat's holder in its steps objects, when the answer is over what the event carries (design 47 G A-254, H2 H-A-412); read through the verb answer
AnswerObject string `json:"answer-object,omitempty"`
// for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2))
Archive string `json:"archive,omitempty"`
Artifact string `json:"artifact,omitempty"`
@@ -853,11 +856,9 @@ type StepEnded struct {
// 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"`
Output string `json:"output,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"`
@@ -1149,6 +1150,24 @@ type StepsAnswer struct {
Steps []DetectedStep `json:"steps,omitempty"`
}
// AnswerInput is what answer takes.
type AnswerInput struct {
// the ask's id, the `answer-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"`
}
// AnswerAnswer is what answer answers.
type AnswerAnswer 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"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
}
// OutputInput is what output takes.
type OutputInput struct {
// the ask's id
@@ -1276,6 +1295,15 @@ func DecodeStepsAnswer(raw []byte) (StepsAnswer, int, error) {
return v, formRead(raw), nil
}
// DecodeAnswerAnswer reads a AnswerAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeAnswerAnswer(raw []byte) (AnswerAnswer, int, error) {
var v AnswerAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeOutputAnswer reads a OutputAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeOutputAnswer(raw []byte) (OutputAnswer, int, error) {
var v OutputAnswer
@@ -19,7 +19,7 @@ func TestFixtures(t *testing.T) {
}{
{name: "a unit step ended passed on its node, with its counts and what it carried", subject: "mesh.seat.node-build-go.event.step-ended.anchor", given: "{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5e\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"carried\":[{\"digest\":\"sha256:bbbb\",\"level\":\"unit\",\"package\":\"./modules/nats/a\"}],\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"ended\":\"2026-11-10T10:02:00Z\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5e\",\"kept\":[{\"digest\":\"sha256:cccc\",\"level\":\"unit\",\"package\":\"./modules/nats/b\"}],\"module\":\"nats\",\"node\":\"anchor\",\"outcome\":\"passed\",\"pipeline\":\"main.12.nats\",\"started\":\"2026-11-10T10:00:00Z\",\"step\":\"unit\",\"tests\":{\"unit\":14},\"v\":1}", wire: "{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5e\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"carried\":[{\"digest\":\"sha256:bbbb\",\"level\":\"unit\",\"package\":\"./modules/nats/a\"}],\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"ended\":\"2026-11-10T10:02:00Z\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5e\",\"kept\":[{\"digest\":\"sha256:cccc\",\"level\":\"unit\",\"package\":\"./modules/nats/b\"}],\"module\":\"nats\",\"node\":\"anchor\",\"outcome\":\"passed\",\"pipeline\":\"main.12.nats\",\"started\":\"2026-11-10T10:00:00Z\",\"step\":\"unit\",\"tests\":{\"unit\":14},\"v\":1}",
decode: func(b []byte) (any, error) { var v StepEndedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-go\\.event\\.step-ended\\.[^.*> ]+$")},
{name: "an integration step that could not run, naming the part not heard", subject: "mesh.seat.node-build-go.event.step-ended.home-server", given: "{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5f\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5f\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"could not run\",\"output-object\":\"mesh-build-go_sent-objects/m2kx9a1b3c4d5f\",\"pipeline\":\"main.12.nats\",\"said\":\"the sandbox could not fetch novox/mesh-sdk\",\"step\":\"integration\",\"v\":1}", wire: "{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5f\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5f\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"could not run\",\"output-object\":\"mesh-build-go_sent-objects/m2kx9a1b3c4d5f\",\"pipeline\":\"main.12.nats\",\"said\":\"the sandbox could not fetch novox/mesh-sdk\",\"step\":\"integration\",\"v\":1}",
{name: "an integration step that could not run, naming the part not heard", subject: "mesh.seat.node-build-go.event.step-ended.home-server", given: "{\"answer-object\":\"answer.m2kx9a1b3c4d5f\",\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5f\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5f\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"could not run\",\"pipeline\":\"main.12.nats\",\"said\":\"the sandbox could not fetch novox/mesh-sdk\",\"step\":\"integration\",\"v\":1}", wire: "{\"answer-object\":\"answer.m2kx9a1b3c4d5f\",\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5f\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5f\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"could not run\",\"pipeline\":\"main.12.nats\",\"said\":\"the sandbox could not fetch novox/mesh-sdk\",\"step\":\"integration\",\"v\":1}",
decode: func(b []byte) (any, error) { var v StepEndedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-go\\.event\\.step-ended\\.[^.*> ]+$")},
{name: "a node's toolchain reported", subject: "mesh.seat.node-build-go.event.toolchain-reported.anchor", given: "{\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"language\":\"go\",\"node\":\"anchor\",\"recipe\":\"1\",\"version\":\"1.26.0\"}", wire: "{\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"language\":\"go\",\"node\":\"anchor\",\"recipe\":\"1\",\"version\":\"1.26.0\"}",
decode: func(b []byte) (any, error) { var v ToolchainReportedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-go\\.event\\.toolchain-reported\\.[^.*> ]+$")},
@@ -97,7 +97,7 @@ func TestFixtures(t *testing.T) {
err := json.Unmarshal(b, &v)
return v, err
}, subjectIs: nil},
{name: "a check's step whose answer is kept as an object (G A-290)", subject: "", given: "{\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"output-object\":\"output.c3d4e5f6a7b8c9\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}", wire: "{\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"output-object\":\"output.c3d4e5f6a7b8c9\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}",
{name: "a check's step whose answer is kept as an object (G A-290)", subject: "", given: "{\"answer-object\":\"answer.c3d4e5f6a7b8c9\",\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}", wire: "{\"answer-object\":\"answer.c3d4e5f6a7b8c9\",\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}",
decode: func(b []byte) (any, error) { var v StepsByNodeIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "drop names the ask and why", subject: "", given: "{\"by\":\"mesh-delivery-builder\",\"id\":\"a1b2\",\"why\":\"a newer fingerprint supersedes it\"}", wire: "{\"by\":\"mesh-delivery-builder\",\"id\":\"a1b2\",\"why\":\"a newer fingerprint supersedes it\"}",
decode: func(b []byte) (any, error) { var v DropInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
@@ -123,6 +123,10 @@ func TestFixtures(t *testing.T) {
decode: func(b []byte) (any, error) { var v StepsAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "steps answers a drop that the hand-act log refused", subject: "", given: "{\"error\":\"the hand-act log refused: nothing was deleted\"}", wire: "{\"error\":\"the hand-act log refused: nothing was deleted\"}",
decode: func(b []byte) (any, error) { var v StepsAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "answer asks a step's kept end by its ask, naming the call of its chunks", subject: "", given: "{\"ask\":\"m2kx9a1b3c4d5f\",\"call\":\"0123456789abcdef0123456789abcdef\"}", wire: "{\"ask\":\"m2kx9a1b3c4d5f\",\"call\":\"0123456789abcdef0123456789abcdef\"}",
decode: func(b []byte) (any, error) { var v AnswerInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "answer answers how many chunks carry the kept end", subject: "", given: "{\"ask\":\"m2kx9a1b3c4d5f\",\"chunks\":3}", wire: "{\"ask\":\"m2kx9a1b3c4d5f\",\"chunks\":3}",
decode: func(b []byte) (any, error) { var v AnswerAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "output asks a step's output by its ask", subject: "", given: "{\"ask\":\"m2kx9a1b3c4d5f\"}", wire: "{\"ask\":\"m2kx9a1b3c4d5f\"}",
decode: func(b []byte) (any, error) { var v OutputInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "output answers the last 64 KB, the size and the failing tests with their words", subject: "", given: "{\"ask\":\"m2kx9a1b3c4d5f\",\"failing\":[{\"test\":\"TestTheBusWhole\",\"words\":\"bus_test.go:41: no responders\"}],\"output\":\"--- FAIL: TestTheBusWhole (0.20s)\\n bus_test.go:41: no responders\\nFAIL\\n\",\"size\":181234}", wire: "{\"ask\":\"m2kx9a1b3c4d5f\",\"failing\":[{\"test\":\"TestTheBusWhole\",\"words\":\"bus_test.go:41: no responders\"}],\"output\":\"--- FAIL: TestTheBusWhole (0.20s)\\n bus_test.go:41: no responders\\nFAIL\\n\",\"size\":181234}",
@@ -23,7 +23,7 @@ const FormBuildStep = 2
// whose fields changed while its forms did not (design 47 H2 §780).
const (
generatedForms = "1 build-step:2"
generatedFieldsDigest = "AskArtifact=35eb85c27e97 AskTaken=8c917075eed4 AskTakenEvent=e4fc9b81e066 BuiltArtifact=b5fcef7a8b58 BuiltArtifactResolvedItem=3bcbbcfd1a1f Capacity=b40cca7ccdfa CheckAccept=ef89c6962ae4 CheckStepAccept=ef89c6962ae4 CurrentAnswer=e39824e012cb CurrentAsk=ac167e5ee11f DeliveryAccept=ef89c6962ae4 DeliveryStepAccept=ef89c6962ae4 DetectedStep=a6fcd7d0eca4 DetectedSteps=05198185c776 DetectedStepsByModuleArtifactValue=cb35b5775cc6 Drop=fb4637978e86 DropAnswer=7538f2f5e68e FailingTest=f3fb3f1a3ca8 Fetch=6e12677bbc2c FetchAnswer=46fc3d5bd7ee FetchBesideItem=774b4bf88ba4 FetchBuildsItem=aee5adc97246 FetchPackage=20d1668a0eee FetchRefusal=de1518848b4c InstallAsk=9f965aa5b30b KeptArtifactAnswer=706729f8ccb9 KeptResult=8657683cdcd7 LevelAnswer=143c69c28a6a LevelAnswerDigest=d54b7fd7b1da LevelAnswerDigestNeedsItem=946b37d1d4a1 LevelAnswerDigestPackagesItem=a7d30558470d LevelAnswerKeptItem=85d3c2f78632 LevelAnswerUnmetItem=946b37d1d4a1 ModuleTree=00bb59e9f262 NotRun=d322fb1eb153 OutputAnswer=97ba4bd92bf9 Pause=d6521e0cdd1e PauseAnswer=7538f2f5e68e PausesByCapacityNodeValue=5392cf505c80 PausesByDroppedIDValue=0e15ac9cacbd PausesByPausedNodeValue=d111aad0f0cf PlacedBeside=53479337ff18 Program=b48ae74f34e0 RecheckAccept=ef89c6962ae4 ResumeAnswer=7538f2f5e68e RunHead=774b4bf88ba4 RunInput=3dc41505a4b7 RunJob=88af2a7f432b RunProgram=6fd636999d54 Step=607e5f1a91cc StepAsk=a22b1f717fc3 StepAskBuild=de784b6c05da StepAskCheck=b77941df6dea StepAskCompose=4c6a08e10231 StepEnded=a49b1cbd0c12 StepEndedEvent=207787118dac StepProgress=d25781cc895a StepProgressEvent=179344ce0ca2 StepResult=67f88be36d0e StepRun=a7a81f25515f StepsAnswer=2c02cac2df23 StepsByAskerNodeIDValue=50ccfd4cebd8 StepsByNodeIDValue=50ccfd4cebd8 TakenVersion=1b8d0547f61e TestCounts=9c1332427159 Toolchain=8ecb7debf9ad ToolchainReported=d26392767c50 ToolchainReportedEvent=fa0a431c9c7b ToolchainUsed=6cc7ccabc9f8 ToolchainsByNodeLanguageValue=f97d1dd27613"
generatedFieldsDigest = "AnswerAnswer=a3b42bd5e791 AskArtifact=35eb85c27e97 AskTaken=8c917075eed4 AskTakenEvent=e4fc9b81e066 BuiltArtifact=b5fcef7a8b58 BuiltArtifactResolvedItem=3bcbbcfd1a1f Capacity=b40cca7ccdfa CheckAccept=ef89c6962ae4 CheckStepAccept=ef89c6962ae4 CurrentAnswer=e39824e012cb CurrentAsk=ac167e5ee11f DeliveryAccept=ef89c6962ae4 DeliveryStepAccept=ef89c6962ae4 DetectedStep=a6fcd7d0eca4 DetectedSteps=05198185c776 DetectedStepsByModuleArtifactValue=cb35b5775cc6 Drop=fb4637978e86 DropAnswer=7538f2f5e68e FailingTest=f3fb3f1a3ca8 Fetch=6e12677bbc2c FetchAnswer=46fc3d5bd7ee FetchBesideItem=774b4bf88ba4 FetchBuildsItem=aee5adc97246 FetchPackage=20d1668a0eee FetchRefusal=de1518848b4c InstallAsk=9f965aa5b30b KeptArtifactAnswer=706729f8ccb9 KeptResult=8657683cdcd7 LevelAnswer=143c69c28a6a LevelAnswerDigest=d54b7fd7b1da LevelAnswerDigestNeedsItem=946b37d1d4a1 LevelAnswerDigestPackagesItem=a7d30558470d LevelAnswerKeptItem=85d3c2f78632 LevelAnswerUnmetItem=946b37d1d4a1 ModuleTree=00bb59e9f262 NotRun=d322fb1eb153 OutputAnswer=97ba4bd92bf9 Pause=d6521e0cdd1e PauseAnswer=7538f2f5e68e PausesByCapacityNodeValue=5392cf505c80 PausesByDroppedIDValue=0e15ac9cacbd PausesByPausedNodeValue=d111aad0f0cf PlacedBeside=53479337ff18 Program=b48ae74f34e0 RecheckAccept=ef89c6962ae4 ResumeAnswer=7538f2f5e68e RunHead=774b4bf88ba4 RunInput=3dc41505a4b7 RunJob=88af2a7f432b RunProgram=6fd636999d54 Step=75190430d510 StepAsk=a22b1f717fc3 StepAskBuild=de784b6c05da StepAskCheck=b77941df6dea StepAskCompose=4c6a08e10231 StepEnded=14b484f0ffa2 StepEndedEvent=207787118dac StepProgress=d25781cc895a StepProgressEvent=179344ce0ca2 StepResult=67f88be36d0e StepRun=a7a81f25515f StepsAnswer=2c02cac2df23 StepsByAskerNodeIDValue=50ccfd4cebd8 StepsByNodeIDValue=50ccfd4cebd8 TakenVersion=1b8d0547f61e TestCounts=9c1332427159 Toolchain=8ecb7debf9ad ToolchainReported=d26392767c50 ToolchainReportedEvent=fa0a431c9c7b ToolchainUsed=6cc7ccabc9f8 ToolchainsByNodeLanguageValue=f97d1dd27613"
)
const (
@@ -33,6 +33,7 @@ const (
VerbDrop = "drop"
VerbKeptArtifact = "kept-artifact"
VerbSteps = "steps"
VerbAnswer = "answer"
VerbOutput = "output"
)
@@ -53,7 +54,7 @@ const (
// 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}
return []string{VerbCurrent, VerbPause, VerbResume, VerbDrop, VerbKeptArtifact, VerbSteps, VerbAnswer, VerbOutput}
}
// Events is every event published on the seat's subject: a new copy each call.
@@ -727,15 +728,15 @@ type RunProgram struct {
type Step struct {
// when the bus gives the ask again, for the state again (RFC 3339 time)
AgainAt *time.Time `json:"again-at,omitempty"`
// the name of the object in the build module's steps objects that holds the step's answer when the step's value would be over what the steps state holds (design 47 G A-290, H2 H-A-412): 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 answer
AnswerObject string `json:"answer-object,omitempty"`
// when (RFC 3339 time)
Ended *time.Time `json:"ended,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,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"`
Form int64 `json:"form,omitempty"`
ID string `json:"id"`
Node string `json:"node"`
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"`
@@ -821,6 +822,8 @@ type StepAsk struct {
// 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 {
// the name of the object that holds the run's answer, kept by the build seat's holder in its steps objects, when the answer is over what the event carries (design 47 G A-254, H2 H-A-412); read through the verb answer
AnswerObject string `json:"answer-object,omitempty"`
// for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2))
Archive string `json:"archive,omitempty"`
Artifact string `json:"artifact,omitempty"`
@@ -851,11 +854,9 @@ type StepEnded struct {
// 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"`
Output string `json:"output,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"`
@@ -1147,6 +1148,24 @@ type StepsAnswer struct {
Steps []DetectedStep `json:"steps,omitempty"`
}
// AnswerInput is what answer takes.
type AnswerInput struct {
// the ask's id, the `answer-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"`
}
// AnswerAnswer is what answer answers.
type AnswerAnswer 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"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
}
// OutputInput is what output takes.
type OutputInput struct {
// the ask's id
@@ -1271,6 +1290,15 @@ func DecodeStepsAnswer(raw []byte) (StepsAnswer, int, error) {
return v, formRead(raw), nil
}
// DecodeAnswerAnswer reads a AnswerAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeAnswerAnswer(raw []byte) (AnswerAnswer, int, error) {
var v AnswerAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeOutputAnswer reads a OutputAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeOutputAnswer(raw []byte) (OutputAnswer, int, error) {
var v OutputAnswer
@@ -19,7 +19,7 @@ func TestFixtures(t *testing.T) {
}{
{name: "a lint step ended passed on its node", subject: "mesh.seat.node-build-image.event.step-ended.anchor", given: "{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5e\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"ended\":\"2026-11-10T10:02:00Z\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5e\",\"module\":\"nats\",\"node\":\"anchor\",\"outcome\":\"passed\",\"pipeline\":\"main.12.nats\",\"started\":\"2026-11-10T10:00:00Z\",\"step\":\"lint\",\"v\":1}", wire: "{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5e\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"ended\":\"2026-11-10T10:02:00Z\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5e\",\"module\":\"nats\",\"node\":\"anchor\",\"outcome\":\"passed\",\"pipeline\":\"main.12.nats\",\"started\":\"2026-11-10T10:00:00Z\",\"step\":\"lint\",\"v\":1}",
decode: func(b []byte) (any, error) { var v StepEndedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-image\\.event\\.step-ended\\.[^.*> ]+$")},
{name: "a lint step that could not run, naming the part not heard", subject: "mesh.seat.node-build-image.event.step-ended.home-server", given: "{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5f\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5f\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"could not run\",\"output-object\":\"mesh-build-go_sent-objects/m2kx9a1b3c4d5f\",\"pipeline\":\"main.12.nats\",\"said\":\"the sandbox could not fetch novox/mesh-sdk\",\"step\":\"lint\",\"v\":1}", wire: "{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5f\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5f\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"could not run\",\"output-object\":\"mesh-build-go_sent-objects/m2kx9a1b3c4d5f\",\"pipeline\":\"main.12.nats\",\"said\":\"the sandbox could not fetch novox/mesh-sdk\",\"step\":\"lint\",\"v\":1}",
{name: "a lint step that could not run, naming the part not heard", subject: "mesh.seat.node-build-image.event.step-ended.home-server", given: "{\"answer-object\":\"answer.m2kx9a1b3c4d5f\",\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5f\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5f\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"could not run\",\"pipeline\":\"main.12.nats\",\"said\":\"the sandbox could not fetch novox/mesh-sdk\",\"step\":\"lint\",\"v\":1}", wire: "{\"answer-object\":\"answer.m2kx9a1b3c4d5f\",\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5f\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5f\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"could not run\",\"pipeline\":\"main.12.nats\",\"said\":\"the sandbox could not fetch novox/mesh-sdk\",\"step\":\"lint\",\"v\":1}",
decode: func(b []byte) (any, error) { var v StepEndedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-image\\.event\\.step-ended\\.[^.*> ]+$")},
{name: "a node's toolchain reported", subject: "mesh.seat.node-build-image.event.toolchain-reported.anchor", given: "{\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"language\":\"go\",\"node\":\"anchor\",\"recipe\":\"1\",\"version\":\"1.26.0\"}", wire: "{\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"language\":\"go\",\"node\":\"anchor\",\"recipe\":\"1\",\"version\":\"1.26.0\"}",
decode: func(b []byte) (any, error) { var v ToolchainReportedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-image\\.event\\.toolchain-reported\\.[^.*> ]+$")},
@@ -79,7 +79,7 @@ func TestFixtures(t *testing.T) {
err := json.Unmarshal(b, &v)
return v, err
}, subjectIs: nil},
{name: "a check's step whose answer is kept as an object (G A-290)", subject: "", given: "{\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"output-object\":\"output.c3d4e5f6a7b8c9\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}", wire: "{\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"output-object\":\"output.c3d4e5f6a7b8c9\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}",
{name: "a check's step whose answer is kept as an object (G A-290)", subject: "", given: "{\"answer-object\":\"answer.c3d4e5f6a7b8c9\",\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}", wire: "{\"answer-object\":\"answer.c3d4e5f6a7b8c9\",\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}",
decode: func(b []byte) (any, error) { var v StepsByNodeIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "drop names the ask and why", subject: "", given: "{\"by\":\"mesh-delivery-builder\",\"id\":\"a1b2\",\"why\":\"a newer fingerprint supersedes it\"}", wire: "{\"by\":\"mesh-delivery-builder\",\"id\":\"a1b2\",\"why\":\"a newer fingerprint supersedes it\"}",
decode: func(b []byte) (any, error) { var v DropInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
@@ -105,6 +105,10 @@ func TestFixtures(t *testing.T) {
decode: func(b []byte) (any, error) { var v StepsAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "steps answers a drop that the hand-act log refused", subject: "", given: "{\"error\":\"the hand-act log refused: nothing was deleted\"}", wire: "{\"error\":\"the hand-act log refused: nothing was deleted\"}",
decode: func(b []byte) (any, error) { var v StepsAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "answer asks a step's kept end by its ask, naming the call of its chunks", subject: "", given: "{\"ask\":\"m2kx9a1b3c4d5f\",\"call\":\"0123456789abcdef0123456789abcdef\"}", wire: "{\"ask\":\"m2kx9a1b3c4d5f\",\"call\":\"0123456789abcdef0123456789abcdef\"}",
decode: func(b []byte) (any, error) { var v AnswerInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "answer answers how many chunks carry the kept end", subject: "", given: "{\"ask\":\"m2kx9a1b3c4d5f\",\"chunks\":3}", wire: "{\"ask\":\"m2kx9a1b3c4d5f\",\"chunks\":3}",
decode: func(b []byte) (any, error) { var v AnswerAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "output asks a step's output by its ask", subject: "", given: "{\"ask\":\"m2kx9a1b3c4d5f\"}", wire: "{\"ask\":\"m2kx9a1b3c4d5f\"}",
decode: func(b []byte) (any, error) { var v OutputInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "output answers the last 64 KB, the size and the failing tests with their words", subject: "", given: "{\"ask\":\"m2kx9a1b3c4d5f\",\"failing\":[{\"test\":\"TestTheBusWhole\",\"words\":\"bus_test.go:41: no responders\"}],\"output\":\"--- FAIL: TestTheBusWhole (0.20s)\\n bus_test.go:41: no responders\\nFAIL\\n\",\"size\":181234}", wire: "{\"ask\":\"m2kx9a1b3c4d5f\",\"failing\":[{\"test\":\"TestTheBusWhole\",\"words\":\"bus_test.go:41: no responders\"}],\"output\":\"--- FAIL: TestTheBusWhole (0.20s)\\n bus_test.go:41: no responders\\nFAIL\\n\",\"size\":181234}",
@@ -23,7 +23,7 @@ const FormBuildStep = 2
// whose fields changed while its forms did not (design 47 H2 §780).
const (
generatedForms = "1 build-step:2"
generatedFieldsDigest = "AskArtifact=35eb85c27e97 AskTaken=8c917075eed4 AskTakenEvent=e4fc9b81e066 BuiltArtifact=b5fcef7a8b58 BuiltArtifactResolvedItem=3bcbbcfd1a1f Capacity=b40cca7ccdfa CheckAccept=ef89c6962ae4 CheckStepAccept=ef89c6962ae4 CurrentAnswer=e39824e012cb CurrentAsk=ac167e5ee11f DeliveryAccept=ef89c6962ae4 DeliveryStepAccept=ef89c6962ae4 DetectedStep=a6fcd7d0eca4 DetectedSteps=05198185c776 DetectedStepsByModuleArtifactValue=cb35b5775cc6 Drop=fb4637978e86 DropAnswer=7538f2f5e68e FailingTest=f3fb3f1a3ca8 Fetch=6e12677bbc2c FetchAnswer=46fc3d5bd7ee FetchBesideItem=774b4bf88ba4 FetchBuildsItem=aee5adc97246 FetchPackage=20d1668a0eee FetchRefusal=de1518848b4c InstallAccept=ef89c6962ae4 InstallAsk=9f965aa5b30b KeptArtifactAnswer=706729f8ccb9 KeptResult=8657683cdcd7 LevelAnswer=143c69c28a6a LevelAnswerDigest=d54b7fd7b1da LevelAnswerDigestNeedsItem=946b37d1d4a1 LevelAnswerDigestPackagesItem=a7d30558470d LevelAnswerKeptItem=85d3c2f78632 LevelAnswerUnmetItem=946b37d1d4a1 ModuleTree=00bb59e9f262 NotRun=d322fb1eb153 OutputAnswer=97ba4bd92bf9 Pause=d6521e0cdd1e PauseAnswer=7538f2f5e68e PausesByCapacityNodeValue=5392cf505c80 PausesByDroppedIDValue=0e15ac9cacbd PausesByPausedNodeValue=d111aad0f0cf PlacedBeside=53479337ff18 Program=b48ae74f34e0 RecheckAccept=ef89c6962ae4 ResumeAnswer=7538f2f5e68e RunHead=774b4bf88ba4 RunInput=3dc41505a4b7 RunJob=88af2a7f432b RunProgram=6fd636999d54 Step=607e5f1a91cc StepAsk=a22b1f717fc3 StepAskBuild=de784b6c05da StepAskCheck=b77941df6dea StepAskCompose=4c6a08e10231 StepEnded=a49b1cbd0c12 StepEndedEvent=207787118dac StepProgress=d25781cc895a StepProgressEvent=179344ce0ca2 StepResult=67f88be36d0e StepRun=a7a81f25515f StepsAnswer=2c02cac2df23 StepsByAskerNodeIDValue=50ccfd4cebd8 StepsByNodeIDValue=50ccfd4cebd8 TakenVersion=1b8d0547f61e TestCounts=9c1332427159 Toolchain=8ecb7debf9ad ToolchainReported=d26392767c50 ToolchainReportedEvent=fa0a431c9c7b ToolchainUsed=6cc7ccabc9f8 ToolchainsByNodeLanguageValue=f97d1dd27613"
generatedFieldsDigest = "AnswerAnswer=a3b42bd5e791 AskArtifact=35eb85c27e97 AskTaken=8c917075eed4 AskTakenEvent=e4fc9b81e066 BuiltArtifact=b5fcef7a8b58 BuiltArtifactResolvedItem=3bcbbcfd1a1f Capacity=b40cca7ccdfa CheckAccept=ef89c6962ae4 CheckStepAccept=ef89c6962ae4 CurrentAnswer=e39824e012cb CurrentAsk=ac167e5ee11f DeliveryAccept=ef89c6962ae4 DeliveryStepAccept=ef89c6962ae4 DetectedStep=a6fcd7d0eca4 DetectedSteps=05198185c776 DetectedStepsByModuleArtifactValue=cb35b5775cc6 Drop=fb4637978e86 DropAnswer=7538f2f5e68e FailingTest=f3fb3f1a3ca8 Fetch=6e12677bbc2c FetchAnswer=46fc3d5bd7ee FetchBesideItem=774b4bf88ba4 FetchBuildsItem=aee5adc97246 FetchPackage=20d1668a0eee FetchRefusal=de1518848b4c InstallAccept=ef89c6962ae4 InstallAsk=9f965aa5b30b KeptArtifactAnswer=706729f8ccb9 KeptResult=8657683cdcd7 LevelAnswer=143c69c28a6a LevelAnswerDigest=d54b7fd7b1da LevelAnswerDigestNeedsItem=946b37d1d4a1 LevelAnswerDigestPackagesItem=a7d30558470d LevelAnswerKeptItem=85d3c2f78632 LevelAnswerUnmetItem=946b37d1d4a1 ModuleTree=00bb59e9f262 NotRun=d322fb1eb153 OutputAnswer=97ba4bd92bf9 Pause=d6521e0cdd1e PauseAnswer=7538f2f5e68e PausesByCapacityNodeValue=5392cf505c80 PausesByDroppedIDValue=0e15ac9cacbd PausesByPausedNodeValue=d111aad0f0cf PlacedBeside=53479337ff18 Program=b48ae74f34e0 RecheckAccept=ef89c6962ae4 ResumeAnswer=7538f2f5e68e RunHead=774b4bf88ba4 RunInput=3dc41505a4b7 RunJob=88af2a7f432b RunProgram=6fd636999d54 Step=75190430d510 StepAsk=a22b1f717fc3 StepAskBuild=de784b6c05da StepAskCheck=b77941df6dea StepAskCompose=4c6a08e10231 StepEnded=14b484f0ffa2 StepEndedEvent=207787118dac StepProgress=d25781cc895a StepProgressEvent=179344ce0ca2 StepResult=67f88be36d0e StepRun=a7a81f25515f StepsAnswer=2c02cac2df23 StepsByAskerNodeIDValue=50ccfd4cebd8 StepsByNodeIDValue=50ccfd4cebd8 TakenVersion=1b8d0547f61e TestCounts=9c1332427159 Toolchain=8ecb7debf9ad ToolchainReported=d26392767c50 ToolchainReportedEvent=fa0a431c9c7b ToolchainUsed=6cc7ccabc9f8 ToolchainsByNodeLanguageValue=f97d1dd27613"
)
const (
@@ -33,6 +33,7 @@ const (
VerbDrop = "drop"
VerbKeptArtifact = "kept-artifact"
VerbSteps = "steps"
VerbAnswer = "answer"
VerbOutput = "output"
)
@@ -54,7 +55,7 @@ const (
// 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}
return []string{VerbCurrent, VerbPause, VerbResume, VerbDrop, VerbKeptArtifact, VerbSteps, VerbAnswer, VerbOutput}
}
// Events is every event published on the seat's subject: a new copy each call.
@@ -731,15 +732,15 @@ type RunProgram struct {
type Step struct {
// when the bus gives the ask again, for the state again (RFC 3339 time)
AgainAt *time.Time `json:"again-at,omitempty"`
// the name of the object in the build module's steps objects that holds the step's answer when the step's value would be over what the steps state holds (design 47 G A-290, H2 H-A-412): 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 answer
AnswerObject string `json:"answer-object,omitempty"`
// when (RFC 3339 time)
Ended *time.Time `json:"ended,omitempty"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,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"`
Form int64 `json:"form,omitempty"`
ID string `json:"id"`
Node string `json:"node"`
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"`
@@ -825,6 +826,8 @@ type StepAsk struct {
// 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 {
// the name of the object that holds the run's answer, kept by the build seat's holder in its steps objects, when the answer is over what the event carries (design 47 G A-254, H2 H-A-412); read through the verb answer
AnswerObject string `json:"answer-object,omitempty"`
// for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2))
Archive string `json:"archive,omitempty"`
Artifact string `json:"artifact,omitempty"`
@@ -855,11 +858,9 @@ type StepEnded struct {
// 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"`
Output string `json:"output,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"`
@@ -1151,6 +1152,24 @@ type StepsAnswer struct {
Steps []DetectedStep `json:"steps,omitempty"`
}
// AnswerInput is what answer takes.
type AnswerInput struct {
// the ask's id, the `answer-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"`
}
// AnswerAnswer is what answer answers.
type AnswerAnswer 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"`
// is the form of what this value carries, left out while it is 1 (design 47 H2 §780).
Form int64 `json:"form,omitempty"`
}
// OutputInput is what output takes.
type OutputInput struct {
// the ask's id
@@ -1278,6 +1297,15 @@ func DecodeStepsAnswer(raw []byte) (StepsAnswer, int, error) {
return v, formRead(raw), nil
}
// DecodeAnswerAnswer reads a AnswerAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeAnswerAnswer(raw []byte) (AnswerAnswer, int, error) {
var v AnswerAnswer
if err := json.Unmarshal(raw, &v); err != nil {
return v, 0, err
}
return v, formRead(raw), nil
}
// DecodeOutputAnswer reads a OutputAnswer as another part wrote it: a field this reader does not know is left unread, never refused; the form read is answered, 1 when absent (design 47 H2 §780).
func DecodeOutputAnswer(raw []byte) (OutputAnswer, int, error) {
var v OutputAnswer
@@ -19,7 +19,7 @@ func TestFixtures(t *testing.T) {
}{
{name: "a unit step ended passed on its node, with its counts and what it carried", subject: "mesh.seat.node-build-node.event.step-ended.anchor", given: "{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5e\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"carried\":[{\"digest\":\"sha256:bbbb\",\"level\":\"unit\",\"package\":\"./modules/nats/a\"}],\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"ended\":\"2026-11-10T10:02:00Z\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5e\",\"kept\":[{\"digest\":\"sha256:cccc\",\"level\":\"unit\",\"package\":\"./modules/nats/b\"}],\"module\":\"nats\",\"node\":\"anchor\",\"outcome\":\"passed\",\"pipeline\":\"main.12.nats\",\"started\":\"2026-11-10T10:00:00Z\",\"step\":\"unit\",\"tests\":{\"unit\":14},\"v\":1}", wire: "{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5e\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"carried\":[{\"digest\":\"sha256:bbbb\",\"level\":\"unit\",\"package\":\"./modules/nats/a\"}],\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"ended\":\"2026-11-10T10:02:00Z\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5e\",\"kept\":[{\"digest\":\"sha256:cccc\",\"level\":\"unit\",\"package\":\"./modules/nats/b\"}],\"module\":\"nats\",\"node\":\"anchor\",\"outcome\":\"passed\",\"pipeline\":\"main.12.nats\",\"started\":\"2026-11-10T10:00:00Z\",\"step\":\"unit\",\"tests\":{\"unit\":14},\"v\":1}",
decode: func(b []byte) (any, error) { var v StepEndedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-node\\.event\\.step-ended\\.[^.*> ]+$")},
{name: "an integration step that could not run, naming the part not heard", subject: "mesh.seat.node-build-node.event.step-ended.home-server", given: "{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5f\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5f\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"could not run\",\"output-object\":\"mesh-build-go_sent-objects/m2kx9a1b3c4d5f\",\"pipeline\":\"main.12.nats\",\"said\":\"the sandbox could not fetch novox/mesh-sdk\",\"step\":\"integration\",\"v\":1}", wire: "{\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5f\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5f\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"could not run\",\"output-object\":\"mesh-build-go_sent-objects/m2kx9a1b3c4d5f\",\"pipeline\":\"main.12.nats\",\"said\":\"the sandbox could not fetch novox/mesh-sdk\",\"step\":\"integration\",\"v\":1}",
{name: "an integration step that could not run, naming the part not heard", subject: "mesh.seat.node-build-node.event.step-ended.home-server", given: "{\"answer-object\":\"answer.m2kx9a1b3c4d5f\",\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5f\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5f\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"could not run\",\"pipeline\":\"main.12.nats\",\"said\":\"the sandbox could not fetch novox/mesh-sdk\",\"step\":\"integration\",\"v\":1}", wire: "{\"answer-object\":\"answer.m2kx9a1b3c4d5f\",\"artifact\":\"nats:program\",\"ask\":\"m2kx9a1b3c4d5f\",\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-10T10:02:00Z\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d5f\",\"module\":\"nats\",\"node\":\"home-server\",\"outcome\":\"could not run\",\"pipeline\":\"main.12.nats\",\"said\":\"the sandbox could not fetch novox/mesh-sdk\",\"step\":\"integration\",\"v\":1}",
decode: func(b []byte) (any, error) { var v StepEndedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-node\\.event\\.step-ended\\.[^.*> ]+$")},
{name: "a node's toolchain reported", subject: "mesh.seat.node-build-node.event.toolchain-reported.anchor", given: "{\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"language\":\"go\",\"node\":\"anchor\",\"recipe\":\"1\",\"version\":\"1.26.0\"}", wire: "{\"digest\":\"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"language\":\"go\",\"node\":\"anchor\",\"recipe\":\"1\",\"version\":\"1.26.0\"}",
decode: func(b []byte) (any, error) { var v ToolchainReportedEvent; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-node\\.event\\.toolchain-reported\\.[^.*> ]+$")},
@@ -87,7 +87,7 @@ func TestFixtures(t *testing.T) {
err := json.Unmarshal(b, &v)
return v, err
}, subjectIs: nil},
{name: "a check's step whose answer is kept as an object (G A-290)", subject: "", given: "{\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"output-object\":\"output.c3d4e5f6a7b8c9\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}", wire: "{\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"output-object\":\"output.c3d4e5f6a7b8c9\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}",
{name: "a check's step whose answer is kept as an object (G A-290)", subject: "", given: "{\"answer-object\":\"answer.c3d4e5f6a7b8c9\",\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}", wire: "{\"answer-object\":\"answer.c3d4e5f6a7b8c9\",\"ended\":\"2026-11-05T10:05:00Z\",\"id\":\"c3d4e5f6a7b8c9\",\"node\":\"anchor\",\"started\":\"2026-11-05T10:00:00Z\",\"state\":\"passed\",\"tool\":\"check\",\"v\":1}",
decode: func(b []byte) (any, error) { var v StepsByNodeIDValue; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "an install ask is a StepAsk of the kind install naming the module's package lock at the commit (H-A-403)", subject: "mesh.seat.node-build-node.accept.install", given: "{\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-22T00:56:00Z\",\"id\":\"m2kx9a1b3c4d61\",\"install\":{\"asker\":\"mesh-delivery-pipeline\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d61\",\"lock\":\"{\\\"name\\\":\\\"mesh-forge\\\",\\\"lockfileVersion\\\":3,\\\"packages\\\":{}}\",\"module\":\"mesh-forge\",\"pipeline\":\"main.12.mesh-forge\"},\"kind\":\"install\",\"language\":\"node\",\"v\":1,\"version\":\"0.1.4\"}", wire: "{\"asker\":\"mesh-delivery-pipeline\",\"at\":\"2026-11-22T00:56:00Z\",\"id\":\"m2kx9a1b3c4d61\",\"install\":{\"asker\":\"mesh-delivery-pipeline\",\"commit\":\"0123456789abcdef0123456789abcdef01234567\",\"fingerprint\":\"fp-0123\",\"id\":\"m2kx9a1b3c4d61\",\"lock\":\"{\\\"name\\\":\\\"mesh-forge\\\",\\\"lockfileVersion\\\":3,\\\"packages\\\":{}}\",\"module\":\"mesh-forge\",\"pipeline\":\"main.12.mesh-forge\"},\"kind\":\"install\",\"language\":\"node\",\"v\":1,\"version\":\"0.1.4\"}",
decode: func(b []byte) (any, error) { var v InstallAccept; err := json.Unmarshal(b, &v); return v, err }, subjectIs: regexp.MustCompile("^mesh\\.seat\\.node-build-node\\.accept\\.install$")},
@@ -115,6 +115,10 @@ func TestFixtures(t *testing.T) {
decode: func(b []byte) (any, error) { var v StepsAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "steps answers a drop that the hand-act log refused", subject: "", given: "{\"error\":\"the hand-act log refused: nothing was deleted\"}", wire: "{\"error\":\"the hand-act log refused: nothing was deleted\"}",
decode: func(b []byte) (any, error) { var v StepsAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "answer asks a step's kept end by its ask, naming the call of its chunks", subject: "", given: "{\"ask\":\"m2kx9a1b3c4d5f\",\"call\":\"0123456789abcdef0123456789abcdef\"}", wire: "{\"ask\":\"m2kx9a1b3c4d5f\",\"call\":\"0123456789abcdef0123456789abcdef\"}",
decode: func(b []byte) (any, error) { var v AnswerInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "answer answers how many chunks carry the kept end", subject: "", given: "{\"ask\":\"m2kx9a1b3c4d5f\",\"chunks\":3}", wire: "{\"ask\":\"m2kx9a1b3c4d5f\",\"chunks\":3}",
decode: func(b []byte) (any, error) { var v AnswerAnswer; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "output asks a step's output by its ask", subject: "", given: "{\"ask\":\"m2kx9a1b3c4d5f\"}", wire: "{\"ask\":\"m2kx9a1b3c4d5f\"}",
decode: func(b []byte) (any, error) { var v OutputInput; err := json.Unmarshal(b, &v); return v, err }, subjectIs: nil},
{name: "output answers the last 64 KB, the size and the failing tests with their words", subject: "", given: "{\"ask\":\"m2kx9a1b3c4d5f\",\"failing\":[{\"test\":\"TestTheBusWhole\",\"words\":\"bus_test.go:41: no responders\"}],\"output\":\"--- FAIL: TestTheBusWhole (0.20s)\\n bus_test.go:41: no responders\\nFAIL\\n\",\"size\":181234}", wire: "{\"ask\":\"m2kx9a1b3c4d5f\",\"failing\":[{\"test\":\"TestTheBusWhole\",\"words\":\"bus_test.go:41: no responders\"}],\"output\":\"--- FAIL: TestTheBusWhole (0.20s)\\n bus_test.go:41: no responders\\nFAIL\\n\",\"size\":181234}",
@@ -262,6 +262,49 @@
},
"class": "act"
},
{
"name": "answer",
"class": "read",
"description": "A step's answer by its ask, when the step's key or a run's step-ended names it as `answer-object` because the answer is over what the steps state's value or the event carries (design 47 H2 H-A-412): the kept end's bytes in chunks of at most 512 KiB on the chunk subject of the call, each acknowledged by the caller on the ack subject within 30 seconds; the answer is of any size. An answer inline in the key or the event is never asked here; a run's test output is the verb output's.",
"input": {
"type": "object",
"properties": {
"ask": {
"type": "string",
"description": "the ask's id, the `answer-object` of its step key or its step-ended naming it",
"minLength": 1
},
"call": {
"type": "string",
"description": "128 random bits the caller chooses: the subject token of this send's chunks and acknowledgements",
"minLength": 1
}
},
"required": [
"ask",
"call"
]
},
"answer": {
"type": "object",
"properties": {
"ask": {
"type": "string",
"description": "the ask's id"
},
"chunks": {
"type": "integer",
"minimum": 0,
"description": "how many chunks are sent; 0 when this node keeps no answer of that ask"
}
},
"required": [
"ask",
"chunks"
]
},
"chunks": true
},
{
"name": "output",
"class": "read",
@@ -711,9 +754,9 @@
"result": {
"$ref": "#/defs/StepResult"
},
"output-object": {
"answer-object": {
"type": "string",
"description": "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"
"description": "the name of the object in the build module's steps objects that holds the step's answer when the step's value would be over what the steps state holds (design 47 G A-290, H2 H-A-412): 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 answer"
},
"what": {
"type": "string"
@@ -1704,9 +1747,9 @@
"type": "string",
"description": "the run's answer (its program's standard output's last line) when it fits the event (design 47 G A-254)"
},
"output-object": {
"answer-object": {
"type": "string",
"description": "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"
"description": "the name of the object that holds the run's answer, kept by the build seat's holder in its steps objects, when the answer is over what the event carries (design 47 G A-254, H2 H-A-412); read through the verb answer"
},
"rerun": {
"type": "boolean"
@@ -56,7 +56,7 @@
"node": "home-server",
"outcome": "could not run",
"said": "the sandbox could not fetch novox/mesh-sdk",
"output-object": "mesh-build-go_sent-objects/m2kx9a1b3c4d5f",
"answer-object": "answer.m2kx9a1b3c4d5f",
"at": "2026-11-10T10:02:00Z"
}
},
@@ -555,7 +555,7 @@
"state": "passed",
"started": "2026-11-05T10:00:00Z",
"ended": "2026-11-05T10:05:00Z",
"output-object": "output.c3d4e5f6a7b8c9"
"answer-object": "answer.c3d4e5f6a7b8c9"
}
}
]
@@ -125,6 +125,22 @@
"error": "the hand-act log refused: nothing was deleted"
}
},
{
"name": "answer asks a step's kept end by its ask, naming the call of its chunks",
"of": "verb:answer.input",
"given": {
"ask": "m2kx9a1b3c4d5f",
"call": "0123456789abcdef0123456789abcdef"
}
},
{
"name": "answer answers how many chunks carry the kept end",
"of": "verb:answer.answer",
"given": {
"ask": "m2kx9a1b3c4d5f",
"chunks": 3
}
},
{
"name": "output asks a step's output by its ask",
"of": "verb:output.input",
@@ -39,7 +39,7 @@
"node": "home-server",
"outcome": "could not run",
"said": "the sandbox could not fetch novox/mesh-sdk",
"output-object": "mesh-build-go_sent-objects/m2kx9a1b3c4d5f",
"answer-object": "answer.m2kx9a1b3c4d5f",
"at": "2026-11-10T10:02:00Z"
}
},
@@ -215,7 +215,7 @@
"state": "passed",
"started": "2026-11-05T10:00:00Z",
"ended": "2026-11-05T10:05:00Z",
"output-object": "output.c3d4e5f6a7b8c9"
"answer-object": "answer.c3d4e5f6a7b8c9"
}
}
]
@@ -125,6 +125,22 @@
"error": "the hand-act log refused: nothing was deleted"
}
},
{
"name": "answer asks a step's kept end by its ask, naming the call of its chunks",
"of": "verb:answer.input",
"given": {
"ask": "m2kx9a1b3c4d5f",
"call": "0123456789abcdef0123456789abcdef"
}
},
{
"name": "answer answers how many chunks carry the kept end",
"of": "verb:answer.answer",
"given": {
"ask": "m2kx9a1b3c4d5f",
"chunks": 3
}
},
{
"name": "output asks a step's output by its ask",
"of": "verb:output.input",
@@ -56,7 +56,7 @@
"node": "home-server",
"outcome": "could not run",
"said": "the sandbox could not fetch novox/mesh-sdk",
"output-object": "mesh-build-go_sent-objects/m2kx9a1b3c4d5f",
"answer-object": "answer.m2kx9a1b3c4d5f",
"at": "2026-11-10T10:02:00Z"
}
},
@@ -312,7 +312,7 @@
"state": "passed",
"started": "2026-11-05T10:00:00Z",
"ended": "2026-11-05T10:05:00Z",
"output-object": "output.c3d4e5f6a7b8c9"
"answer-object": "answer.c3d4e5f6a7b8c9"
}
},
{
@@ -125,6 +125,22 @@
"error": "the hand-act log refused: nothing was deleted"
}
},
{
"name": "answer asks a step's kept end by its ask, naming the call of its chunks",
"of": "verb:answer.input",
"given": {
"ask": "m2kx9a1b3c4d5f",
"call": "0123456789abcdef0123456789abcdef"
}
},
{
"name": "answer answers how many chunks carry the kept end",
"of": "verb:answer.answer",
"given": {
"ask": "m2kx9a1b3c4d5f",
"chunks": 3
}
},
{
"name": "output asks a step's output by its ask",
"of": "verb:output.input",
@@ -13,6 +13,7 @@ export declare const verbs: {
readonly drop: "drop";
readonly keptArtifact: "kept-artifact";
readonly steps: "steps";
readonly answer: "answer";
readonly output: "output";
};
@@ -115,6 +116,8 @@ export declare function detectedStepsByModuleArtifactKey(module: string, artifac
/** The parts of a key of the form "<module>.<artifact>", or undefined for a key of another form. */
export declare function parseDetectedStepsByModuleArtifactKey(_key: string): { module: string; artifact: string } | undefined;
export type AnswerAnswer = buildStep.AnswerAnswer;
export type AnswerInput = buildStep.AnswerInput;
export type AskArtifact = buildStep.AskArtifact;
export type AskTaken = buildStep.AskTaken;
export type AskTakenEvent = buildStep.AskTakenEvent;
@@ -11,6 +11,7 @@ export const verbs = {
drop: "drop",
keptArtifact: "kept-artifact",
steps: "steps",
answer: "answer",
output: "output",
};
@@ -9,6 +9,7 @@ export declare const verbs: {
readonly drop: "drop";
readonly keptArtifact: "kept-artifact";
readonly steps: "steps";
readonly answer: "answer";
readonly output: "output";
};
@@ -375,12 +376,12 @@ export interface RunProgram {
export interface Step {
/** when the bus gives the ask again, for the state again (RFC 3339 time) */
"again-at"?: string;
/** the name of the object in the build module's steps objects that holds the step's answer when the step's value would be over what the steps state holds (design 47 G A-290, H2 H-A-412): 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 answer */
"answer-object"?: string;
/** when (RFC 3339 time) */
"ended"?: string;
"id": string;
"node": string;
/** 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 */
"output-object"?: string;
"owner"?: string;
/** true when the step ended on a fault that passes (a transport fault), so a failed end after the last run says so */
"passing"?: boolean;
@@ -464,6 +465,8 @@ export interface StepAsk {
/** 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) */
export interface StepEnded {
/** the name of the object that holds the run's answer, kept by the build seat's holder in its steps objects, when the answer is over what the event carries (design 47 G A-254, H2 H-A-412); read through the verb answer */
"answer-object"?: string;
/** for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2)) */
"archive"?: string;
"artifact"?: string;
@@ -495,8 +498,6 @@ export interface StepEnded {
"outcome": "passed" | "failed" | "nothing to run" | "could not run";
/** the run's answer (its program's standard output's last line) when it fits the event (design 47 G A-254) */
"output"?: string;
/** 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 */
"output-object"?: string;
"pipeline"?: string;
"rerun"?: boolean;
/** why it failed or could not run, naming the part not heard */
@@ -743,6 +744,24 @@ export interface StepsAnswer {
"steps"?: DetectedStep[];
}
/** is what answer takes. */
export interface AnswerInput {
/** the ask's id, the `answer-object` of its step key or its step-ended naming it */
"ask": string;
/** 128 random bits the caller chooses: the subject token of this send's chunks and acknowledgements */
"call": string;
}
/** is what answer answers. */
export interface AnswerAnswer {
/** the ask's id */
"ask": string;
/** how many chunks are sent; 0 when this node keeps no answer of that ask */
"chunks": number;
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
"form"?: number;
}
/** is what output takes. */
export interface OutputInput {
/** the ask's id */
@@ -9,6 +9,7 @@ export const verbs = {
drop: "drop",
keptArtifact: "kept-artifact",
steps: "steps",
answer: "answer",
output: "output",
};
@@ -13,6 +13,7 @@ export declare const verbs: {
readonly drop: "drop";
readonly keptArtifact: "kept-artifact";
readonly steps: "steps";
readonly answer: "answer";
readonly output: "output";
};
@@ -112,6 +113,8 @@ export declare function detectedStepsByModuleArtifactKey(module: string, artifac
/** The parts of a key of the form "<module>.<artifact>", or undefined for a key of another form. */
export declare function parseDetectedStepsByModuleArtifactKey(_key: string): { module: string; artifact: string } | undefined;
export type AnswerAnswer = buildStep.AnswerAnswer;
export type AnswerInput = buildStep.AnswerInput;
export type AskArtifact = buildStep.AskArtifact;
export type AskTaken = buildStep.AskTaken;
export type AskTakenEvent = buildStep.AskTakenEvent;
@@ -11,6 +11,7 @@ export const verbs = {
drop: "drop",
keptArtifact: "kept-artifact",
steps: "steps",
answer: "answer",
output: "output",
};
@@ -9,6 +9,7 @@ export declare const verbs: {
readonly drop: "drop";
readonly keptArtifact: "kept-artifact";
readonly steps: "steps";
readonly answer: "answer";
readonly output: "output";
};
@@ -375,12 +376,12 @@ export interface RunProgram {
export interface Step {
/** when the bus gives the ask again, for the state again (RFC 3339 time) */
"again-at"?: string;
/** the name of the object in the build module's steps objects that holds the step's answer when the step's value would be over what the steps state holds (design 47 G A-290, H2 H-A-412): 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 answer */
"answer-object"?: string;
/** when (RFC 3339 time) */
"ended"?: string;
"id": string;
"node": string;
/** 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 */
"output-object"?: string;
"owner"?: string;
/** true when the step ended on a fault that passes (a transport fault), so a failed end after the last run says so */
"passing"?: boolean;
@@ -464,6 +465,8 @@ export interface StepAsk {
/** 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) */
export interface StepEnded {
/** the name of the object that holds the run's answer, kept by the build seat's holder in its steps objects, when the answer is over what the event carries (design 47 G A-254, H2 H-A-412); read through the verb answer */
"answer-object"?: string;
/** for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2)) */
"archive"?: string;
"artifact"?: string;
@@ -495,8 +498,6 @@ export interface StepEnded {
"outcome": "passed" | "failed" | "nothing to run" | "could not run";
/** the run's answer (its program's standard output's last line) when it fits the event (design 47 G A-254) */
"output"?: string;
/** 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 */
"output-object"?: string;
"pipeline"?: string;
"rerun"?: boolean;
/** why it failed or could not run, naming the part not heard */
@@ -743,6 +744,24 @@ export interface StepsAnswer {
"steps"?: DetectedStep[];
}
/** is what answer takes. */
export interface AnswerInput {
/** the ask's id, the `answer-object` of its step key or its step-ended naming it */
"ask": string;
/** 128 random bits the caller chooses: the subject token of this send's chunks and acknowledgements */
"call": string;
}
/** is what answer answers. */
export interface AnswerAnswer {
/** the ask's id */
"ask": string;
/** how many chunks are sent; 0 when this node keeps no answer of that ask */
"chunks": number;
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
"form"?: number;
}
/** is what output takes. */
export interface OutputInput {
/** the ask's id */
@@ -9,6 +9,7 @@ export const verbs = {
drop: "drop",
keptArtifact: "kept-artifact",
steps: "steps",
answer: "answer",
output: "output",
};
@@ -13,6 +13,7 @@ export declare const verbs: {
readonly drop: "drop";
readonly keptArtifact: "kept-artifact";
readonly steps: "steps";
readonly answer: "answer";
readonly output: "output";
};
@@ -115,6 +116,8 @@ export declare function detectedStepsByModuleArtifactKey(module: string, artifac
/** The parts of a key of the form "<module>.<artifact>", or undefined for a key of another form. */
export declare function parseDetectedStepsByModuleArtifactKey(_key: string): { module: string; artifact: string } | undefined;
export type AnswerAnswer = buildStep.AnswerAnswer;
export type AnswerInput = buildStep.AnswerInput;
export type AskArtifact = buildStep.AskArtifact;
export type AskTaken = buildStep.AskTaken;
export type AskTakenEvent = buildStep.AskTakenEvent;
@@ -11,6 +11,7 @@ export const verbs = {
drop: "drop",
keptArtifact: "kept-artifact",
steps: "steps",
answer: "answer",
output: "output",
};
@@ -9,6 +9,7 @@ export declare const verbs: {
readonly drop: "drop";
readonly keptArtifact: "kept-artifact";
readonly steps: "steps";
readonly answer: "answer";
readonly output: "output";
};
@@ -375,12 +376,12 @@ export interface RunProgram {
export interface Step {
/** when the bus gives the ask again, for the state again (RFC 3339 time) */
"again-at"?: string;
/** the name of the object in the build module's steps objects that holds the step's answer when the step's value would be over what the steps state holds (design 47 G A-290, H2 H-A-412): 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 answer */
"answer-object"?: string;
/** when (RFC 3339 time) */
"ended"?: string;
"id": string;
"node": string;
/** 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 */
"output-object"?: string;
"owner"?: string;
/** true when the step ended on a fault that passes (a transport fault), so a failed end after the last run says so */
"passing"?: boolean;
@@ -464,6 +465,8 @@ export interface StepAsk {
/** 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) */
export interface StepEnded {
/** the name of the object that holds the run's answer, kept by the build seat's holder in its steps objects, when the answer is over what the event carries (design 47 G A-254, H2 H-A-412); read through the verb answer */
"answer-object"?: string;
/** for an install, the reference the installed tree's archive was published under in the artifact store (the seat oci-artifact-registry; design 47 H2 §800, H-A-399 (2)) */
"archive"?: string;
"artifact"?: string;
@@ -495,8 +498,6 @@ export interface StepEnded {
"outcome": "passed" | "failed" | "nothing to run" | "could not run";
/** the run's answer (its program's standard output's last line) when it fits the event (design 47 G A-254) */
"output"?: string;
/** 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 */
"output-object"?: string;
"pipeline"?: string;
"rerun"?: boolean;
/** why it failed or could not run, naming the part not heard */
@@ -743,6 +744,24 @@ export interface StepsAnswer {
"steps"?: DetectedStep[];
}
/** is what answer takes. */
export interface AnswerInput {
/** the ask's id, the `answer-object` of its step key or its step-ended naming it */
"ask": string;
/** 128 random bits the caller chooses: the subject token of this send's chunks and acknowledgements */
"call": string;
}
/** is what answer answers. */
export interface AnswerAnswer {
/** the ask's id */
"ask": string;
/** how many chunks are sent; 0 when this node keeps no answer of that ask */
"chunks": number;
/** is the form of what this value carries, left out while it is 1 (design 47 H2 §780). */
"form"?: number;
}
/** is what output takes. */
export interface OutputInput {
/** the ask's id */
@@ -9,6 +9,7 @@ export const verbs = {
drop: "drop",
keptArtifact: "kept-artifact",
steps: "steps",
answer: "answer",
output: "output",
};
@@ -44,11 +44,12 @@ const StepEndedVersion = 1
// StepEndedInlineMost is the most bytes of a run's answer a step-ended carries inline as `output`: the bus's message limit
// less the room its headers take and 16 KiB for the end's other fields. An answer over it is kept by the holder as an object,
// which `output-object` names and the seat's verb `output` answers (design 47 G A-254).
// which `answer-object` names and the seat's verb `answer` answers (design 47 G A-254, H2 H-A-412).
const StepEndedInlineMost = (1 << 20) - (8 << 10) - (16 << 10)
// OutputObjectName is the name of the object a build seat's holder keeps a run's answer in, by the ask's id.
func OutputObjectName(ask string) string { return "output." + ask }
// AnswerObjectName is the name of the object a build seat's holder keeps a step's end over what its key or event carries
// in, by the ask's id, in its steps objects (design 47 H2 H-A-412 addendum).
func AnswerObjectName(ask string) string { return "answer." + ask }
// KeptResult is a package's passing result at the digest of what its tests read (ADR 0666 §8).
type KeptResult struct {
@@ -141,7 +142,7 @@ type StepEnded struct {
Kept []KeptResult `json:"kept,omitempty"`
Said string `json:"said,omitempty"`
Output string `json:"output,omitempty"`
OutputObject string `json:"output-object,omitempty"`
AnswerObject string `json:"answer-object,omitempty"`
// NotRun are the tests that did not run, each with its reason, counted apart from passed and failed (design 47 H2
// §800).
NotRun []NotRun `json:"not-run,omitempty"`
@@ -225,7 +226,7 @@ func (e StepEnded) check() error {
if err := checkNode(e.Node); err != nil {
return err
}
if e.Output != "" && e.OutputObject != "" {
if e.Output != "" && e.AnswerObject != "" {
return fmt.Errorf("buildstep: the end of %s carries its answer inline and as an object", e.ID)
}
if e.Pipeline == "" {
@@ -9,41 +9,46 @@ import (
"fmt"
)
// OutputVerb is the verb of a build seat that answers a step's answer kept as an object (design 47 G A-254, A-290).
// OutputVerb is the verb of a build seat that answers a run's test output kept in its outputs objects (design 47 H2 §791,
// H-A-367 (1), H-A-412): the output's last 64 KB, its size, the failing tests with their words, or no longer kept.
const OutputVerb = "output"
// AnswerVerb is the verb of a build seat that answers, in chunks, a step's end kept as an object because it is over what the
// steps state's value or the event carries (design 47 G A-254, A-290; H2 H-A-412 addendum): the object `answer-object` names.
const AnswerVerb = "answer"
// AskVerb asks a seat verb as the runtime calls it (stdio.Ask): the key `seat:<seat>.<verb>[@<node>]` and the body in, the
// verb's answer out. A verb marked chunks is asked by the plain call, and the runtime hands the whole file in `file` (A-249).
type AskVerb func(key string, body any) (json.RawMessage, error)
// ReadOutput is the answer a build seat's step-ended carries (design 47 G A-254): its inline `output`, else the object
// `output-object` names, read through the verb `output` of the seat of language on the node that ran the ask. Every asker of a
// `answer-object` names, read through the verb `answer` of the seat of language on the node that ran the ask. Every asker of a
// run reads the answer this way, whichever build seat ran it; none reads the seat's step state.
func (e StepEnded) ReadOutput(language string, ask AskVerb) ([]byte, error) {
if e.OutputObject == "" {
if e.AnswerObject == "" {
return []byte(e.Output), nil
}
return readObject(language, e.Node, e.Ask, e.OutputObject, ask)
return readObject(language, e.Node, e.Ask, e.AnswerObject, ask)
}
// Whole is the step with its answer whole (design 47 G A-290): a step whose key names its answer as the object
// `output-object`, its value being over what the steps state holds, has it read through the verb `output` of the seat of
// `answer-object`, its value being over what the steps state holds, has it read through the verb `answer` of the seat of
// language on the step's node, and put back where the key holds the answer itself: a run's (run true) as its run answer's
// output, any other's as its result. A step whose key holds its answer is answered as it is. Every reader of a step's answer
// reads it so, the checker and the builder alike (no step reads passed in one place and failed in another).
func (s Step) Whole(language string, run bool, ask AskVerb) (Step, error) {
if s.OutputObject == "" {
if s.AnswerObject == "" {
return s, nil
}
body, err := readObject(language, s.Node, s.ID, s.OutputObject, ask)
body, err := readObject(language, s.Node, s.ID, s.AnswerObject, ask)
if err != nil {
return s, err
}
if !run {
if !json.Valid(body) {
return s, fmt.Errorf("buildstep: the answer %s of the ask %s is not JSON", s.OutputObject, s.ID)
return s, fmt.Errorf("buildstep: the answer %s of the ask %s is not JSON", s.AnswerObject, s.ID)
}
s.Result, s.OutputObject = json.RawMessage(body), ""
s.Result, s.AnswerObject = json.RawMessage(body), ""
return s, nil
}
var answer RunAnswer
@@ -55,26 +60,26 @@ func (s Step) Whole(language string, run bool, ask AskVerb) (Step, error) {
answer.Output = json.RawMessage(body)
raw, err := json.Marshal(answer)
if err != nil {
return s, fmt.Errorf("buildstep: the run answer of the ask %s with its output %s: %w", s.ID, s.OutputObject, err)
return s, fmt.Errorf("buildstep: the run answer of the ask %s with its output %s: %w", s.ID, s.AnswerObject, err)
}
s.Result, s.OutputObject = raw, ""
s.Result, s.AnswerObject = raw, ""
return s, nil
}
// readObject reads the object a build seat's holder on node keeps of the ask askID through the seat's verb `output`.
// readObject reads the object a build seat's holder on node keeps of the ask askID through the seat's verb `answer`.
func readObject(language, node, askID, object string, ask AskVerb) ([]byte, error) {
seat, err := BuildSeat(language)
if err != nil {
return nil, err
}
if ask == nil {
return nil, errors.New("buildstep: the answer is in the output object " + object + ", which this reader has no verb to read")
return nil, errors.New("buildstep: the answer is in the answer object " + object + ", which this reader has no verb to read")
}
var call [16]byte
if _, err := rand.Read(call[:]); err != nil {
return nil, err
}
raw, err := ask("seat:"+seat+"."+OutputVerb+"@"+node, map[string]any{"ask": askID, "call": hex.EncodeToString(call[:])})
raw, err := ask("seat:"+seat+"."+AnswerVerb+"@"+node, map[string]any{"ask": askID, "call": hex.EncodeToString(call[:])})
if err != nil {
return nil, fmt.Errorf("buildstep: asking %s for the answer %s of the ask %s: %w", seat, object, askID, err)
}
@@ -84,10 +89,10 @@ func readObject(language, node, askID, object string, ask AskVerb) ([]byte, erro
Chunks int `json:"chunks"`
}
if err := json.Unmarshal(raw, &got); err != nil {
return nil, fmt.Errorf("buildstep: the verb output of %s answered no answer for %s: %w", seat, askID, err)
return nil, fmt.Errorf("buildstep: the verb answer of %s answered no answer for %s: %w", seat, askID, err)
}
if got.Ask != askID {
return nil, fmt.Errorf("buildstep: the verb output of %s answered the ask %q, asked %s", seat, got.Ask, askID)
return nil, fmt.Errorf("buildstep: the verb answer of %s answered the ask %q, asked %s", seat, got.Ask, askID)
}
if got.File == "" {
return nil, fmt.Errorf("buildstep: %s on %s keeps no answer of the ask %s", seat, node, askID)
@@ -29,12 +29,12 @@ func TestStepEndedReadOutput(t *testing.T) {
fail string
}{
{name: "inline", end: StepEnded{Ask: ask, Node: "ace", Output: `{"a":1}`}, want: `{"a":1}`},
{name: "an object is read through the verb on its node", end: StepEnded{Ask: ask, Node: "ace", OutputObject: OutputObjectName(ask)},
ask: verb(`{"ask":"`+ask+`","file":"eyJhIjoxfQ=="}`, nil), want: `{"a":1}`, wantKey: "seat:node-build-go.output@ace"},
{name: "no answer kept", end: StepEnded{Ask: ask, Node: "ace", OutputObject: "o"}, ask: verb(`{"ask":"`+ask+`","chunks":0}`, nil), fail: "keeps no answer"},
{name: "another ask's answer", end: StepEnded{Ask: ask, Node: "ace", OutputObject: "o"}, ask: verb(`{"ask":"x","file":"e30="}`, nil), fail: "answered the ask"},
{name: "the verb fails", end: StepEnded{Ask: ask, Node: "ace", OutputObject: "o"}, ask: verb(``, errors.New("no seat")), fail: "no seat"},
{name: "no verb", end: StepEnded{Ask: ask, Node: "ace", OutputObject: "o"}, fail: "no verb"},
{name: "an object is read through the verb on its node", end: StepEnded{Ask: ask, Node: "ace", AnswerObject: AnswerObjectName(ask)},
ask: verb(`{"ask":"`+ask+`","file":"eyJhIjoxfQ=="}`, nil), want: `{"a":1}`, wantKey: "seat:node-build-go.answer@ace"},
{name: "no answer kept", end: StepEnded{Ask: ask, Node: "ace", AnswerObject: "o"}, ask: verb(`{"ask":"`+ask+`","chunks":0}`, nil), fail: "keeps no answer"},
{name: "another ask's answer", end: StepEnded{Ask: ask, Node: "ace", AnswerObject: "o"}, ask: verb(`{"ask":"x","file":"e30="}`, nil), fail: "answered the ask"},
{name: "the verb fails", end: StepEnded{Ask: ask, Node: "ace", AnswerObject: "o"}, ask: verb(``, errors.New("no seat")), fail: "no seat"},
{name: "no verb", end: StepEnded{Ask: ask, Node: "ace", AnswerObject: "o"}, fail: "no verb"},
} {
t.Run(c.name, func(t *testing.T) {
key, body = "", nil
@@ -57,7 +57,7 @@ func TestStepEndedReadOutput(t *testing.T) {
// A step-ended names its answer inline or as an object, never both.
func TestStepEndedRefusesAnswerTwice(t *testing.T) {
e := StepEnded{ID: "m2kx9a1b3c4d5f", Ask: "m2kx9a1b3c4d5f", Asker: "a", Node: "ace", Outcome: OutcomePassed, Output: "1", OutputObject: "o"}
e := StepEnded{ID: "m2kx9a1b3c4d5f", Ask: "m2kx9a1b3c4d5f", Asker: "a", Node: "ace", Outcome: OutcomePassed, Output: "1", AnswerObject: "o"}
if _, err := EncodeStepEnded(e); err == nil || !strings.Contains(err.Error(), "inline and as an object") {
t.Fatalf("err %v", err)
}
@@ -75,7 +75,7 @@ func TestStepWholeReadsTheObjectItsKeyNames(t *testing.T) {
}
}
b64 := func(s string) string { return base64.StdEncoding.EncodeToString([]byte(s)) }
named := Step{ID: ask, Node: "ace", State: StepPassed, OutputObject: OutputObjectName(ask)}
named := Step{ID: ask, Node: "ace", State: StepPassed, AnswerObject: AnswerObjectName(ask)}
for _, c := range []struct {
name string
step Step
@@ -100,10 +100,10 @@ func TestStepWholeReadsTheObjectItsKeyNames(t *testing.T) {
}
return
}
if err != nil || string(got.Result) != c.want || got.OutputObject != "" {
t.Fatalf("got %s (object %q), %v; want %s", got.Result, got.OutputObject, err, c.want)
if err != nil || string(got.Result) != c.want || got.AnswerObject != "" {
t.Fatalf("got %s (object %q), %v; want %s", got.Result, got.AnswerObject, err, c.want)
}
if c.ask != nil && key != "seat:node-build-go.output@ace" {
if c.ask != nil && key != "seat:node-build-go.answer@ace" {
t.Fatalf("asked %q", key)
}
})
+5 -5
View File
@@ -49,11 +49,11 @@ type Step struct {
Ended time.Time `json:"ended,omitzero"`
Reason string `json:"reason,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
// OutputObject names the object in the build module's outputs store (OutputObjectName) that holds the step's answer
// when the whole value would be over what the steps state holds (design 47 G A-290): a check's whole answer, Result
// then empty; a run's output, Result the run's answer without it. A reader reads the answer through the seat's verb
// output (Step.Answer).
OutputObject string `json:"output-object,omitempty"`
// AnswerObject names the object in the build module's steps objects (AnswerObjectName) that holds the step's answer
// when the whole value would be over what the steps state holds (design 47 G A-290, H2 H-A-412): a check's whole
// answer, Result then empty; a run's output, Result the run's answer without it. A reader reads the answer through the
// seat's verb answer (Step.Whole).
AnswerObject string `json:"answer-object,omitempty"`
What string `json:"what,omitempty"`
Phase string `json:"phase,omitempty"`
PhaseAt time.Time `json:"phase-at,omitzero"`
+15 -9
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"git.novox.be/novox/mesh-sdk/go/buscalls"
"git.novox.be/novox/mesh-sdk/go/catalogue"
)
// OutputsStore is the local name of the object store a build seat's holder keeps a run's output in (design 47 H2 §791,
@@ -11,32 +12,37 @@ import (
// output reads (H-A-399 (1)).
const OutputsStore = "outputs"
// OutputObjects is the object store of OutputsStore as a holder uses it (mesh-sdk busstate.ObjectsOf(OutputsStore)).
// AnswersStore is the local name of the object store a build seat's holder keeps a step's end in when it is over what the
// steps state's value or step-ended carries (design 47 H2 H-A-412 addendum): the steps state's own objects store,
// `steps-objects`, which the holder's manifest `requires` with its steps state, and which the seat's verb answer reads.
var AnswersStore = catalogue.StateObjectsName("steps")
// OutputObjects is an object store as a holder uses it (mesh-sdk busstate.ObjectsOf(OutputsStore), or of AnswersStore).
type OutputObjects interface {
Put(name string, data []byte, description string) (buscalls.ObjectInfo, error)
Get(name string) (buscalls.ObjectData, error)
}
// KeepOutputIn is a holder's Puller.KeepOutput over its store of outputs.
func KeepOutputIn(o OutputObjects) func(object string, body []byte) error {
// KeepAnswerIn is a holder's Puller.KeepAnswer over its store of answers (AnswersStore).
func KeepAnswerIn(o OutputObjects) func(object string, body []byte) error {
return func(object string, body []byte) error {
if o == nil {
return fmt.Errorf("this module keeps no %s store", OutputsStore)
return fmt.Errorf("this module keeps no %s store", AnswersStore)
}
_, err := o.Put(object, body, "a run's answer, named by its step-ended")
_, err := o.Put(object, body, "a step's end over what its key or step-ended carries, named by it")
return err
}
}
// ReadOutputFrom is a holder's read of a kept answer for OutputTool over its store of outputs.
func ReadOutputFrom(o OutputObjects) func(object string) ([]byte, error) {
// ReadAnswerFrom is a holder's read of a kept end for AnswerTool over its store of answers (AnswersStore).
func ReadAnswerFrom(o OutputObjects) func(object string) ([]byte, error) {
return func(object string) ([]byte, error) {
if o == nil {
return nil, fmt.Errorf("this module keeps no %s store", OutputsStore)
return nil, fmt.Errorf("this module keeps no %s store", AnswersStore)
}
got, err := o.Get(object)
if err != nil {
return nil, fmt.Errorf("the answer %s in the %s store: %w", object, OutputsStore, err)
return nil, fmt.Errorf("the answer %s in the %s store: %w", object, AnswersStore, err)
}
return got.Data, nil
}
@@ -22,23 +22,23 @@ func (f fakeOutputs) Get(name string) (buscalls.ObjectData, error) {
return buscalls.ObjectData{Data: d}, nil
}
// Design 47 G A-254: what a holder keeps through KeepOutputIn it reads again through ReadOutputFrom; with no store both refuse by name.
// Design 47 G A-254: what a holder keeps through KeepAnswerIn it reads again through ReadAnswerFrom; with no store both refuse by name.
func TestOutputsKeptAreRead(t *testing.T) {
st := fakeOutputs{m: map[string][]byte{}}
if err := KeepOutputIn(st)("output.a1", []byte("x")); err != nil {
if err := KeepAnswerIn(st)("answer.a1", []byte("x")); err != nil {
t.Fatal(err)
}
if got, err := ReadOutputFrom(st)("output.a1"); err != nil || string(got) != "x" {
if got, err := ReadAnswerFrom(st)("answer.a1"); err != nil || string(got) != "x" {
t.Fatalf("read %q, %v", got, err)
}
if _, err := ReadOutputFrom(st)("output.none"); err == nil {
if _, err := ReadAnswerFrom(st)("answer.none"); err == nil {
t.Fatal("an absent answer was read")
}
// Design 47 H2 §791: the store is the holder's `outputs` objects.
if err := KeepOutputIn(nil)("o", nil); err == nil || !strings.Contains(err.Error(), "no outputs store") {
t.Fatalf("no store kept an answer, or did not name the outputs store: %v", err)
// Design 47 H2 H-A-412 addendum: a kept end is in the steps state's own objects, not in the `outputs` objects.
if err := KeepAnswerIn(nil)("o", nil); err == nil || !strings.Contains(err.Error(), "no steps-objects store") {
t.Fatalf("no store kept an answer, or did not name the steps objects: %v", err)
}
if _, err := ReadOutputFrom(nil)("o"); err == nil {
if _, err := ReadAnswerFrom(nil)("o"); err == nil {
t.Fatal("no store read an answer")
}
}
+12 -12
View File
@@ -83,10 +83,10 @@ type Puller struct {
// every ProgressEvery while it runs, step-ended when an ask outside a pipeline ends (design 47 G §496, §602). Nil says
// none, a test's. ProgressEvery defaults to DefaultProgressEvery.
Say func(event string, body any, id string) error
// KeepOutput keeps a step's answer over what its key holds in the steps state (a check's or a run's, design 47 G A-290)
// as the object named object, which the key and a run's step-ended name and the seat's verb `output` answers (A-254); a
// holder keeps it in the object store its manifest requires. Nil keeps none: such an answer ends the ask failed, saying so.
KeepOutput func(object string, body []byte) error
// KeepAnswer keeps a step's answer over what its key holds in the steps state (a check's or a run's, design 47 G A-290)
// as the object named object, which the key and a run's step-ended name and the seat's verb `answer` answers (A-254); a
// holder keeps it in its steps objects (AnswersStore, H-A-412). Nil keeps none: such an answer ends the ask failed, saying so.
KeepAnswer func(object string, body []byte) error
// Prior says how many runs of the ask under a step key started before (the Run of the step the key holds, PriorRuns; 0 for
// none), so the poison rule and the transport fault's run count only runs that started, never an ask given back before it
// ran. Nil counts the bus's deliveries (a test's).
@@ -713,7 +713,7 @@ func (p *Puller) endUnrun(msg *Pulled, ask sdkstep.StepAsk, key string, step sdk
why = fmt.Errorf("the ask is on its last delivery (%d) and no run of it started: it is out of its deliveries and run no more", msg.Delivered)
}
p.logf("the ask %s is ended on %s: %v", ask.ID, p.Node, why)
if _, ferr := finish(p.Put, p.KeepOutput, key, step, nil, why, p.Logf); ferr != nil {
if _, ferr := finish(p.Put, p.KeepAnswer, key, step, nil, why, p.Logf); ferr != nil {
p.logf("the end of the ask %s could not be written on %s, so it is given back: %v", ask.ID, p.Node, ferr)
_ = msg.Nak()
return
@@ -879,7 +879,7 @@ func (p *Puller) run(ctx context.Context, msg *Pulled, ask sdkstep.StepAsk, key
p.logf("the ask %s ended on a transport fault and its step could not be written again (%v): it ends failed", ask.ID, aerr)
}
}
written, ferr := finish(p.Put, p.KeepOutput, key, step, result, err, p.Logf)
written, ferr := finish(p.Put, p.KeepAnswer, key, step, result, err, p.Logf)
if ferr != nil {
// No end was written: the ask is not acknowledged as done, so the stream gives it again and a run that can
// write its end (or the poison rule, issue 1907) ends it where its asker sees it (issue 1930).
@@ -889,7 +889,7 @@ func (p *Puller) run(ctx context.Context, msg *Pulled, ask sdkstep.StepAsk, key
}
// step-ended says the end the key holds (design 47 G A-290): its outcome, and the answer only when the key kept it, so no
// step reads passed in one place and failed in another.
if len(written.Result) == 0 && written.OutputObject == "" {
if len(written.Result) == 0 && written.AnswerObject == "" {
result = nil
}
outcome := "passed"
@@ -898,9 +898,9 @@ func (p *Puller) run(ctx context.Context, msg *Pulled, ask sdkstep.StepAsk, key
if len(outcome) > 300 {
outcome = outcome[:300] + "..."
}
p.sayEnded(msg, ask, sdkstep.OutcomeFailed, written.Reason, result, written.OutputObject)
p.sayEnded(msg, ask, sdkstep.OutcomeFailed, written.Reason, result, written.AnswerObject)
} else {
p.sayEnded(msg, ask, sdkstep.OutcomePassed, "", result, written.OutputObject)
p.sayEnded(msg, ask, sdkstep.OutcomePassed, "", result, written.AnswerObject)
}
p.logf("the %s ask %s ended on %s after %s, in its phase %q; %s%s", ask.Kind, ask.ID, p.Node,
now().Sub(step.Started).Round(time.Second), step.Phase, outcome, stepOutcomeWords(result))
@@ -1099,8 +1099,8 @@ func (p *Puller) say(event string, body any, id string) {
// sayEnded says step-ended for an ask outside a pipeline, whatever its asker (design 47 G §602): a pipeline step's end is
// its run's own (AskSteps.SayStep). The end of a run carries the run's answer (A-254): the last line of its program's
// standard output, inline as `output` up to sdkstep.StepEndedInlineMost, else as `output-object`, the object kept, the step's
// key naming it (design 47 G A-290: finish kept it with KeepOutput, so it is not put twice); a program that exits other than 0
// standard output, inline as `output` up to sdkstep.StepEndedInlineMost, else as `answer-object`, the object kept, the step's
// key naming it (design 47 G A-290: finish kept it with KeepAnswer, so it is not put twice); a program that exits other than 0
// ends failed with its answer carried.
func (p *Puller) sayEnded(msg *Pulled, ask sdkstep.StepAsk, outcome, said string, result any, kept string) {
if p.Say == nil || ask.Step != nil || ask.Install != nil {
@@ -1114,7 +1114,7 @@ func (p *Puller) sayEnded(msg *Pulled, ask sdkstep.StepAsk, outcome, said string
if len(ans.Output) <= sdkstep.StepEndedInlineMost {
end.Output = string(ans.Output)
} else if kept != "" {
end.OutputObject = kept
end.AnswerObject = kept
} else {
outcome, said = sdkstep.OutcomeFailed, fmt.Sprintf("the run's answer is %d bytes, over what the end carries, and no object of it was kept", len(ans.Output))
}
@@ -279,7 +279,7 @@ func TestACheckAnswerOverTheStepsStateIsKeptAndReadBackWhole(t *testing.T) {
publishAsk(t, js, a)
p := &Puller{Source: &JetStreamAsks{JS: js, Language: sdkstep.AskGo}, Language: sdkstep.AskGo, Node: "ace", Put: put,
Capacity: func() int { return 1 }, PullWait: 100 * time.Millisecond,
KeepOutput: func(object string, body []byte) error { _, err := objects.PutBytes(ctx, object, body); return err },
KeepAnswer: func(object string, body []byte) error { _, err := objects.PutBytes(ctx, object, body); return err },
Run: func(context.Context, sdkstep.StepAsk) (any, error) { return answer, nil }}
go p.Pull(ctx)
key, _ := askKey(a, "ace")
@@ -292,14 +292,14 @@ func TestACheckAnswerOverTheStepsStateIsKeptAndReadBackWhole(t *testing.T) {
step, err = sdkstep.DecodeStep(e.Value())
return err == nil && sdkstep.Ended(step)
})
if step.State != sdkstep.StepPassed || step.OutputObject != sdkstep.OutputObjectName(a.ID) || len(step.Result) != 0 {
t.Fatalf("the key ended %s (%s) naming %q with %d bytes of result, want passed, naming the object and no result", step.State, step.Reason, step.OutputObject, len(step.Result))
if step.State != sdkstep.StepPassed || step.AnswerObject != sdkstep.AnswerObjectName(a.ID) || len(step.Result) != 0 {
t.Fatalf("the key ended %s (%s) naming %q with %d bytes of result, want passed, naming the object and no result", step.State, step.Reason, step.AnswerObject, len(step.Result))
}
verb := func(k string, body any) (json.RawMessage, error) {
if k != "seat:node-build-go.output@ace" {
if k != "seat:node-build-go.answer@ace" {
return nil, fmt.Errorf("asked %s", k)
}
data, err := objects.GetBytes(ctx, sdkstep.OutputObjectName(body.(map[string]any)["ask"].(string)))
data, err := objects.GetBytes(ctx, sdkstep.AnswerObjectName(body.(map[string]any)["ask"].(string)))
if err != nil {
return nil, err
}
@@ -14,7 +14,7 @@ import (
)
// Design 47 G A-254, A-290: a build seat's step-ended of a run carries the run's answer, the last line of its program's standard
// output: inline as `output` up to the event bound, else as `output-object`, the object the holder keeps, which the verb `output`
// output: inline as `output` up to the event bound, else as `answer-object`, the object the holder keeps, which the verb `output`
// answers. The step's key holds the answer only within what the steps state holds per value: over it, a check's whole answer or a
// run's output is the object output.<ask> the key names, kept once; the key and step-ended always say the same outcome, a run
// whose program exited other than 0 failed in both, its answer kept (A-290).
@@ -62,7 +62,7 @@ func TestStepEndedOfARunCarriesItsAnswer(t *testing.T) {
kept, keeps := map[string][]byte{}, 0
p := &Puller{Source: src, Language: sdkstep.AskGo, Node: "shanks", Put: st.put, Capacity: func() int { return 1 },
PullWait: 10 * time.Millisecond, Heartbeat: time.Hour, Say: sy.say,
KeepOutput: func(object string, body []byte) error {
KeepAnswer: func(object string, body []byte) error {
mu.Lock()
defer mu.Unlock()
keeps++
@@ -100,28 +100,28 @@ func TestStepEndedOfARunCarriesItsAnswer(t *testing.T) {
}
mu.Lock()
defer mu.Unlock()
name := sdkstep.OutputObjectName(a.ID)
name := sdkstep.AnswerObjectName(a.ID)
if c.objectKept {
if end["output-object"] != name || end["output"] != nil || string(kept[name]) != big {
t.Fatalf("end %v and kept %d bytes, want the object %s holding the whole answer and no inline output", end["output-object"], len(kept[name]), name)
if end["answer-object"] != name || end["output"] != nil || string(kept[name]) != big {
t.Fatalf("end %v and kept %d bytes, want the object %s holding the whole answer and no inline output", end["answer-object"], len(kept[name]), name)
}
} else if end["output-object"] != nil {
t.Fatalf("an object %v was named, want none", end["output-object"])
} else if end["answer-object"] != nil {
t.Fatalf("an object %v was named, want none", end["answer-object"])
}
switch {
case c.keyObject == "":
if step.OutputObject != "" || (c.keepErr == nil && keeps != 0) {
t.Fatalf("the key names %q and %d objects were kept, want none", step.OutputObject, keeps)
if step.AnswerObject != "" || (c.keepErr == nil && keeps != 0) {
t.Fatalf("the key names %q and %d objects were kept, want none", step.AnswerObject, keeps)
}
case c.check:
var whole map[string]any
if step.OutputObject != name || len(step.Result) != 0 || keeps != 1 || json.Unmarshal(kept[name], &whole) != nil || whole["fetch"] == nil {
t.Fatalf("the key names %q with result %.80s, %d keeps; want the object %s holding the whole check answer, kept once", step.OutputObject, step.Result, keeps, name)
if step.AnswerObject != name || len(step.Result) != 0 || keeps != 1 || json.Unmarshal(kept[name], &whole) != nil || whole["fetch"] == nil {
t.Fatalf("the key names %q with result %.80s, %d keeps; want the object %s holding the whole check answer, kept once", step.AnswerObject, step.Result, keeps, name)
}
default:
var rest sdkstep.RunAnswer
if step.OutputObject != name || keeps != 1 || string(kept[name]) != c.keyObject || json.Unmarshal(step.Result, &rest) != nil || rest.Output != nil || rest.Key != c.answer.Key {
t.Fatalf("the key names %q with result %.80s, %d keeps; want the object %s holding the output, kept once, and the run answer without it", step.OutputObject, step.Result, keeps, name)
if step.AnswerObject != name || keeps != 1 || string(kept[name]) != c.keyObject || json.Unmarshal(step.Result, &rest) != nil || rest.Output != nil || rest.Key != c.answer.Key {
t.Fatalf("the key names %q with result %.80s, %d keeps; want the object %s holding the output, kept once, and the run answer without it", step.AnswerObject, step.Result, keeps, name)
}
}
})
@@ -60,22 +60,22 @@ func SeatTools(seat, what string, p *Puller) []stdio.Tool {
}
}
// OutputTool serves `<seat>.output` (design 47 G A-254, A-257): a run's answer by its ask, as the object the holder keeps it in
// (sdkstep.OutputObjectName), read with read, which answers nil for none. The verb's answer is marked chunks: the bundle answers
// the whole answer as the member `file` (base64) and the tool runner sends it in chunks and answers their count; an ask
// whose answer this node does not keep answers no chunks.
func OutputTool(seat string, read func(object string) ([]byte, error)) stdio.Tool {
return stdio.Tool{Name: seat + ".output",
Description: "A run's answer by its ask, when its step-ended named it as an output-object: the answer's bytes in chunks, of any size.",
// AnswerTool serves `<seat>.answer` (design 47 G A-254, A-257; H2 H-A-412 addendum): a step's end over what its key or
// step-ended carries, by its ask, as the object the holder keeps it in (sdkstep.AnswerObjectName), read with read, which
// answers nil for none. The verb's answer is marked chunks: the bundle answers the whole end as the member `file` (base64)
// and the tool runner sends it in chunks and answers their count; an ask whose end this node does not keep answers no chunks.
func AnswerTool(seat string, read func(object string) ([]byte, error)) stdio.Tool {
return stdio.Tool{Name: seat + "." + sdkstep.AnswerVerb,
Description: "A step's answer by its ask, when its step key or step-ended named it as an answer-object: the kept end's bytes in chunks, of any size.",
Input: map[string]any{"type": "object", "required": []string{"ask", "call"}, "properties": map[string]any{
"ask": map[string]any{"type": "string", "description": "the ask's id"},
"call": map[string]any{"type": "string", "description": "the subject token of this send's chunks"}}},
Run: func(args map[string]any) (any, error) {
ask, _ := args["ask"].(string)
if ask == "" {
return nil, errors.New("the verb output is asked for no ask")
return nil, errors.New("the verb answer is asked for no ask")
}
body, err := read(sdkstep.OutputObjectName(ask))
body, err := read(sdkstep.AnswerObjectName(ask))
if err != nil {
return nil, err
}
@@ -72,12 +72,12 @@ func TestSeatToolsCurrentPauseResume(t *testing.T) {
}
}
// Design 47 G A-254: `<seat>.output` answers a run's answer by its ask as the whole file (base64), which the tool runner sends in
// Design 47 G A-254, H2 H-A-412 addendum: `<seat>.answer` answers a step's kept end by its ask as the whole file (base64), which the tool runner sends in
// chunks (A-257); an ask this node keeps no answer of answers no chunks.
func TestOutputToolAnswersTheKeptAnswer(t *testing.T) {
kept := map[string][]byte{sdkstep.OutputObjectName("a1"): []byte(`{"verdict":"x"}`)}
tool := OutputTool("node-build-go", func(object string) ([]byte, error) { return kept[object], nil })
if tool.Name != "node-build-go.output" {
func TestAnswerToolAnswersTheKeptAnswer(t *testing.T) {
kept := map[string][]byte{sdkstep.AnswerObjectName("a1"): []byte(`{"verdict":"x"}`)}
tool := AnswerTool("node-build-go", func(object string) ([]byte, error) { return kept[object], nil })
if tool.Name != "node-build-go.answer" {
t.Fatalf("name %q", tool.Name)
}
got, err := tool.Run(map[string]any{"ask": "a1", "call": "c"})
+6 -6
View File
@@ -21,7 +21,7 @@ import (
type Put func(key string, value any) (uint64, error)
// Keep keeps a step's answer that is over what the steps state holds per value as the object named object in the build
// module's outputs store (design 47 G A-290), the object the seat's verb output answers: Puller.KeepOutput, KeepOutputIn.
// module's steps objects (design 47 G A-290, H2 H-A-412), the object the seat's verb answer answers: Puller.KeepAnswer, KeepAnswerIn.
type Keep func(object string, body []byte) error
// EndAttempts and EndRetry bound how a step's end is written: a write that fails is tried again, since the end
@@ -122,7 +122,7 @@ func finish(put Put, keep Keep, key string, step sdkstep.Step, result any, err e
if step.Reason != "" {
why = fmt.Sprintf("the step ended %s (%s), and its end could not be written: %v", ended, step.Reason, werr)
}
step.State, step.Reason, step.Result, step.OutputObject = sdkstep.StepFailed, why, nil, ""
step.State, step.Reason, step.Result, step.AnswerObject = sdkstep.StepFailed, why, nil, ""
if ferr := writeEnd(put, key, step); ferr != nil {
if logf != nil {
logf("the failed end of the step %s could not be written either: %v", key, ferr)
@@ -134,7 +134,7 @@ func finish(put Put, keep Keep, key string, step sdkstep.Step, result any, err e
// keepOver is step as its key keeps it (design 47 G A-290): a value within what the steps state holds per value
// (kvlimit.ModuleStateValueBytes less the headers' room) keeps its answer itself; over it, the answer is kept with keep as the
// object sdkstep.OutputObjectName(step.ID), which the key names as its output-object: a run's output, the key keeping the
// object sdkstep.AnswerObjectName(step.ID), which the key names as its answer-object: a run's output, the key keeping the
// run answer without it, else the whole answer, the key's result then empty. A step whose answer cannot be kept ends failed,
// saying why, with no answer, so it never reads passed where its answer is lost.
func keepOver(keep Keep, step sdkstep.Step, result any) sdkstep.Step {
@@ -142,7 +142,7 @@ func keepOver(keep Keep, step sdkstep.Step, result any) sdkstep.Step {
if err != nil || len(step.Result) == 0 || kvlimit.Check("steps", "", len(raw), kvlimit.ModuleStateValueBytes) == nil {
return step
}
object, body, rest := sdkstep.OutputObjectName(step.ID), []byte(step.Result), json.RawMessage(nil)
object, body, rest := sdkstep.AnswerObjectName(step.ID), []byte(step.Result), json.RawMessage(nil)
if ans, ok := runAnswerIn(result); ok {
body, ans.Output = ans.Output, nil
if rest, err = json.Marshal(ans); err != nil {
@@ -162,7 +162,7 @@ func keepOver(keep Keep, step sdkstep.Step, result any) sdkstep.Step {
if err := keep(object, body); err != nil {
return lost(fmt.Sprintf("the step's answer makes its value %d bytes, over what the steps state holds, and could not be kept as the object %s: %v", len(raw), object, err))
}
step.Result, step.OutputObject = rest, object
step.Result, step.AnswerObject = rest, object
return step
}
@@ -187,7 +187,7 @@ func runAnswerIn(result any) (sdkstep.RunAnswer, bool) {
// again writes the step as given again after a transport fault: the state again with the run's cause, and when the bus gives
// the ask again (ADR 0664 §1). The key is not ended: its asker keeps waiting on it.
func again(put Put, key string, step sdkstep.Step, err error, delay time.Duration) error {
step.State, step.Reason, step.Passing, step.Result, step.OutputObject = sdkstep.StepAgain, err.Error(), true, nil, ""
step.State, step.Reason, step.Passing, step.Result, step.AnswerObject = sdkstep.StepAgain, err.Error(), true, nil, ""
step.Ended, step.AgainAt = time.Time{}, now().UTC().Add(delay)
return writeEnd(put, key, step)
}