Use native ConfigKit loading for shared references

This commit is contained in:
2026-11-29 16:33:35 +00:00
parent ea163dd5dd
commit bfd9556a9e
2 changed files with 188 additions and 151 deletions

View File

@@ -4,8 +4,8 @@
Implement [Shared Domain Schema Adoption](shared-domain-schemas.md). That roadmap Implement [Shared Domain Schema Adoption](shared-domain-schemas.md). That roadmap
owns the target state, intent, and approved input cutover. This document owns the owns the target state, intent, and approved input cutover. This document owns the
ordered implementation tasks. The baseline is `3ba68e6`; application code still ordered implementation tasks. The planning baseline is `ea163dd`; application
uses the private spell overlay and text party/glossary references. code still uses the private spell overlay and text party/glossary references.
Each numbered stage is one Luna implementation prompt. Execute in order during Each numbered stage is one Luna implementation prompt. Execute in order during
one end-to-end sprint. Intermediate stages may leave callers or tests broken; one end-to-end sprint. Intermediate stages may leave callers or tests broken;
@@ -20,22 +20,38 @@ authorize future implementation, not implementation during the planning pass.
## Resolved Design Details ## Resolved Design Details
- Adopt `glossary@0.1.0` and `rpg/party@0.1.0` from schemas distribution - Adopt published ConfigKit-aligned glossary and RPG party contracts. The reviewed
`2026.11.0`, commit `1b8430bdcbf04eb98c8d45c98a1cb986a9e6d477`. `0.1.0` schemas in `2026.11.0` predate that alignment and are not the target.
Use that revision's schemas, semantics, and license terms. Its validation Stage 1 verifies the new publication and records exact versions before reader
profile is reference context, not a requirement to expand native YAML support. implementation. Do not implement a local bridge while awaiting publication.
- 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/v<selected-version>/` and `rpg/party/v<selected-version>/`. Include
and the selected validation/compatibility documents. Keep the existing single schema files, adjacent semantics, and a small source/version record. Link
assets Go file content-only; extend its embed declaration as necessary. upstream manuals rather than copying them. Keep the single assets Go file
- Put reusable decoding, validation, and retained document types in content-only; extend its embed declaration as necessary.
`internal/integrations/domainrefs`. Put D&D contextual projections in - Put a small native-load/schema-validation integration in
`internal/modules/dnd/shared`; spell recognition remains catalog-owned. `internal/integrations/domainrefs`. Use ConfigKit `v1.4.0`'s public
No dependency on upstream internal Go packages or runtime schema downloads. `Load[map[string]any](configkit.Bytes(label, content))` for both JSON and YAML.
Pass `Result.Config` directly to JSON Schema validation. Keep that resolved
mapping as the document; build narrow D&D projections in
`internal/modules/dnd/shared` and recognition views in the spell catalog.
No custom parser, generic document SDK, or upstream internal-package import.
- Use a single-source native load with no enabled imports, selected overlay,
defaults, application resolver, overrides, or secrets bootstrap. Native
structural behavior still applies, including `extends` and source-root `config`
controls. Do not pre-parse, disable, or reinterpret native reserved controls.
Retain wrapped native causes instead of reconstructing parser diagnostics.
This is a reference-document load, not another load of application settings.
- Keep native dynamic number binding (`int64`/finite `float64`) and native value
limits. Retain supported resolved extensions, not exact authored numeric
spelling/precision or consumed controls. Do not create serialization/forwarding
APIs or marshal/reload documents merely to construct typed views. Existing
reference items retain original bytes independently where needed.
- External reference objects gain `collections: [name, ...]`. Omission or null - External reference objects gain `collections: [name, ...]`. Omission or null
means slot defaults. Explicit `[]` selects no collections. Preserve this means slot defaults. Explicit `[]` selects no collections. Preserve this
distinction through conversion, cloning, resolution, and inspection. Use a distinction through conversion, cloning, resolution, and inspection. Use
presence-aware document field and a runtime nil-versus-empty slice; do not ordinary ConfigKit-bound nullable fields and its native presence/inspection
behavior, then a runtime nil-versus-empty slice; do not add a presence tracker or
collapse an explicit empty slice with `append(nil, values...)`. collapse an explicit empty slice with `append(nil, values...)`.
- Collection names compare exactly, without trimming or case folding. Empty - Collection names compare exactly, without trimming or case folding. Empty
names cannot identify a valid upstream collection and are input errors. names cannot identify a valid upstream collection and are input errors.
@@ -62,19 +78,19 @@ authorize future implementation, not implementation during the planning pass.
forms when supplied. Party context projects names, aliases, player relationships, forms when supplied. Party context projects names, aliases, player relationships,
and classes/levels when supplied. Sort roster keys for presentation but omit and classes/levels when supplied. Sort roster keys for presentation but omit
those IDs from model content. Preserve distinct same-name roster entries. those IDs from model content. Preserve distinct same-name roster entries.
Unknown extensions remain retained data, not interpreted instructions. Full Ordinary extensions remain native resolved data, not model instructions;
document forwarding preserves extensions; these task views omit them. these task views omit them. Native reserved controls keep their upstream meaning.
- Spell context projects canonical names/aliases only. Embedded vocabulary keeps - Spell context projects canonical names/aliases only. Embedded vocabulary keeps
display precedence. For new external names, traverse collections and entries display precedence. For new external names, traverse collections and entries
in exact collection-name/entry-ID order so map/list order does not select the in exact collection-name/entry-ID order so map/list order does not select the
display spelling. Use existing lookup normalization; trim surrounding whitespace display spelling. Use existing lookup normalization; trim surrounding whitespace
in the recognition view without changing authored data. A name/alias that in the recognition view without changing the resolved document. A name/alias that
becomes unusable after normalization is a task suitability error. Preserve becomes unusable after normalization is a task suitability error. Preserve
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 existing parser capabilities. Do not media requires JSON syntax via a standard `json.Valid` check, followed by the
bridge ConfigKit's narrower YAML language to the full shared-schema profile. same native load used for YAML. Neither serialization bypasses native limits.
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
@@ -82,97 +98,76 @@ authorize future implementation, not implementation during the planning pass.
construction shared by run and explicit preflight, before domain inference. construction shared by run and explicit preflight, before domain inference.
Keep ordinary offline pipeline validation free of reference-file reads. Keep ordinary offline pipeline validation free of reference-file reads.
## Stage 1 — Bundle The Selected Contract Content ## Stage 1 — Confirm And Bundle The Aligned Contracts
**Goal:** Make exact adopted contracts available offline without behavioral asset **Goal:** Pin released aligned definitions and make essential contracts available
registration. offline without behavioral asset registration.
**Inspect:** `assets/package.go`, schemas tag/catalog and selected version **Inspect:** `assets/package.go`, schemas tag/catalog and selected version
directories in `../schemas`, `docs/policy/oss.md`, and current attribution. directories in `../schemas`, `docs/policy/oss.md`, and current attribution.
**Work:** **Work:**
1. Copy the two schema directories, including adjacent semantics and synthetic 1. Verify publication of a ConfigKit-aligned schema distribution. At preparation
examples, from the exact source revision into the selected asset subtree. time only the pre-alignment `2026.11.0` source tag was available. If alignment
Copy selected validation/compatibility documentation into its `docs/` folder, is not published yet, report that prerequisite and stop schema-dependent work;
preserving contract text and identifying its source. Keep schemas verbatim; do not silently select old contracts, unpublished candidates, or local patches.
repair documentation links to pinned upstream sources for targets not bundled, 2. Select the most current glossary and party versions from that published
recording those navigation adaptations in the material identification. Do not distribution's catalog and review their semantics against ConfigKit `v1.4.0`.
copy the full catalog as though the unbundled campaign schema were supported. Record distribution, full source commit, versions, document markers, and
2. Record distribution, revision, exact schema versions and canonical IDs in a canonical IDs in the feature roadmap, this plan, and a small asset source record.
small content record. No runtime release discovery or inventory framework. No runtime release discovery or inventory framework.
3. Extend the existing embed declaration. Update asset-package commentary to 3. Copy only the selected schema files and adjacent semantics, plus exact schema
dependencies if any, into the asset subtree. Keep schema files verbatim; link
nonbundled documentation targets to the selected upstream revision and record
any navigation adaptations. Do not copy upstream parser manuals, full example
archives, or a catalog advertising unbundled campaign support.
4. Extend the existing embed declaration. Update asset-package commentary to
recognize shared input contracts as well as LLM content. recognize shared input contracts as well as LLM content.
4. Add the incorporated material's attribution and applicable CC0 license text 5. Add the incorporated material's attribution and applicable license text using
using the existing OSS conventions and commit-pinned links. the selected release's actual terms, existing OSS conventions, and pinned links.
**Acceptance:** The packaged filesystem contains the selected schemas and **Acceptance:** Published aligned versions are pinned, and the packaged filesystem
semantics; `assets` still has no business logic or kit dependency. Source/license contains their schemas and semantics; `assets` still has no business logic or kit
records describe only incorporated material. dependency. Source/license records describe only incorporated material.
**Validation:** `go test ./assets`; inspect copied files against `git show` at the **Validation:** `go test ./assets`; inspect copied files against `git show` at the
selected upstream commit, and `git diff --check`. selected upstream commit, and `git diff --check`.
## Stage 2 — Implement Lossless JSON Document Decoding ## Stage 2 — Load Shared References Through ConfigKit
**Goal:** Establish the reusable completed-document representation and JSON path. **Goal:** Delegate parsing and resolution for both serializations to ConfigKit.
**Inspect:** Selected validation profile, existing jsonschema dependency usage, **Inspect:** ConfigKit's pinned public `Load`, `Bytes`, and dynamic-value contracts;
and upstream decoder behavior for guidance only. the aligned schemas' semantics; existing reference byte/media-type transport.
**Work:** **Work:**
1. Create `internal/integrations/domainrefs` with a decoder accepting bytes and 1. Create a small shared-reference loader in `internal/integrations/domainrefs`
media type and retaining string-keyed objects, arrays, strings, booleans, that accepts already-materialized bytes, media type, and a useful diagnostic
null, and exact JSON numbers. Retain a complete document separately from any label. For JSON media, use only `json.Valid` to enforce JSON syntax. Then call
later typed view; no general import/composition machinery. the public native byte-source load for either media type.
2. Use standard JSON token decoding with `UseNumber` to reject duplicate keys at 2. Return the native resolved mapping for subsequent schema/domain validation.
every depth, including equivalent escaped spellings, before a map loses them. Do not recreate a raw/typed document hierarchy, custom JSON token walker,
Require one complete JSON value; invalid JSON must not fall back to YAML when direct YAML-library decoder, numeric adapter, or generic conversion API.
the declared media type is JSON. 3. Use the single-source selections above. Native parsing, structural resolution,
3. Return contextual decode errors using existing error wrapping, not a public scalar binding, limits, and error details remain authoritative. Wrap failures
taxonomy. Add ordinary serialization/forwarding support that preserves values with reference context and retain their causes; do not create an error taxonomy.
and extensions without promising original whitespace or key order. 4. Add a few public-API integration tests: ordinary equivalent YAML/JSON input,
one representative native rejection, resolved numeric/extension values, and
native reserved-control handling. Do not reproduce ConfigKit's parser matrix.
An `instruction` extension remains ordinary data. JSON receives no fallback
path when ConfigKit rejects a syntactically valid document.
**Acceptance:** Precision-sensitive extension values survive a decode/encode **Acceptance:** Both serializations use one native loading boundary. No exact
round trip. Duplicate keys, trailing values, and invalid JSON fail distinctly numeric-preservation guarantee, independent parser, or configuration reconstruction
from subsequent schema validation. has been introduced. ConfigKit failures remain distinguishable from later schema
and domain checks without reimplementing native error semantics.
**Validation:** `go test ./internal/integrations/domainrefs` with focused JSON **Validation:** `go test ./internal/integrations/domainrefs`; no network, engine,
fixtures; no network, engine, or credentials. or credentials.
## Stage 3 — Add Straightforward YAML Input Support ## Stage 3 — Validate Resolved Shared Documents
**Goal:** Accept ordinary supported YAML without a custom compatibility parser.
**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. 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:** 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`.
## Stage 4 — Add Offline Shared Validation And Typed Views
**Goal:** Separate shared conformance from consumer requirements. **Goal:** Separate shared conformance from consumer requirements.
@@ -184,9 +179,13 @@ values survive forwarding without additional interpretation.
jsonschema library. Compile once with safe shared reuse; configure unresolved jsonschema library. Compile once with safe shared reuse; configure unresolved
resource loads to fail locally. Do not enumerate unrelated schemas or query resource loads to fail locally. Do not enumerate unrelated schemas or query
canonical URLs at runtime. canonical URLs at runtime.
2. Provide glossary/party readers that decode and validate the complete envelope, Schema resource JSON remains owned by the schema engine's resource loader,
then expose typed known-field views alongside the retained full document. preserving exact numeric constraints; it is not a domain document to load
Validate all known fields and all collections, not only selected entries. through ConfigKit.
2. Validate the Stage 2 native mapping directly. Check the complete resolved
envelope, all known fields, and all collections, not only selected entries.
Do not decode a second typed copy or marshal/reload subtrees. Add narrow typed
accessors/projections only where needed by the concrete consumers.
3. Check glossary entry-ID uniqueness within each collection using exact strings. 3. Check glossary entry-ID uniqueness within each collection using exact strings.
Do not add name uniqueness, global ID uniqueness, required player/classes, or Do not add name uniqueness, global ID uniqueness, required player/classes, or
cross-document reference checks. cross-document reference checks.
@@ -195,15 +194,15 @@ values survive forwarding without additional interpretation.
as task errors, not upstream schema errors. as task errors, not upstream schema errors.
5. Cover omitted/null/empty aliases, permitted extensions at all relevant levels, 5. Cover omitted/null/empty aliases, permitted extensions at all relevant levels,
invalid optional-field types, empty collections/rosters, shared IDs across invalid optional-field types, empty collections/rosters, shared IDs across
collections, and duplicate IDs within a collection. Include a forwarding test collections, and duplicate IDs within a collection. Retain supported resolved
showing that an `instruction` extension stays ordinary retained data. extensions in the mapping without inventing a forwarding subsystem.
**Acceptance:** Both readers conform offline to their exact selected contracts; **Acceptance:** The native resolved mapping is validated offline against the exact
typed projection neither discards forwarded extensions nor alters authored data. aligned contracts. Domain checks add no new authoring format or decoding path.
**Validation:** `go test ./internal/integrations/domainrefs`. **Validation:** `go test ./internal/integrations/domainrefs`.
## Stage 5 — Carry Collection Selection Through Configuration ## Stage 4 — Carry Collection Selection Through Configuration
**Goal:** Preserve binding selection and its presence through normal configuration **Goal:** Preserve binding selection and its presence through normal configuration
resolution without changing ConfigKit ownership. resolution without changing ConfigKit ownership.
@@ -217,6 +216,8 @@ in `internal/framework/contracts/contracts.go`.
1. Add the presence-aware `collections` field to external reference documents, 1. Add the presence-aware `collections` field to external reference documents,
runtime `ReferenceSource`, and resolved `ReferenceBinding`. Extend existing runtime `ReferenceSource`, and resolved `ReferenceBinding`. Extend existing
external-source constructors as needed; avoid duplicate legacy source types. external-source constructors as needed; avoid duplicate legacy source types.
Use ordinary typed ConfigKit binding and inspection. Do not create another
presence index, source tracker, configuration merge, or cloning framework.
2. Keep the reference source union explicit: collection selection accompanies 2. Keep the reference source union explicit: collection selection accompanies
`path`, not `artifact`. Reject wrong selection types and empty names; preserve `path`, not `artifact`. Reject wrong selection types and empty names; preserve
null/omitted versus explicit empty according to the resolved design. null/omitted versus explicit empty according to the resolved design.
@@ -235,7 +236,7 @@ explicit `[]` does not turn into defaults.
`go test ./internal/core/config ./internal/framework/pipeline`. Temporary failures `go test ./internal/core/config ./internal/framework/pipeline`. Temporary failures
from later wiring must be identified, not hidden with compatibility scaffolding. from later wiring must be identified, not hidden with compatibility scaffolding.
## Stage 6 — Preserve Selections Through CLI And Materialization ## Stage 5 — Preserve Selections Through CLI And Materialization
**Goal:** Deliver selected input views consistently to consumers. **Goal:** Deliver selected input views consistently to consumers.
@@ -267,7 +268,7 @@ or configuration composition mechanism is introduced.
**Validation:** Focused tests in `./internal/framework/pipeline` and **Validation:** Focused tests in `./internal/framework/pipeline` and
`./internal/cli` for reference handling. `./internal/cli` for reference handling.
## Stage 7 — Cut Spell Recognition Over To Shared Glossaries ## Stage 6 — Cut Spell Recognition Over To Shared Glossaries
**Goal:** Replace the private overlay format across the whole spell family. **Goal:** Replace the private overlay format across the whole spell family.
@@ -300,7 +301,7 @@ no durable spell shape or evidence rule changes.
**Validation:** `go test ./internal/modules/dnd/spells/... ./internal/modules/dnd/extract/spells ./internal/modules/dnd/normalize/spells ./internal/modules/dnd/validate/spells/...` **Validation:** `go test ./internal/modules/dnd/spells/... ./internal/modules/dnd/extract/spells ./internal/modules/dnd/normalize/spells ./internal/modules/dnd/validate/spells/...`
and focused CLI spell-catalog tests after their fixture migration. and focused CLI spell-catalog tests after their fixture migration.
## Stage 8 — Prepare Shared Context For Scenes And Registry Lanes ## Stage 7 — Prepare Shared Context For Scenes And Registry Lanes
**Goal:** Establish one reusable context preparation path and migrate its first **Goal:** Establish one reusable context preparation path and migrate its first
coherent consumer group. coherent consumer group.
@@ -311,7 +312,8 @@ and `assets/dnd/shared/prompts/common-dnd-references.md`.
**Work:** **Work:**
1. Add a constructor-time shared context preparer using the Stage 4 readers. 1. Add a constructor-time shared context preparer using Stage 3's validated native
mappings and narrow task views.
Prepare fixed party/glossary/player material and combine it with each operation's Prepare fixed party/glossary/player material and combine it with each operation's
current transcript material. Keep generated references separate and dynamic. current transcript material. Keep generated references separate and dynamic.
2. Change party/roster/glossary declarations to structured media; retain text 2. Change party/roster/glossary declarations to structured media; retain text
@@ -333,7 +335,7 @@ missing optional context is supported and same-name roster members remain distin
**Validation:** Shared projection tests plus scene chunker and four migrated **Validation:** Shared projection tests plus scene chunker and four migrated
extractor package tests. Update obsolete text fixtures for these consumers. extractor package tests. Update obsolete text fixtures for these consumers.
## Stage 9 — Migrate All Remaining D&D Context Consumers ## Stage 8 — Migrate All Remaining D&D Context Consumers
**Goal:** Complete context cutover without leaving a text-input bypass. **Goal:** Complete context cutover without leaving a text-input bypass.
@@ -343,7 +345,7 @@ calls and grounding helpers, including enemy-event material assembly.
**Work:** **Work:**
1. Migrate these six extractors to the Stage 8 prepared context facility. Keep 1. Migrate these six extractors to the Stage 7 prepared context facility. Keep
their generated registry/scene/combat handoffs and operation-local inputs intact. their generated registry/scene/combat handoffs and operation-local inputs intact.
2. Audit production calls to `shared.PromptInputs`, `ReferencePromptMaterial`, 2. Audit production calls to `shared.PromptInputs`, `ReferencePromptMaterial`,
and `ReferencePromptInput`. Remove the obsolete party/glossary raw-text path; and `ReferencePromptInput`. Remove the obsolete party/glossary raw-text path;
@@ -361,7 +363,7 @@ validation simply because no chunks execute or accepted artifacts are cached.
**Validation:** `go test ./internal/modules/dnd/... ./internal/modules/integration`. **Validation:** `go test ./internal/modules/dnd/... ./internal/modules/integration`.
## Stage 10 — Verify Assembled Run And Preflight Behavior ## Stage 9 — Verify Assembled Run And Preflight Behavior
**Goal:** Prove the public workflow through real internal collaborators and fake **Goal:** Prove the public workflow through real internal collaborators and fake
provider boundaries. provider boundaries.
@@ -378,7 +380,7 @@ provider boundaries.
2. Prove run and explicit preflight reject malformed party/glossary documents, 2. Prove run and explicit preflight reject malformed party/glossary documents,
duplicate IDs, absent explicit collections, and spell collisions before any duplicate IDs, absent explicit collections, and spell collisions before any
fake domain inference/provider smoke call. Use representative cases rather fake domain inference/provider smoke call. Use representative cases rather
than rerunning the decoder matrix in CLI tests. than rerunning ConfigKit's parser matrix in CLI tests.
3. Prove valid shared inputs reach the expected tasks; use a controlled empty 3. Prove valid shared inputs reach the expected tasks; use a controlled empty
model extraction with populated references to verify the application does not model extraction with populated references to verify the application does not
synthesize reference-only events. Do not assert live model quality guarantees. synthesize reference-only events. Do not assert live model quality guarantees.
@@ -393,7 +395,7 @@ the final ordinary pipeline remains usable with optional references omitted.
**Validation:** `go test ./internal/cli ./internal/preflight ./internal/framework/pipeline`. **Validation:** `go test ./internal/cli ./internal/preflight ./internal/framework/pipeline`.
## Stage 11 — Migrate Maintained Examples And Canonical Documentation ## Stage 10 — Migrate Maintained Examples And Canonical Documentation
**Goal:** Make the supported workflow discoverable without duplicating upstream **Goal:** Make the supported workflow discoverable without duplicating upstream
schema manuals. schema manuals.
@@ -418,6 +420,8 @@ and the documentation/OSS policies.
subprocess examples, and relevant internal ownership docs. Include a concise subprocess examples, and relevant internal ownership docs. Include a concise
migration section: new envelopes, existing slot names, collection selection, migration section: new envelopes, existing slot names, collection selection,
nullable aliases, optional provenance, and roster-derived player relationships. nullable aliases, optional provenance, and roster-derived player relationships.
Link native loading, numeric binding, limits, and reserved controls to the
pinned ConfigKit documentation rather than maintaining a second manual.
5. Recheck attribution and copied content. Do not publish a release, preselect a 5. Recheck attribution and copied content. Do not publish a release, preselect a
version, or claim other applications already support the shared format. version, or claim other applications already support the shared format.
@@ -429,7 +433,7 @@ docs describe the implemented cutover, not legacy support or future campaigns.
local link checks and searches for retired example paths/overlay marker. Intentional local link checks and searches for retired example paths/overlay marker. Intentional
migration explanations are not stale references to delete. migration explanations are not stale references to delete.
## Stage 12 — Final Contract And Regression Pass ## Stage 11 — Final Contract And Regression Pass
**Goal:** Finish the end-to-end sprint with all target behavior verified. **Goal:** Finish the end-to-end sprint with all target behavior verified.
@@ -442,6 +446,10 @@ migration explanations are not stale references to delete.
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,
ruleset/provenance requirements, custom composition, new caps or retries. ruleset/provenance requirements, custom composition, new caps or retries.
Confirm no parallel parser, scalar adapter, subtree conversion round trip,
generic document/forwarding SDK, or copied upstream parser suite remains.
Native reserved controls and dynamic-value limits are upstream behavior, not
locally reimplemented restrictions or guarantees.
Check durable outputs, session identity, native reports and cache policy remain Check durable outputs, session identity, native reports and cache policy remain
unchanged. Remove temporary migration scaffolding and obsolete fixtures. unchanged. Remove temporary migration scaffolding and obsolete fixtures.
3. Run `gofmt` on modified Go files, then `go test ./...`, `go vet ./...`, and 3. Run `gofmt` on modified Go files, then `go test ./...`, `go vet ./...`, and
@@ -455,4 +463,5 @@ migration explanations are not stale references to delete.
**Acceptance:** All stages' outcomes and the feature-roadmap acceptance criteria **Acceptance:** All stages' outcomes and the feature-roadmap acceptance criteria
are satisfied; repository-wide checks pass and no compatibility reader or are satisfied; repository-wide checks pass and no compatibility reader or
duplicated authoring workflow remains. No blocking design question is known. duplicated authoring workflow remains. No blocking product decision is known;
the aligned-schema publication prerequisite must have been satisfied in Stage 1.

View File

@@ -42,30 +42,42 @@ Reviewed against Notarius commit
- The maintained [complete example](../../examples/dnd-complete/config.yml) - The maintained [complete example](../../examples/dnd-complete/config.yml)
supplies text party/glossary references and a separately authored spell overlay. supplies text party/glossary references and a separately authored spell overlay.
The [D&D subprocess guide](../consumers/dnd-pipeline.md) reflects those inputs. The [D&D subprocess guide](../consumers/dnd-pipeline.md) reflects those inputs.
- The repository already imports `go.yaml.in/yaml/v4` and - The repository already imports ConfigKit `v1.4.0` and
`github.com/santhosh-tekuri/jsonschema/v6`. No new parser or schema-engine `github.com/santhosh-tekuri/jsonschema/v6`. Their public APIs supply native
dependency is expected solely for this adoption. loading and external JSON Schema validation; no new parser dependency is needed.
## Selected Upstream Baseline ## Upstream Baseline And Adoption Prerequisite
Use the shared schemas source distribution The reviewed shared schemas source distribution is
[`2026.11.0`](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0), [`2026.11.0`](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0),
whose published remote tag resolves to commit whose published remote tag resolves to commit
`1b8430bdcbf04eb98c8d45c98a1cb986a9e6d477`. Its `1b8430bdcbf04eb98c8d45c98a1cb986a9e6d477`. Its
[catalog](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/catalog.json) [catalog](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/catalog.json)
contains the following independently versioned contracts: contains the following independently versioned contracts:
| Contract | Version | Document identifier | Adoption scope | | Contract | Reviewed version | Document identifier | Intended adoption scope |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| General glossary | `0.1.0` | `maximumdirect.glossary.v1` | Structured vocabulary and spell recognition. | | General glossary | `0.1.0` | `maximumdirect.glossary.v1` | Structured vocabulary and spell recognition. |
| RPG party | `0.1.0` | `maximumdirect.rpg.party.v1` | Structured character roster and player relationships. | | RPG party | `0.1.0` | `maximumdirect.rpg.party.v1` | Structured character roster and player relationships. |
| RPG campaign | `0.1.0` | `maximumdirect.rpg.campaign.v1` | Reviewed; no new structured consumer in this work set. | | RPG campaign | `0.1.0` | `maximumdirect.rpg.campaign.v1` | Reviewed; no new structured consumer in this work set. |
Adopt the glossary and party schemas together with their adjacent semantics and That release's `0.1.0` contracts predate the upstream ConfigKit-alignment work
the selected distribution's and are not the implementation target. As of this revision, `2026.11.0` is the
[validation profile](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/docs/validation.md) only published source tag verified. Select the published ConfigKit-aligned
and glossary and party versions when available, together with their adjacent
[compatibility guidance](https://forge.maximumdirect.net/eric/schemas/src/tag/2026.11.0/docs/compatibility.md). semantics. Record the distribution, full source commit, exact schema versions,
canonical IDs, and document markers before implementing their readers. Do not
adapt the old contracts locally or treat unpublished schema work as released.
The adoption prerequisite is a published aligned schema distribution; no further
product decision is needed to keep loading native. Preparation can proceed, but
schema-dependent implementation must use the verified new definitions. Keep
older source/version details above as review evidence, not accepted legacy input.
Use the existing ConfigKit `v1.4.0`
[consumer guide](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/consumers/README.md)
and [native contract](https://forge.maximumdirect.net/base-layer/configkit/src/tag/v1.4.0/docs/config.md)
for loading semantics; the aligned schema release must fit that boundary.
Repository CalVer, individual schema SemVer, document generation markers, and Repository CalVer, individual schema SemVer, document generation markers, and
canonical schema IDs remain distinct. Record exact selected versions and source canonical schema IDs remain distinct. Record exact selected versions and source
revision; do not discover support from mutable `main` or live URL availability. revision; do not discover support from mutable `main` or live URL availability.
@@ -125,26 +137,38 @@ modules. Internal transport details belong in the implementation plan.
### Shared Conformance And Task Suitability ### Shared Conformance And Task Suitability
Provide one reusable decoding/validation boundary for adopted shared documents, Provide one small shared-reference loading/validation integration, with
with small task-specific projections. Ordinary validation is offline, using task-specific projections. Ordinary validation is offline, using
bundled exact-version schemas registered under their canonical IDs. Bundle the bundled exact-version schemas registered under their canonical IDs. Bundle the
adopted schema directories and semantics without importing the schema adopted schema files and adjacent 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.
Adopt the shared domain structure and semantics without promising the full Load already-materialized reference bytes through ConfigKit's public
upstream YAML decoding profile. ConfigKit accepts a narrower YAML value language; `Load[map[string]any]` and `Bytes` APIs. YAML and JSON use the same native loading
do not widen it or build a compatibility bridge for shared-schema YAML forms. path. A standard JSON syntax check may enforce the JSON media convention, but
Use existing parser capabilities and straightforward decoding for supported does not provide an alternate decoder. Pass `Result.Config` directly to the
documents. Operators can use supported plain YAML or equivalent JSON rather than existing JSON Schema engine, then apply shared semantic checks and D&D task
requiring Notarius-specific scalar, alias, tag, or arbitrary-precision machinery. selection. ConfigKit owns parsing, duplicate-key checks, scalar binding,
Document the serialization boundary separately from shared-schema validity. structural resolution, native limits, and native diagnostic details.
Reference documents remain completed domain data, not another application Use a single-source load without enabling import traversal, selecting overlays,
configuration load. Avoid routing them through configuration imports/directives or supplying application defaults, custom resolvers, overrides, or secrets
merely to reuse a parser. Preserve supported decoded values and extensions when bootstrap. Native structural behavior still applies: `extends` is structural
forwarding; do not claim lossless handling of every upstream YAML value. input and source-root `config` has native control semantics even when imports
are off. Do not suppress or reinterpret these controls with a pre-parser.
Nested ordinary `config` data follows upstream behavior. This shared-reference
load is separate from the one application-owned configuration result and does
not reconstruct Notarius's application configuration or its engine.
Validate the complete shared document before projecting selected collections. Keep the resolved mapping as the document representation and build only the
small projections consumers need. No separate raw/typed document SDK, generic
subtree converter, serialization round trip, or forwarding API is needed.
Existing reference transport can retain original bytes; resolved values need
not preserve authored spelling, numeric precision, or consumed controls. If a
shared document is forwarded, use its supported resolved values and extensions.
JSON is subject to the same native limits; it is not a universal escape hatch.
Validate the complete resolved 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
each collection using exact comparison. Reuse of an ID in another collection is each collection using exact comparison. Reuse of an ID in another collection is
valid. Do not require globally unique names, aliases, player names, or IDs, or valid. Do not require globally unique names, aliases, player names, or IDs, or
@@ -156,10 +180,10 @@ supported, while null is not interchangeable with omission for every optional
field. Shared authored-input schemas are not private LLM response schemas and field. Shared authored-input schemas are not private LLM response schemas and
do not inherit provider-specific restrictions on optional response properties. do not inherit provider-specific restrictions on optional response properties.
Accept permitted extensions and preserve them when forwarding a shared document. Accept permitted extensions within the native resolved-value boundary.
Task-specific projections may intentionally omit irrelevant fields. An extension Task-specific projections may omit irrelevant fields. An ordinary extension
named `instruction` has no instruction or configuration semantics. Supported named `instruction` does not become model guidance. Native reserved controls keep
domain interpretation must be deliberate rather than inferred from field names. their upstream meaning; additional domain interpretation must be deliberate.
Keep shared conformance separate from task suitability. A valid document may Keep shared conformance separate from task suitability. A valid document may
still lack a selected collection or contain spell-recognition ambiguities. still lack a selected collection or contain spell-recognition ambiguities.
@@ -167,11 +191,10 @@ Report those as task requirements with reference/collection/field context where
practical, rather than redefining the upstream schema. A selected empty spell practical, rather than redefining the upstream schema. A selected empty spell
collection adds no vocabulary to the embedded catalog; it is not malformed. collection adds no vocabulary to the embedded catalog; it is not malformed.
ConfigKit retains ownership of configuration loading and composition. Shared ConfigKit retains ownership of loading and composition. Notarius does not add
reference readers consume completed domain documents; they do not add imports, another authoring merge language or a compatibility parser. Roster, glossary,
overlays, or another authoring merge language. Roster, glossary, and provenance and provenance content remain auxiliary context. The current transcript remains
content remain auxiliary context. The current transcript remains the sole source the sole source of event evidence and durable source ranges.
of event evidence and durable source ranges.
### Spell Recognition ### Spell Recognition
@@ -274,7 +297,7 @@ are input/preparation errors, not model-quality failures to repair with retries.
| Area | Work needed | | Area | Work needed |
| --- | --- | | --- | --- |
| Shared contract assets | Bundle exact adopted schemas and adjacent semantics, source/version identification, and applicable license material in the content-only asset tree. Keep validation logic outside `assets`. | | Shared contract assets | Bundle exact adopted schemas and adjacent semantics, source/version identification, and applicable license material in the content-only asset tree. Keep validation logic outside `assets`. |
| Shared input integration | Implement reusable offline decoding, schema validation, and glossary semantic checks. Preserve full documents separately from task projections. | | Shared input integration | Use one native ConfigKit byte-source load, validate the resolved mapping against bundled schemas, and apply glossary semantic checks. Build only the task projections needed by consumers. |
| Reference binding | Add binding-level `collections` selection and carry it through normal configuration/CLI override resolution without implementing a new composition system. Update reference declarations and accepted media types for affected consumers. | | Reference binding | Add binding-level `collections` selection and carry it through normal configuration/CLI override resolution without implementing a new composition system. Update reference declarations and accepted media types for affected consumers. |
| Spell family | Replace private overlay parsing in `internal/modules/dnd/spells/catalog`; adapt effective-catalog composition, prompt projection, and useful input diagnostics. Exercise extraction, normalization, and catalog-validator constructors together. | | Spell family | Replace private overlay parsing in `internal/modules/dnd/spells/catalog`; adapt effective-catalog composition, prompt projection, and useful input diagnostics. Exercise extraction, normalization, and catalog-validator constructors together. |
| D&D context consumers | Update `internal/modules/dnd/shared`, applicable chunk/extract constructors, shared reference prompt content, and any direct reference presentations bypassing those helpers. Derive player context from the roster without requiring duplicate authored data. | | D&D context consumers | Update `internal/modules/dnd/shared`, applicable chunk/extract constructors, shared reference prompt content, and any direct reference presentations bypassing those helpers. Derive player context from the roster without requiring duplicate authored data. |
@@ -292,7 +315,10 @@ Create a focused integration document for Notarius's shared-input support. It
owns exact supported versions, accepted serializations, consumer roles, owns exact supported versions, accepted serializations, consumer roles,
collection selection, recognition adaptations, and task suitability. Link to collection selection, recognition adaptations, and task suitability. Link to
the selected upstream semantics and validation documentation for the shared the selected upstream semantics and validation documentation for the shared
formats rather than maintaining a competing format specification. formats rather than maintaining a competing format specification. Link native
loading behavior to ConfigKit; do not copy its parser manual or maintain a local
compatibility matrix. Bundle essential schema/semantic content, not copies of
upstream validation manuals or example archives.
Replace or retire `docs/integrations/dnd-spell-catalog-overlays.md` when its reader Replace or retire `docs/integrations/dnd-spell-catalog-overlays.md` when its reader
is removed, updating inbound links. Update `docs/config.md` for binding fields and is removed, updating inbound links. Update `docs/config.md` for binding fields and
@@ -327,9 +353,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 supported YAML and JSON inputs produce equivalent task material. 4. Equivalent native-supported YAML and JSON inputs produce equivalent task
Focused tests cover ordinary supported values and native decoding failures, material through the same ConfigKit load. A few public-API integration tests
without requiring full upstream YAML-profile parity or a custom bridge. cover successful handoff and representative native failures, without copying
ConfigKit's parser suite or adding precision/serialization guarantees.
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
@@ -339,8 +366,9 @@ The implemented feature should demonstrate:
before domain inference. Fake provider boundaries prove valid projections before domain inference. Fake provider boundaries prove valid projections
reach their intended tasks and reference-only entries do not create events. reach their intended tasks and reference-only entries do not create events.
7. Bundled schema validation requires no network, schema-repository installation, 7. Bundled schema validation requires no network, schema-repository installation,
or credentials. Full-document forwarding retains extensions; model-facing or credentials. The native resolved mapping retains supported domain
projections omit opaque IDs and do not promote extensions to instructions. extensions; model-facing projections omit opaque IDs and do not promote
ordinary extensions to instructions or override native reserved controls.
8. Existing output artifact contracts, generated handoffs, input-based session 8. Existing output artifact contracts, generated handoffs, input-based session
identity, native report shape, and cache policy remain intact. Updated prompt identity, native report shape, and cache policy remain intact. Updated prompt
material participates in existing native cache identity; add no separate material participates in existing native cache identity; add no separate