1
0
Fork 0
Code Issues Pull requests Projects Releases 2 Packages Wiki Activity Actions Pages

Add versioned independent projection contracts

This commit is contained in:
Andraxion 2026-07-29 10:50:05 -04:00
parent 4c5773c865
commit 96e3965855
22 changed files with 3561 additions and 133 deletions

View file

@ -0,0 +1,321 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://docforge.local/schema/graph-view-plan-v1.json",
"title": "DocForge immutable portable graph view plan",
"$comment": "plan_id is the SHA-256 of canonical JSON without plan_id and is verified by the runtime contract validator. The version-1 nested graph vocabulary remains planner-owned.",
"$defs": {
"sha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"project": {
"type": "object",
"required": [
"project_id",
"project_root_fingerprint",
"adapter",
"revision",
"source_hash"
],
"properties": {
"project_id": { "type": "string", "minLength": 1 },
"project_root_fingerprint": {
"type": "string",
"pattern": "^[0-9a-f]{16}$"
},
"adapter": { "type": "string", "minLength": 1 },
"revision": { "type": "string", "minLength": 1 },
"source_hash": { "$ref": "#/$defs/sha256" }
},
"additionalProperties": false
},
"filter": {
"type": "array",
"maxItems": 64,
"items": {
"type": "string",
"minLength": 1,
"maxLength": 1024
},
"uniqueItems": true
},
"edge": {
"type": "object",
"required": ["source_id", "relation", "target_id"],
"properties": {
"source_id": { "type": "string", "minLength": 1 },
"relation": { "type": "string", "minLength": 1 },
"target_id": { "type": "string", "minLength": 1 }
},
"additionalProperties": false
},
"node": {
"type": "object",
"required": [
"node_id",
"title",
"family",
"authority",
"status",
"tags",
"summary",
"content_hash"
],
"properties": {
"node_id": { "type": "string", "minLength": 1 },
"title": { "type": "string", "minLength": 1 },
"family": { "type": "string", "minLength": 1 },
"authority": { "type": "string", "minLength": 1 },
"status": { "type": "string", "minLength": 1 },
"tags": { "$ref": "#/$defs/filter" },
"summary": { "type": "string" },
"content_hash": { "$ref": "#/$defs/sha256" }
},
"additionalProperties": false
},
"omission": {
"oneOf": [
{
"type": "object",
"required": ["code", "subject", "limit", "minimum_omitted"],
"properties": {
"code": { "const": "node_result_limit" },
"subject": { "const": "nodes" },
"limit": { "type": "integer", "minimum": 1, "maximum": 1000 },
"minimum_omitted": { "type": "integer", "minimum": 1 }
},
"additionalProperties": false
},
{
"type": "object",
"required": ["code", "subject", "limit", "minimum_omitted"],
"properties": {
"code": { "const": "edge_result_limit" },
"subject": { "const": "edges" },
"limit": { "type": "integer", "minimum": 0, "maximum": 4000 },
"minimum_omitted": { "type": "integer", "minimum": 1 }
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"code",
"subject",
"limit",
"examined",
"minimum_omitted"
],
"properties": {
"code": { "const": "work_limit" },
"subject": { "const": "selection" },
"limit": { "type": "integer", "minimum": 1, "maximum": 1000000 },
"examined": { "type": "integer", "minimum": 0 },
"minimum_omitted": { "type": "integer", "minimum": 1 }
},
"additionalProperties": false
},
{
"type": "object",
"required": ["code", "subject", "minimum_omitted"],
"properties": {
"code": { "const": "logic_forbidden" },
"subject": { "const": "logic" },
"minimum_omitted": { "type": "integer", "minimum": 1 }
},
"additionalProperties": false
}
]
}
},
"type": "object",
"required": [
"schema_version",
"contract",
"plan_id",
"project",
"view",
"bounds",
"policy",
"graph",
"omissions",
"diagnostics"
],
"properties": {
"schema_version": { "const": 1 },
"contract": { "const": "docforge.graph-view-plan" },
"plan_id": { "$ref": "#/$defs/sha256" },
"project": { "$ref": "#/$defs/project" },
"view": {
"type": "object",
"required": [
"view_id",
"title",
"initial_mode",
"scope",
"filters",
"detail_fields"
],
"properties": {
"view_id": {
"type": "string",
"minLength": 1,
"maxLength": 1024
},
"title": {
"type": "string",
"minLength": 1,
"maxLength": 1024
},
"initial_mode": { "enum": ["nodes", "flow", "web", "logic"] },
"scope": {
"oneOf": [
{
"type": "object",
"required": ["kind", "root_node_id", "depth"],
"properties": {
"kind": { "const": "exact_root" },
"root_node_id": {
"type": "string",
"minLength": 1,
"maxLength": 1024
},
"depth": { "type": "integer", "minimum": 1, "maximum": 32 }
},
"additionalProperties": false
},
{
"type": "object",
"required": ["kind", "query"],
"properties": {
"kind": { "const": "lexical" },
"query": {
"type": "string",
"minLength": 1,
"maxLength": 10000
}
},
"additionalProperties": false
}
]
},
"filters": {
"type": "object",
"required": [
"families",
"relations",
"authorities",
"statuses",
"tags"
],
"properties": {
"families": { "$ref": "#/$defs/filter" },
"relations": { "$ref": "#/$defs/filter" },
"authorities": { "$ref": "#/$defs/filter" },
"statuses": { "$ref": "#/$defs/filter" },
"tags": { "$ref": "#/$defs/filter" }
},
"additionalProperties": false
},
"detail_fields": {
"const": [
"node_id",
"title",
"family",
"authority",
"status",
"tags",
"summary",
"content_hash"
]
}
},
"additionalProperties": false
},
"bounds": {
"type": "object",
"required": ["depth", "max_nodes", "max_edges", "max_work"],
"properties": {
"depth": { "type": "integer", "minimum": 1, "maximum": 32 },
"max_nodes": { "type": "integer", "minimum": 1, "maximum": 1000 },
"max_edges": { "type": "integer", "minimum": 0, "maximum": 4000 },
"max_work": { "type": "integer", "minimum": 1, "maximum": 1000000 }
},
"additionalProperties": false
},
"policy": {
"type": "object",
"required": [
"visibility",
"source_paths",
"source_bodies",
"database_queries",
"executable_content",
"logic",
"logic_requested"
],
"properties": {
"visibility": { "const": "selected_graph_only" },
"source_paths": { "const": "excluded" },
"source_bodies": { "const": "excluded" },
"database_queries": { "const": "forbidden" },
"executable_content": { "const": "forbidden" },
"logic": { "enum": ["allowed", "forbidden"] },
"logic_requested": { "type": "boolean" }
},
"additionalProperties": false
},
"graph": {
"type": "object",
"required": ["root_node_id", "nodes", "edges", "logic_projections"],
"properties": {
"root_node_id": {
"type": ["string", "null"],
"minLength": 1,
"maxLength": 1024
},
"nodes": {
"type": "array",
"maxItems": 1000,
"items": { "$ref": "#/$defs/node" }
},
"edges": {
"type": "array",
"maxItems": 4000,
"items": { "$ref": "#/$defs/edge" }
},
"logic_projections": {
"type": "array",
"maxItems": 0
}
},
"additionalProperties": false
},
"omissions": {
"type": "array",
"maxItems": 4,
"items": { "$ref": "#/$defs/omission" }
},
"diagnostics": {
"type": "object",
"required": [
"selection",
"returned_nodes",
"returned_edges",
"examined_work_units",
"truncated",
"ordering"
],
"properties": {
"selection": { "enum": ["exact_root", "lexical"] },
"returned_nodes": { "type": "integer", "minimum": 0, "maximum": 1000 },
"returned_edges": { "type": "integer", "minimum": 0, "maximum": 4000 },
"examined_work_units": { "type": "integer", "minimum": 0 },
"truncated": { "type": "boolean" },
"ordering": { "const": "node_id;source_id,relation,target_id" }
},
"additionalProperties": false
}
},
"additionalProperties": false
}

View file

@ -0,0 +1,214 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://docforge.local/schema/manual-render-plan-v1.json",
"title": "DocForge immutable manual render plan",
"$comment": "plan_id is the SHA-256 of canonical JSON without plan_id and is verified by the runtime contract validator.",
"$defs": {
"sha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"project": {
"type": "object",
"required": [
"project_id",
"project_root_fingerprint",
"adapter",
"revision",
"source_hash"
],
"properties": {
"project_id": { "type": "string", "minLength": 1 },
"project_root_fingerprint": {
"type": "string",
"pattern": "^[0-9a-f]{16}$"
},
"adapter": { "type": "string", "minLength": 1 },
"revision": { "type": "string", "minLength": 1 },
"source_hash": { "$ref": "#/$defs/sha256" }
},
"additionalProperties": false
},
"edge": {
"type": "object",
"required": ["source_id", "relation", "target_id"],
"properties": {
"source_id": { "type": "string", "minLength": 1 },
"relation": { "type": "string", "minLength": 1 },
"target_id": { "type": "string", "minLength": 1 }
},
"additionalProperties": false
},
"page": {
"type": "object",
"required": [
"node_id",
"title",
"family",
"authority",
"status",
"tags",
"summary",
"content",
"content_hash",
"components",
"breadcrumbs",
"cross_references",
"backlinks"
],
"properties": {
"node_id": { "type": "string", "minLength": 1 },
"title": { "type": "string", "minLength": 1 },
"family": { "type": "string", "minLength": 1 },
"authority": { "type": "string", "minLength": 1 },
"status": { "type": "string", "minLength": 1 },
"tags": {
"type": "array",
"maxItems": 10000,
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"summary": { "type": "string" },
"content": { "type": "string" },
"content_hash": { "$ref": "#/$defs/sha256" },
"components": {
"type": "array",
"maxItems": 32,
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"breadcrumbs": {
"type": "array",
"maxItems": 10000,
"items": { "type": "string", "minLength": 1 }
},
"cross_references": {
"type": "array",
"maxItems": 10000,
"items": { "$ref": "#/$defs/edge" }
},
"backlinks": {
"type": "array",
"maxItems": 10000,
"items": { "$ref": "#/$defs/edge" }
}
},
"additionalProperties": false
},
"navigation_item": {
"type": "object",
"required": ["node_id", "title"],
"properties": {
"node_id": { "type": "string", "minLength": 1 },
"title": { "type": "string", "minLength": 1 }
},
"additionalProperties": false
},
"search_document": {
"type": "object",
"required": [
"node_id",
"title",
"summary",
"family",
"status",
"tags"
],
"properties": {
"node_id": { "type": "string", "minLength": 1 },
"title": { "type": "string", "minLength": 1 },
"summary": { "type": "string" },
"family": { "type": "string", "minLength": 1 },
"status": { "type": "string", "minLength": 1 },
"tags": {
"type": "array",
"maxItems": 10000,
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
}
},
"additionalProperties": false
}
},
"type": "object",
"required": [
"schema_version",
"contract",
"plan_id",
"project",
"view",
"changeset_hash",
"pages",
"navigation",
"search_documents",
"diagnostics"
],
"properties": {
"schema_version": { "const": 1 },
"contract": { "const": "docforge.manual-render-plan" },
"plan_id": { "$ref": "#/$defs/sha256" },
"project": { "$ref": "#/$defs/project" },
"view": {
"type": "object",
"required": ["view_id", "title", "families", "renderer"],
"properties": {
"view_id": { "type": "string", "minLength": 1 },
"title": { "type": "string", "minLength": 1 },
"families": {
"type": "array",
"maxItems": 10000,
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"renderer": { "type": "string", "minLength": 1 }
},
"additionalProperties": false
},
"changeset_hash": {
"oneOf": [
{ "$ref": "#/$defs/sha256" },
{ "type": "null" }
]
},
"pages": {
"type": "array",
"maxItems": 10000,
"items": { "$ref": "#/$defs/page" }
},
"navigation": {
"type": "array",
"maxItems": 10000,
"items": { "$ref": "#/$defs/navigation_item" }
},
"search_documents": {
"type": "array",
"maxItems": 10000,
"items": { "$ref": "#/$defs/search_document" }
},
"diagnostics": {
"type": "object",
"required": ["orphans", "cycles"],
"properties": {
"orphans": {
"type": "array",
"maxItems": 10000,
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
},
"cycles": {
"type": "array",
"maxItems": 10000,
"items": {
"type": "array",
"minItems": 1,
"maxItems": 10000,
"items": { "type": "string", "minLength": 1 },
"uniqueItems": true
}
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}

View file

@ -0,0 +1,190 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://docforge.local/schema/projection-package-v1.json",
"title": "DocForge immutable renderer projection package",
"$comment": "package_id and embedded plan identity equality are verified by the runtime contract validator.",
"$defs": {
"sha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"manual_plan": {
"type": "object",
"required": [
"schema_version",
"contract",
"plan_id",
"project",
"view",
"changeset_hash",
"pages",
"navigation",
"search_documents",
"diagnostics"
],
"properties": {
"schema_version": { "const": 1 },
"contract": { "const": "docforge.manual-render-plan" },
"plan_id": { "$ref": "#/$defs/sha256" },
"project": { "type": "object" },
"view": { "type": "object" },
"changeset_hash": {
"oneOf": [
{ "$ref": "#/$defs/sha256" },
{ "type": "null" }
]
},
"pages": { "type": "array", "maxItems": 10000 },
"navigation": { "type": "array", "maxItems": 10000 },
"search_documents": { "type": "array", "maxItems": 10000 },
"diagnostics": { "type": "object" }
},
"additionalProperties": false
},
"graph_plan": {
"type": "object",
"required": [
"schema_version",
"contract",
"plan_id",
"project",
"view",
"bounds",
"policy",
"graph",
"omissions",
"diagnostics"
],
"properties": {
"schema_version": { "const": 1 },
"contract": { "const": "docforge.graph-view-plan" },
"plan_id": { "$ref": "#/$defs/sha256" },
"project": { "type": "object" },
"view": { "type": "object" },
"bounds": { "type": "object" },
"policy": { "type": "object" },
"graph": { "type": "object" },
"omissions": { "type": "array", "maxItems": 10000 },
"diagnostics": { "type": "object" }
},
"additionalProperties": false
},
"renderer": {
"type": "object",
"required": ["renderer_id", "renderer_version"],
"properties": {
"renderer_id": { "type": "string", "minLength": 1 },
"renderer_version": { "type": "string", "minLength": 1 }
},
"additionalProperties": false
},
"component": {
"type": "object",
"required": ["component_id"],
"properties": {
"component_id": { "type": "string", "minLength": 1 }
},
"additionalProperties": false
},
"asset": {
"type": "object",
"required": ["asset_id", "media_type", "sha256", "text"],
"properties": {
"asset_id": {
"type": "string",
"minLength": 1,
"pattern": "^[^/]+$"
},
"media_type": { "type": "string", "minLength": 1 },
"sha256": { "$ref": "#/$defs/sha256" },
"text": { "type": "string" }
},
"additionalProperties": false
}
},
"type": "object",
"required": [
"schema_version",
"contract",
"package_id",
"kind",
"plan_id",
"plan",
"renderer",
"components",
"assets",
"output_policy"
],
"properties": {
"schema_version": { "const": 1 },
"contract": { "const": "docforge.projection-package" },
"package_id": { "$ref": "#/$defs/sha256" },
"kind": { "enum": ["manual", "graph"] },
"plan_id": { "$ref": "#/$defs/sha256" },
"plan": {
"oneOf": [
{ "$ref": "#/$defs/manual_plan" },
{ "$ref": "#/$defs/graph_plan" }
]
},
"renderer": { "$ref": "#/$defs/renderer" },
"components": {
"type": "array",
"maxItems": 32,
"items": { "$ref": "#/$defs/component" },
"uniqueItems": true
},
"assets": {
"type": "array",
"maxItems": 32,
"items": { "$ref": "#/$defs/asset" }
},
"output_policy": {
"type": "object",
"required": ["artifact_ids", "max_total_bytes"],
"properties": {
"artifact_ids": {
"type": "array",
"minItems": 1,
"maxItems": 32,
"items": {
"type": "string",
"minLength": 1,
"pattern": "^[^/]+$"
},
"uniqueItems": true
},
"max_total_bytes": {
"type": "integer",
"minimum": 1
}
},
"additionalProperties": false
}
},
"allOf": [
{
"if": {
"properties": { "kind": { "const": "manual" } },
"required": ["kind"]
},
"then": {
"properties": {
"plan": { "$ref": "#/$defs/manual_plan" }
}
}
},
{
"if": {
"properties": { "kind": { "const": "graph" } },
"required": ["kind"]
},
"then": {
"properties": {
"plan": { "$ref": "#/$defs/graph_plan" }
}
}
}
],
"additionalProperties": false
}

View file

@ -0,0 +1,89 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://docforge.local/schema/projection-receipt-v1.json",
"title": "DocForge projection renderer receipt",
"$comment": "receipt_id is the SHA-256 of canonical JSON without receipt_id and is verified by the runtime contract validator.",
"$defs": {
"sha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"renderer": {
"type": "object",
"required": ["renderer_id", "renderer_version"],
"properties": {
"renderer_id": { "type": "string", "minLength": 1 },
"renderer_version": { "type": "string", "minLength": 1 }
},
"additionalProperties": false
},
"artifact": {
"type": "object",
"required": ["artifact_id", "media_type", "sha256", "bytes"],
"properties": {
"artifact_id": {
"type": "string",
"minLength": 1,
"pattern": "^[^/]+$"
},
"media_type": { "type": "string", "minLength": 1 },
"sha256": { "$ref": "#/$defs/sha256" },
"bytes": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
}
},
"type": "object",
"required": [
"schema_version",
"contract",
"receipt_id",
"kind",
"package_id",
"plan_id",
"renderer",
"artifacts",
"diagnostics",
"timing",
"peak_memory_bytes"
],
"properties": {
"schema_version": { "const": 1 },
"contract": { "const": "docforge.projection-receipt" },
"receipt_id": { "$ref": "#/$defs/sha256" },
"kind": { "enum": ["manual", "graph"] },
"package_id": { "$ref": "#/$defs/sha256" },
"plan_id": { "$ref": "#/$defs/sha256" },
"renderer": { "$ref": "#/$defs/renderer" },
"artifacts": {
"type": "array",
"maxItems": 32,
"items": { "$ref": "#/$defs/artifact" }
},
"diagnostics": {
"type": "object",
"required": ["warnings"],
"properties": {
"warnings": {
"type": "array",
"maxItems": 10000,
"items": { "type": "string" }
}
},
"additionalProperties": false
},
"timing": {
"type": "object",
"required": ["elapsed_ns"],
"properties": {
"elapsed_ns": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
},
"peak_memory_bytes": {
"type": ["integer", "null"],
"minimum": 0
}
},
"additionalProperties": false
}