diff --git a/docs/roadmap/remediation.md b/docs/roadmap/remediation.md index ccf8196..905b29f 100644 --- a/docs/roadmap/remediation.md +++ b/docs/roadmap/remediation.md @@ -21,7 +21,7 @@ resource-oriented profile result and changed post-handoff null fallback are deliberately selected compatibility changes, not accidental regressions. Review evidence below describes the pre-remediation implementation. Completion -markers record the subsequent corrections. +markers record the subsequent corrections. Both findings are now addressed. ## Findings @@ -79,7 +79,14 @@ another implementation path, compatibility field, or new runtime test. ### R2. Hoist The Prompt Presence Lookup Out Of The Input Loop [P3] -**Status:** Open for consideration. **Affected stage:** 4. +**Status:** Complete. **Affected stage:** 4. + +Completion: `InspectPrompt` fetches the selected presence slice once before +iterating over inputs. The loop now indexes that slice directly, with no new +cache or public contract. Existing inherited-presence, captured-content, generic +JSON/YAML encoding, typed-source, and isolation tests pass with Go 1.27.3 under +the race detector; `go vet ./...` also passes. No benchmark or implementation- +coupled lookup-count test was added. **Location:** [Prompt resource projection](../../internal/configuration/resources.go), `InspectPrompt`, lines 77–85, especially `state.promptMetadata[id][i]` at line 81. diff --git a/internal/configuration/resources.go b/internal/configuration/resources.go index e48858d..197e9a3 100644 --- a/internal/configuration/resources.go +++ b/internal/configuration/resources.go @@ -76,9 +76,10 @@ func (state *loaded) InspectPrompt(ctx context.Context, id string) (*PromptResou result := &PromptResource{ID: id, Hash: entry.hash, DefaultProfile: raw.DefaultProfile, Description: raw.Description, SessionID: raw.SessionID} if raw.Inputs != nil { inputs := make([]PromptInputResource, len(raw.Inputs)) + presence := state.promptMetadata[id] for i, input := range raw.Inputs { inputs[i] = PromptInputResource{Name: input.Name, ContentType: input.ContentType, Description: input.Description} - if state.promptMetadata[id][i].required == fieldValue { + if presence[i].required == fieldValue { required := input.Required inputs[i].Required = &required }