From 41622c54e09a8fac4764256ea8ab89d98a479145 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sat, 21 Nov 2026 03:07:14 +0000 Subject: [PATCH] Settle value access for manually constructed results --- docs/roadmap/result-value.md | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/docs/roadmap/result-value.md b/docs/roadmap/result-value.md index 4471c40..9e8faea 100644 --- a/docs/roadmap/result-value.md +++ b/docs/roadmap/result-value.md @@ -62,6 +62,13 @@ selected value into a requested component type. - 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 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 @@ -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, incompatible segments, or traversal through nil or a scalar. Declared schema -validity alone does not make a runtime descendant available. Receiver handling -and dynamic values changed after loading are addressed in the open decisions. +validity alone does not make a runtime descendant available. Dynamic values +supplied by callers, including changes after loading, are addressed in OD-2. ### Subtree-focused inspection @@ -215,20 +222,10 @@ loading and inspection callers need not adopt either new capability. ## 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 -successful-load inspection state, including `&Result[T]{Config: value}`. This -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` +This decision covers both post-load mutations and values in manually constructed +results permitted by settled OD-1. **Recommendation:** navigate current dynamic values using ConfigKit's supported dynamic container shapes. Return false if further traversal needs an unsupported