Record the schema file output collision gap

This commit is contained in:
2026-11-23 14:30:52 +00:00
parent ca06f7c4e3
commit a020d155f4

View File

@@ -1,17 +1,19 @@
# Library Adoption Remediation
**Status:** Findings from the completed implementation review; remediation has
not begun.
**Status:** Findings from the implementation and follow-up integration reviews;
remediation has not begun.
**Reviewed source:** `338e93a7ebda9a86593069d63f9d5a7fe23ccaf5`
(`Complete library adoption validation and cleanup`).
The follow-up review used `ca06f7c4e34d5702d2234a56c84250c31435fcf2`, which
adds the initial findings without changing application code or dependencies.
The review covered Stages 1–10 of the [implementation plan](implementation.md)
against the [feature roadmap](library-upgrades.md), including implementation,
tests, maintained documentation, migration guidance, and release preparation.
The intended architecture is substantially in place. No production correctness
defect was identified in this review; the following test-maintenance and
documentation gaps need correction.
The intended architecture is substantially in place. The initial review found
test-maintenance and documentation gaps; the follow-up integration review also
confirmed an output-safety gap involving operator-owned schema files.
## R1: Remove the Test Fixtures' Implicit YAML Layout Requirement
@@ -92,6 +94,80 @@ contracts. Roadmap status agrees with the implementation and this review.
No application code, historical release record, or accepted ADR needs to change
to address this finding.
## R3: Include Operator Schema Files in Existing Output-Collision Checks
**Priority:** P2 — consumed-input preservation and runtime integration.
**Affected code:**
- [Runtime source tracking](../../internal/framework/llm/source_paths.go):
`capturedSourcePaths`, especially lines 23–44.
- [Processing input assembly](../../internal/cli/process_inputs.go):
protected-path handoff near lines 71–77.
- [Output selection](../../internal/core/diagnostics/output_session.go):
`SelectOutput` consumes that protected set before preparing outputs.
**Finding:** Prompt-owned contracts now make an operator's native
`output.schema_file` an actual processing input. Source tracking still collects
only configuration sources and effective `messages[].content_file` paths. The
schema file is absent from ConfigKit's configuration-source inventory and from
Audita's protected paths, so existing output-collision checks never see it.
A transcript destination can consequently overwrite a schema used by its own
run. An ordinary report can also overwrite the schema during initialization,
before PromptKit prepares the first request. That both damages an input and
turns a valid configuration into a fatal validation-contract failure. The
configured contract is valid; the conflict arises between the newly honored
schema input and the previously existing output lifecycle. This concerns the
integration work in Stages 3 and 4, rather than a defect in native schema
validation.
**Evidence:** Two isolated subprocess probes used a grammar-only pipeline, a
complete operator prompt replacement with a source-relative `schema_file`, and
a local HTTP stub returning `{"corrections":[]}`:
- Selecting that schema file as the transcript output completed successfully
after one provider request and replaced the schema with transcript JSON.
- Naming the schema `errors.yml` beside the transcript output let report
initialization replace it. Processing then failed with `structured validation
contract failed`, made no provider request, and left report YAML in the
former schema file.
The probe binary's build metadata identifies the reviewed implementation
commit. Application code and dependencies are unchanged at the follow-up
review revision. All probe files were temporary and synthetic.
**Recommended change:** Extend the existing consumed-input path collection to
include effective host-backed `output.schema_file` inputs for root and
collection prompts. Use the native recorded origin/filesystem context to
identify the same file PromptKit resolves, including inherited or replaced
definitions, and pass those paths through the existing collision mechanism
before any output preparation. Keep schema parsing and validation upstream;
this requires no alternate resolver or restriction on operator contracts.
Keep inline and embedded schemas valid and preserve intentional in-place
transcript replacement. Update the operational description of protected inputs
when the fix lands.
**Acceptance:** Colliding transcript and ordinary-report destinations are
rejected before writes or provider calls, leaving the schema unchanged. A
noncolliding operator schema still supports processing and native preparation.
Cover source-local origin selection at the source-tracking boundary and both
output-collision outcomes at an assembled boundary, reusing existing collision
semantics rather than duplicating their complete filesystem test matrix.
## Follow-Up Integration Coverage
The review revisited the numbered implementation stages in order:
| Stages | Interaction reviewed | Result |
| --- | --- | --- |
| 1–2 | Shared settings, domain defaults and overrides, companion origins, secrets bootstrap, native inspection, and startup diagnostics. | No additional gap identified. |
| 3–4 | Runtime handoff, source protection, prompt-owned contracts, recoverable decoding, and semantic correction repair. | R3 confirms a missing input in existing output protection. |
| 5–6 | Native execution evidence alongside domain operation counts, proposal attribution, repair histories, and optional debug output. | No additional gap identified. |
| 7 | Invocation context propagation, shared admission, nested validation, usage reporting, quiet mode, and transcript streams. | No additional gap identified. |
| 8–9 | Maintained examples, migration guidance, canonical contracts, attribution, and prepared release documentation. | Existing R2 remains; no additional gap identified. |
| 10 | Cleanup and assembled workflows, including failure, cancellation, partial success, and output publication. | Existing tests pass; the schema-collision probes expose R3 beyond their coverage. |
## Review Validation
With Go 1.27.4, the complete `go test -race ./...` suite, `go vet ./...`,
@@ -100,3 +176,9 @@ were gofmt clean, and 145 local links in the changed Markdown documents
resolved. The fixture-format probe above confirmed R1 separately from the
passing current suite. This review did not change application code or publish
a release.
For the follow-up, uncached race-enabled tests passed for `internal/appconfig`,
`internal/cli`, `internal/framework/llm`, `internal/framework/runner`,
`internal/framework/processreport`, and `cmd/audita`. The two controlled schema
collision probes confirmed R3. The follow-up changes only this remediation
document; it does not implement the fixes or publish a release.