Clarify import context compatibility and glob traversal

This commit is contained in:
2026-12-05 19:20:57 +00:00
parent ccedd79cad
commit 8c04dfdaa4

View File

@@ -74,6 +74,13 @@ An absolute glob establishes its absolute starting location; it does not scan
the declaring file's directory first. Handle path roots separately from pattern
segments so normalization preserves wildcard and escape semantics.
Absolute globs also work within an explicit containment root. With
`Root: /etc/myapp`, `/etc/myapp/fragments/*.yml` starts wildcard discovery in
`/etc/myapp/fragments`; resolving its literal prefix must not fail merely because
`/` and `/etc` are ancestors of the allowed root. Establish the literal starting
directory before wildcard discovery, then apply the existing containment and
traversal rules. The same rule applies within a supplied filesystem namespace.
Preserve traversal order when parent segments follow wildcards. For example,
`services/*/../shared/*.yml` must expand the wildcard directory segment before
processing its following `..`, using the existing link-handling rules. Cleaning
@@ -126,6 +133,15 @@ inferring filesystem locations from display labels or the working directory.
The redundant base for an absolute-only synthetic document is an accepted
tradeoff for keeping the existing context model straightforward.
An explicit absolute existing `BaseDir` without `Root` is also a usable host
context for `NoSource()`, optional discovery exhaustion, and main-relative
fallbacks where a host context is applicable. It supplies the relative lookup
base and default resource root, with no import containment boundary. Existing
root-only absent-main contexts continue to use that root as their base and
explicit boundary. Omitting both does not infer the working directory. These
rules do not change context selection or the rule that a selected host file
determines its own base and rejects an explicit `BaseDir`.
Apply explicit containment to canonical targets, including symlink targets and
every transitive import. Without an explicit boundary, a host symlink target
outside the main file's directory is eligible under the normal import rules.
@@ -157,6 +173,15 @@ Prepared main sources must retain whether containment was expressly selected;
materializing a default context during preparation must not turn an omitted
import boundary into an explicit one on a subsequent load.
With no later context, a prepared main retains its captured policy. A later
compatible host context may explicitly select containment at the captured
resource root: preparing without `Root` and then loading with `Root` equal to
the main directory remains valid and applies that explicit boundary. Omitting
`Root` in a later context does not remove a boundary explicitly selected during
preparation. Continue rejecting incompatible root changes under the existing
prepared-source contract. Context compatibility must account for the selected
containment policy as well as resolved paths.
Keep passive `SourceContext` reporting usable for externally imported files,
including through resolution and available failed-load inspection. Its filesystem
and slash-relative `BaseDir` must address the contributing source's directory.
@@ -166,9 +191,9 @@ without an explicit containment root receives a passive context rooted at that
source's canonical directory, with `BaseDir` equal to `.`. With an explicit root,
continue using it for the passive context as today.
For a synthetic host source with `BaseDir` and no explicit `Root`, use that
`BaseDir` as its default passive resource root, with resource `BaseDir` equal to
`.`. Imports inside that resource root share it; external imports receive the
For a synthetic or absent host source with `BaseDir` and no explicit `Root`, use
that `BaseDir` as its default passive resource root, with resource `BaseDir` equal
to `.`. Imports inside that resource root share it; external imports receive the
source-directory-rooted context described above. A main-relative input preserves
its inherited resource context, including its resource root and base coordinates,
instead of manufacturing a new resource root from its relative lookup base.
@@ -261,10 +286,16 @@ configuration to adopt the release.
unchanged Go filesystem argument conventions. Include compatibility cases for
existing valid relative imports, explicit roots, synthetic contexts and passive
resource coordinates. Include a glob with parent traversal after a wildcard,
synthetic host contexts with an omitted root, inherited main-relative resource
contexts, and the distinction between native YAML selectors and native symlink
targets. Reuse existing semantic, budget and cleanup coverage
rather than adding a Cartesian test matrix or performance thresholds.
absolute globs whose literal prefixes lead into an explicit host or namespace
root, and synthetic and absent-main host contexts with an omitted root.
Exercise BaseDir-only main-relative fallbacks and retained root-only absent-main
behavior. Cover prepared-source loads that inherit the captured boundary,
explicitly narrow an unbounded capture at its resource root, or supply an
incompatible root; an omitted later root must preserve captured containment.
Include inherited main-relative resource contexts and the distinction between
native YAML selectors and native symlink targets. Reuse existing semantic,
budget and cleanup coverage rather than adding a Cartesian test matrix or
performance thresholds.
The implementation plan will own sequencing and concrete verification commands.
This roadmap proposes no new release gates, dependencies or public performance