Accept direct source lookup on results

This commit is contained in:
2026-10-27 14:10:51 +00:00
parent 4289f9ff7f
commit 3ebb848ead

View File

@@ -4,9 +4,9 @@ Status: decisions accepted; implementation has not begun.
Baseline: `a050986` and the revision-pinned [API review](review.md). Baseline: `a050986` and the revision-pinned [API review](review.md).
This document records the accepted cleanup from that review. The goal is clearer This document records the accepted cleanup from that review. The goal is clearer
public vocabulary and recording methods before v1.0.0, preserving existing public vocabulary, recording methods, and direct source lookup before v1.0.0,
behavior. The review remains the catalog and analysis; its other assessments preserving existing behavior. The review remains the catalog and analysis; its
are not automatically adopted by these decisions. other assessments are not automatically adopted by these decisions.
## Accepted Changes ## Accepted Changes
@@ -20,6 +20,7 @@ are not automatically adopted by these decisions.
| D6 | Replace `Resolution.Record` with the two intent-specific methods below. Retain `ChangeKind` and its inspection constants. | | D6 | Replace `Resolution.Record` with the two intent-specific methods below. Retain `ChangeKind` and its inspection constants. |
| D7 | Rename `LoadSecretsDir` to `LoadSecretsIntoEnvironment`, making process-environment mutation explicit. Preserve its signature apart from the name, report-plus-error behavior, and existing bootstrap semantics. | | D7 | Rename `LoadSecretsDir` to `LoadSecretsIntoEnvironment`, making process-environment mutation explicit. Preserve its signature apart from the name, report-plus-error behavior, and existing bootstrap semantics. |
| D8 | Remove `CodeOptionsUnavailable` after confirming there is no intentional supported role. Do not introduce a failure merely to give the code a producer; a concrete reason to retain it should be brought back for discussion. | | D8 | Remove `CodeOptionsUnavailable` after confirming there is no intentional supported role. Do not introduce a failure merely to give the code a producer; a concrete reason to retain it should be brought back for discussion. |
| A1 | Add `Result.Source(id)` for direct lookup of acquired-source evidence, alongside ordered `Sources()` enumeration and passive `SourceContext(id)` resource access. |
### Recording Methods (D6) ### Recording Methods (D6)
@@ -53,14 +54,27 @@ Document the modes together, preserving these distinctions:
invocation or acceptance. Preserve nil-versus-observed-absence meaning, invocation or acceptance. Preserve nil-versus-observed-absence meaning,
explicit null, locations, consumption, and redaction. No acceptance flag is added. explicit null, locations, consumption, and redaction. No acceptance flag is added.
### Direct Source Lookup (A1)
```go
func (r *Result[T]) Source(id string) (SourceInfo, bool)
```
Look up an acquired source by its load-local ID, returning the same information
represented in `Sources()` as a detached record. Empty or unknown IDs return
false. The query performs no source acquisition, filesystem access, or credential
lookup. Reuse existing source lookup and conversion machinery where practical;
no public registry, indexing strategy, or constant-time guarantee is required.
## Scope And Follow-Up ## Scope And Follow-Up
Implement the selected changes with corresponding declaration comments, owning Implement the selected changes with corresponding declaration comments, owning
documentation, examples, tests, and affected consumer call sites. Preserve the documentation, examples, tests, and affected consumer call sites. Preserve the
existing loading, composition, presence, inspection, ownership, and diagnostic existing loading, composition, presence, inspection, ownership, and diagnostic
contracts except for the expressly selected API replacements/removals above. contracts except for the expressly selected API replacements/removals and addition
above.
This record does not authorize release publication or a broader API redesign. This record does not authorize release publication or a broader API redesign.
A1 (`Result.Source(id)`) and A2 (public path comparison) are not selected for this A2 (public path comparison) is deferred. It can be considered separately as a
cleanup. Both can be considered separately as compatible additions; path compatible addition once a concrete use case and an explicit equality definition
comparison needs a concrete use case and an explicit equality definition. are established.