Record failed-load inspection review
This commit is contained in:
117
docs/roadmap/remediation.md
Normal file
117
docs/roadmap/remediation.md
Normal file
@@ -0,0 +1,117 @@
|
||||
# Failed-load inspection review
|
||||
|
||||
Reviewed commit `729724debab789ffb0e91147a134283bb2e236fa` against the
|
||||
[implementation plan](implementation.md), the
|
||||
[feature roadmap](failed-load-inspection.md), and
|
||||
[ADR 0025](../adr/0025-inspect-failed-configuration-loads.md).
|
||||
|
||||
## Finding 1 — Preserve the actual layered main checkpoint and its collection policy
|
||||
|
||||
**Status:** Open. **Priority:** P2. **Affected stages:** 3 and 6; regression
|
||||
coverage belongs with the stage 8 integration cases.
|
||||
|
||||
### Relevant code
|
||||
|
||||
- [executeLoadRequest](../../internal/engine/load.go) captures `mainCandidate`
|
||||
before the layered loader composes the main tier, and supplies that descriptor
|
||||
to failure handling after layered assembly fails.
|
||||
- [assembleLayeredInput](../../internal/engine/load_request.go) composes the main
|
||||
tier using the completed underlays' collection policies. Its local
|
||||
`mainComposition` is not retained in the returned input on a later error.
|
||||
- [sourceFailure](../../internal/engine/load_result.go), particularly its call to
|
||||
`compositionForInputWithPolicy`, reconstructs the main candidate without the
|
||||
lower collection policy used by the actual load.
|
||||
|
||||
### Circumstances and observed behavior
|
||||
|
||||
An underlay can declare an identity for a collection that the main tier's imports
|
||||
then use during strict composition. This is established collection-policy
|
||||
behavior; applications need not duplicate the declaration in the main document
|
||||
or register it in Go.
|
||||
|
||||
The following fixture reproduces the issue through the public API:
|
||||
|
||||
```yaml
|
||||
# Underlay supplied through LayeredOptions.Underlays
|
||||
config:
|
||||
sequences:
|
||||
- destination: [items]
|
||||
key: id
|
||||
items: [{id: lower, value: base}]
|
||||
|
||||
---
|
||||
# main.yml (loaded with Input.Imports: true)
|
||||
config:
|
||||
imports:
|
||||
- path: a.yml
|
||||
- path: b.yml
|
||||
|
||||
---
|
||||
# a.yml
|
||||
items: [{id: a, value: first}]
|
||||
|
||||
---
|
||||
# b.yml
|
||||
items: [{id: b, value: second}]
|
||||
```
|
||||
|
||||
`LoadLayered` succeeds with these inputs and no selected overlay. With an
|
||||
explicit overlay filesystem and a nonexistent selected overlay, it correctly
|
||||
returns a load error. However, `LoadError.InspectSubtree(Path{})` returns false,
|
||||
instead of exposing the completed main tier with its `a` and `b` records at
|
||||
`InspectionStageMain`. This occurs under the normal history limits.
|
||||
|
||||
The load already composed that main tier successfully using the underlay's
|
||||
identity rule. Failure handling instead recomposes the two imported lists with
|
||||
no identity rule, encounters an ordinary overlapping-list conflict, and discards
|
||||
the available checkpoint.
|
||||
|
||||
The same policy mismatch can manufacture a misleading checkpoint in the other
|
||||
direction. With the same underlay, a single main document containing
|
||||
`items: [{id: a}, {id: a}]` fails main composition with `compose.conflict`.
|
||||
A document containing `items: [{other: a}]` fails with `compose.invalid`.
|
||||
In both cases the fallback nevertheless returns a `main` view: reconstruction
|
||||
without the identity rule succeeds even though the main composition required by
|
||||
this invocation did not. The plan distinguishes completed main composition from
|
||||
failures before such a checkpoint exists.
|
||||
|
||||
### Remediation and verification
|
||||
|
||||
Retain the actual completed main-tier document and its source/history/policy
|
||||
evidence when layered assembly produces it, preserving ownership across later
|
||||
tier and overlay operations. Pass that checkpoint to failure inspection rather
|
||||
than reconstructing it under different collection rules. Where lazy main
|
||||
materialization remains necessary, use the applicable policy context and report
|
||||
only the processing actually completed. Keep the original diagnostics and the
|
||||
existing checkpoint availability rules.
|
||||
|
||||
Add a focused layered-load regression covering an underlay-only YAML identity,
|
||||
strict main imports, and a later overlay failure. Verify the main values, stage,
|
||||
origins and history, without including underlay values as main-tier values.
|
||||
Also verify that main composition rejected by the applicable identity rule does
|
||||
not become a completed checkpoint merely by retrying without that rule. No new
|
||||
consumer registration requirement, callback retry, source reread, or history
|
||||
limit is needed.
|
||||
|
||||
## Review coverage and validation
|
||||
|
||||
The review followed all ten implementation stages in order:
|
||||
|
||||
| Stages | Reviewed outcome |
|
||||
| --- | --- |
|
||||
| 1 | Accepted decision separates failure status from inspection and extends existing view comparison. |
|
||||
| 2 | Shared finalization classifies snapshots and attaches conservative source catalogs, passive contexts and known references. |
|
||||
| 3 | Source prefixes reuse source/inheritance evidence without inventing typed defaults. Finding 1 affects which main prefix is selected. |
|
||||
| 4 | CLI and resolver failures retain their frozen entry candidates without failed partial edits. |
|
||||
| 5 | Late failures retain resolved evidence, including pre-validator values and known secret references. |
|
||||
| 6 | Ownership and budget fallback are implemented; Finding 1 affects preservation of the actual layered main checkpoint. |
|
||||
| 7 | Root-owned API and stage conversions reuse the existing inspection view, including nil/zero and absent scopes. |
|
||||
| 8 | Evidence, redaction, comparison and detachment tests protect success/failure parity; the policy-dependent fallback above is missing. |
|
||||
| 9 | Maintained consumer example reports failed loads from one invocation and preserves the error. |
|
||||
| 10 | Public/configuration/architecture/internal documentation describes checkpoint inspection and retains existing lifecycle boundaries. |
|
||||
|
||||
`./scripts/check.sh` and `go test -race ./...` passed using Go 1.27.4 with
|
||||
dependency downloads disabled. Disposable public-API probes outside the
|
||||
repository confirmed both manifestations above. No production code or permanent
|
||||
tests were changed during this review. No additional actionable defects or
|
||||
inadvertently strengthened contracts were identified.
|
||||
Reference in New Issue
Block a user