Merge pull request 'fix: serialize graph synthesis request fields' (#163) from codex/wp-403-graph-persistence into main
CI / test (push) Successful in 1m17s
CI / test (push) Successful in 1m17s
This commit was merged in pull request #163.
This commit is contained in:
+26
-26
@@ -53,23 +53,23 @@ type WorkGraph struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ResultCandidate struct {
|
type ResultCandidate struct {
|
||||||
ID string
|
ID string `json:"id"`
|
||||||
GraphID string
|
GraphID string `json:"graph_id"`
|
||||||
GraphRevision int64
|
GraphRevision int64 `json:"graph_revision"`
|
||||||
NodeID GraphNodeID
|
NodeID GraphNodeID `json:"node_id"`
|
||||||
AuthorRunID AgentRunID
|
AuthorRunID AgentRunID `json:"author_run_id"`
|
||||||
ArtifactRefs []EvidenceRef
|
ArtifactRefs []EvidenceRef `json:"artifact_refs"`
|
||||||
EvidenceSummary string
|
EvidenceSummary string `json:"evidence_summary"`
|
||||||
Summary string
|
Summary string `json:"summary"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ConflictSet struct {
|
type ConflictSet struct {
|
||||||
ID string
|
ID string `json:"id"`
|
||||||
GraphID string
|
GraphID string `json:"graph_id"`
|
||||||
GraphRevision int64
|
GraphRevision int64 `json:"graph_revision"`
|
||||||
NodeID GraphNodeID
|
NodeID GraphNodeID `json:"node_id"`
|
||||||
CandidateIDs []string
|
CandidateIDs []string `json:"candidate_ids"`
|
||||||
Resolved bool
|
Resolved bool `json:"resolved"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GraphSynthesisState string
|
type GraphSynthesisState string
|
||||||
@@ -80,16 +80,16 @@ const GraphSynthesisVerified GraphSynthesisState = "VERIFIED"
|
|||||||
// independently verified selection. It is a candidate, not an external action
|
// independently verified selection. It is a candidate, not an external action
|
||||||
// or authority grant.
|
// or authority grant.
|
||||||
type GraphSynthesisCandidate struct {
|
type GraphSynthesisCandidate struct {
|
||||||
ID string
|
ID string `json:"id"`
|
||||||
GraphID string
|
GraphID string `json:"graph_id"`
|
||||||
GraphRevision int64
|
GraphRevision int64 `json:"graph_revision"`
|
||||||
NodeID GraphNodeID
|
NodeID GraphNodeID `json:"node_id"`
|
||||||
CandidateIDs []string
|
CandidateIDs []string `json:"candidate_ids"`
|
||||||
SelectedCandidateID string
|
SelectedCandidateID string `json:"selected_candidate_id"`
|
||||||
DissentCandidateIDs []string
|
DissentCandidateIDs []string `json:"dissent_candidate_ids"`
|
||||||
VerifierRunID AgentRunID
|
VerifierRunID AgentRunID `json:"verifier_run_id"`
|
||||||
VerifierIdentity string
|
VerifierIdentity string `json:"verifier_identity"`
|
||||||
EvidenceRefs []EvidenceRef
|
EvidenceRefs []EvidenceRef `json:"evidence_refs"`
|
||||||
Summary string
|
Summary string `json:"summary"`
|
||||||
State GraphSynthesisState
|
State GraphSynthesisState `json:"state"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
"risk_tier": "E",
|
"risk_tier": "E",
|
||||||
"intent": "Persist Work Graph result candidates, conflicts and independently verified synthesis through the work owner and expose the governed synthesis runtime path.",
|
"intent": "Persist Work Graph result candidates, conflicts and independently verified synthesis through the work owner and expose the governed synthesis runtime path.",
|
||||||
"requirement_ids": ["WP-403", "Durable graph result evidence", "Durable conflict resolution", "Synthesis runtime endpoint"],
|
"requirement_ids": ["WP-403", "Durable graph result evidence", "Durable conflict resolution", "Synthesis runtime endpoint"],
|
||||||
"allowed_change_scope": {"modules": ["work-agent-execution", "work-storage", "work-graph-runtime"], "paths": ["database/migrations/036_work_graph_result_synthesis.sql", "adapters/postgres/work_repository.go", "modules/work/ports/graph.go", "modules/work/application/graph_runtime.go", "cmd/work-graph-runtime/main.go", "tests/agent_execution/graph_persistence_sql_test.go", "tests/agent_execution/graph_runtime_test.go", "dev/ACTIVE_TASK.json", "dev/tasks/DEV-000189-durable-graph-synthesis-runtime.json"]},
|
"allowed_change_scope": {"modules": ["work-agent-execution", "work-storage", "work-graph-runtime"], "paths": ["contracts/work/graph.go", "database/migrations/036_work_graph_result_synthesis.sql", "adapters/postgres/work_repository.go", "modules/work/ports/graph.go", "modules/work/application/graph_runtime.go", "cmd/work-graph-runtime/main.go", "tests/agent_execution/graph_persistence_sql_test.go", "tests/agent_execution/graph_runtime_test.go", "dev/ACTIVE_TASK.json", "dev/tasks/DEV-000189-durable-graph-synthesis-runtime.json"]},
|
||||||
"forbidden_change_scope": {"paths": ["architecture/**", "security/**", "contracts/authority/**", "modules/epistemics/**", "deploy/**", ".gitea/**"]},
|
"forbidden_change_scope": {"paths": ["architecture/**", "security/**", "contracts/authority/**", "modules/epistemics/**", "deploy/**", ".gitea/**"]},
|
||||||
"allowed_architecture_delta": {"new_cross_module_dependencies": 0, "new_canonical_owners": 0, "new_privileges": 0, "new_third_party_dependencies": 0, "new_database_owner_roles": 1},
|
"allowed_architecture_delta": {"new_cross_module_dependencies": 0, "new_canonical_owners": 0, "new_privileges": 0, "new_third_party_dependencies": 0, "new_database_owner_roles": 1},
|
||||||
"contracts": {"consume": ["Existing Work Graph ResultCandidate/ConflictSet/GraphSynthesisCandidate contracts", "WP-403 independent verifier gate"], "may_change": ["GraphStore persistence port"]},
|
"contracts": {"consume": ["Existing Work Graph ResultCandidate/ConflictSet/GraphSynthesisCandidate contracts", "WP-403 independent verifier gate"], "may_change": ["GraphResult JSON serialization tags", "GraphStore persistence port"]},
|
||||||
"semantic_owner": "work-agent-execution",
|
"semantic_owner": "work-agent-execution",
|
||||||
"canonical_state": ["work.graph_result_candidates", "work.graph_conflicts", "work.graph_synthesis_candidates"],
|
"canonical_state": ["work.graph_result_candidates", "work.graph_conflicts", "work.graph_synthesis_candidates"],
|
||||||
"state_transitions": ["result candidate append -> conflict append -> independently verified synthesis append", "failed verification does not persist a resolved synthesis"],
|
"state_transitions": ["result candidate append -> conflict append -> independently verified synthesis append", "failed verification does not persist a resolved synthesis"],
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package agent_execution_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.cin.su/m/Assistant/contracts/work"
|
"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)
|
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