Settle value access for manually constructed results
This commit is contained in:
@@ -62,6 +62,13 @@ selected value into a requested component type.
|
|||||||
- A found nil pointer, map, slice, or interface is distinct from an unavailable
|
- A found nil pointer, map, slice, or interface is distinct from an unavailable
|
||||||
path. In particular, `(nil, true)` is possible. A zero/defaulted struct field
|
path. In particular, `(nil, true)` is possible. A zero/defaulted struct field
|
||||||
may be found without YAML input; source presence remains a metadata question.
|
may be found without YAML input; source presence remains a metadata question.
|
||||||
|
- **OD-1 settled:** return `(nil, false)` for a nil receiver. Any non-nil result
|
||||||
|
exposes its current `Config` through the same traversal rules, including a
|
||||||
|
manually constructed result without load or inspection state. Lookup success
|
||||||
|
establishes value availability only, not validation or corresponding load
|
||||||
|
evidence. This matches direct field access and supports hand-built fixtures
|
||||||
|
without coupling typed access to inspection. `InspectSubtree` still requires
|
||||||
|
completed-load inspection state.
|
||||||
|
|
||||||
### Path traversal
|
### Path traversal
|
||||||
|
|
||||||
@@ -80,8 +87,8 @@ pointer targets, including nil inline embeddings, to satisfy a lookup.
|
|||||||
|
|
||||||
Return `(nil, false)` for malformed paths, missing keys, out-of-range indices,
|
Return `(nil, false)` for malformed paths, missing keys, out-of-range indices,
|
||||||
incompatible segments, or traversal through nil or a scalar. Declared schema
|
incompatible segments, or traversal through nil or a scalar. Declared schema
|
||||||
validity alone does not make a runtime descendant available. Receiver handling
|
validity alone does not make a runtime descendant available. Dynamic values
|
||||||
and dynamic values changed after loading are addressed in the open decisions.
|
supplied by callers, including changes after loading, are addressed in OD-2.
|
||||||
|
|
||||||
### Subtree-focused inspection
|
### Subtree-focused inspection
|
||||||
|
|
||||||
@@ -215,20 +222,10 @@ loading and inspection callers need not adopt either new capability.
|
|||||||
|
|
||||||
## Open Decisions
|
## Open Decisions
|
||||||
|
|
||||||
### OD-1: Nil and manually constructed results
|
### OD-2: Traversal of caller-supplied values inside `any`
|
||||||
|
|
||||||
**Recommendation:** return `(nil, false)` for a nil receiver or a result without
|
This decision covers both post-load mutations and values in manually constructed
|
||||||
successful-load inspection state, including `&Result[T]{Config: value}`. This
|
results permitted by settled OD-1.
|
||||||
keeps the method on the completed-result boundary and consistent with the
|
|
||||||
inspection methods a library may use alongside it. This is a proposed eligibility
|
|
||||||
rule, not a claim that caller changes to a successful result are revalidated.
|
|
||||||
|
|
||||||
**Alternative:** allow any non-nil result to expose its `Config`, even without
|
|
||||||
load state. This matches direct field access and simplifies hand-built fixtures,
|
|
||||||
but a library can then obtain values from a result with no corresponding load
|
|
||||||
evidence. Nil receivers would still return `(nil, false)`.
|
|
||||||
|
|
||||||
### OD-2: Traversal after arbitrary changes inside `any`
|
|
||||||
|
|
||||||
**Recommendation:** navigate current dynamic values using ConfigKit's supported
|
**Recommendation:** navigate current dynamic values using ConfigKit's supported
|
||||||
dynamic container shapes. Return false if further traversal needs an unsupported
|
dynamic container shapes. Return false if further traversal needs an unsupported
|
||||||
|
|||||||
Reference in New Issue
Block a user