Files
schemas/docs/roadmap/implementation.md

17 KiB

ConfigKit alignment implementation plan

Scope and execution

Implement ConfigKit alignment in this repository. Audience: a Luna coding agent executing one numbered stage per prompt, in order. This is one end-to-end sprint. Intermediate stages may leave old tests or callers temporarily broken; completion requires the entire final system to pass. Avoid temporary compatibility wrappers or duplicate loaders merely to keep each commit green. Commit focused completed work with short, plain English messages and record actual validation, including intermediate limitations.

Start with AGENTS.md and docs/development.md. Read the affected contract and existing tests before changing them. The feature roadmap owns scope and policy; this document owns implementation steps. Do not adopt Narratio-specific policies or application machinery into the schema repository.

Baseline: schemas commit 09db04d on top of published distribution 2026.11.0 at 1b8430bdcbf04eb98c8d45c98a1cb986a9e6d477. ConfigKit is go.maximumdirect.net/configkit v1.4.0, upstream commit 4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3. Its pinned contract and consumer guide own native behavior. Recheck the working tree and baseline before starting.

The settled target is:

  • All three new schema versions are 0.2.0; document markers retain .v1. Pre-1.0 and 1.x versions use .v1; major 2 begins .v2.
  • Domain loading uses ConfigKit's native mapping-root handoff. Schema-resource and catalog JSON have a separate standard JSON decoding path.
  • -schema NAME chooses the highest SemVer in the selected local catalog and reports the exact version. No historical selection or fallback is provided.
  • Every published definition stays inventoried and compiles offline. Native example checks apply to the most current version of every schema name.
  • Publication, hosting changes, consumer migrations, upstream library changes, and ReleaseKit adoption are outside the sprint. Make no tag or push.

Preserve glossary/v0.1.0/, rpg/party/v0.1.0/, and rpg/campaign/v0.1.0/ byte-for-byte, including examples and semantic documents. Preserve their existing catalog records, original release note, license grants, and historical source snapshots. Select a future CalVer only during a separately requested release; leave VERSION and the published release note unchanged here.

Stage 1 — Separate resource JSON from domain decoding

Read internal/validation/{validate,decode}.go, catalog_test.go, and TestDistributionAndOfflineResolution in validation_test.go.

  1. Remove schema-resource and catalog dependence on the custom domain Decode path. Use the standard JSON decoder for these maintained JSON files.
  2. Decode schema resources into generic JSON values using json.Decoder.UseNumber. Retain the exact number 9223372036854775807 in schema constraints. Do not convert resource numbers through float64. Catalog records can continue decoding into their existing typed structures.
  3. Retain JSON syntax/completeness checks, inventory consistency checks, Draft 2020-12 meta-validation, local registration before compilation, and denial of unresolved network resources. Do not apply ConfigKit source controls or its size/value limits to schema resources.
  4. Use the standard decoder directly or a small internal helper. Do not preserve the old token walker as a second resource parser or introduce a generic codec framework. This work does not establish new resource error-wording contracts.

Acceptance: an in-memory schema fixture with the exact maximum compiles; valid and above-bound values are distinguished without rounding the schema constraint. Catalog failures, missing references, and bundled cross-schema references retain their protection. No schema resource is passed through ConfigKit.

Stage 2 — Adopt native ConfigKit domain loading

Read the pinned ConfigKit guidance above, cmd/validate/main.go, the decoder, and the decoding/CLI tests. Use upstream public APIs, not private implementation types.

  1. Add ConfigKit v1.4.0. Replace domain decoding with one small operation that calls configkit.Load[map[string]any](configkit.Bytes(label, data)). Use a useful non-secret document label, normally the caller's filename.
  2. Pass Result.Config directly to JSON Schema and existing domain semantic checks. Do not marshal/unmarshal, reconstruct a mapping, repair scalars, normalize numbers, populate defaults, or mutate the native result.
  3. Use ordinary loading without import traversal, discovery, overlays, startup bootstrap, environment overrides, or application defaults/resolvers. Preserve native structural handling of extends and source-root config even when imports are disabled. No pre-parser disables these features or treats them as opaque domain extensions. Nested ordinary config remains permitted as upstream supports it.
  4. Delete custom domain YAML/JSON token/node walkers, alias expansion, numeric spelling normalization, arbitrary-precision helpers, and tests whose only remaining purpose would be protecting those implementations. Retain the small JSON Pointer escaping helper used by semantic diagnostics in its actual owner.
  5. Keep the existing .json filename syntax check. It precedes the same native load; it is not an alternate decoder. Wrap native errors with load-phase and document context without reconstructing diagnostics. Preserve structural and semantic failure categories after successful acquisition.
  6. Tidy module metadata. Remove direct YAML imports/dependency when unused; ConfigKit may retain YAML transitively. Keep the Go minimum and JSON Schema dependency unchanged unless a concrete compilation requirement demands it.

Acceptance: focused public-API tests cover a supported mapping, null/empty values, literal Unicode, native int64/float64 binding, and a native load failure. Native limits apply, including the baseline's 8 MiB source limit; do not copy that limit into local constants, add truncation, or introduce another size gate. The old decoder is gone rather than hidden behind a fallback.

Stage 3 — Add the aligned immutable contract candidates

Read all three 0.1.0 schemas/semantics and catalog.json. Create:

New root Marker
glossary/v0.2.0/ maximumdirect.glossary.v1
rpg/party/v0.2.0/ maximumdirect.rpg.party.v1
rpg/campaign/v0.2.0/ maximumdirect.rpg.campaign.v1

Each root contains schema.json, semantics.md, and representative examples/. Set $id to https://schemas.maximumdirect.net/ plus the new schema path. Add catalog records without replacing old records or changing catalog format. Correct cross-document example locators to the new adjacent versioned inputs.

Preserve domain fields, extension acceptance, omissions/null/empty distinctions, and per-collection exact glossary ID uniqueness. ruleset remains an extension, not a defined glossary provenance field. Party's defined level gains maximum 9223372036854775807, retaining minimum 1 and JSON Schema integer semantics after native binding. Do not require integer lexical spelling beyond ConfigKit's own rules or recover precision lost by its dynamic float binding.

Write each new semantic document with the immutable ConfigKit baseline link and an affirmative definition of the completed native handoff. Preserve supported resolved values; schema validation adds no trimming, case folding, or defaults. Defined fields plus native acquisition jointly establish conformance. State that structural validation alone cannot prove native loading compatibility. Delegate syntax and resource limits upstream, including the per-source limit. Keep the glossary domain-neutral, with both weather and sports examples.

Acceptance: all new schemas compile offline; representative new examples load through ConfigKit and pass structure/semantics. Party tests cover zero, negative, fractional, maximum int64, and above-maximum levels at the applicable failure boundary. Published directories and old catalog records remain unchanged.

Stage 4 — Select the most current local version by schema name

Read Set.Select, catalog loading, and the CLI and selection tests. Replace name/version CLI selection rather than adding another mode.

  1. Keep exact compiled schemas indexed by canonical identity for references. Build one reusable current-record selection per schema name from the catalog; both CLI selection and example discovery use this result.
  2. Compare full SemVer with golang.org/x/mod/semver, pinning golang.org/x/mod at v0.43.0 if it is not already selected. Prefix versions with v for the library API. Do not compare versions lexically or build a comparator/parser. Include prereleases in ordinary SemVer ordering; a stable version outranks its prereleases. Build metadata does not affect precedence. For equal precedence, retain the first catalog record as an internal deterministic tie handling choice, not a new public ordering guarantee or rejection rule.
  3. Change CLI syntax to -schema NAME, retaining -root. Reject missing/unknown names, including the removed NAME@VERSION syntax, as selection/usage errors. All supplied documents use the chosen definition. Do not guess from markers, retry an older schema, add version flags, or download a newer catalog.
  4. Report exact selected name/version and marker on success. Retain exit 0 for success, 1 for document read/load/structure/semantic failures, and 2 for usage/selection/unusable-distribution errors. Continue checking later files after a document fails. Error wording/order is not otherwise frozen.

Acceptance: tests distinguish 0.9.0 from 0.10.0, stable from prerelease, and catalog ordering from precedence. Temporary definitions sharing a marker prove the selected schema is actually applied and failures never cause fallback. Missing name, unknown name, removed exact-version syntax, marker mismatch, mixed valid/invalid documents, and an unpacked -root are covered.

Stage 5 — Align catalog-driven verification and historical evidence

Read internal/validation/*_test.go, cmd/validate/main_test.go, tests/{valid,invalid}/, and publication history tests.

  1. Compile every inventoried schema offline, including historical versions and exact referenced dependencies. For native examples, iterate the current record per schema name from Stage 4, require its examples directory to be nonempty, and validate every maintained YAML/JSON document there through ConfigKit, that exact selected schema, and applicable semantic checks.
  2. Add a synthetic schema name in a temporary catalog and prove its examples are discovered automatically. Missing examples and an invalid maintained example fail verification. Do not maintain a hard-coded current-name list, generic semantic-plugin interface, or compatibility prover.
  3. Keep useful broad-profile fixtures as clearly located/labeled historical evidence outside current fixture traversal. Their original decoding behavior belongs to the 2026.11.0 tool. Do not run historical native-example checks, restore the old decoder, or change historical published examples to pass.
  4. Retain domain regression coverage under native binding: required/known fields, supported extensions at every object layer, omissions/null/empty values, Unicode, duplicate glossary IDs within a collection, cross-collection ID reuse, and no mutation during structural/semantic validation.
  5. Replace exact-arbitrary-precision expectations with native int64 and float64 expectations. Cover integer overflow, exponent overflow, representative unsupported scalar syntax/tags/aliases, duplicate/non-string keys, and the JSON surrogate-escape limitation versus supported literal Unicode. Assert failure phase/useful context rather than copying native diagnostic wording. Use a small representative set, not ConfigKit's parser test inventory.
  6. Prove native resolution is authoritative: extends: null is consumed, a supported sibling inheritance resolves with imports disabled, invalid source-root control data fails, and nested ordinary config data survives. Validate the completed result without imposing a second directive policy.
  7. Retain an equivalent supported YAML/JSON example pair. Verify native acquisition and local references do not contact providers or fetch campaign locators. Keep existing local static-path/byte checks and publication tests detecting changed/removed published directories while allowing new versions.

Acceptance: the ordinary suite covers new schemas discovered through catalog data, old resources still compile, and historical examples impose no new-tool decoding contract. Tests remain deterministic and use local temporary fixtures or loopback HTTP only. No paid calls, production URLs, or installed consumers are required.

Stage 6 — Update canonical guidance and attribution

Update README.md, docs/{validation,development,compatibility,catalog}.md, AGENTS.md, and affected current navigation/examples. Keep published versioned documents and the 2026.11.0 release note unchanged.

  • Explain 0.2.0 candidates and the changed acquisition contract with retained .v1 markers. Replace the previous pre-stable marker-change policy with the agreed schema-major rule. Published directory immutability remains unchanged.
  • Document -schema NAME as local most-current selection, with exact version reporting. A development catalog can select unpublished candidates. Consumer pinning of exact schema versions and source CalVer snapshots is independent of this developer CLI. Neither mode fetches newer inputs automatically.
  • State that this tool always uses its pinned ConfigKit boundary. Historical full conformance uses the historical distribution's tool; choosing an older root with a newer binary does not restore a historical decoder.
  • Replace the independent syntax manual with a concise boundary description, short authoring advice, and pinned upstream links. Include native source limits and numeric/JSON limitations as upstream behavior, not new local enforcement. Put an obvious immutable link to the original 2026.11.0 validation guide/tool in the mutable guide for readers arriving from historical semantic documents.
  • Add the standing authoring review in development guidance and link from AGENTS.md: field types, numeric ranges/precision, reserved controls, extension values, representative examples, and native boundary fixtures. New schemas and ConfigKit upgrades receive the same review. Tests are useful evidence rather than proof of every accepted document's compatibility.
  • Update attribution for actual incorporated dependencies, including ConfigKit, the SemVer package, and applicable transitive material. Verify actual selected versions, terms, and commit links. Preserve original CC0 scope and the glossary origin snapshot. A dependency's upstream tool declaration is not adoption of ReleaseKit into this repository's release workflow.

Acceptance: current docs agree with actual CLI and contracts; upstream manuals remain canonical. No active guidance promises the old decoder or redefines old contracts. No future release date, tag, distribution version, or publication is claimed by this sprint.

Stage 7 — Verify the complete committed candidate and hand off

Review the final scope diff against the feature roadmap. Confirm there is one native domain loader, a separate standard resource decoder preserving exact constraints, no hidden historical CLI mode, no duplicate parsing/repair, and no application changes. Confirm all three 0.2.0 roots have pinned-baseline semantics, the correct IDs, unchanged .v1 markers, and suitable examples.

Prepare dependencies, then run:

GOTOOLCHAIN=go1.27.4 go test ./...
GOTOOLCHAIN=go1.27.4 go vet ./...

Compare every previously published contract directory and old catalog record against 2026.11.0; use the existing publication check for that tag or the normal authoritative-remote check after fetching its tags. History checks remain separate from offline distribution checks. Do not change the publication mechanism.

Commit the final intended schema candidate, then run:

GOTOOLCHAIN=go1.27.4 sh scripts/check.sh

The existing script tests the checkout, runs vet, and tests an unpacked committed source archive. Its extracted-tree tests must work without the original checkout or Git metadata in that tree. CI continues using this same command; update its configuration only if necessary for the actual dependency/setup changes. Do not add CI polling or external-host gates. If candidate content changes, commit and revalidate the affected final candidate rather than citing an earlier revision.

Record stage completion, candidate hash, selected schema/ConfigKit versions, checks actually run, historical support guidance, and any remaining limitations in this plan. Leave committed clean worktrees. Summarize the exact consumer handoff information available now; the future published CalVer is intentionally unset. Stop before tagging, pushing, or changing consumer repositories.

Open Questions

None. The feature decisions are settled; remaining details above are scoped implementation choices. A later release task selects the actual CalVer and publishes, and later consumer roadmaps define application adoption.