Files
narratio/docs/roadmap/remediation.md

163 lines
8.5 KiB
Markdown

# Shared glossary and Audita adoption review
Reviewed Narratio commit `4f27331636b44bd75e402c12fc6ab4c16fcb3899`
against all 19 stages of [implementation.md](implementation.md) and the
[feature roadmap](audita.md). The catalog checkout was
`ff26b24172ff5efddbcf666c5179268ea1372b01`; its embedded schema source is
`ecad94a5a53f87847b1fd81fd042eee9c8d3ea08`. Native compatibility was checked
with Audita v4.2.0 at `973b24e46618dc785751fa7c803e7c16c900353f`.
This document records required remediations. Implementation code and upstream
repositories were left unchanged during review.
## 1. Reject empty paths for explicitly selected catalog entries
Priority: P2
Status: Pending
Affected stages: 3 and 5; prepare and downstream vocabulary coverage are affected.
### Finding
`internal/config/reference_catalog.go:19-23` distinguishes unknown IDs from
known IDs, but returns a known entry's value without checking whether it names
a source. For example:
```yaml
reference_catalog:
settings:
broken: ""
```
A campaign selecting `inputs.setting: broken` passes combined acquisition.
The empty path then reaches `internal/glossary/resolve.go:73-74`, which treats
it like an omitted setting and prepares an empty collection. An explicit null
catalog path, by contrast, already fails native decoding with `decode.null`;
retain that correct behavior.
The CLI reproduction used ordinary valid campaign/session inputs and a
prepare-only invocation. It exited zero with `complete: true` and wrote:
```yaml
setting:
entries: []
```
This contradicts the selected-source contract: omitted selections may be empty,
while explicitly selected invalid sources must fail. It can silently remove
expected correction vocabulary, particularly because all four runtime lists
replace their same-named Audita lists.
### Required remediation
Reject a selected catalog entry whose value does not identify a usable source,
with context naming the catalog kind and selected ID. Preserve ordinary source
loading errors for nonempty nonexistent or unreadable paths. Keep an omitted
setting/system selection valid, and do not impose eager file-existence checks
on unselected catalog entries.
Add behavioral coverage through full configuration acquisition and preparation
for selected empty and null paths in both catalog groups. Verify that invalid
selection cannot become successful empty vocabulary, while omitted selections
still prepare empty roles. Cover native decoding rejection as an acceptable
outcome where the selected value is invalid before domain selection.
## 2. Preserve native acceptance of a null aliases list
Priority: P2
Status: Pending
Affected stages: 1, 2, and 5. This is an inadvertently strengthened input
restriction in the shared schema and its embedded copy.
### Finding
The catalog schema and `internal/glossary/glossary-v1.schema.json:30-36`
require `aliases` to be an array whenever supplied. Audita v4.2 accepts an
explicit null aliases list through its native typed configuration, so valid
native glossary input is rejected by Narratio's new shared format validator.
This minimal glossary was used for the comparison:
```yaml
campaign:
entries:
- id: watch
name: Silver Watch
category: organization
aliases: null
```
With a valid Audita main configuration:
```sh
audita config validate --scope app --config MAIN --glossary-file VOCABULARY
```
returned `app: valid` and exit zero. Selecting the same file as Narratio's
campaign glossary made `prepare` fail with:
```text
at '/campaign/entries/0/aliases': got null, want array
```
The requested format follows native Audita fields and preserves supported
presence semantics. A blanket non-null restriction on optional aliases was
not selected. This finding is specific to aliases: the same probe confirmed
that Audita rejects null `instruction` and `description` strings, so those
fields must not be broadened merely by analogy.
### Required remediation
Correct the catalog-owned schema to accept the supported null aliases value
alongside its existing array shape. Update the embedded schema verbatim, its
recorded catalog revision, applicable notices, and the canonical format
description as needed. Keep the schema locally pinned and preserve the normal
native handoff; no compatibility parser or custom alias-merging rule is needed.
Test omitted, null, empty, and populated aliases through resolved file and
inline vocabulary and preparation. Include the null case in the controlled
native Audita compatibility check. Retain rejection of genuinely invalid alias
types and upstream-invalid null scalar fields. Default tests remain offline.
## Stage-by-stage review coverage
| Stage | Evidence examined and result |
| --- | --- |
| 1 | Catalog format/schema, minimal relative-import bundle, examples, CC0 grant, and check script. Finding 2 affects the native format match. |
| 2 | Local schema compilation, offline loader, partial/complete validation, extension retention, and collection-scoped identity checks. Finding 2 affects accepted aliases. |
| 3 | Native pipeline catalog acquisition, source-origin path adaptation, lookup behavior, and imported catalog tests. Finding 1 affects selected values. |
| 4 | Independent campaign/session defaults, pointer/null handling, inline replacement, native-result preservation, and snapshot rendering tests. No additional actionable finding. |
| 5 | Native layered resolution, imports/sibling inheritance, whole-record upsert/replacement, party projection, deterministic output, and selection errors. Findings 1 and 2 surface here. |
| 6 | Four descriptors/paths, manifest-backed resolution, retired-source rejection, and unchanged roster/player/spell-overlay identities. No additional actionable finding. |
| 7 | Preparation writes, input sizes/digests/provenance, workspace modes, empty roles, and failure handling. Finding 1 can incorrectly yield empty selected vocabulary. |
| 8 | Versioned prepare evidence, effective-content comparison, source relocation, imported changes, and missing/tampered prepared records. No additional actionable finding. |
| 9 | Verified prepared-input archival, nested remote/local mapping, manifest-last restore, and round-trip tests. No additional actionable finding. |
| 10 | Native arguments, removed module surface, independent report/debug paths, credential handling, and omission semantics. No additional actionable finding. |
| 11 | Shared polish request construction, four-input evidence, resume metadata, report bounds/paths, and transcript promotion failures. No additional actionable finding. |
| 12 | Embedded synthetic transcript, native preflight arguments, isolated temporary captures, cleanup, redaction, and cancellation. No additional actionable finding. |
| 13 | Selected Audita/Scriptorium checks, native error propagation, existing prompt findings, and empty/cancelled checks. No additional actionable finding. |
| 14 | Post-prepare reprojection, lazy adapter composition, bounded runs, force/failure authority, preparation reuse, and fully reused invocations. No additional actionable finding. |
| 15 | Validation against existing prepared evidence, probe namespace, provider side effects, source independence, and unchanged manifest tests. No additional actionable finding. |
| 16 | Explicit consumer source changes, maintained native authoring/catalog examples, and retired-field tests. No additional actionable finding. |
| 17 | Real catalog acquisition/preparation and controlled native Audita inspection/preflight checks. Checks pass, but did not cover Findings 1 and 2. |
| 18 | Public/internal integration, configuration, migration, lifecycle, and attribution updates. Schema documentation needs coordination for Finding 2. |
| 19 | Full tests/race tests, vet/build, native compatibility, recovery round trip, and cutover review. Checks pass; the two reproduced edge cases still require remediation. |
## Verification performed
- `go test ./...` and `go test -race ./...` passed with Go 1.27.4.
- `go vet ./...` and `go build ./...` passed.
- Opt-in `TestReferenceCatalogCompatibility` and `TestAuditaBinaryCompatibility`
passed against the actual catalog and a fresh Audita v4.2 build. Provider
requests used a controlled loopback server, not paid services.
- The embedded schema matches the catalog schema byte for byte.
- CLI probes independently reproduced both findings using temporary synthetic
data. Native Audita acceptance of null aliases was checked directly.
Automatic provider checks, synthetic-transcript feasibility errors, all-four-role
runtime authority, and the clean source/format cutover are explicit user-selected
scope. They are not findings or reasons to restore the earlier behavior.