BM4b: the build modules keep an oversized end in steps-objects, read by the verb answer
The delivery SDK replaced the output chunks with the verb answer over the steps state's objects and output at form 2: each build module keeps an end over the steps state's value with KeepAnswerIn, serves AnswerTool and OutputTool over its steps state, and its steps name their outputs objects. Builds: design 47 H2 §791, H-A-412 addendum, H-A-412 second addendum (b), H-A-399 (1)
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
|
||||
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun"
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"git.novox.be/novox/mesh-sdk/go/busstate"
|
||||
)
|
||||
|
||||
// **The module pulls its seat's asks** (novox/hq ADR 0525 §2-§6, ADR 0536 §4; issue 1887 A3go). It holds the seat
|
||||
@@ -50,9 +51,19 @@ func (m *Module) askSteps(steps []StepTool) steprun.AskSteps {
|
||||
Lint: m.lintStep,
|
||||
Node: m.Node,
|
||||
SayStep: m.sayStep(),
|
||||
Outputs: m.outputs(),
|
||||
}
|
||||
}
|
||||
|
||||
// outputs are the outputs objects a test step keeps its run's output in and the verb output reads (design 47 H2 §791,
|
||||
// §820): Outputs when a test sets it, else the module's own objects store on the bus.
|
||||
func (m *Module) outputs() steprun.OutputObjects {
|
||||
if m.Outputs != nil {
|
||||
return m.Outputs
|
||||
}
|
||||
return busstate.ObjectsOf(steprun.OutputsStore)
|
||||
}
|
||||
|
||||
// Puller is the module's pull of its seat's asks, on source (the runtime's seat pull when nil).
|
||||
func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Puller {
|
||||
if source == nil {
|
||||
@@ -88,7 +99,7 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul
|
||||
if m.SayEvent != nil {
|
||||
say = steprun.SayOn(sdkstep.AskGo, m.Node, m.SayEvent)
|
||||
}
|
||||
return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskGo, Say: say, Prior: steprun.PriorRuns(m.ReadSteps.Get), Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys,
|
||||
return &steprun.Puller{KeepAnswer: steprun.KeepAnswerIn(m.Answers), Source: source, Language: sdkstep.AskGo, Say: say, Prior: steprun.PriorRuns(m.ReadSteps.Get), Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys,
|
||||
Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Logf: m.Say, Has: m.Has,
|
||||
Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) {
|
||||
if err := m.Check(ctx); err != nil {
|
||||
@@ -109,7 +120,8 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul
|
||||
|
||||
// SeatTools are the seat's verbs on this node (ADR 0525 §10): what it runs, and its pause and resume.
|
||||
func (m *Module) SeatTools(p *steprun.Puller) []stdio.Tool {
|
||||
return append(steprun.SeatTools(Seat, "Go", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, steprun.ReadOutputFrom(m.Outputs)))
|
||||
return append(steprun.SeatTools(Seat, "Go", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, m.Node, m.outputs(), steprun.EndedHere(m.Node, m.ReadSteps.Keys, m.ReadSteps.Get)),
|
||||
steprun.AnswerTool(Seat, steprun.ReadAnswerFrom(m.Answers)))
|
||||
}
|
||||
|
||||
// StepEndTool ends one step left running (issue 1890); the module's steps state is the one it reads and writes.
|
||||
|
||||
@@ -142,7 +142,7 @@ func mustJSON(v any) []byte { b, _ := json.Marshal(v); return b }
|
||||
// the node's build capacity as a setting, with the builder's default; the seat's verbs are served as its tools.
|
||||
func TestManifestClaimsTheGoBuildSeatAndReadsItsCapacity(t *testing.T) {
|
||||
m := readManifest(t)
|
||||
if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output"}) {
|
||||
if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"}) {
|
||||
t.Fatalf("claims = %+v", m.Claims)
|
||||
}
|
||||
if len(m.Reads) != 0 {
|
||||
|
||||
@@ -70,7 +70,7 @@ func main() {
|
||||
m.ReadEntry = askEntry
|
||||
m.AskInput = stdio.Ask
|
||||
m.KeptBuilds = busstate.ObjectsOf(KeptBuildsStore)
|
||||
m.Outputs = busstate.ObjectsOf(steprun.OutputsStore)
|
||||
m.Answers = busstate.ObjectsOf(steprun.AnswersStore)
|
||||
m.Self = strings.TrimSpace(os.Getenv("MESH_MODULE"))
|
||||
m.Probe = ProbeGo(m.Home, m.Cache)
|
||||
m.Bubblewrap = ProbeBubblewrap
|
||||
|
||||
@@ -124,7 +124,11 @@ type Module struct {
|
||||
// KeptBuilds is the object store of the builds kept for the artifact store's holder (keptbuilds.go); nil keeps none.
|
||||
// Self is this module's name as the runtime launched it (MESH_MODULE), the first part of the store's name on the bus.
|
||||
KeptBuilds KeptObjects
|
||||
// Outputs is the object store of a run's answers over what step-ended carries inline (steprun.OutputsStore); nil keeps none.
|
||||
// Answers is the steps state's objects (steprun.AnswersStore), where a step's end over what its key or step-ended
|
||||
// carries is kept and the seat's verb answer reads it (design 47 H2 H-A-412 addendum); nil keeps none.
|
||||
Answers steprun.OutputObjects
|
||||
// Outputs are the outputs objects (steprun.OutputsStore) a test step keeps a run's output in, which the verb output
|
||||
// reads (design 47 H2 §791); nil is the module's own on the bus (outputs), a test sets its own.
|
||||
Outputs steprun.OutputObjects
|
||||
Self string
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
"resume",
|
||||
"steps",
|
||||
"kept-artifact",
|
||||
"output"
|
||||
"output",
|
||||
"answer"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
|
||||
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun"
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"git.novox.be/novox/mesh-sdk/go/busstate"
|
||||
)
|
||||
|
||||
// **The module pulls its seat's asks** (novox/hq ADR 0525 §2-§6; issue 1887 A3image), as mesh-build-go does: the seat
|
||||
@@ -33,9 +34,19 @@ func (m *Module) askSteps(steps []StepTool) steprun.AskSteps {
|
||||
Logf: m.Say,
|
||||
Node: m.Node,
|
||||
SayStep: m.sayStep(),
|
||||
Outputs: m.outputs(),
|
||||
}
|
||||
}
|
||||
|
||||
// outputs are the outputs objects a test step keeps its run's output in and the verb output reads (design 47 H2 §791,
|
||||
// §820): Outputs when a test sets it, else the module's own objects store on the bus.
|
||||
func (m *Module) outputs() steprun.OutputObjects {
|
||||
if m.Outputs != nil {
|
||||
return m.Outputs
|
||||
}
|
||||
return busstate.ObjectsOf(steprun.OutputsStore)
|
||||
}
|
||||
|
||||
// sayStep says a step ask's end on this node's subject of the seat (design 47 G §24): an image has no lint, unit or integration
|
||||
// step (§328), so none is asked of this seat, but the steps of every build module can say their ends, which the kit holds.
|
||||
func (m *Module) sayStep() func(sdkstep.StepEnded) error {
|
||||
@@ -77,7 +88,7 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul
|
||||
if m.SayEvent != nil {
|
||||
say = steprun.SayOn(sdkstep.AskImage, m.Node, m.SayEvent)
|
||||
}
|
||||
return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskImage, Say: say, Prior: steprun.PriorRuns(m.ReadSteps.Get), Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys,
|
||||
return &steprun.Puller{KeepAnswer: steprun.KeepAnswerIn(m.Answers), Source: source, Language: sdkstep.AskImage, Say: say, Prior: steprun.PriorRuns(m.ReadSteps.Get), Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys,
|
||||
Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Eligible: m.Eligible, Logf: m.Say,
|
||||
Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) {
|
||||
if err := m.Check(ctx); err != nil {
|
||||
@@ -92,7 +103,8 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul
|
||||
|
||||
// SeatTools are the seat's verbs on this node (ADR 0525 §10).
|
||||
func (m *Module) SeatTools(p *steprun.Puller) []stdio.Tool {
|
||||
return append(steprun.SeatTools(Seat, "image", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, steprun.ReadOutputFrom(m.Outputs)))
|
||||
return append(steprun.SeatTools(Seat, "image", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, m.Node, m.outputs(), steprun.EndedHere(m.Node, m.ReadSteps.Keys, m.ReadSteps.Get)),
|
||||
steprun.AnswerTool(Seat, steprun.ReadAnswerFrom(m.Answers)))
|
||||
}
|
||||
|
||||
// StepEndTool ends one step left running (issue 1890); the module's steps state is the one it reads and writes.
|
||||
|
||||
@@ -67,7 +67,7 @@ func main() {
|
||||
logf("announcing the states it keeps: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
m.Outputs = busstate.ObjectsOf(steprun.OutputsStore)
|
||||
m.Answers = busstate.ObjectsOf(steprun.AnswersStore)
|
||||
steps := m.StepTools()
|
||||
booted := time.Now()
|
||||
puller := m.Puller(steps, nil)
|
||||
|
||||
@@ -136,7 +136,7 @@ func TestManifestKeepsItsStatesClaimsItsBuildSeatAndDeclaresItsHealthTool(t *tes
|
||||
if want := []string{"keys", MirrorWaitsState, "pauses"}; !slices.Equal(states, want) {
|
||||
t.Errorf("state = %v, want %v", states, want)
|
||||
}
|
||||
if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output"}) {
|
||||
if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"}) {
|
||||
t.Errorf("claims = %v, want the seat %s alone", m.Claims, Seat)
|
||||
}
|
||||
raw, _ := os.ReadFile(filepath.Join(moduleDir, "module.json"))
|
||||
|
||||
@@ -20,7 +20,11 @@ const CheckRound = 10 * time.Minute
|
||||
|
||||
// Module is the image build module's one running state.
|
||||
type Module struct {
|
||||
// Outputs is the object store of a run's answers over what step-ended carries inline (steprun.OutputsStore); nil keeps none.
|
||||
// Answers is the steps state's objects (steprun.AnswersStore), where a step's end over what its key or step-ended
|
||||
// carries is kept and the seat's verb answer reads it (design 47 H2 H-A-412 addendum); nil keeps none.
|
||||
Answers steprun.OutputObjects
|
||||
// Outputs are the outputs objects (steprun.OutputsStore) a test step keeps a run's output in, which the verb output
|
||||
// reads (design 47 H2 §791); nil is the module's own on the bus (outputs), a test sets its own.
|
||||
Outputs steprun.OutputObjects
|
||||
// SayEvent publishes an event of the image build seat on a seat subject (stdio.SeatPublish; nil says none, a test's): the
|
||||
// puller's ask-taken, step-progress and step-ended (design 47 G §496, §602).
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
{
|
||||
"name": "node-build-image",
|
||||
"scope": "node",
|
||||
"serves": ["current", "drop", "pause", "resume", "steps", "kept-artifact", "output"]
|
||||
"serves": ["current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"]
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
|
||||
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun"
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
"git.novox.be/novox/mesh-sdk/go/busstate"
|
||||
)
|
||||
|
||||
// **The module pulls its seat's asks** (novox/hq ADR 0525 §2-§6, ADR 0536 §4; issue 1887 A3node), as mesh-build-go
|
||||
@@ -45,9 +46,19 @@ func (m *Module) askSteps(steps []StepTool) steprun.AskSteps {
|
||||
Lint: m.lintStep,
|
||||
Node: m.Node,
|
||||
SayStep: m.sayStep(),
|
||||
Outputs: m.outputs(),
|
||||
}
|
||||
}
|
||||
|
||||
// outputs are the outputs objects a test step keeps its run's output in and the verb output reads (design 47 H2 §791,
|
||||
// §820): Outputs when a test sets it, else the module's own objects store on the bus.
|
||||
func (m *Module) outputs() steprun.OutputObjects {
|
||||
if m.Outputs != nil {
|
||||
return m.Outputs
|
||||
}
|
||||
return busstate.ObjectsOf(steprun.OutputsStore)
|
||||
}
|
||||
|
||||
// sayStep says a pipeline step's end on this node's subject of the seat (design 47 G §24, *Asked on a work queue, ended by an
|
||||
// event*): SayStep when a test sets it, else the runtime's seat publish.
|
||||
func (m *Module) sayStep() func(sdkstep.StepEnded) error {
|
||||
@@ -89,7 +100,7 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul
|
||||
if m.SayEvent != nil {
|
||||
say = steprun.SayOn(sdkstep.AskNode, m.Node, m.SayEvent)
|
||||
}
|
||||
return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskNode, Say: say, Prior: steprun.PriorRuns(m.ReadSteps.Get), Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys,
|
||||
return &steprun.Puller{KeepAnswer: steprun.KeepAnswerIn(m.Answers), Source: source, Language: sdkstep.AskNode, Say: say, Prior: steprun.PriorRuns(m.ReadSteps.Get), Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys,
|
||||
Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Logf: m.Say,
|
||||
Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) {
|
||||
if err := m.Prepare(ctx); err != nil {
|
||||
@@ -104,7 +115,8 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul
|
||||
|
||||
// SeatTools are the seat's verbs on this node (ADR 0525 §10).
|
||||
func (m *Module) SeatTools(p *steprun.Puller) []stdio.Tool {
|
||||
return append(steprun.SeatTools(Seat, "Node", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, steprun.ReadOutputFrom(m.Outputs)))
|
||||
return append(steprun.SeatTools(Seat, "Node", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, m.Node, m.outputs(), steprun.EndedHere(m.Node, m.ReadSteps.Keys, m.ReadSteps.Get)),
|
||||
steprun.AnswerTool(Seat, steprun.ReadAnswerFrom(m.Answers)))
|
||||
}
|
||||
|
||||
// StepEndTool ends one step left running (issue 1890); the module's steps state is the one it reads and writes.
|
||||
|
||||
@@ -79,7 +79,7 @@ func main() {
|
||||
logf("announcing the states it keeps: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
m.Outputs = busstate.ObjectsOf(steprun.OutputsStore)
|
||||
m.Answers = busstate.ObjectsOf(steprun.AnswersStore)
|
||||
steps := m.StepTools()
|
||||
booted := time.Now()
|
||||
puller := m.Puller(steps, nil)
|
||||
|
||||
@@ -118,7 +118,7 @@ func TestManifestKeepsItsStatesClaimsItsBuildSeatAndDeclaresItsHealthTool(t *tes
|
||||
if want := []string{"keys", "pauses", "toolchains"}; !slices.Equal(states, want) {
|
||||
t.Errorf("state = %v, want %v", states, want)
|
||||
}
|
||||
if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output"}) {
|
||||
if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"}) {
|
||||
t.Errorf("claims = %v, want the seat %s alone", m.Claims, Seat)
|
||||
}
|
||||
if !slices.Contains(m.Tools, HealthTool) {
|
||||
|
||||
@@ -25,7 +25,11 @@ const CheckRound = 10 * time.Minute
|
||||
// Module is the Node build module's one running state: the node it runs on, its recipe, the toolchain guard, the
|
||||
// toolchain directory and the states it writes (toolchains, steps).
|
||||
type Module struct {
|
||||
// Outputs is the object store of a run's answers over what step-ended carries inline (steprun.OutputsStore); nil keeps none.
|
||||
// Answers is the steps state's objects (steprun.AnswersStore), where a step's end over what its key or step-ended
|
||||
// carries is kept and the seat's verb answer reads it (design 47 H2 H-A-412 addendum); nil keeps none.
|
||||
Answers steprun.OutputObjects
|
||||
// Outputs are the outputs objects (steprun.OutputsStore) a test step keeps a run's output in, which the verb output
|
||||
// reads (design 47 H2 §791); nil is the module's own on the bus (outputs), a test sets its own.
|
||||
Outputs steprun.OutputObjects
|
||||
// SayEvent publishes an event of the node build seat on a seat subject (stdio.SeatPublish; nil says none, a test's): the
|
||||
// puller's ask-taken, step-progress and step-ended (design 47 G §496, §602).
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
{
|
||||
"name": "node-build-node",
|
||||
"scope": "node",
|
||||
"serves": ["current", "drop", "pause", "resume", "steps", "kept-artifact", "output"]
|
||||
"serves": ["current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"]
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
|
||||
Reference in New Issue
Block a user