149 lines
6.8 KiB
Markdown
149 lines
6.8 KiB
Markdown
# Shared Glossary Remediation
|
||
|
||
**Status:** Open.
|
||
|
||
Review covers all seven stages of [the implementation plan](implementation.md),
|
||
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.
|
||
The initial review identified R1 and no unintended requirement strengthening.
|
||
A follow-up integration audit at commit
|
||
`8699ec442ab9d4747d1244ad7b6980d5f13fefda` identified R2. That audit traced the
|
||
new adapter through native inspection/comparison, processing and preflight,
|
||
selection/protection, bootstrap, and output source checks. Targeted CLI integration
|
||
tests passed; executable probes confirmed extension acceptance and imported-file
|
||
hardlink collision protection. The application code is unchanged from the initial
|
||
review. Completion status for each finding is recorded below.
|
||
|
||
## R1: Schema errors lose field-level source attribution
|
||
|
||
**Priority:** P3. **Status:** Complete. **Plan stage:** 2, surfaced through Stage 3.
|
||
|
||
**Completion:** Report leaf schema failures through their instance paths so native
|
||
metadata identifies the contributing source, with root/parent fallback for absent
|
||
fields. Regression coverage verifies an earlier input's invalid value and missing
|
||
field, including escaped collection names. Go 1.27.4 offline appconfig and CLI
|
||
tests passed.
|
||
|
||
**Location:** [shared glossary loading](../../internal/appconfig/sharedglossary/load.go),
|
||
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:
|
||
|
||
```yaml
|
||
# first.yml
|
||
schema_version: maximumdirect.glossary.v1
|
||
collections:
|
||
first:
|
||
entries: [{id: a, name: 17, category: person}]
|
||
```
|
||
|
||
```yaml
|
||
# 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.
|
||
|
||
### Recommended change
|
||
|
||
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.
|
||
|
||
## R2: Shared-file assignment conflicts with disjoint native glossary overrides
|
||
|
||
**Priority:** P2. **Status:** Open. **Plan stages:** 3 and 5.
|
||
|
||
**Locations:** [application acquisition](../../internal/appconfig/config.go),
|
||
lines 94 and 116–122; [native command wiring](../../internal/cli/app_wiring.go).
|
||
|
||
### Finding
|
||
|
||
The native application scope supports `--set` overrides. Application acquisition
|
||
copies those overrides, then appends the shared-file projection as another CLI
|
||
override at the whole `/glossary_collections` path. ConfigKit correctly rejects
|
||
ancestor/descendant override records, so the file assignment conflicts with every
|
||
user override beneath that path, including an entirely different collection.
|
||
|
||
For a shared file defining only `people`, this invocation fails with status 2 and
|
||
`override.overlap` at `/glossary_collections`:
|
||
|
||
```sh
|
||
audita config show --scope=app --config config.yml \
|
||
--glossary-file shared.yml \
|
||
--set '/glossary_collections/other/entries=[{"id":"b","name":"Bob","category":"person"}]'
|
||
```
|
||
|
||
The `--set` succeeds without the file. A disjoint `/context/description` override
|
||
also succeeds with the file. Even an empty shared envelope with `collections: {}`
|
||
causes the glossary override conflict, despite contributing no vocabulary.
|
||
|
||
This is an inherited integration gap in the runtime-file assignment strategy,
|
||
not a regression introduced by the shared-schema adapter: the parent override
|
||
was already present before this sprint. It still prevents ordinary native
|
||
configuration controls from working alongside the adopted shared-file interface
|
||
when their logical contributions are disjoint.
|
||
|
||
### Recommended change
|
||
|
||
Represent disjoint file-derived and caller-supplied glossary contributions as
|
||
non-overlapping native assignments. Scope file contributions to the data they
|
||
actually assign rather than claiming the entire glossary mapping, and avoid a
|
||
parent assignment for an empty collection map. Keep ConfigKit responsible for
|
||
binding, recorded origins, and native overlap checks for genuinely overlapping
|
||
assignments.
|
||
|
||
Preserve supplied entry-list replacement, unrelated configured vocabulary, and
|
||
native value semantics. Consider the native override-record budget when choosing
|
||
assignment granularity; do not introduce a separate application collection cap
|
||
or a custom override parser/merge framework. This finding does not require
|
||
defining a new precedence rule for two flags assigning the same field.
|
||
|
||
### Acceptance
|
||
|
||
Add a native-command regression combining a shared `people` collection with
|
||
`--set` for `other`; both must appear in effective configuration. Also cover an
|
||
empty shared envelope with a valid glossary override. Preserve native CLI origins
|
||
and existing file-to-configuration list replacement. Test resulting values and
|
||
failure classifications rather than complete diagnostic snapshots or internal
|
||
override-record counts.
|