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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user