From 9cbf5f5a45adde2edc669c47b27e0f79bfa26e3b Mon Sep 17 00:00:00 2001 From: David Ahmann Date: Fri, 27 Feb 2026 18:07:30 -0500 Subject: [PATCH] fix: preserve legacy relations alias and relax envelope schema --- core/record/record.go | 3 ++- core/schema/v1/proof-record-v1.schema.json | 27 +++++++------------ .../v1/relationship_envelope.schema.json | 27 +++++++------------ proof_test.go | 5 +++- schemas/v1/proof-record-v1.schema.json | 27 +++++++------------ schemas/v1/relationship_envelope.schema.json | 27 +++++++------------ 6 files changed, 42 insertions(+), 74 deletions(-) diff --git a/core/record/record.go b/core/record/record.go index c4abac2..39495b3 100644 --- a/core/record/record.go +++ b/core/record/record.go @@ -32,7 +32,8 @@ func New(opts RecordOpts) (*Record, error) { Event: opts.Event, Controls: opts.Controls, Metadata: opts.Metadata, - Relationship: normalizeRelationship(cloneRelationship(firstRelationship(opts))), + Relationship: normalizeRelationship(cloneRelationship(opts.Relationship)), + Relations: normalizeRelationship(cloneRelationship(opts.Relations)), Integrity: Integrity{}, } if err := Validate(r); err != nil { diff --git a/core/schema/v1/proof-record-v1.schema.json b/core/schema/v1/proof-record-v1.schema.json index 7396488..b4dcc7d 100644 --- a/core/schema/v1/proof-record-v1.schema.json +++ b/core/schema/v1/proof-record-v1.schema.json @@ -26,8 +26,7 @@ "enum": ["trace", "run", "session", "intent", "policy", "agent", "evidence"] }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } }, "entity_refs": { "type": "array", @@ -41,8 +40,7 @@ "enum": ["agent", "tool", "resource", "policy", "run", "trace", "delegation", "evidence"] }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } } }, "policy_ref": { @@ -56,8 +54,7 @@ "uniqueItems": true, "items": { "type": "string", "minLength": 1 } } - }, - "additionalProperties": false + } }, "agent_chain": { "type": "array", @@ -67,8 +64,7 @@ "properties": { "identity": { "type": "string", "minLength": 1 }, "role": { "type": "string", "enum": ["requester", "delegator", "delegate"] } - }, - "additionalProperties": false + } } }, "edges": { @@ -88,8 +84,7 @@ "properties": { "kind": { "type": "string", "minLength": 1 }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } }, "to": { "type": "object", @@ -97,11 +92,9 @@ "properties": { "kind": { "type": "string", "minLength": 1 }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } } - }, - "additionalProperties": false + } } }, "parent_record_id": { "type": "string", "minLength": 1 }, @@ -124,12 +117,10 @@ "agent_id": { "type": "string", "minLength": 1 }, "delegated_by": { "type": "string", "minLength": 1 }, "delegation_record_id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } } } - }, - "additionalProperties": false + } } }, "properties": { diff --git a/core/schema/v1/relationship_envelope.schema.json b/core/schema/v1/relationship_envelope.schema.json index e898099..c30c5cc 100644 --- a/core/schema/v1/relationship_envelope.schema.json +++ b/core/schema/v1/relationship_envelope.schema.json @@ -12,8 +12,7 @@ "enum": ["trace", "run", "session", "intent", "policy", "agent", "evidence"] }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } }, "entity_refs": { "type": "array", @@ -27,8 +26,7 @@ "enum": ["agent", "tool", "resource", "policy", "run", "trace", "delegation", "evidence"] }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } } }, "policy_ref": { @@ -42,8 +40,7 @@ "uniqueItems": true, "items": { "type": "string", "minLength": 1 } } - }, - "additionalProperties": false + } }, "agent_chain": { "type": "array", @@ -53,8 +50,7 @@ "properties": { "identity": { "type": "string", "minLength": 1 }, "role": { "type": "string", "enum": ["requester", "delegator", "delegate"] } - }, - "additionalProperties": false + } } }, "edges": { @@ -74,8 +70,7 @@ "properties": { "kind": { "type": "string", "minLength": 1 }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } }, "to": { "type": "object", @@ -83,11 +78,9 @@ "properties": { "kind": { "type": "string", "minLength": 1 }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } } - }, - "additionalProperties": false + } } }, "parent_record_id": { "type": "string", "minLength": 1 }, @@ -110,10 +103,8 @@ "agent_id": { "type": "string", "minLength": 1 }, "delegated_by": { "type": "string", "minLength": 1 }, "delegation_record_id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } } } - }, - "additionalProperties": false + } } diff --git a/proof_test.go b/proof_test.go index 8a40ac6..9569921 100644 --- a/proof_test.go +++ b/proof_test.go @@ -73,7 +73,10 @@ func TestNewRecordLegacyRelationsAliasAccepted(t *testing.T) { }, }) require.NoError(t, err) - require.NotNil(t, r.Relationship) + raw, err := json.Marshal(r) + require.NoError(t, err) + require.Contains(t, string(raw), `"relations"`) + require.NotContains(t, string(raw), `"relationship"`) } func TestChainTamperDetection(t *testing.T) { diff --git a/schemas/v1/proof-record-v1.schema.json b/schemas/v1/proof-record-v1.schema.json index 7396488..b4dcc7d 100644 --- a/schemas/v1/proof-record-v1.schema.json +++ b/schemas/v1/proof-record-v1.schema.json @@ -26,8 +26,7 @@ "enum": ["trace", "run", "session", "intent", "policy", "agent", "evidence"] }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } }, "entity_refs": { "type": "array", @@ -41,8 +40,7 @@ "enum": ["agent", "tool", "resource", "policy", "run", "trace", "delegation", "evidence"] }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } } }, "policy_ref": { @@ -56,8 +54,7 @@ "uniqueItems": true, "items": { "type": "string", "minLength": 1 } } - }, - "additionalProperties": false + } }, "agent_chain": { "type": "array", @@ -67,8 +64,7 @@ "properties": { "identity": { "type": "string", "minLength": 1 }, "role": { "type": "string", "enum": ["requester", "delegator", "delegate"] } - }, - "additionalProperties": false + } } }, "edges": { @@ -88,8 +84,7 @@ "properties": { "kind": { "type": "string", "minLength": 1 }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } }, "to": { "type": "object", @@ -97,11 +92,9 @@ "properties": { "kind": { "type": "string", "minLength": 1 }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } } - }, - "additionalProperties": false + } } }, "parent_record_id": { "type": "string", "minLength": 1 }, @@ -124,12 +117,10 @@ "agent_id": { "type": "string", "minLength": 1 }, "delegated_by": { "type": "string", "minLength": 1 }, "delegation_record_id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } } } - }, - "additionalProperties": false + } } }, "properties": { diff --git a/schemas/v1/relationship_envelope.schema.json b/schemas/v1/relationship_envelope.schema.json index e898099..c30c5cc 100644 --- a/schemas/v1/relationship_envelope.schema.json +++ b/schemas/v1/relationship_envelope.schema.json @@ -12,8 +12,7 @@ "enum": ["trace", "run", "session", "intent", "policy", "agent", "evidence"] }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } }, "entity_refs": { "type": "array", @@ -27,8 +26,7 @@ "enum": ["agent", "tool", "resource", "policy", "run", "trace", "delegation", "evidence"] }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } } }, "policy_ref": { @@ -42,8 +40,7 @@ "uniqueItems": true, "items": { "type": "string", "minLength": 1 } } - }, - "additionalProperties": false + } }, "agent_chain": { "type": "array", @@ -53,8 +50,7 @@ "properties": { "identity": { "type": "string", "minLength": 1 }, "role": { "type": "string", "enum": ["requester", "delegator", "delegate"] } - }, - "additionalProperties": false + } } }, "edges": { @@ -74,8 +70,7 @@ "properties": { "kind": { "type": "string", "minLength": 1 }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } }, "to": { "type": "object", @@ -83,11 +78,9 @@ "properties": { "kind": { "type": "string", "minLength": 1 }, "id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } } - }, - "additionalProperties": false + } } }, "parent_record_id": { "type": "string", "minLength": 1 }, @@ -110,10 +103,8 @@ "agent_id": { "type": "string", "minLength": 1 }, "delegated_by": { "type": "string", "minLength": 1 }, "delegation_record_id": { "type": "string", "minLength": 1 } - }, - "additionalProperties": false + } } } - }, - "additionalProperties": false + } }