diff --git a/construction_contract_test.go b/construction_contract_test.go index e175263..bf73475 100644 --- a/construction_contract_test.go +++ b/construction_contract_test.go @@ -291,7 +291,7 @@ func TestBackendSourceOwnsSmokeTestValuesAndDefersDefaultLookup(t *testing.T) { "https://backend.example/v1", "not-yet-listed", "https://probe.example/ready?check=1", - " OPENROUTER_KEY ", + "openrouter_key", "https://probe.example/key?scope=current", } { if !strings.Contains(contents, want) { diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index a7d55da..9539af7 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -186,6 +186,10 @@ Validation: `go test ./internal/configuration ./internal/engine` and the affecte root API tests. Search for remaining interpreted-state consumers and confirm validation does not mutate the working configuration. +Completion: validation, inventories, execution profiles, and prompt construction +use the single resolved configuration. The configuration, engine, and root API +tests pass; no interpreted-state consumers remain. + ## Stage 5: Verify Provenance And Inspection Integration Scope: focused configuration tests and existing public inspection/diff tests. diff --git a/internal/configuration/load.go b/internal/configuration/load.go index 5a5eb67..149fb05 100644 --- a/internal/configuration/load.go +++ b/internal/configuration/load.go @@ -119,7 +119,6 @@ const ( type loaded struct { result *configkit.Result[document] - interpreted document backends map[string]map[string]fieldState profiles map[string]map[string]fieldState promptMetadata map[string][]promptInputPresence @@ -250,8 +249,7 @@ func configurationDefinition(state *loaded) configkit.Definition[document] { return nil }, Validate: func(config *document, validation *configkit.Validation) { - state.interpreted = interpretConfiguration(config, validation) - validateEffective(&state.interpreted, validation) + validateEffective(config, validation) }, } } @@ -278,7 +276,7 @@ func load(main configkit.Input, underlays []configkit.Underlay) (*loaded, error) if err := state.buildExecutionProfiles(); err != nil { return nil, fmt.Errorf("load configuration: %w", err) } - state.backendIDs = sortedKeys(indexedBackends(&state.interpreted)) + state.backendIDs = sortedKeys(indexedBackends(&state.result.Config)) state.profileIDs = sortedKeys(state.indexedProfiles) for _, id := range sortedKeys(state.prompts) { state.promptIDs = append(state.promptIDs, domain.PromptIdentity{ID: id}) @@ -408,18 +406,6 @@ func sortedKeys[T any](entries map[string]T) []string { return keys } -func interpretConfiguration(config *document, validation *configkit.Validation) document { - interpreted := *config - if config.Collections != nil { - interpreted.Collections = make(map[string]collectionConfig, len(config.Collections)) - for namespace, original := range config.Collections { - collection := original - interpreted.Collections[namespace] = collection - } - } - return interpreted -} - func validateEffective(config *document, validation *configkit.Validation) { sets := resourceSets(config) backendIDs := make(map[string]struct{}) diff --git a/internal/configuration/prompts.go b/internal/configuration/prompts.go index 9b354e9..f709522 100644 --- a/internal/configuration/prompts.go +++ b/internal/configuration/prompts.go @@ -38,7 +38,7 @@ func (state *loaded) materializePrompts() error { } return metadata.Lookup(path) } - for _, resources := range resourceSets(&state.interpreted) { + for _, resources := range resourceSets(&state.result.Config) { for index, raw := range resources.prompts { promptBase := resources.bases.prompts.Index(index) if strings.TrimSpace(raw.ID) == "" { diff --git a/internal/configuration/targets.go b/internal/configuration/targets.go index 577fcde..e4691a4 100644 --- a/internal/configuration/targets.go +++ b/internal/configuration/targets.go @@ -12,8 +12,8 @@ import ( ) func (state *loaded) buildExecutionProfiles() error { - backendConfigs := indexedBackends(&state.interpreted) - profileConfigs := indexedProfiles(&state.interpreted) + backendConfigs := indexedBackends(&state.result.Config) + profileConfigs := indexedProfiles(&state.result.Config) definitions := make(map[string]domain.Backend, len(backendConfigs)) for _, id := range sortedKeys(backendConfigs) { config := backendConfigs[id]