@@ -1016,7 +1016,7 @@ func (a *simpleProjectAuth) AuthorizeProject(_ string) error {
10161016// ─── REQ-006, REQ-008: Relation payload validation tests (Phase D) ───────────
10171017
10181018// TestHandleMutationPush_ValidRelation_Returns200 (D.1a) verifies REQ-006 happy
1019- // path: a complete relation payload with all 6 required fields returns HTTP 200.
1019+ // path: a complete relation payload with all required fields returns HTTP 200.
10201020func TestHandleMutationPush_ValidRelation_Returns200 (t * testing.T ) {
10211021 ms := newFakeMutationStore ()
10221022 srv := newMutationTestServer (ms , "secret" , []string {"proj-a" })
@@ -1025,6 +1025,7 @@ func TestHandleMutationPush_ValidRelation_Returns200(t *testing.T) {
10251025 "sync_id": "rel-001",
10261026 "source_id": "obs-src-001",
10271027 "target_id": "obs-tgt-001",
1028+ "relation": "conflicts_with",
10281029 "judgment_status": "judged",
10291030 "marked_by_actor": "alice",
10301031 "marked_by_kind": "human",
@@ -1063,6 +1064,7 @@ func TestHandleMutationPush_RelationMissingEachRequiredField(t *testing.T) {
10631064 payload : json .RawMessage (`{
10641065 "source_id": "obs-src",
10651066 "target_id": "obs-tgt",
1067+ "relation": "conflicts_with",
10661068 "judgment_status": "judged",
10671069 "marked_by_actor": "alice",
10681070 "marked_by_kind": "human"
@@ -1073,6 +1075,7 @@ func TestHandleMutationPush_RelationMissingEachRequiredField(t *testing.T) {
10731075 payload : json .RawMessage (`{
10741076 "sync_id": "rel-001",
10751077 "target_id": "obs-tgt",
1078+ "relation": "conflicts_with",
10761079 "judgment_status": "judged",
10771080 "marked_by_actor": "alice",
10781081 "marked_by_kind": "human"
@@ -1083,6 +1086,18 @@ func TestHandleMutationPush_RelationMissingEachRequiredField(t *testing.T) {
10831086 payload : json .RawMessage (`{
10841087 "sync_id": "rel-001",
10851088 "source_id": "obs-src",
1089+ "relation": "conflicts_with",
1090+ "judgment_status": "judged",
1091+ "marked_by_actor": "alice",
1092+ "marked_by_kind": "human"
1093+ }` ),
1094+ },
1095+ {
1096+ name : "relation" ,
1097+ payload : json .RawMessage (`{
1098+ "sync_id": "rel-001",
1099+ "source_id": "obs-src",
1100+ "target_id": "obs-tgt",
10861101 "judgment_status": "judged",
10871102 "marked_by_actor": "alice",
10881103 "marked_by_kind": "human"
@@ -1094,6 +1109,7 @@ func TestHandleMutationPush_RelationMissingEachRequiredField(t *testing.T) {
10941109 "sync_id": "rel-001",
10951110 "source_id": "obs-src",
10961111 "target_id": "obs-tgt",
1112+ "relation": "conflicts_with",
10971113 "marked_by_actor": "alice",
10981114 "marked_by_kind": "human"
10991115 }` ),
@@ -1104,6 +1120,7 @@ func TestHandleMutationPush_RelationMissingEachRequiredField(t *testing.T) {
11041120 "sync_id": "rel-001",
11051121 "source_id": "obs-src",
11061122 "target_id": "obs-tgt",
1123+ "relation": "conflicts_with",
11071124 "judgment_status": "judged",
11081125 "marked_by_kind": "human"
11091126 }` ),
@@ -1114,6 +1131,7 @@ func TestHandleMutationPush_RelationMissingEachRequiredField(t *testing.T) {
11141131 "sync_id": "rel-001",
11151132 "source_id": "obs-src",
11161133 "target_id": "obs-tgt",
1134+ "relation": "conflicts_with",
11171135 "judgment_status": "judged",
11181136 "marked_by_actor": "alice"
11191137 }` ),
@@ -1145,7 +1163,7 @@ func TestHandleMutationPush_RelationMissingEachRequiredField(t *testing.T) {
11451163 }
11461164 // Verify the missing field name appears in the response
11471165 var resp struct {
1148- Error string `json:"error"`
1166+ Error string `json:"error"`
11491167 Invalid []struct {
11501168 Field string `json:"field"`
11511169 Index int `json:"index"`
@@ -1175,6 +1193,7 @@ func TestHandleMutationPush_PartialBatch_Atomic(t *testing.T) {
11751193 "sync_id": "rel-001",
11761194 "source_id": "obs-src-001",
11771195 "target_id": "obs-tgt-001",
1196+ "relation": "conflicts_with",
11781197 "judgment_status": "judged",
11791198 "marked_by_actor": "alice",
11801199 "marked_by_kind": "human"
@@ -1183,6 +1202,7 @@ func TestHandleMutationPush_PartialBatch_Atomic(t *testing.T) {
11831202 invalidPayload := json .RawMessage (`{
11841203 "sync_id": "rel-002",
11851204 "source_id": "obs-src-002",
1205+ "relation": "conflicts_with",
11861206 "judgment_status": "judged",
11871207 "marked_by_actor": "bob",
11881208 "marked_by_kind": "human"
@@ -1576,6 +1596,7 @@ func TestRelationSync_ServerValidation_MissingField(t *testing.T) {
15761596 "sync_id": "rel-g4-001",
15771597 "source_id": "obs-src-g4",
15781598 "target_id": "obs-tgt-g4",
1599+ "relation": "conflicts_with",
15791600 "marked_by_actor": "agent:test",
15801601 "marked_by_kind": "agent"
15811602 }` )
0 commit comments