Files
audita/docs/roadmap/remediation.md

3.1 KiB
Raw Blame History

Shared Glossary Remediation

Status: Open.

Review covers all seven stages of the implementation plan, including the pinned assets, native composition, application projection, retired discovery, CLI/preflight integration, examples, and documentation. The reviewed implementation is commit 00a36284516b7d87730430beffb07df8fd13f6a3 ("Clarify completed glossary roadmap markers"). No application code was changed during review.

The Go 1.27.4 offline test suite and build passed. The copied glossary directory and CC0 license match the selected upstream source byte for byte. Changed documents' local links and representative documented validation commands passed. No other actionable implementation gaps or unintended requirement strengthening were identified.

R1: Schema errors lose field-level source attribution

Priority: P3. Status: Open. Plan stage: 2, surfaced through Stage 3.

Location: shared glossary loading, lines 34–36.

Finding

The native validation callback submits every JSON Schema error with validation.Error(ck.Keys(), err.Error()). The error text contains the JSON instance path, but the native diagnostic path is always the root. For layered inputs, ConfigKit consequently associates the diagnostic with the main input (the last supplied file), even when the invalid field came from an earlier file.

Reproduced with two explicit glossary inputs:

# first.yml
schema_version: maximumdirect.glossary.v1
collections:
  first:
    entries: [{id: a, name: 17, category: person}]
# last.yml
schema_version: maximumdirect.glossary.v1
collections:
  last:
    entries: []

Passing first.yml and then last.yml to config show --scope=app correctly fails with status 2. Its diagnostic identifies /collections/first/entries/0/name inside the message, but attaches the native location <root> (source-1:1:1); the source inventory identifies source-1 as last.yml, not first.yml.

Input rejection is correct. The issue is misleading file attribution when operators diagnose a composed glossary, contrary to the plan's useful field/source-context objective.

Use the structured JSON Schema validation error's offending instance location when reporting through ConfigKit, so its existing nearest-source metadata can locate the contributing field. Traverse nested schema errors as needed without emitting redundant wrapper diagnostics. Retain root/nearest-parent fallback for errors that genuinely concern the root or an absent field; no universal exact source-location guarantee is required.

Keep native LoadError classification and CLI presentation. Do not introduce a separate provenance tracker, error taxonomy, or custom diagnostic renderer.

Acceptance

Add one regression at the native loading or CLI boundary with an invalid field in an earlier input and a valid last input. Verify that the diagnostic points to the affected collection/entry field and its contributing source rather than the last document's root. Preserve the existing failure outcome; avoid assertions on complete diagnostic wording or generated source IDs.