CultLib/contracts/cultnet/cultnet.raw-document-record.schema.json

43 lines
1.6 KiB
JSON
Raw Normal View History

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
Consolidate CultNet schema contracts into CultLib/contracts/cultnet REC-032 commit 1: move the canonical 33 TS + witness-artifact-bundle schema files (34 total) into runtime-neutral CultLib/contracts/cultnet, move the interop-note schema (and delete the zero-consumer discovery-* schemas per D3, tagged parked/cultnet-discovery-contracts) into contracts/cultnet/interop, and delete the 27 C# and 24 Rust duplicate copies after confirming byte-for-byte equivalence (only cultnet.snapshot-request differs: TS carries shardId/shardEpoch, a known drift already resolved in favor of the TS shape). Rewrite every $id from https://github.com/GameCult/cultnet-ts/contracts/ and .../cultnet-ts/integration/contracts/ to https://github.com/GameCult/CultLib/contracts/cultnet/(interop/); give the two shard-catalog schemas URL ids per D1, replacing the bare cultnet.shard_catalog_*.v0 identifiers; leave ghostlight.agent-state's Ghostlight-owned $id untouched per D5. Repoint every runtime's load path and id literal at the new location: C# csproj EmbeddedResource + LogicalName, Rust include_str! paths, TS contracts.ts imports + swarm-contracts manifest/tooling + package.json files/prepack, and the id/path literals in the C#, Rust, Python and Kotlin interop tests and peers. Python and Kotlin still build their own schema JSON in-process (D2); only their base constants, id literals, and (for Kotlin) contentHash literals were swapped. Every Kotlin contentHash was recomputed from the final canonical files using the runtime's own stable-stringify + SHA-256 function; all matched the planner's precomputed values except cultnet.schema-catalog-response, where the planner's proposed value did not match recomputation and the freshly computed value was used instead. REC-032, decisions D1/D2/D3/D5. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 17:27:41 +02:00
"$id": "https://github.com/GameCult/CultLib/contracts/cultnet/cultnet.raw-document-record.schema.json",
"title": "CultNet Raw Document Record",
Land fix batch 3's R-S: the schemas describe the bytes C# writes New contracts/cultnet/cultnet.raw-document-header.schema.json for CultNetRawDocumentHeader - it has no payload/payloadEncoding members at all, so headers must not $ref the record schema (which required both). The response page's own schema now lists every property CultNetSnapshotResponseRawV1Message declares as `required` (present on the wire, nil included) rather than only the four that happened to be non-nullable - MessagePack-CSharp's map-mode formatter writes every declared key regardless of null, so `headers`/`documents` are always both present, one an array and the other an explicit null by projection. The old `oneOf: [{required:[headers]},{required:[documents]}]` matched both branches on every real page (both keys present) and so never validated anything; it is now `oneOf` over each key's type (array vs null), which is mutually exclusive. cultnet.raw-document-record.schema.json gained schemaName/schemaVersion/schemaContentHash (present on every real record, not previously in the schema at all - any real page would have failed additionalProperties:false on them). fieldPredicate's two oneOf branches each gained `not: {required: [the other]}`, so `values` and `number` cannot both be present (previously only `required` was checked, which does not exclude the sibling key). Added MiniJsonSchemaValidator, a deliberately small draft-2020-12 subset validator (type/required/additionalProperties/properties/items/const/enum/ pattern/minLength/minItems/oneOf/$ref, same-document and cross-document) - no schema-validation dependency existed in this repo, and this only needs to cover what contracts/cultnet/*.schema.json actually use. CultNetSchemaContractTests decodes real wire bytes from a live CultNetDatabaseServer (header projection, document projection, and a hop with edges) through MessagePackSerializer.ConvertToJson and checks them against the committed schema files, plus three fieldPredicate-shape tests pinning the values/number exclusivity. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 20:12:58 +02:00
"description": "R-S (docs/cultnet-selection-cut.md, fix batch 3): matches MessagePack-CSharp's map-mode output for CultNetRawDocumentRecord - every declared key is written, nil included, so every property here is `required` (present on the wire) even where its value may be null.",
"type": "object",
"required": [
"schemaId",
Land fix batch 3's R-S: the schemas describe the bytes C# writes New contracts/cultnet/cultnet.raw-document-header.schema.json for CultNetRawDocumentHeader - it has no payload/payloadEncoding members at all, so headers must not $ref the record schema (which required both). The response page's own schema now lists every property CultNetSnapshotResponseRawV1Message declares as `required` (present on the wire, nil included) rather than only the four that happened to be non-nullable - MessagePack-CSharp's map-mode formatter writes every declared key regardless of null, so `headers`/`documents` are always both present, one an array and the other an explicit null by projection. The old `oneOf: [{required:[headers]},{required:[documents]}]` matched both branches on every real page (both keys present) and so never validated anything; it is now `oneOf` over each key's type (array vs null), which is mutually exclusive. cultnet.raw-document-record.schema.json gained schemaName/schemaVersion/schemaContentHash (present on every real record, not previously in the schema at all - any real page would have failed additionalProperties:false on them). fieldPredicate's two oneOf branches each gained `not: {required: [the other]}`, so `values` and `number` cannot both be present (previously only `required` was checked, which does not exclude the sibling key). Added MiniJsonSchemaValidator, a deliberately small draft-2020-12 subset validator (type/required/additionalProperties/properties/items/const/enum/ pattern/minLength/minItems/oneOf/$ref, same-document and cross-document) - no schema-validation dependency existed in this repo, and this only needs to cover what contracts/cultnet/*.schema.json actually use. CultNetSchemaContractTests decodes real wire bytes from a live CultNetDatabaseServer (header projection, document projection, and a hop with edges) through MessagePackSerializer.ConvertToJson and checks them against the committed schema files, plus three fieldPredicate-shape tests pinning the values/number exclusivity. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 20:12:58 +02:00
"schemaName",
"schemaVersion",
"schemaContentHash",
"recordKey",
"storedAt",
"payloadEncoding",
Land fix batch 3's R-S: the schemas describe the bytes C# writes New contracts/cultnet/cultnet.raw-document-header.schema.json for CultNetRawDocumentHeader - it has no payload/payloadEncoding members at all, so headers must not $ref the record schema (which required both). The response page's own schema now lists every property CultNetSnapshotResponseRawV1Message declares as `required` (present on the wire, nil included) rather than only the four that happened to be non-nullable - MessagePack-CSharp's map-mode formatter writes every declared key regardless of null, so `headers`/`documents` are always both present, one an array and the other an explicit null by projection. The old `oneOf: [{required:[headers]},{required:[documents]}]` matched both branches on every real page (both keys present) and so never validated anything; it is now `oneOf` over each key's type (array vs null), which is mutually exclusive. cultnet.raw-document-record.schema.json gained schemaName/schemaVersion/schemaContentHash (present on every real record, not previously in the schema at all - any real page would have failed additionalProperties:false on them). fieldPredicate's two oneOf branches each gained `not: {required: [the other]}`, so `values` and `number` cannot both be present (previously only `required` was checked, which does not exclude the sibling key). Added MiniJsonSchemaValidator, a deliberately small draft-2020-12 subset validator (type/required/additionalProperties/properties/items/const/enum/ pattern/minLength/minItems/oneOf/$ref, same-document and cross-document) - no schema-validation dependency existed in this repo, and this only needs to cover what contracts/cultnet/*.schema.json actually use. CultNetSchemaContractTests decodes real wire bytes from a live CultNetDatabaseServer (header projection, document projection, and a hop with edges) through MessagePackSerializer.ConvertToJson and checks them against the committed schema files, plus three fieldPredicate-shape tests pinning the values/number exclusivity. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 20:12:58 +02:00
"payload",
"sourceRuntimeId",
"sourceAgentId",
"sourceRole",
"tags"
],
"additionalProperties": false,
"properties": {
"schemaId": { "type": "string", "minLength": 1 },
Land fix batch 3's R-S: the schemas describe the bytes C# writes New contracts/cultnet/cultnet.raw-document-header.schema.json for CultNetRawDocumentHeader - it has no payload/payloadEncoding members at all, so headers must not $ref the record schema (which required both). The response page's own schema now lists every property CultNetSnapshotResponseRawV1Message declares as `required` (present on the wire, nil included) rather than only the four that happened to be non-nullable - MessagePack-CSharp's map-mode formatter writes every declared key regardless of null, so `headers`/`documents` are always both present, one an array and the other an explicit null by projection. The old `oneOf: [{required:[headers]},{required:[documents]}]` matched both branches on every real page (both keys present) and so never validated anything; it is now `oneOf` over each key's type (array vs null), which is mutually exclusive. cultnet.raw-document-record.schema.json gained schemaName/schemaVersion/schemaContentHash (present on every real record, not previously in the schema at all - any real page would have failed additionalProperties:false on them). fieldPredicate's two oneOf branches each gained `not: {required: [the other]}`, so `values` and `number` cannot both be present (previously only `required` was checked, which does not exclude the sibling key). Added MiniJsonSchemaValidator, a deliberately small draft-2020-12 subset validator (type/required/additionalProperties/properties/items/const/enum/ pattern/minLength/minItems/oneOf/$ref, same-document and cross-document) - no schema-validation dependency existed in this repo, and this only needs to cover what contracts/cultnet/*.schema.json actually use. CultNetSchemaContractTests decodes real wire bytes from a live CultNetDatabaseServer (header projection, document projection, and a hop with edges) through MessagePackSerializer.ConvertToJson and checks them against the committed schema files, plus three fieldPredicate-shape tests pinning the values/number exclusivity. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 20:12:58 +02:00
"schemaName": { "type": ["string", "null"], "minLength": 1 },
"schemaVersion": { "type": ["string", "null"], "minLength": 1 },
"schemaContentHash": { "type": ["string", "null"], "minLength": 1 },
"recordKey": { "type": "string", "minLength": 1 },
"storedAt": { "type": "string", "minLength": 1 },
"payloadEncoding": { "const": "messagepack" },
"payload": {
"type": "string",
"contentEncoding": "base64",
"x-cult-runtime-type": "bytes"
},
Land fix batch 3's R-S: the schemas describe the bytes C# writes New contracts/cultnet/cultnet.raw-document-header.schema.json for CultNetRawDocumentHeader - it has no payload/payloadEncoding members at all, so headers must not $ref the record schema (which required both). The response page's own schema now lists every property CultNetSnapshotResponseRawV1Message declares as `required` (present on the wire, nil included) rather than only the four that happened to be non-nullable - MessagePack-CSharp's map-mode formatter writes every declared key regardless of null, so `headers`/`documents` are always both present, one an array and the other an explicit null by projection. The old `oneOf: [{required:[headers]},{required:[documents]}]` matched both branches on every real page (both keys present) and so never validated anything; it is now `oneOf` over each key's type (array vs null), which is mutually exclusive. cultnet.raw-document-record.schema.json gained schemaName/schemaVersion/schemaContentHash (present on every real record, not previously in the schema at all - any real page would have failed additionalProperties:false on them). fieldPredicate's two oneOf branches each gained `not: {required: [the other]}`, so `values` and `number` cannot both be present (previously only `required` was checked, which does not exclude the sibling key). Added MiniJsonSchemaValidator, a deliberately small draft-2020-12 subset validator (type/required/additionalProperties/properties/items/const/enum/ pattern/minLength/minItems/oneOf/$ref, same-document and cross-document) - no schema-validation dependency existed in this repo, and this only needs to cover what contracts/cultnet/*.schema.json actually use. CultNetSchemaContractTests decodes real wire bytes from a live CultNetDatabaseServer (header projection, document projection, and a hop with edges) through MessagePackSerializer.ConvertToJson and checks them against the committed schema files, plus three fieldPredicate-shape tests pinning the values/number exclusivity. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 20:12:58 +02:00
"sourceRuntimeId": { "type": ["string", "null"], "minLength": 1 },
"sourceAgentId": { "type": ["string", "null"], "minLength": 1 },
"sourceRole": { "type": ["string", "null"], "minLength": 1 },
"tags": {
Land fix batch 3's R-S: the schemas describe the bytes C# writes New contracts/cultnet/cultnet.raw-document-header.schema.json for CultNetRawDocumentHeader - it has no payload/payloadEncoding members at all, so headers must not $ref the record schema (which required both). The response page's own schema now lists every property CultNetSnapshotResponseRawV1Message declares as `required` (present on the wire, nil included) rather than only the four that happened to be non-nullable - MessagePack-CSharp's map-mode formatter writes every declared key regardless of null, so `headers`/`documents` are always both present, one an array and the other an explicit null by projection. The old `oneOf: [{required:[headers]},{required:[documents]}]` matched both branches on every real page (both keys present) and so never validated anything; it is now `oneOf` over each key's type (array vs null), which is mutually exclusive. cultnet.raw-document-record.schema.json gained schemaName/schemaVersion/schemaContentHash (present on every real record, not previously in the schema at all - any real page would have failed additionalProperties:false on them). fieldPredicate's two oneOf branches each gained `not: {required: [the other]}`, so `values` and `number` cannot both be present (previously only `required` was checked, which does not exclude the sibling key). Added MiniJsonSchemaValidator, a deliberately small draft-2020-12 subset validator (type/required/additionalProperties/properties/items/const/enum/ pattern/minLength/minItems/oneOf/$ref, same-document and cross-document) - no schema-validation dependency existed in this repo, and this only needs to cover what contracts/cultnet/*.schema.json actually use. CultNetSchemaContractTests decodes real wire bytes from a live CultNetDatabaseServer (header projection, document projection, and a hop with edges) through MessagePackSerializer.ConvertToJson and checks them against the committed schema files, plus three fieldPredicate-shape tests pinning the values/number exclusivity. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 20:12:58 +02:00
"type": ["array", "null"],
"items": { "type": "string", "minLength": 1 }
}
}
}