Use resolved configuration for construction
This commit is contained in:
@@ -291,7 +291,7 @@ func TestBackendSourceOwnsSmokeTestValuesAndDefersDefaultLookup(t *testing.T) {
|
|||||||
"https://backend.example/v1",
|
"https://backend.example/v1",
|
||||||
"not-yet-listed",
|
"not-yet-listed",
|
||||||
"https://probe.example/ready?check=1",
|
"https://probe.example/ready?check=1",
|
||||||
" OPENROUTER_KEY ",
|
"openrouter_key",
|
||||||
"https://probe.example/key?scope=current",
|
"https://probe.example/key?scope=current",
|
||||||
} {
|
} {
|
||||||
if !strings.Contains(contents, want) {
|
if !strings.Contains(contents, want) {
|
||||||
|
|||||||
@@ -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
|
root API tests. Search for remaining interpreted-state consumers and confirm
|
||||||
validation does not mutate the working configuration.
|
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
|
## Stage 5: Verify Provenance And Inspection Integration
|
||||||
|
|
||||||
Scope: focused configuration tests and existing public inspection/diff tests.
|
Scope: focused configuration tests and existing public inspection/diff tests.
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ const (
|
|||||||
|
|
||||||
type loaded struct {
|
type loaded struct {
|
||||||
result *configkit.Result[document]
|
result *configkit.Result[document]
|
||||||
interpreted document
|
|
||||||
backends map[string]map[string]fieldState
|
backends map[string]map[string]fieldState
|
||||||
profiles map[string]map[string]fieldState
|
profiles map[string]map[string]fieldState
|
||||||
promptMetadata map[string][]promptInputPresence
|
promptMetadata map[string][]promptInputPresence
|
||||||
@@ -250,8 +249,7 @@ func configurationDefinition(state *loaded) configkit.Definition[document] {
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Validate: func(config *document, validation *configkit.Validation) {
|
Validate: func(config *document, validation *configkit.Validation) {
|
||||||
state.interpreted = interpretConfiguration(config, validation)
|
validateEffective(config, validation)
|
||||||
validateEffective(&state.interpreted, validation)
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,7 +276,7 @@ func load(main configkit.Input, underlays []configkit.Underlay) (*loaded, error)
|
|||||||
if err := state.buildExecutionProfiles(); err != nil {
|
if err := state.buildExecutionProfiles(); err != nil {
|
||||||
return nil, fmt.Errorf("load configuration: %w", err)
|
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)
|
state.profileIDs = sortedKeys(state.indexedProfiles)
|
||||||
for _, id := range sortedKeys(state.prompts) {
|
for _, id := range sortedKeys(state.prompts) {
|
||||||
state.promptIDs = append(state.promptIDs, domain.PromptIdentity{ID: id})
|
state.promptIDs = append(state.promptIDs, domain.PromptIdentity{ID: id})
|
||||||
@@ -408,18 +406,6 @@ func sortedKeys[T any](entries map[string]T) []string {
|
|||||||
return keys
|
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) {
|
func validateEffective(config *document, validation *configkit.Validation) {
|
||||||
sets := resourceSets(config)
|
sets := resourceSets(config)
|
||||||
backendIDs := make(map[string]struct{})
|
backendIDs := make(map[string]struct{})
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ func (state *loaded) materializePrompts() error {
|
|||||||
}
|
}
|
||||||
return metadata.Lookup(path)
|
return metadata.Lookup(path)
|
||||||
}
|
}
|
||||||
for _, resources := range resourceSets(&state.interpreted) {
|
for _, resources := range resourceSets(&state.result.Config) {
|
||||||
for index, raw := range resources.prompts {
|
for index, raw := range resources.prompts {
|
||||||
promptBase := resources.bases.prompts.Index(index)
|
promptBase := resources.bases.prompts.Index(index)
|
||||||
if strings.TrimSpace(raw.ID) == "" {
|
if strings.TrimSpace(raw.ID) == "" {
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (state *loaded) buildExecutionProfiles() error {
|
func (state *loaded) buildExecutionProfiles() error {
|
||||||
backendConfigs := indexedBackends(&state.interpreted)
|
backendConfigs := indexedBackends(&state.result.Config)
|
||||||
profileConfigs := indexedProfiles(&state.interpreted)
|
profileConfigs := indexedProfiles(&state.result.Config)
|
||||||
definitions := make(map[string]domain.Backend, len(backendConfigs))
|
definitions := make(map[string]domain.Backend, len(backendConfigs))
|
||||||
for _, id := range sortedKeys(backendConfigs) {
|
for _, id := range sortedKeys(backendConfigs) {
|
||||||
config := backendConfigs[id]
|
config := backendConfigs[id]
|
||||||
|
|||||||
Reference in New Issue
Block a user