Assemble imported sequence-item scopes

This commit is contained in:
2026-10-16 16:20:14 +00:00
parent 1a04bb3835
commit 25cf6d32b6
9 changed files with 722 additions and 27 deletions

View File

@@ -884,6 +884,25 @@ walk failures, matched directories, invalid documents, escapes, and repeated tar
remain errors. Final candidates are bounded by the remaining source limit before
their contents are accumulated.
Each path or glob declaration may include `placement: mapping` or
`placement: sequence-item`. Omission means `mapping` for that declaration,
including every match of a glob; placement is not inherited. Sequence-item
placement requires a nonempty effective destination and wraps the imported
mapping as one element of a sequence there. It does not split source sequences
or enable sequence accumulation: overlapping sequences still follow the strict
composition rules above.
An item import first opens a local mapping scope. Its body and ordinary helper
imports compose within that record. An omitted helper destination or
`destination: []` places the helper at the record root; other destinations are
relative to the immediate importing source. A helper may supply fields such as
the record's `id`. An explicit nested `sequence-item` import creates a sequence
inside the record, and its placement is independent of the enclosing item.
At the record root, an item import must name a nonempty nested destination.
Physical paths continue to resolve from the file that declares each import.
An actual empty mapping contributes an empty item, while an optional unmatched
path or glob contributes nothing.
For host files, the configuration root defaults to the selected file's canonical
directory. A host file may supply `FilesystemContext.Root` to widen that root but
may not supply `BaseDir` or a native `FS`. Byte, reader, and mapping inputs with host context

View File

@@ -1,6 +1,6 @@
# Implementation Plan: Sequence Placement and Composition
Status: implementation in progress; stages 1–7 completed.
Status: implementation in progress; stages 1–8 completed.
## Purpose and authority
@@ -505,6 +505,20 @@ Validation: import/directive/glob/destination/composition tests and
`./scripts/check.sh`. Completion: private item imports construct the agreed
records and preserve physical acquisition evidence.
Completion evidence: import declarations now parse per-declaration placement,
and item imports compose their body and ordinary helpers in a local mapping
scope before wrapping the completed record. Nested item scopes, glob matches,
relative and transitive helper destinations, source origins/history, and
resolved underlay destinations are retained. Configuration documentation
describes only the implemented import-placement subset; private registration
controls remain unadvertised. These checks passed with Go `go1.26.9 linux/amd64`:
- `GOTOOLCHAIN=local GOPROXY=off go test ./internal/engine -run 'Import|Directive|Glob|Destination|Compose|NativeFilesystem' -count=1`
- `GOTOOLCHAIN=local ./scripts/check.sh`
- `git diff --check`
No environmental limitation affected validation; checks ran on Linux/amd64.
## Stage 9 — Wire strict policy through the complete loading lifecycle
Scope: ordinary/grouped engine loading and every strict-tier entry point.