node-engine seat: compose-candidate is a verb marked chunks; its ask carries a call token and its answer names the chunks (A-237b)

Builds: design 47 G (G-22 lead answers 2) A-237b; A-237, A-249
This commit is contained in:
2026-11-16 14:36:46 +01:00
parent 2db6e5df49
commit 0806ca5d05
4 changed files with 42 additions and 3 deletions
@@ -157,3 +157,24 @@ func TestCandidateKeysOfTheThreeFormsRoundTripAndRefuse(t *testing.T) {
t.Errorf("an ask naming a revision: %v", err)
}
}
// A-237b: compose-candidate is a verb marked chunks: an ask carries the caller's call token, and an answer names the chunks the
// composition input is sent in; the inline input stays for an ask with no token.
func TestComposeCandidateAskAndAnswerCarryTheChunkedForm(t *testing.T) {
key, _ := RevisionKey("main", 7)
ask, err := EncodeAsk(seat.ComposeCandidateInput{Candidate: key, Input: true, Call: "0123456789abcdef0123456789abcdef"})
if err != nil {
t.Fatal(err)
}
back, err := DecodeAsk(ask)
if err != nil || back.Call != "0123456789abcdef0123456789abcdef" || !back.Input {
t.Errorf("the ask came back as %+v (%v)", back, err)
}
raw, err := EncodeAnswer(seat.ComposeCandidateAnswer{Node: "n1", Candidate: key, Verdict: Composed, Modules: []seat.Module{}, Own: seat.Module{Module: NodeWord, State: ModuleComposed, Digest: "sha256:" + strings.Repeat("a", 64)}, Chunks: 3})
if err != nil {
t.Fatal(err)
}
if a, err := DecodeAnswer(raw); err != nil || a.Chunks != 3 || a.Input != nil {
t.Errorf("the answer came back as %+v (%v)", a, err)
}
}