03 — Canonical Serialization and Validation¶
Status¶
- Normative baseline
- Version:
0.9.0 - Layer: Part 0 / Foundation
1. Purpose¶
This chapter defines the canonical serialized notation, the machine-checkable validation boundary, and the relationship between prose semantics and machine artifacts.
2. Canonical Serialized Notation¶
RhoeJSONis the canonical serialized notation of the canonical AST.RhoeJSONis used for:- interchange
- fixtures
- conformance
- machine validation
- implementation-neutral inspection
RhoeJSONis not the primary humane authoring surface.
3. Canonical Domain¶
- The canonical validation domain is the canonical semantic AST.
- Raw surface text and raw parse trees are not the canonical validation domain.
- Target projections are downstream of the canonical validation domain.
4. Validation Layers¶
| Layer | Purpose |
|---|---|
| Parse-time validation | Check syntax, delimiter structure, head metadata shape, and directive grammar |
| Canonical structural validation | Check the Artifact contract, matter presence, and carrier-scoped node legality |
| Registry validation | Check carrier IDs, core genres, stage roles, zones, and composition-grammar registry entries |
| Semantic lint | Check brand, critic, shell, zone, continuation, and carrier legitimacy rules |
| Projection conformance | Check that downstream writers preserve canonical semantics |
5. Normative Relationship Between Prose and Machine Artifacts¶
- Normative prose defines the meaning of the language.
- Machine artifacts MUST conform to the prose.
- If a machine artifact underspecifies a prose rule, the prose wins.
- If the prose is silent and the machine artifact is specific, the machine artifact is authoritative for mechanical structure only.
6. Canonical Omission Policy¶
- Required object fields MUST be present.
- Required collection fields MUST be present, even when empty.
- Optional scalar fields MAY be absent.
- Null is not the preferred encoding for absent optional scalar fields.
- Canonical writers SHOULD prefer omission for absent optional scalars and explicit arrays for required collections.
7. Validation Severities¶
- Normative severities in
0.9.0are: errorwarningsuggestion- Superseded severity spellings such as
advisoryare compatibility-only.
8. Root Invariants¶
- Exactly one
Artifactroot. - Exactly one
carrierArchetype. - Exactly one
genre. - Exactly one
MatterEnvelope. - Exactly one
compositionGrammarRef. - Presence of all three matter zones.
- Valid carrier-node placement.
9. Canonical Schema¶
- The baseline schema lives at:
../machine/schemas/rhoejson-canonical-v0_9.schema.json- That schema is carrier-explicit and validates matter-node legality per baseline carrier.
10. Conformance Fixtures¶
- The shipped fixture suite manifest lives at:
../fixtures/fixture-suite-v0_9.json- Conforming implementations SHOULD validate:
- canonical
RhoeJSONfixtures - canonical
rhoemdfixtures - canonical
rhoedslfixtures - compatibility lowering fixtures
- carrier-node placement fixtures
- projection conformance assertions