Add bounded generation transition receipts
This commit is contained in:
parent
4cc6277054
commit
9a48233983
21 changed files with 3822 additions and 65 deletions
363
schemas/generation-diff.schema.json
Normal file
363
schemas/generation-diff.schema.json
Normal file
|
|
@ -0,0 +1,363 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://docforge.local/schema/generation-diff-v1.json",
|
||||
"title": "DocForge latest primary-graph generation diff receipt",
|
||||
"$defs": {
|
||||
"sha256": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9a-f]{64}$"
|
||||
},
|
||||
"generation": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"revision",
|
||||
"source_hash",
|
||||
"node_count",
|
||||
"node_hash",
|
||||
"edge_count",
|
||||
"edge_hash",
|
||||
"index_schema_version"
|
||||
],
|
||||
"properties": {
|
||||
"revision": { "type": "string", "minLength": 1 },
|
||||
"source_hash": { "$ref": "#/$defs/sha256" },
|
||||
"node_count": { "type": "integer", "minimum": 0 },
|
||||
"node_hash": { "$ref": "#/$defs/sha256" },
|
||||
"edge_count": { "type": "integer", "minimum": 0 },
|
||||
"edge_hash": { "$ref": "#/$defs/sha256" },
|
||||
"index_schema_version": { "type": "integer", "minimum": 1 }
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"node_item": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"entity",
|
||||
"change",
|
||||
"node_id",
|
||||
"before_content_hash",
|
||||
"after_content_hash",
|
||||
"before_source_path",
|
||||
"after_source_path",
|
||||
"before_node_hash",
|
||||
"after_node_hash",
|
||||
"changed_fields",
|
||||
"item_hash"
|
||||
],
|
||||
"properties": {
|
||||
"entity": { "const": "node" },
|
||||
"change": { "enum": ["added", "removed", "changed"] },
|
||||
"node_id": { "type": "string", "minLength": 1 },
|
||||
"before_content_hash": {
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/sha256" },
|
||||
{ "type": "null" }
|
||||
]
|
||||
},
|
||||
"after_content_hash": {
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/sha256" },
|
||||
{ "type": "null" }
|
||||
]
|
||||
},
|
||||
"before_source_path": { "type": ["string", "null"] },
|
||||
"after_source_path": { "type": ["string", "null"] },
|
||||
"before_node_hash": {
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/sha256" },
|
||||
{ "type": "null" }
|
||||
]
|
||||
},
|
||||
"after_node_hash": {
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/sha256" },
|
||||
{ "type": "null" }
|
||||
]
|
||||
},
|
||||
"changed_fields": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"enum": [
|
||||
"title",
|
||||
"family",
|
||||
"authority",
|
||||
"status",
|
||||
"tags",
|
||||
"summary",
|
||||
"content",
|
||||
"source_path",
|
||||
"source_anchor",
|
||||
"content_hash"
|
||||
]
|
||||
},
|
||||
"uniqueItems": true
|
||||
},
|
||||
"item_hash": { "$ref": "#/$defs/sha256" }
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": { "change": { "const": "added" } },
|
||||
"required": ["change"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"before_content_hash": { "type": "null" },
|
||||
"before_source_path": { "type": "null" },
|
||||
"before_node_hash": { "type": "null" },
|
||||
"after_content_hash": { "$ref": "#/$defs/sha256" },
|
||||
"after_source_path": { "type": "string", "minLength": 1 },
|
||||
"after_node_hash": { "$ref": "#/$defs/sha256" },
|
||||
"changed_fields": { "maxItems": 0 }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": { "change": { "const": "removed" } },
|
||||
"required": ["change"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"before_content_hash": { "$ref": "#/$defs/sha256" },
|
||||
"before_source_path": { "type": "string", "minLength": 1 },
|
||||
"before_node_hash": { "$ref": "#/$defs/sha256" },
|
||||
"after_content_hash": { "type": "null" },
|
||||
"after_source_path": { "type": "null" },
|
||||
"after_node_hash": { "type": "null" },
|
||||
"changed_fields": { "maxItems": 0 }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": { "change": { "const": "changed" } },
|
||||
"required": ["change"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"before_content_hash": { "$ref": "#/$defs/sha256" },
|
||||
"before_source_path": { "type": "string", "minLength": 1 },
|
||||
"before_node_hash": { "$ref": "#/$defs/sha256" },
|
||||
"after_content_hash": { "$ref": "#/$defs/sha256" },
|
||||
"after_source_path": { "type": "string", "minLength": 1 },
|
||||
"after_node_hash": { "$ref": "#/$defs/sha256" },
|
||||
"changed_fields": { "minItems": 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"edge_item": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"entity",
|
||||
"change",
|
||||
"source_id",
|
||||
"relation",
|
||||
"target_id",
|
||||
"item_hash"
|
||||
],
|
||||
"properties": {
|
||||
"entity": { "const": "edge" },
|
||||
"change": { "enum": ["added", "removed"] },
|
||||
"source_id": { "type": "string", "minLength": 1 },
|
||||
"relation": { "type": "string", "minLength": 1 },
|
||||
"target_id": { "type": "string", "minLength": 1 },
|
||||
"item_hash": { "$ref": "#/$defs/sha256" }
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"required": [
|
||||
"schema_version",
|
||||
"diff_semantics_version",
|
||||
"project_id",
|
||||
"project_root_fingerprint",
|
||||
"adapter",
|
||||
"kind",
|
||||
"reason",
|
||||
"from_generation",
|
||||
"to_generation",
|
||||
"summary",
|
||||
"items",
|
||||
"full_item_count",
|
||||
"retained_item_count",
|
||||
"details_truncated",
|
||||
"truncation_reason",
|
||||
"full_collection_hash",
|
||||
"retained_collection_hash",
|
||||
"index_signature",
|
||||
"receipt_hash"
|
||||
],
|
||||
"properties": {
|
||||
"schema_version": { "const": 1 },
|
||||
"diff_semantics_version": { "const": 1 },
|
||||
"project_id": { "type": "string", "minLength": 1 },
|
||||
"project_root_fingerprint": {
|
||||
"type": "string",
|
||||
"pattern": "^[0-9a-f]{16}$"
|
||||
},
|
||||
"adapter": { "type": "string", "minLength": 1 },
|
||||
"kind": { "enum": ["baseline", "transition"] },
|
||||
"reason": {
|
||||
"enum": [
|
||||
null,
|
||||
"no_predecessor",
|
||||
"predecessor_unsafe",
|
||||
"predecessor_unsupported_schema",
|
||||
"predecessor_foreign",
|
||||
"predecessor_policy_incompatible",
|
||||
"predecessor_corrupt",
|
||||
"predecessor_unattested",
|
||||
"predecessor_changed",
|
||||
"no_meaningful_transition"
|
||||
]
|
||||
},
|
||||
"from_generation": {
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/generation" },
|
||||
{ "type": "null" }
|
||||
]
|
||||
},
|
||||
"to_generation": { "$ref": "#/$defs/generation" },
|
||||
"summary": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"nodes_added",
|
||||
"nodes_removed",
|
||||
"nodes_changed",
|
||||
"edges_added",
|
||||
"edges_removed",
|
||||
"total_changes"
|
||||
],
|
||||
"properties": {
|
||||
"nodes_added": { "type": "integer", "minimum": 0 },
|
||||
"nodes_removed": { "type": "integer", "minimum": 0 },
|
||||
"nodes_changed": { "type": "integer", "minimum": 0 },
|
||||
"edges_added": { "type": "integer", "minimum": 0 },
|
||||
"edges_removed": { "type": "integer", "minimum": 0 },
|
||||
"total_changes": { "type": "integer", "minimum": 0 }
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"items": {
|
||||
"type": "array",
|
||||
"maxItems": 1000,
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/node_item" },
|
||||
{ "$ref": "#/$defs/edge_item" }
|
||||
]
|
||||
}
|
||||
},
|
||||
"full_item_count": { "type": "integer", "minimum": 0 },
|
||||
"retained_item_count": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 1000
|
||||
},
|
||||
"details_truncated": { "type": "boolean" },
|
||||
"truncation_reason": {
|
||||
"enum": [null, "receipt_item_limit", "receipt_byte_limit"]
|
||||
},
|
||||
"full_collection_hash": { "$ref": "#/$defs/sha256" },
|
||||
"retained_collection_hash": { "$ref": "#/$defs/sha256" },
|
||||
"index_signature": {
|
||||
"type": "object",
|
||||
"required": ["device", "inode", "size", "mtime_ns", "ctime_ns"],
|
||||
"properties": {
|
||||
"device": { "type": "integer", "minimum": 0 },
|
||||
"inode": { "type": "integer", "minimum": 0 },
|
||||
"size": { "type": "integer", "minimum": 0 },
|
||||
"mtime_ns": { "type": "integer", "minimum": 0 },
|
||||
"ctime_ns": { "type": "integer", "minimum": 0 }
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"receipt_hash": { "$ref": "#/$defs/sha256" }
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": { "kind": { "const": "baseline" } },
|
||||
"required": ["kind"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"from_generation": { "type": "null" },
|
||||
"reason": { "not": { "type": "null" } },
|
||||
"summary": {
|
||||
"properties": {
|
||||
"nodes_added": { "const": 0 },
|
||||
"nodes_removed": { "const": 0 },
|
||||
"nodes_changed": { "const": 0 },
|
||||
"edges_added": { "const": 0 },
|
||||
"edges_removed": { "const": 0 },
|
||||
"total_changes": { "const": 0 }
|
||||
}
|
||||
},
|
||||
"full_item_count": { "const": 0 },
|
||||
"retained_item_count": { "const": 0 },
|
||||
"details_truncated": { "const": false },
|
||||
"truncation_reason": { "const": null },
|
||||
"full_collection_hash": {
|
||||
"const": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945"
|
||||
},
|
||||
"retained_collection_hash": {
|
||||
"const": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945"
|
||||
}
|
||||
}
|
||||
},
|
||||
"else": {
|
||||
"properties": {
|
||||
"from_generation": { "$ref": "#/$defs/generation" },
|
||||
"reason": { "type": "null" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": { "truncation_reason": { "const": null } },
|
||||
"required": ["truncation_reason"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"details_truncated": { "const": false },
|
||||
"full_item_count": { "maximum": 1000 }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"truncation_reason": { "const": "receipt_item_limit" }
|
||||
},
|
||||
"required": ["truncation_reason"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"details_truncated": { "const": true },
|
||||
"full_item_count": { "minimum": 1001 },
|
||||
"retained_item_count": { "const": 1000 }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"truncation_reason": { "const": "receipt_byte_limit" }
|
||||
},
|
||||
"required": ["truncation_reason"]
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"details_truncated": { "const": true }
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue