Record directory import integration defect
This commit is contained in:
@@ -100,7 +100,65 @@ ordinary behavior. Keep the distinction between YAML namespace-root syntax and
|
||||
symlink target syntax. Correct the documentation rather than introducing new
|
||||
named-file rejection or a stronger filesystem guarantee.
|
||||
|
||||
## Review coverage and validation
|
||||
## 3. Preserve symlink-target components before resolving host directory identity
|
||||
|
||||
Priority: P2. Status: open.
|
||||
|
||||
Relevant code: `hostImportLinkOperations.normalizeTarget` at lines 237–249 of
|
||||
[filesystem_links.go](../../internal/engine/filesystem_links.go), and the
|
||||
`rootTarget.identity` handoff at lines 104–111 of `selectDirectoryImportCandidates`
|
||||
in [import_selection.go](../../internal/engine/import_selection.go).
|
||||
|
||||
Host link-target normalization cleans the complete target before the shared
|
||||
link-frame evaluator visits its components. If the target contains another
|
||||
symlink followed by `..`, cleaning removes that inner link before resolving it.
|
||||
The returned directory identity can therefore differ from the actual filesystem
|
||||
target. The new unbounded absolute-target branch repeats this normalization;
|
||||
the relative-target and bounded branches already had the same limitation.
|
||||
|
||||
An external host layout reproduces the integration failure:
|
||||
|
||||
```text
|
||||
app/main.yml
|
||||
external/
|
||||
alias -> a/link/../shared
|
||||
a/
|
||||
link -> ../b/unit
|
||||
shared/part.yml # value: wrong
|
||||
b/
|
||||
unit/marker
|
||||
shared/part.yml # value: intended
|
||||
```
|
||||
|
||||
The filesystem resolves `external/alias` to `external/b/shared`, as verified
|
||||
with `filepath.EvalSymlinks`. A main declaring an absolute `dir` selector for
|
||||
`external/alias`, with `pattern: '*.yml'` and `required: true`, instead loads
|
||||
`external/a/shared/part.yml` and returns `value: wrong`. Equivalent absolute
|
||||
`path` and `glob` selectors through the alias both load `external/b/shared/part.yml`
|
||||
and return `value: intended`. The same disagreement occurs when the outer alias
|
||||
contains the absolute target `<fixture>/external/a/link/../shared`. Both target
|
||||
forms were reproduced through ordinary public `Load` with imports enabled and
|
||||
no Root, using disposable files outside the checkout.
|
||||
|
||||
The directory selector initially validates the correct canonical directory, then
|
||||
replaces its access path with the link resolver's incorrectly cleaned identity
|
||||
before enumeration. This exposes an inherited resolver defect through the new
|
||||
external-directory access mode, causing successful loading of unintended
|
||||
configuration. It is distinct from finding 1: here the symlink target itself is
|
||||
normalized incorrectly, including for host access, before any glob parent step.
|
||||
|
||||
Suggested remediation: preserve unresolved symlink-target components until the
|
||||
shared link evaluator processes them in filesystem order. In particular, resolve
|
||||
an intervening link before applying a following parent segment. Audit both
|
||||
absolute and relative host-target coordinate conversion and keep directory
|
||||
enumeration and cycle identity consistent with the validated canonical target.
|
||||
Retain the existing iterative evaluator, active/completed link tracking, explicit
|
||||
containment and native target policy; no stronger sandbox or mutation guarantee
|
||||
is needed. Add a real-filesystem regression for both target forms that compares
|
||||
directory selection with the corresponding named/glob targets. Check bounded
|
||||
access as well, since it shares the normalization defect.
|
||||
|
||||
## Initial implementation review coverage and validation
|
||||
|
||||
- Stage 1: ADR 0026 records the selected separation, and ADR 0022 changes only
|
||||
its status to identify the partial supersession.
|
||||
@@ -116,6 +174,42 @@ named-file rejection or a stronger filesystem guarantee.
|
||||
- Stage 14: reviewed the changed canonical documentation and Go comments.
|
||||
Finding 2 is an unintended strengthening of the documented contract.
|
||||
- Stage 15: `./scripts/check.sh` and `go test -race ./...` pass with Go 1.27.4.
|
||||
Existing tests do not expose the two findings above. The public reproductions
|
||||
Existing tests do not expose findings 1 and 2. The public reproductions
|
||||
remained outside the repository; no permanent tests, dependencies, release
|
||||
gates or runtime changes were added for this audit.
|
||||
|
||||
## Integration audit coverage and validation
|
||||
|
||||
Integration follow-up reviewed at `22a022a9e85a37ccf7a77f6823412c34359f9d3e`;
|
||||
production code remains at the implementation revision identified above.
|
||||
Findings 1 and 2 remain open. This follow-up adds finding 3.
|
||||
|
||||
| Stage | Interaction reviewed | Result |
|
||||
| --- | --- | --- |
|
||||
| 1 | ADR 0026 versus discovery, companion-binding and bootstrap decisions | The selected import change preserves the other responsibilities. |
|
||||
| 2 | Context validation versus discovery selection, synthetic inputs and absence | Base-only contexts and terminal selected-file validation follow the context table. |
|
||||
| 3 | Unbounded access versus shared regular-file reads, directory reads and ownership | The existing read/accounting/cleanup owners remain in use. |
|
||||
| 4 | Host link resolution versus directory access identity | Finding 3: normalization can select the wrong physical directory. |
|
||||
| 5 | Rooted YAML selectors versus Go filesystem arguments and parser validation | Root interpretation stays in selection; Go namespace arguments remain unchanged. |
|
||||
| 6 | External directory selection versus canonical validation, union and admission | Finding 3: enumeration can disagree with the target just validated. |
|
||||
| 7 | Glob prefixes versus native link inspection and explicit roots | Finding 1 remains in literal-prefix parent handling. |
|
||||
| 8 | Wildcard parents versus physical targets, filtering and candidate unions | Distinct physical parents are retained; findings 1 and 3 identify the remaining link-coordinate inconsistencies. |
|
||||
| 9 | External source contexts versus origins, resolution and failure inspection | Passive contexts follow source IDs and preserve contained coordinates. |
|
||||
| 10 | Derived/fallback contexts versus tier repetition and selected overlays | Import policy is copied while overlay access uses its legacy bound and lookup location. |
|
||||
| 11 | Captured main policy versus later context selection and secrets bootstrap | Omitted roots preserve capture policy; bootstrap uses its separate captured anchor. |
|
||||
| 12 | External inputs versus composition, mounting, versions, inheritance and inspection | The existing processing owners remain in use; focused lifecycle coverage passes. |
|
||||
| 13 | Consumer example versus public source/resource APIs | The maintained external-import consumer example passes. |
|
||||
| 14 | Updated documentation versus existing native filesystem behavior | Finding 2 remains the contract wording correction. |
|
||||
| 15 | Combined integration verification | Focused suites pass; the additional public reproducer exposes finding 3. |
|
||||
|
||||
Commands run for this follow-up:
|
||||
|
||||
```sh
|
||||
go test ./internal/engine -run 'Import|Glob|Filesystem|Captured|MainRelative|Resource|SecretsFromConfig'
|
||||
go test . -run 'Import|Glob|Filesystem|Search|MainRelative|SourceContext|Secrets|Failure'
|
||||
go test ./examples/consumers
|
||||
```
|
||||
|
||||
All passed. The earlier everyday-check and full-race results above remain
|
||||
applicable to unchanged production code. No production code or permanent tests
|
||||
were changed, and no publication or downstream dependency updates were made.
|
||||
|
||||
Reference in New Issue
Block a user