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,

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
repository's internal Go validation harness or creating a runtime catalog client.
Match the selected upstream validation profile for JSON/YAML decoding, including
one completed document, duplicate-key rejection, supported YAML aliases and
scalar handling, and preservation of numeric precision. In particular, extension
values must not be silently altered by a lossy generic decode. Reuse existing
libraries where they provide the required behavior; add only the adapter logic
needed to bridge the adopted profile.
Adopt the shared domain structure and semantics without promising the full
upstream YAML decoding profile. ConfigKit accepts a narrower YAML value language;
do not widen it or build a compatibility bridge for shared-schema YAML forms.
Use existing parser capabilities and straightforward decoding for supported
documents. Operators can use supported plain YAML or equivalent JSON rather than
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.
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
maintained pipeline without duplicate player/party-vocabulary authoring.
Optional attributes and duplicate display labels follow the shared contract.
4. Equivalent YAML and JSON inputs produce equivalent task material. Focused
decoding tests cover duplicate keys, unsupported YAML forms, precision-sensitive
extension values, and representative allowed aliases/scalars from the upstream
profile. Structural and semantic tests cover omission/null/empty behavior,
4. Equivalent supported YAML and JSON inputs produce equivalent task material.
Focused tests cover ordinary supported values and native decoding failures,
without requiring full upstream YAML-profile parity or a custom bridge.
Structural and semantic tests cover omission/null/empty behavior,
extensions, per-collection ID uniqueness, and incompatible markers.
5. Recognition tests preserve embedded vocabulary, canonical display, same-spell
alias augmentation, and deterministic collision handling. General glossary