fix: serialize graph synthesis request fields
This commit is contained in:
@@ -2,7 +2,9 @@ package agent_execution_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.cin.su/m/Assistant/contracts/work"
|
||||
@@ -81,3 +83,14 @@ func TestSynthesizeGraphPersistsVerifiedDissent(t *testing.T) {
|
||||
t.Fatalf("unexpected runtime synthesis: conflict=%+v synthesis=%+v stored=%+v err=%v", conflict, synthesis, store.conflict, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGraphSynthesisJSONUsesStableSnakeCaseContract(t *testing.T) {
|
||||
payload, err := json.Marshal(application.GraphSynthesisRequest{Conflict: work.ConflictSet{ID: "c", GraphID: "g", GraphRevision: 1, NodeID: "n", CandidateIDs: []string{"a", "b"}}, SelectedCandidate: "a", VerifierRunID: "v", VerifierIdentity: "independent", EvidenceRefs: []work.EvidenceRef{"e"}, Summary: "s", Verified: true})
|
||||
if err != nil || !strings.Contains(string(payload), `"graph_id":"g"`) || !strings.Contains(string(payload), `"selected_candidate_id":"a"`) {
|
||||
t.Fatalf("unexpected synthesis JSON: %s err=%v", payload, err)
|
||||
}
|
||||
var decoded application.GraphSynthesisRequest
|
||||
if err := json.Unmarshal(payload, &decoded); err != nil || decoded.Conflict.GraphID != "g" || decoded.SelectedCandidate != "a" || !decoded.Verified {
|
||||
t.Fatalf("snake_case request did not round-trip: %+v err=%v", decoded, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user