diff --git a/docs/adr/0022-main-relative-context.md b/docs/adr/0022-main-relative-context.md index 73969cf..f3432c8 100644 --- a/docs/adr/0022-main-relative-context.md +++ b/docs/adr/0022-main-relative-context.md @@ -2,7 +2,10 @@ ## Status -Accepted. +Accepted. The inherited import-containment provision is partially superseded by +[ADR 0026](0026-optional-host-import-containment.md), which separates optional +import containment from resource and overlay anchors. The context-selection and +overlay-binding decisions continue to apply. ## Date diff --git a/docs/adr/0026-optional-host-import-containment.md b/docs/adr/0026-optional-host-import-containment.md new file mode 100644 index 0000000..c0693eb --- /dev/null +++ b/docs/adr/0026-optional-host-import-containment.md @@ -0,0 +1,81 @@ +# ADR 0026: Separate Import Containment from Resource Anchors + +## Status + +Accepted. Partially supersedes the inherited import-containment provision of +[ADR 0022](0022-main-relative-context.md). + +## Date + +2026-12-05 + +## Context + +Applications need to import shared configuration outside the main file's +directory. The relative lookup base, import boundary, and passive resource root +serve different purposes. Treating the main directory as all three prevents +ordinary shared-file layouts and couples import access to resource coordinates. + +[ADR 0019](0019-explicit-configuration-discovery.md) keeps main selection explicit. +[ADR 0016](0016-independent-import-controls.md) separates import selection controls, +and [ADR 0015](0015-shared-dependency-ready-ordering.md) owns dependency ordering. +Broader path selection can use these existing loading responsibilities. + +## Decision + +Host imports have no implicit containment boundary. Absolute YAML selectors name +host paths, and relative selectors use the declaring source's canonical directory. +An explicit FilesystemContext.Root retains canonical containment for every +transitive import. Synthetic host sources require an explicit BaseDir and may +omit Root. An absent input with BaseDir alone uses that base without inferring +the process working directory. + +Within a supplied filesystem, leading-slash YAML selectors start at its namespace +root. Relative selectors use the declaring source's namespace directory. The +selected namespace and any explicit root continue to bound access; native Go +path arguments and filesystem symlink targets retain their existing syntax. + +Apply this interpretation to path, directory, and glob selectors. Establish a +glob's literal starting location before wildcard discovery, then inspect each +segment in order, including parent segments following wildcards. Preserve source +identity, admission, dependency ordering, budgets, composition, and inspection. + +Represent the optional import boundary separately from the existing resource, +overlay, and bootstrap anchor and the lookup base. Derived main-relative inputs +inherit those independent facts. Contained sources retain their existing passive +resource coordinates; an external unbounded host source uses its own canonical +directory as its passive resource root. This root does not constrain imports. + +Captured main sources retain their import policy separately. Omitting a later +root preserves that policy; a compatible explicit root may narrow an unbounded +capture at its resource anchor. Existing incompatible-context errors remain. + +Overlay lookup retains its established anchor and containment. Configured secrets +bootstrap retains its separate relative-only, anchored access under +[ADR 0023](0023-explicit-configured-secrets-bootstrap.md). Loading remains +synchronous and complete on return as described by +[ADR 0008](0008-complete-on-return-loading.md), releasing loading handles before +return and exposing passive resource contexts. + +## Alternatives Considered + +- Retain implicit main-directory containment and require callers to widen Root. + This leaves shared layouts dependent on redundant context setup. +- Widen every context root to the host root. This changes existing resource, + overlay, and bootstrap coordinates along with import access. +- Add a public permission switch. The existing explicit Root already expresses + intentional containment. +- Add a separate acquisition pipeline for absolute imports. This duplicates + admission, accounting, link handling, and lifecycle responsibilities. + +## Consequences + +This is an additive minor-release feature: existing valid configurations, public +signatures, explicit roots, and resource coordinates remain compatible. Default +host import scope deliberately becomes broader. Applications requiring the +previous containment boundary specify Root explicitly. + +The access owner supports bounded host, unbounded host, and native namespace +operations. These use ordinary filesystem facilities and the existing stable-input +assumptions; the change establishes no sandbox or concurrent-mutation guarantee. +The roadmap owns implementation progress until canonical contracts are updated. diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index e6a0bee..31ca65f 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -146,6 +146,9 @@ locations. Import widening does not widen either facility. ## Stage 1 — Record the selected architectural change +Completed: recorded in [ADR 0026](../adr/0026-optional-host-import-containment.md) +and linked from ADR 0022's status. + Write ADR 0026 (or the next available number) as Accepted, recording optional host import containment, namespace-root YAML selectors, and the separation of import policy from resource/overlay/bootstrap anchors. Include the additive