Keep shared YAML support within native parser capabilities

This commit is contained in:
2026-11-29 15:44:05 +00:00
parent 8e0f155464
commit ea163dd5dd
2 changed files with 43 additions and 32 deletions

View File

@@ -22,7 +22,8 @@ authorize future implementation, not implementation during the planning pass.
- Adopt `glossary@0.1.0` and `rpg/party@0.1.0` from schemas distribution - Adopt `glossary@0.1.0` and `rpg/party@0.1.0` from schemas distribution
`2026.11.0`, commit `1b8430bdcbf04eb98c8d45c98a1cb986a9e6d477`. `2026.11.0`, commit `1b8430bdcbf04eb98c8d45c98a1cb986a9e6d477`.
Use that revision's schemas, semantics, validation profile, and license terms. Use that revision's schemas, semantics, and license terms. Its validation
profile is reference context, not a requirement to expand native YAML support.
- Bundle content under `assets/shared-domain/`, retaining upstream paths - Bundle content under `assets/shared-domain/`, retaining upstream paths
`glossary/v0.1.0/` and `rpg/party/v0.1.0/`. Add a small source/version record `glossary/v0.1.0/` and `rpg/party/v0.1.0/`. Add a small source/version record
and the selected validation/compatibility documents. Keep the existing single and the selected validation/compatibility documents. Keep the existing single
@@ -72,7 +73,8 @@ authorize future implementation, not implementation during the planning pass.
existing same-spell alias augmentation and cross-spell collision rejection. existing same-spell alias augmentation and cross-spell collision rejection.
- Structured media types are `application/json`, `application/yaml`, and - Structured media types are `application/json`, `application/yaml`, and
`application/x-yaml`, matching existing file-extension materialization. JSON `application/x-yaml`, matching existing file-extension materialization. JSON
media requires JSON syntax; YAML uses the selected profile (and accepts JSON). media requires JSON syntax; YAML uses existing parser capabilities. Do not
bridge ConfigKit's narrower YAML language to the full shared-schema profile.
Keep current byte bounds rather than adding new ones. Do not infer old text or Keep current byte bounds rather than adding new ones. Do not infer old text or
overlay formats, require optional provenance/rulesets, or add a campaign reader. overlay formats, require optional provenance/rulesets, or add a campaign reader.
- Validate completed documents before task selection. Configuration composition - Validate completed documents before task selection. Configuration composition
@@ -139,31 +141,34 @@ from subsequent schema validation.
**Validation:** `go test ./internal/integrations/domainrefs` with focused JSON **Validation:** `go test ./internal/integrations/domainrefs` with focused JSON
fixtures; no network, engine, or credentials. fixtures; no network, engine, or credentials.
## Stage 3 — Implement The Shared YAML Decoding Profile ## Stage 3 — Add Straightforward YAML Input Support
**Goal:** Accept authored YAML without changing its defined data meanings. **Goal:** Accept ordinary supported YAML without a custom compatibility parser.
**Inspect:** The bundled validation profile, pinned `go.yaml.in/yaml/v4` API, **Inspect:** Pinned `go.yaml.in/yaml/v4` capabilities and ConfigKit's documented
and selected upstream decoder/fixtures as reference material. YAML boundary. Keep the broader shared-schema profile as context only.
**Work:** **Work:**
1. Decode YAML nodes into the Stage 2 representation. Enforce one document, 1. Use the existing YAML library's ordinary decoder for completed reference
unique string keys, supported tags, and finite numeric values. Resolve aliases documents, with native duplicate-key checking and a single-document boundary.
while rejecting cycles; reject merge keys as specified by the profile. Convert supported decoded containers to the Stage 2 representation only as
2. Preserve timestamp-like scalars as authored strings, YAML booleans/null as needed for validation. No copied upstream decoder, custom node interpreter,
specified, and integer/decimal precision with standard `math/big` and `math/big` scalar adapter, or full-profile compatibility layer.
`encoding/json` facilities. Handle the profile's alternate integer spellings 2. Do not extend ConfigKit's parser or recreate configuration loading for these
and decimal forms without a float64 conversion that loses data. domain files. ConfigKit continues to own application configuration composition;
3. Reuse the JSON decoder for JSON syntax supplied under YAML media where useful. domain reference loading does not execute imports or directives.
Preserve node location/field context in errors where the parser provides it. 3. Retain useful native decode errors. Document supported serialization behavior
4. Add representative profile cases, including quoted versus plain scalars, and recommend ordinary quoted strings/JSON-compatible scalars or JSON where
anchors, duplicate keys, cycles, unsupported tags/keys, nonfinite values, and the broader shared-schema YAML language would need extra machinery.
large numbers. Avoid cloning the entire upstream harness. 4. Test representative ordinary YAML/JSON equivalents and native failure cases.
Do not require aliases, alternate numeric spellings, arbitrary-precision YAML
numbers, or other broader-profile forms merely because upstream supports them.
**Acceptance:** Equivalent YAML and JSON yield equivalent document values; **Acceptance:** Supported YAML and JSON produce equivalent task views. Native
allowed optional/extension values retain their meaning and unsupported profile parser capabilities define serialization support; neither code nor documentation
forms fail before domain projection. claims full upstream YAML-profile compatibility. Supported decoded extension
values survive forwarding without additional interpretation.
**Validation:** `go test ./internal/integrations/domainrefs`. **Validation:** `go test ./internal/integrations/domainrefs`.
@@ -432,7 +437,7 @@ migration explanations are not stale references to delete.
1. Review each feature-roadmap acceptance item against current implementation and 1. Review each feature-roadmap acceptance item against current implementation and
tests. Check explicit-empty/default selection, multi-target CLI overrides, tests. Check explicit-empty/default selection, multi-target CLI overrides,
whole-document extension retention, all context consumers, schema offline use, supported decoded extension retention, all context consumers, schema offline use,
spell collision/display policy, and preflight/run agreement. spell collision/display policy, and preflight/run agreement.
2. Check for accidental extra requirements: mandatory context/player/classes, 2. Check for accidental extra requirements: mandatory context/player/classes,
trimmed authored strings, extra name/ID uniqueness, extension rejection, trimmed authored strings, extra name/ID uniqueness, extension rejection,

View File

@@ -131,12 +131,18 @@ bundled exact-version schemas registered under their canonical IDs. Bundle the
adopted schema directories and semantics without importing the schema adopted schema directories and semantics without importing the schema
repository's internal Go validation harness or creating a runtime catalog client. repository's internal Go validation harness or creating a runtime catalog client.
Match the selected upstream validation profile for JSON/YAML decoding, including Adopt the shared domain structure and semantics without promising the full
one completed document, duplicate-key rejection, supported YAML aliases and upstream YAML decoding profile. ConfigKit accepts a narrower YAML value language;
scalar handling, and preservation of numeric precision. In particular, extension do not widen it or build a compatibility bridge for shared-schema YAML forms.
values must not be silently altered by a lossy generic decode. Reuse existing Use existing parser capabilities and straightforward decoding for supported
libraries where they provide the required behavior; add only the adapter logic documents. Operators can use supported plain YAML or equivalent JSON rather than
needed to bridge the adopted profile. requiring Notarius-specific scalar, alias, tag, or arbitrary-precision machinery.
Document the serialization boundary separately from shared-schema validity.
Reference documents remain completed domain data, not another application
configuration load. Avoid routing them through configuration imports/directives
merely to reuse a parser. Preserve supported decoded values and extensions when
forwarding; do not claim lossless handling of every upstream YAML value.
Validate the complete shared document before projecting selected collections. Validate the complete shared document before projecting selected collections.
Enforce the upstream semantic rule that glossary entry IDs are unique within Enforce the upstream semantic rule that glossary entry IDs are unique within
@@ -321,10 +327,10 @@ The implemented feature should demonstrate:
3. One shared roster supplies character aliases and player relationships to the 3. One shared roster supplies character aliases and player relationships to the
maintained pipeline without duplicate player/party-vocabulary authoring. maintained pipeline without duplicate player/party-vocabulary authoring.
Optional attributes and duplicate display labels follow the shared contract. Optional attributes and duplicate display labels follow the shared contract.
4. Equivalent YAML and JSON inputs produce equivalent task material. Focused 4. Equivalent supported YAML and JSON inputs produce equivalent task material.
decoding tests cover duplicate keys, unsupported YAML forms, precision-sensitive Focused tests cover ordinary supported values and native decoding failures,
extension values, and representative allowed aliases/scalars from the upstream without requiring full upstream YAML-profile parity or a custom bridge.
profile. Structural and semantic tests cover omission/null/empty behavior, Structural and semantic tests cover omission/null/empty behavior,
extensions, per-collection ID uniqueness, and incompatible markers. extensions, per-collection ID uniqueness, and incompatible markers.
5. Recognition tests preserve embedded vocabulary, canonical display, same-spell 5. Recognition tests preserve embedded vocabulary, canonical display, same-spell
alias augmentation, and deterministic collision handling. General glossary alias augmentation, and deterministic collision handling. General glossary