Add FLUID wire contract schemas

Nine JSON Schemas covering the five record types from the schema spec,
plus backend requirements, feedback, the revision descriptor, routing
policy and the telemetry envelope. These are the integration boundary:
readable without any fluid-core code, so adapters may be written in any
language.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014KmVxhJ35tCo7rE7UnLwWu

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 1116572@bnt-lap001
Assistant-Session: 8ba9bb93-a72a-4883-b189-2499cce5c400
This commit is contained in:
tegwick 2026-09-04 01:55:47 +02:00
parent 7d2fc2af5d
commit fbbf56df7a
11 changed files with 1242 additions and 0 deletions

View file

@ -0,0 +1,113 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://fluid.dev/schemas/telemetry-envelope.schema.json",
"title": "FLUID telemetry envelope",
"description": "The normalized interaction event. Designed for interface learning, not unrestricted behavioral capture: raw payload capture is never the default and redaction happens before an event reaches the store (ArchitectureBlueprint.md section 6.2).",
"type": "object",
"properties": {
"fluid_telemetry": {
"type": "object",
"properties": {
"schema_version": { "$ref": "common.schema.json#/$defs/schemaVersion" },
"id": { "type": "string", "minLength": 1 },
"occurred_at": { "$ref": "common.schema.json#/$defs/timestamp" },
"interface_id": { "$ref": "common.schema.json#/$defs/interfaceId" },
"kind": {
"enum": ["request", "error", "sequence", "adoption", "feedback"],
"description": "ArchitectureBlueprint.md section 6.1."
},
"correlation_id": {
"type": "string",
"description": "Ties an event to the response the consumer saw, and to the other events in its call chain."
},
"consumer_ref": {
"type": "string",
"description": "Pseudonymous and stable. Never a raw end-user identifier."
},
"cohort": { "$ref": "common.schema.json#/$defs/cohortId" },
"revision": { "$ref": "common.schema.json#/$defs/revisionId" },
"experiment": { "oneOf": [{ "$ref": "common.schema.json#/$defs/experimentId" }, { "type": "null" }] },
"resolution": {
"type": "object",
"description": "Why this revision was chosen. Revision resolution must be deterministic and auditable (ArchitectureBlueprint.md section 5.2).",
"properties": {
"reason": {
"enum": ["explicit_revision", "bound_contract", "experiment_assignment", "cohort_rule", "stable_default"]
},
"policy_generation": { "type": "integer", "minimum": 0 }
},
"required": ["reason"],
"additionalProperties": false
},
"request": {
"type": "object",
"properties": {
"operation": { "type": "string" },
"route": { "type": "string" },
"method": { "type": "string" },
"status": { "type": "integer" },
"latency_ms": { "type": "number", "minimum": 0 },
"request_bytes": { "type": "integer", "minimum": 0 },
"response_bytes": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
},
"error": {
"type": "object",
"properties": {
"class": {
"enum": ["validation", "unknown_path", "unknown_field", "unsupported_parameter", "authorization", "backend_failure", "timeout", "policy_rejection"]
},
"detail": { "type": "string", "description": "Redacted. Must not carry backend internals or consumer data." },
"field": { "type": "string" }
},
"required": ["class"],
"additionalProperties": false
},
"sequence": {
"type": "object",
"description": "Interaction topology is often more informative than error counts (ArchitectureBlueprint.md section 6.4).",
"properties": {
"chain_id": { "type": "string" },
"position": { "type": "integer", "minimum": 0 },
"pattern": { "type": "string" },
"repeat_count": { "type": "integer", "minimum": 0 }
},
"additionalProperties": false
},
"adoption": {
"type": "object",
"properties": {
"event": { "enum": ["first_use", "continued_use", "migration", "reversion", "deprecation_response"] },
"from_revision": { "oneOf": [{ "$ref": "common.schema.json#/$defs/revisionId" }, { "type": "null" }] }
},
"required": ["event"],
"additionalProperties": false
},
"feedback_ref": { "$ref": "common.schema.json#/$defs/feedbackId" },
"redaction": {
"type": "object",
"description": "What the privacy filter removed. Recorded so analysis knows what it cannot see.",
"properties": {
"applied": { "type": "boolean" },
"rules": { "type": "array", "items": { "type": "string" } }
},
"required": ["applied"],
"additionalProperties": false
}
},
"required": ["schema_version", "id", "occurred_at", "interface_id", "kind"],
"additionalProperties": false
}
},
"required": ["fluid_telemetry"],
"additionalProperties": false
}