Files
schemas/docs/roadmap/configkit-alignment.md

282 lines
17 KiB
Markdown
Raw Permalink Normal View History

# Align shared schemas with ConfigKit
Status: implemented locally; [completion evidence](implementation.md#execution-status)
recorded. Publication and consumer adoption remain separate work.
## Objective and ownership
Make all three shared contracts usable through ConfigKit's existing public
loading and handoff APIs. ConfigKit defines supported input syntax, values, and
configuration resolution. The schemas collection defines domain structure and
meaning within that boundary. Consumers own task-specific interpretation.
The schemas must conform to ConfigKit, not require ConfigKit to adopt the
collection's broader decoding profile. Do not add consumer compatibility
adapters, a replacement parser, scalar repair, arbitrary-precision handling, or
serialization round trips to bridge a difference. Unsupported capabilities must
be removed from the new contracts' promises.
This work covers glossary, RPG party, RPG campaign, their documentation and
examples, and the repository's validation harness. Consumer adoption and release
publication remain separate work. The contracts remain language-neutral;
ConfigKit's Go API is the reference implementation used by this repository's
internal tooling, not a schema SDK for consumers.
## Reviewed baseline
- Schemas distribution `2026.11.0`, commit
`1b8430bdcbf04eb98c8d45c98a1cb986a9e6d477`: all three schemas are `0.1.0`.
- ConfigKit `v1.4.0`, commit
`4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3`:
[configuration contract](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md)
and [consumer guide](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/consumers/README.md).
Review included the three schemas and semantic documents, the custom decoder,
validation and CLI paths, maintained fixtures, and temporary executable probes
using ConfigKit's public `Load[map[string]any]` and `Bytes` APIs. No ConfigKit
change is required for the proposed loading path.
### Findings
| Area | Current schemas behavior | ConfigKit boundary and required alignment |
| --- | --- | --- |
| YAML scalars | Case variants of booleans/null and unquoted `yes`, `no`, `on`, `off` are accepted under the local profile. | Follow native scalar classification. Quote these words when intended as strings; do not translate unsupported spellings. |
| YAML numeric syntax | Hexadecimal, octal, binary, separators, leading plus, and leading/trailing decimal dots are normalized. | Use ConfigKit's accepted JSON decimal number spellings. Remove normalization. |
| Tags and aliases | Standard explicit tags and acyclic aliases are accepted. | ConfigKit rejects explicit tags, anchors, and aliases. New examples and fixtures must reflect this. |
| Mapping keys | The local profile permits a quoted `<<` extension key. | ConfigKit rejects that key even when quoted. Duplicate keys and non-string keys remain errors. |
| Numeric values | `json.Number` preserves arbitrary precision, including integers beyond `int64` and `1e500`. | The native dynamic handoff uses `int64` integers and finite `float64` fractional/exponent values. Oversized values can fail; decimal precision can change. Do not promise exact authored numeric preservation. |
| Party class levels | Positive integers have no upper bound. | Bound the defined field to the supported dynamic integer range; retain its positive-integer domain rule. |
| Extension fields | All objects allow extensions and promise broad value preservation. | Keep extensions, but apply native value limits and reserved controls recursively. Preserve resolved supported values, not every authored representation. |
| Configuration controls | Completed documents are treated as arbitrary data mappings. | `extends` is always structural input; source-root `config` is a control namespace. Disabling imports does not make these ordinary extension data. |
| JSON | A separate JSON decoder accepts forms rejected by ConfigKit's parser. | Route JSON documents through the same native boundary. Do not promise acceptance of every JSON serialization. |
| Harness | A custom YAML node walker and JSON token walker implement a broader profile. | Replace domain decoding with native ConfigKit loading; retain maintained JSON Schema validation and domain semantic checks. |
Probes confirmed that a maximum `int64` succeeds while the next integer and
`1e500` fail; `0.123456789012345678901234567890` becomes
`0.12345678901234568`. They also confirmed that `extends: null` is consumed,
sibling inheritance resolves without enabling imports, and root
`config: {note: ordinary}` fails. A JSON surrogate-pair escape fails while the
equivalent literal Unicode character succeeds. These findings identify the
baseline's limits; do not turn incidental error wording into repository policy.
Glossary and campaign defined fields already use supported strings, objects,
arrays, and null where specified. Their changes concern the common loading,
extension, and preservation contract. Party additionally needs the explicit
class-level bound. Existing domain meanings need no redesign.
## Required work
### Common loading boundary
Replace the independently specified broad YAML profile with a short description
that delegates to the pinned ConfigKit contract. Record the supported ConfigKit
baseline and link its canonical guidance. Future schema additions and updates
must be checked against that boundary before publication.
Make this a standing schema-authoring requirement in `docs/development.md`,
with a link from `AGENTS.md` so future contributors encounter it before defining
a contract. Every new schema or revision must review its field types, numeric
ranges and precision promises, extension values, and reserved names against the
selected ConfigKit boundary. Resolve incompatibilities in the proposed schema;
do not add a schema-specific decoder or broaden the shared loading path.
Extend the ordinary validation suite to discover newly added schema versions
through the catalog and exercise their examples through the same native loading,
structural validation, and applicable semantic checks. Require representative
examples and focused boundary fixtures for new field constraints. This must
apply to future schemas without maintaining a hard-coded list of the current
three. Run native document checks against the most current version of each
schema; retained historical definitions are not alternate validation targets.
These checks verify examples and relevant boundaries, not every document a JSON
Schema could accept. Contributor guidance must retain the contract review above;
passing meta-schema validation or a few examples is not proof of full native
compatibility. Run the same checks when upgrading ConfigKit.
Distinguish three checks:
1. Native ConfigKit acquisition, resolution, and dynamic value binding.
2. JSON Schema validation of the completed result.
3. Schema-specific semantic validation, such as glossary entry-ID uniqueness.
JSON Schema success alone does not establish ConfigKit compatibility. JSON
Schema cannot express all serialization, number-spelling, or resolution rules.
Do not build a recursive substitute for ConfigKit's value checker in JSON
Schema or application code. Published semantics must state that native loading
is part of full conformance.
Use one common mapping-root handoff: string-keyed mappings, sequences, and
native dynamic scalar values. Do not derive stronger precision guarantees from
ConfigKit's private tree retaining original numeric spelling. Typed consumer
destinations can impose further task constraints; they do not broaden the
shared dynamic-value contract.
Native resource limits also apply, including the selected baseline's 8 MiB
per-source limit. Upstream owns their definitions and enforcement; the schema
repository does not duplicate them as schema constraints or local size gates.
### Aligned contract versions
Create new version directories, canonical IDs, examples, and catalog records.
Leave every published `0.1.0` directory byte-for-byte unchanged.
- **Glossary:** retain the envelope, general-purpose collection model, nullable
aliases/plural, provenance, and per-collection exact ID uniqueness. Replace
broader syntax and preservation promises with the common native boundary.
- **RPG party:** retain optional players/classes and existing identity rules.
Set the class-level maximum to `9223372036854775807`, with minimum `1`.
Explain that JSON Schema evaluates integer values after native binding;
do not introduce a separate schema-owned numeric spelling parser.
- **RPG campaign:** retain domain context and locator semantics. References
remain data; schema validation does not fetch them or check installation.
Keep unknown domain fields allowed. Extension names and values are subject to
ConfigKit's native restrictions, including reserved `extends` and source-root
`config` controls. Those controls cannot be promised as opaque preserved data.
Nested ordinary `config` data follows upstream rules; do not ban that name
everywhere. Task instructions remain outside the shared domain contract.
Replace blanket preservation language with preservation of supported values
in the resolved handoff. No trimming, case folding, or domain defaults are
introduced by schema validation. Native resolution and numeric binding retain
their upstream meaning. Task projections may omit irrelevant fields as before.
Each new version's semantics must identify its ConfigKit baseline with an
immutable upstream reference. Mutable repository-wide guidance must not be able
to silently redefine a published contract. No new catalog format or independently
versioned serialization-profile system is needed.
### Native validation harness
Adopt ConfigKit `v1.4.0` as a pinned dependency. Load each supplied document
through `Load[map[string]any]` using `Bytes` for the already-read document, then
pass `Result.Config` directly to the existing JSON Schema engine and semantic
checks. A public-API probe has established that this path is supported.
The default validator remains for completed documents. Do not enable import
traversal, discovery, overlays, secrets bootstrap, environment overrides, or
application defaults/resolvers. Native structural processing still applies;
do not implement a pre-parser to disable or reinterpret it. Application
composition remains the consuming application's job, and authored partial
contributions need not pass complete-document validation.
Remove the custom domain YAML/JSON decoders, alias traversal, numeric
normalization, and arbitrary-precision helpers. Do not retain a fallback for
documents rejected by ConfigKit. Keep a simple JSON syntax check for `.json`
files if preserving that filename convention; it must not provide an alternate
decoding path or bypass native restrictions.
Change CLI selection from `-schema NAME@VERSION` to `-schema NAME`, selecting
that schema's highest SemVer version in the chosen local distribution's catalog.
Report the exact selected version. Do not offer historical-version selection or
fetch a newer distribution automatically. A development checkout may contain
unpublished candidates; a published snapshot selects its own most current version.
Retain offline schema registration and exact referenced dependency resolution,
maintained JSON Schema validation, and exact glossary ID checks.
Do not coerce, default, or mutate the native result during validation. Keep
schema resource/catalog JSON decoding separate from operator-domain loading;
JSON Schema files themselves are not ConfigKit configuration documents.
Resource decoding preserves exact numeric schema constraints independently of
ConfigKit's native domain-number binding.
Preserve useful filename and schema-selection context around native errors.
Distinguish native load failures from structural and semantic failures without
reconstructing parser diagnostics or promising the previous decoder's positions
and wording. Retain the CLI's existing overall success/failure convention.
Remove the direct YAML dependency if it is no longer used; ConfigKit may retain
it transitively. Update module metadata and attribution for the actual dependency
set. The harness stays internal; no shared Go SDK or alternate consumer loader
is introduced.
### Documentation and maintained examples
Update the README, validation guide, development guide, compatibility guidance,
and new versioned semantics together. Identify the native loading baseline and
explain the distinction between structural validity and full conformance.
Update compatibility policy so document generations follow schema major versions:
pre-1.0 and 1.x schemas use `.v1`; `.v2` begins at schema `2.0.0`. Pre-1.0
contract changes do not require marker changes. Update CLI guidance to use
schema names and explain local most-current selection. Consumer pinning to exact
published schema versions remains independent of this developer-tool behavior.
Document supported YAML authoring with short examples and upstream links:
quote ambiguous string values, use supported numeric syntax, and avoid aliases
and explicit tags. Explain native numeric limits, reserved controls, and JSON
limitations without reproducing ConfigKit's entire manual. Do not recommend
JSON as a universal escape from ConfigKit restrictions.
Keep historical inventory, origins, release notes, and published contracts
accurate to their original releases. Existing semantic documents link to the
mutable validation guide: preserve a clear pointer there to the original
`2026.11.0` guide and tool, rather than retrospectively assigning old contracts
the new boundary.
New examples remain synthetic, with glossary examples covering non-RPG domains.
Update current fixtures that rely on aliases or exact arbitrary precision.
Retain useful historical fixtures as historical evidence, not expectations for
the new decoder. Consumer migration notes should identify the new exact versions,
retained `.v1` markers, affected authoring forms, and the absence of compatibility
shims.
### Verification and downstream handoff
Use focused public-API tests for the integration boundary, not a copy of
ConfigKit's parser suite:
- All three new contracts' examples validate through native loading, structural
validation, and applicable semantic checks.
- Adding a schema to the catalog brings its examples into the ordinary native
validation checks without schema-name-specific test wiring. Missing required
example coverage or an incompatible maintained example fails the suite.
- Selection uses SemVer ordering rather than lexical or catalog order, reports
the selected version, and never falls back to an older definition based on
document contents. Historical CLI version selection is no longer supported.
- Required fields, unknown supported extensions, omitted/null/empty distinctions,
and glossary ID uniqueness retain their intended domain behavior.
- Representative unsupported syntax, duplicate/non-string keys, integer
overflow, and exponent overflow fail through ConfigKit.
- Numeric tests assert native handoff behavior rather than exact authored decimal
precision. Party levels test the positive bound, maximum, and failures.
- Reserved controls follow native behavior. Completed results are validated;
directives are not silently treated as preserved extension data.
- Supported YAML and JSON representations produce equivalent domain values;
unsupported JSON forms have no alternate success path.
- Validation remains offline, selected schema references resolve from bundled
files, and neither schema selection nor campaign locators trigger network access.
- Published directories and existing catalog records remain unchanged. The
unpacked distribution retains everything needed for its supported validator.
Run `go test ./...` and `go vet ./...`, then the existing archive checks at
release preparation. Reuse the current release process and publication guards;
this roadmap does not authorize publishing.
After the aligned versions are published, provide their exact schema versions,
document markers, source CalVer snapshot, and ConfigKit baseline to Narratio,
Notarius, Audita, and the reference catalog. Update their adoption plans to
remove broader-profile obligations and custom compatibility work. Those
repository changes remain separately scoped.
## Recorded decisions
### Versions and document generations
Release the aligned schemas as `0.2.0`, retaining `maximumdirect.glossary.v1`,
`maximumdirect.rpg.party.v1`, and `maximumdirect.rpg.campaign.v1`. Document
markers remain `.v1` throughout pre-1.0 and 1.x development; they advance to
`.v2` when the corresponding schema reaches `2.0.0`. Update the current
compatibility policy accordingly. Published version directories stay immutable.
Select the distribution's CalVer at release preparation.
### Most-current validation
The validator always uses the most current version of the requested schema in
the selected local distribution. It does not provide historical validation modes
or multiple decoding implementations. Retain published definitions and catalog
records for consumers that pin them. Historical validation, when needed, uses
the historical distribution's tool; it is outside the current validator's scope.
## Open decisions
None.