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
`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
`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
@@ -72,7 +73,8 @@ authorize future implementation, not implementation during the planning pass.
existing same-spell alias augmentation and cross-spell collision rejection.
- Structured media types are `application/json`, `application/yaml`, and
`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
overlay formats, require optional provenance/rulesets, or add a campaign reader.
- 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
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,
and selected upstream decoder/fixtures as reference material.
**Inspect:** Pinned `go.yaml.in/yaml/v4` capabilities and ConfigKit's documented
YAML boundary. Keep the broader shared-schema profile as context only.
**Work:**
1. Decode YAML nodes into the Stage 2 representation. Enforce one document,
unique string keys, supported tags, and finite numeric values. Resolve aliases
while rejecting cycles; reject merge keys as specified by the profile.
2. Preserve timestamp-like scalars as authored strings, YAML booleans/null as
specified, and integer/decimal precision with standard `math/big` and
`encoding/json` facilities. Handle the profile's alternate integer spellings
and decimal forms without a float64 conversion that loses data.
3. Reuse the JSON decoder for JSON syntax supplied under YAML media where useful.
Preserve node location/field context in errors where the parser provides it.
4. Add representative profile cases, including quoted versus plain scalars,
anchors, duplicate keys, cycles, unsupported tags/keys, nonfinite values, and
large numbers. Avoid cloning the entire upstream harness.
1. Use the existing YAML library's ordinary decoder for completed reference
documents, with native duplicate-key checking and a single-document boundary.
Convert supported decoded containers to the Stage 2 representation only as
needed for validation. No copied upstream decoder, custom node interpreter,
`math/big` scalar adapter, or full-profile compatibility layer.
2. Do not extend ConfigKit's parser or recreate configuration loading for these
domain files. ConfigKit continues to own application configuration composition;
domain reference loading does not execute imports or directives.
3. Retain useful native decode errors. Document supported serialization behavior
and recommend ordinary quoted strings/JSON-compatible scalars or JSON where
the broader shared-schema YAML language would need extra machinery.
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;
allowed optional/extension values retain their meaning and unsupported profile
forms fail before domain projection.
**Acceptance:** Supported YAML and JSON produce equivalent task views. Native
parser capabilities define serialization support; neither code nor documentation
claims full upstream YAML-profile compatibility. Supported decoded extension
values survive forwarding without additional interpretation.
**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
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.
2. Check for accidental extra requirements: mandatory context/player/classes,
trimmed authored strings, extra name/ID uniqueness, extension rejection,