Activate ordinary source collection declarations
This commit is contained in:
@@ -52,7 +52,8 @@ preserves already validated secret state without rereading the environment.
|
||||
The current lifecycle is:
|
||||
|
||||
```text
|
||||
validate options → parse the selected source → traverse/compose enabled imports
|
||||
validate options → parse the selected source → extract source controls and
|
||||
traverse/strictly compose enabled imports
|
||||
→ build schema → check the optional application version → apply a selected overlay
|
||||
→ apply explicit CLI overrides → expand sibling inheritance
|
||||
→ create and clone defaults → strictly decode
|
||||
@@ -75,10 +76,11 @@ may register strict sequence composition paths through
|
||||
at the destination; `sequence-item` explicitly wraps the mapping as one item at a
|
||||
non-root destination. Unknown modes, invalid destinations, and invalid or
|
||||
conflicting sequence registrations fail before source acquisition. Overlay and
|
||||
CLI coordinates remain rooted at the application root. `NoSource` rejects
|
||||
CLI coordinates remain rooted at the application root. Ordinary `Load` recognizes
|
||||
source-root collection declarations whether or not imports are enabled; an
|
||||
`imports` declaration still requires imports to be enabled. `NoSource` rejects
|
||||
imports, active overlays, and filesystem context as invalid combinations but
|
||||
accepts overrides. Input containing a reserved `configkit` mapping key is rejected
|
||||
while imports are disabled.
|
||||
accepts overrides and remains an absent source rather than an empty document.
|
||||
|
||||
Every source, options, schema, version, defaults, decode, resolution, or validation
|
||||
failure returns a nil result and a `*LoadError`. Successful results contain caller-owned `Config`, detached
|
||||
@@ -767,8 +769,11 @@ live services as a substitute for configuration validation.
|
||||
|
||||
## Strict document composition
|
||||
|
||||
ConfigKit strictly composes parsed base documents when `Options.Imports` is true.
|
||||
Application defaults do not participate in this operation.
|
||||
Ordinary `Load` applies strict document composition to its parsed source scope;
|
||||
`Options.Imports` adds imported documents as peers in that scope. Application
|
||||
defaults do not participate. With imports disabled, the single source still has
|
||||
its controls extracted and any declared or registered collection identity is
|
||||
validated, but there are no imported peers to combine.
|
||||
|
||||
| Existing node | Incoming node | Result |
|
||||
| --- | --- | --- |
|
||||
@@ -779,11 +784,11 @@ Application defaults do not participate in this operation.
|
||||
| Any other pair of present nodes | Any other pair of present nodes | `compose.conflict` |
|
||||
|
||||
Every non-mapping overlap is a conflict, even when values are equal, except for
|
||||
sequence/sequence contributions at a registered sequence-composition path. Nulls
|
||||
remain atomic conflicts. Unregistered sequences conflict when repeated and are
|
||||
never joined by index. Disjoint entries under shared mappings compose, making
|
||||
stable keyed mappings the natural representation for independently contributed
|
||||
entries.
|
||||
sequence/sequence contributions at a registered sequence-composition path or a
|
||||
source-declared collection destination. Nulls remain atomic conflicts.
|
||||
Unregistered and undeclared sequences conflict when repeated and are never joined
|
||||
by index. Disjoint entries under shared mappings compose, making stable keyed
|
||||
mappings the natural representation for independently contributed entries.
|
||||
|
||||
`Definition.SequenceCompositions` registers literal mapping paths and one literal
|
||||
`IdentityField` for sequences that should compose independently authored records.
|
||||
@@ -819,6 +824,26 @@ headers are consumed before strict composition and cannot supply a registered
|
||||
record identity. Final typed decoding and application validation still run on the
|
||||
completed configuration.
|
||||
|
||||
Ordinary source documents may also declare collection behavior under the root
|
||||
`configkit.sequences` key. Each entry has a required literal `destination` and may
|
||||
specify `key` as one string or a nonempty list of strings, plus a `mode` of
|
||||
`replace`, `append`, or `upsert`. These controls are removed before application
|
||||
decoding. A declaration destination is relative to that source's placement, so a
|
||||
mounted fragment's declaration is mounted with its values. Declarations from
|
||||
strict peers must agree on identity fields and on any explicitly supplied mode;
|
||||
they apply even when the declaring source has no value at that destination.
|
||||
Singleton sequence contributions are validated as well as peers. A key supplies
|
||||
the identity used by `append` and `upsert`; without an explicit or retained mode,
|
||||
a keyed collection uses `upsert`, while an unkeyed collection uses `replace`.
|
||||
`append` keeps contribution order and rejects repeated identities. `upsert`
|
||||
replaces a complete matched record at its existing position and appends new
|
||||
identities in incoming order; it does not merge record fields.
|
||||
|
||||
At this boundary, declarations govern ordinary strict source composition,
|
||||
including loads with imports disabled. They do not change selected-overlay or
|
||||
layered precedence, inheritance, or CLI behavior. A root `configkit.imports`
|
||||
declaration still requires `Options.Imports`; `NoSource` has no declaration scope.
|
||||
|
||||
An empty mapping contributes no child definitions. Two empty mappings compose, and
|
||||
an empty mapping neither clears nor conflicts with another mapping's children.
|
||||
Shared mapping containers retain all contributing value locations as their composite
|
||||
@@ -915,9 +940,11 @@ zero.
|
||||
|
||||
## Explicit imports
|
||||
|
||||
Imports are opt-in. With `Options.Imports` enabled, a document may reserve its root
|
||||
`configkit` mapping for an `imports` sequence. ConfigKit removes that mapping before
|
||||
application decoding. Each sequence item is a mapping with exactly one `path`,
|
||||
Imports are opt-in. With `Options.Imports` enabled, a document may use its root
|
||||
`configkit` mapping for `imports` and `sequences` controls. Ordinary `Load` may use
|
||||
`sequences` without enabling imports, but an `imports` field still requires
|
||||
`Options.Imports`. ConfigKit removes recognized root controls before application
|
||||
decoding. Each imports sequence item is a mapping with exactly one `path`,
|
||||
`dir`, or `glob` selector. `path` and `dir` accept a string or a list of strings;
|
||||
`glob` accepts one path pattern string. The optional `required` boolean controls
|
||||
whether an empty selection or a missing named path is an error. Its default is
|
||||
@@ -927,8 +954,8 @@ strings. Every destination string is one literal mapping key and follows the
|
||||
input-destination validation rules above; quote numeric-looking keys so YAML
|
||||
reads them as strings. Null, scalar destinations, and non-string members are
|
||||
`import.invalid`, as are all other unsupported shapes and fields. A `configkit`
|
||||
key below the root is invalid. With imports disabled, any occurrence remains
|
||||
`import.disabled`.
|
||||
key below the root is invalid. With imports disabled, root imports and nested
|
||||
`configkit` keys remain `import.disabled`.
|
||||
|
||||
The directive key is `configkit`, not the `_configkit` spelling used in v0.1.0.
|
||||
There is no legacy alias: `_configkit` is ordinary application data, subject to
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Sequence Identity And Combination Implementation Plan
|
||||
|
||||
Status: implementation in progress; Stages 1–12 complete.
|
||||
Status: implementation in progress; Stages 1–13 complete.
|
||||
|
||||
Audience: a Luna coding agent implementing one numbered stage per prompt, in
|
||||
order. This plan starts at commit
|
||||
@@ -493,6 +493,10 @@ selected-overlay policy surface until Stage 14.
|
||||
Validation: ordinary-load, import, composition, and metadata tests plus
|
||||
the everyday check. Include one public ordinary-load declaration example test.
|
||||
|
||||
**Completion:** Implemented and verified with ordinary-load, import, composition,
|
||||
metadata, sequence-item, and source-version tests, the public ordinary-load
|
||||
example, and `./scripts/check.sh`.
|
||||
|
||||
## Stage 14 — Activate Selected Overlay Collection Policies
|
||||
|
||||
Scope: ordinary loading's selected overlay and shared precedence integration,
|
||||
|
||||
Reference in New Issue
Block a user