diff --git a/modules/mesh-delivery-checker/internal/check/engines.go b/modules/mesh-delivery-checker/internal/check/engines.go index 2e077789..7b7f1909 100644 --- a/modules/mesh-delivery-checker/internal/check/engines.go +++ b/modules/mesh-delivery-checker/internal/check/engines.go @@ -214,7 +214,13 @@ func (e EngineCompositions) inSandbox(ctx context.Context, c *Case, head, node s delete(verdicts, name) // a manifest the change brings is the checker's own judge's (ADR 0578 ยง2) } } - req := composer.Request{V: composer.Version, Input: a.Input, Depth: composer.DepthCompose, Machines: []string{node}, + // The answer carries its input as the object the seat's contract names, decoded with its numbers as written + // (json.Number), so encoding it again gives the composer the same values the engine sent. + input, err := json.Marshal(a.Input) + if err != nil { + return a, fmt.Errorf("the engine of %s answered a composition input that cannot be encoded again: %w", node, err) + } + req := composer.Request{V: composer.Version, Input: input, Depth: composer.DepthCompose, Machines: []string{node}, Cases: []composer.Case{{Name: "change", Manifests: manifests, Verdicts: verdicts}}} raw, err := json.Marshal(req) if err != nil { diff --git a/modules/mesh-delivery-checker/internal/check/engines_test.go b/modules/mesh-delivery-checker/internal/check/engines_test.go index fed2774f..18f5ac10 100644 --- a/modules/mesh-delivery-checker/internal/check/engines_test.go +++ b/modules/mesh-delivery-checker/internal/check/engines_test.go @@ -143,7 +143,7 @@ func TestTheCompositionIsMadeFromTheEnginesAnswers(t *testing.T) { } host := CaseOf(c, map[string]string{repoA: trunkA, nodeEngineRepo: trunkA}) withInput := composed("anchor") - withInput.Input = json.RawMessage(`{"nodes":[{"name":"anchor"}]}`) + withInput.Input = map[string]any{"nodes": []any{map[string]any{"name": "anchor"}}} e := &fakeEngines{answers: map[string]delivery.ComposeCandidateAnswer{"anchor": withInput}} sb := &fakeSandbox{v: func(node string) composer.Verdict { return composer.Verdict{V: composer.Version, Cases: []composer.CaseVerdict{{Name: "change", @@ -162,7 +162,7 @@ func TestTheCompositionIsMadeFromTheEnginesAnswers(t *testing.T) { var req composer.Request _ = json.Unmarshal(job.Request, &req) if job.Fetch["repository"] != nodeEngineRepo || job.Fetch["commit"] != head2 || job.Package != composer.Package || - string(req.Input) != string(withInput.Input) || req.Cases[0].Manifests["web"].Digest == "" { + string(req.Input) != `{"nodes":[{"name":"anchor"}]}` || req.Cases[0].Manifests["web"].Digest == "" { t.Errorf("job = %+v, request %+v", job, req) } if v.State != delivery.CompositionFail || v.SDK != head2 || !strings.Contains(v.Words, "the new composer refuses it") {