Include failed-load source lookup in A1

This commit is contained in:
2026-10-27 14:31:25 +00:00
parent 7330107389
commit 197567177e
2 changed files with 17 additions and 7 deletions

View File

@@ -22,7 +22,7 @@ as well.
| D6 (including N4) | Replace `Resolution.Record` with the two intent-specific methods below and remove `CodeResolveInvalidKind` once its public trigger is eliminated. 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. |
| 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. |
| A1 (including N5) | Add `Result.Source(id)` and `LoadError.Source(id)` for direct lookup of source evidence on successful and failed loads, alongside their existing `Sources()` enumeration. Keep source evidence distinct from passive resource access through `SourceContext(id)`. |
| N1 | Rename `Paths(paths ...string) Search` to `SearchPaths(paths ...string) Search`, replacing the old name outright. Preserve literal file candidates, ordering, deferred acquisition, and selection/failure behavior. Leave semantic `Path` APIs and `Searches` unchanged. |
| N2 | Replace `LayerBase = "base"` with `LayerMain = "main"`, without a compatibility alias. Update Go references and affected string comparisons, serialization, and rendered labels. Preserve the existing main-tier category, imported contributions' owning tiers, precedence, and acquisition order. |
| N3 | Replace `CodeExplainLimitExceeded = "explain.limit_exceeded"` with `CodeHistoryLimitExceeded = "history.limit_exceeded"`, without a compatibility alias. Update Go references and affected diagnostic-code consumers. Preserve the existing quota, retained-node accounting, failure conditions, diagnostic locations, and admission timing before effective secret lookup and application validation. |
@@ -70,6 +70,7 @@ Document the modes together, preserving these distinctions:
```go
func (r *Result[T]) Source(id string) (SourceInfo, bool)
func (e *LoadError) Source(id string) (SourceInfo, bool)
```
Look up an acquired source by its load-local ID, returning the same information
@@ -78,6 +79,12 @@ false. The query performs no source acquisition, filesystem access, or credentia
lookup. Reuse existing source lookup and conversion machinery where practical;
no public registry, indexing strategy, or constant-time guarantee is required.
The failed-load lookup returns records from `LoadError.Sources()`'s partial
inventory and returns false for nil or zero-valued errors as well. Preserve
existing failed-load redaction and the evidence available at failure, including
incomplete placement information. Lookup neither completes acquisition nor
promises a record for every attempted source. This incorporates N5 into A1.
## Scope And Follow-Up
Implement the selected changes with corresponding declaration comments, owning

View File

@@ -1,8 +1,8 @@
# Additional Public API Review
Reviewed revision: `3ebb848eadf6e61275ecec6e35838ad6576cdd3a`.
Status: N1–N4 accepted, with N4 incorporated into D6; N5–N6 remain discussion
findings. Implementation has not begun.
Status: N1–N5 accepted, with N4 incorporated into D6 and N5 into A1; N6 remains
open for discussion. Implementation has not begun.
## Scope And Assessment
@@ -13,7 +13,7 @@ It covers loading/discovery, source and resource ownership, paths and collection
registration, callbacks, inspection/diffs, secrets, and diagnostics. It does not
repeat the symbol inventory or conduct a correctness/performance audit.
[api.md](api.md) owns the accepted D1–D8, A1, and N1–N4 changes. Those decisions remain
[api.md](api.md) owns the accepted D1–D8, A1, and N1–N5 changes. Those decisions remain
settled; public path comparison (A2) remains deferred. The findings here are
additional opportunities, including consequences of the accepted cleanup.
@@ -28,12 +28,12 @@ obsolete input-error category, and a missing convenience on failed loads.
| N2: main-tier provenance (accepted) | Rename `LayerBase` to `LayerMain`, with value `"main"`; decision recorded in [api.md](api.md). | Go constant rename and observable string change. |
| N3: shared-history quota (accepted) | Rename `CodeExplainLimitExceeded` to `CodeHistoryLimitExceeded`, with value `"history.limit_exceeded"`; decision recorded in [api.md](api.md). | Go constant rename and machine-readable code change. |
| N4: recording-kind diagnostic (accepted through D6) | Incorporated into [D6 in api.md](api.md#recording-methods-d6). | Conditional constant removal. |
| N5: failed-load source lookup | Add `LoadError.Source(id)` alongside accepted A1. | Compatible addition. |
| N5: failed-load source lookup (accepted through A1) | Incorporated into [A1 in api.md](api.md#direct-source-lookup-a1). | Compatible addition. |
| N6: import-default field names | Consider `FollowSymlinks` and `IncludeHidden`; lower priority. | Go field renames; YAML keys unchanged. |
These are design recommendations, not defect severities or additional release
gates. The string-value changes in N2 and N3 are explicitly accepted; the remaining
findings are proposals for discussion.
gates. The string-value changes in N2 and N3 are explicitly accepted; N6 remains
a proposal for discussion.
## N1. Distinguish Discovery Paths From Semantic Paths
@@ -138,6 +138,9 @@ final D6 implementation, rather than assuming a guard must be deleted now.
## N5. Offer Direct Source Lookup On Failed Loads
Status: accepted and incorporated into [A1](api.md#direct-source-lookup-a1). The
discussion below preserves the rationale and alternative.
Evidence: [diagnostic.go](../../diagnostic.go) exposes `LoadError.Diagnostics()`
and `LoadError.Sources()`. Diagnostic primary and related locations refer to
source IDs. Accepted A1 adds direct lookup on successful results, while