B1 (H-A-412): a step's oversized end is read as its answer object
The delivery SDK's build-step part keeps a step's end over the steps state's value as the object answer.<ask>, read through the build seat's verb answer; OutputObject is gone. The builder's wait names the answer object it could not read. Builds: design 47 H2 §775, §791; H-A-412
This commit is contained in:
@@ -57,8 +57,8 @@ type Asker struct {
|
||||
Expiry *Expiry
|
||||
// Logf says a drop that failed (the log's Printf when unset): the ask then stays on its stream, and it is said.
|
||||
Logf func(format string, args ...any)
|
||||
// Outputs reads the answer a step's key names as its output-object, being over what the steps state holds (design 47 G
|
||||
// A-290), through the build seat's verb output on the step's node (buildstep.Step.Whole); Wait answers the step whole.
|
||||
// Outputs reads the answer a step's key names as its answer-object, being over what the steps state holds (design 47 G
|
||||
// A-290), through the build seat's verb answer on the step's node (buildstep.Step.Whole; H-A-412); Wait answers the step whole.
|
||||
// Nil reads none: such a step's wait is an error saying so.
|
||||
Outputs buildstep.AskVerb
|
||||
}
|
||||
@@ -337,7 +337,7 @@ func (k Asker) Wait(ctx context.Context, a buildstep.StepAsk) (buildstep.Step, e
|
||||
}
|
||||
whole, err := step.Whole(a.Language, a.Run != nil, k.Outputs)
|
||||
if err != nil {
|
||||
return buildstep.Step{}, fmt.Errorf("the ask %s's step on %s ended %s, and its answer %s cannot be read: %w", a.ID, step.Node, step.State, step.OutputObject, err)
|
||||
return buildstep.Step{}, fmt.Errorf("the ask %s's step on %s ended %s, and its answer %s cannot be read: %w", a.ID, step.Node, step.State, step.AnswerObject, err)
|
||||
}
|
||||
return whole, nil
|
||||
}
|
||||
|
||||
@@ -55,17 +55,17 @@ func TestAnAskerPutsOnceAndReadsTheStep(t *testing.T) {
|
||||
if _, err := k.Ask(context.Background(), goAsk("mvl0frv18d1958")); err == nil || !strings.Contains(err.Error(), "shanks refused: go 1.27 installed") {
|
||||
t.Fatalf("a refused step: %v", err)
|
||||
}
|
||||
// Design 47 G A-290: a step whose key names its answer as the object output.<ask> is answered whole, read through the
|
||||
// build seat's verb output on the step's node; with no verb to read it the wait says so, never the step without its answer.
|
||||
// Design 47 G A-290, H-A-412: a step whose key names its answer as the object answer.<ask> is answered whole, read through the
|
||||
// build seat's verb answer on the step's node; with no verb to read it the wait says so, never the step without its answer.
|
||||
f.Answer = func(a buildstep.StepAsk) buildstep.Step {
|
||||
return buildstep.Step{ID: a.ID, Node: "ace", State: buildstep.StepPassed, OutputObject: buildstep.OutputObjectName(a.ID)}
|
||||
return buildstep.Step{ID: a.ID, Node: "ace", State: buildstep.StepPassed, AnswerObject: buildstep.AnswerObjectName(a.ID)}
|
||||
}
|
||||
var asked string
|
||||
k.Outputs = func(key string, body any) (json.RawMessage, error) {
|
||||
asked = key
|
||||
return json.RawMessage(`{"ask":"` + body.(map[string]any)["ask"].(string) + `","file":"eyJhcnRpZmFjdHMiOltdfQ=="}`), nil
|
||||
}
|
||||
if step, err := k.Ask(context.Background(), goAsk("mvl0frv18d1961")); err != nil || string(step.Result) != `{"artifacts":[]}` || step.OutputObject != "" || asked != "seat:node-build-go.output@ace" {
|
||||
if step, err := k.Ask(context.Background(), goAsk("mvl0frv18d1961")); err != nil || string(step.Result) != `{"artifacts":[]}` || step.AnswerObject != "" || asked != "seat:node-build-go.answer@ace" {
|
||||
t.Fatalf("a step whose answer is an object: %+v, %v, asked %q", step, err, asked)
|
||||
}
|
||||
k.Outputs = nil
|
||||
|
||||
Reference in New Issue
Block a user