Resolve repair budgets from validation modes
This commit is contained in:
@@ -108,7 +108,7 @@ type promptOutputConfig struct {
|
||||
Schema any `yaml:"schema"`
|
||||
SchemaFile *string `yaml:"schema_file"`
|
||||
SchemaPath *string `yaml:"schema_path"`
|
||||
RepairAttempts int `yaml:"repair_attempts"`
|
||||
RepairAttempts *int `yaml:"repair_attempts"`
|
||||
}
|
||||
|
||||
// fieldState distinguishes omission, an explicit value, and an explicit null.
|
||||
@@ -124,7 +124,6 @@ const (
|
||||
type loaded struct {
|
||||
result *configkit.Result[document]
|
||||
promptMetadata map[string][]promptInputPresence
|
||||
promptRepair map[string]bool
|
||||
prompts map[string]*promptEntry
|
||||
registry *backend.Registry
|
||||
backendRecords map[string]backendConfig
|
||||
@@ -239,7 +238,7 @@ func configurationDefinition(state *loaded) configkit.Definition[document] {
|
||||
Sensitive: secretProviderPath,
|
||||
Resolve: func(config *document, resolution *configkit.Resolution) error {
|
||||
for _, resources := range resourceSets(config) {
|
||||
capturePromptMetadata(resources.prompts, resources.bases.prompts, resources.namespace, resolution, state.promptMetadata, state.promptRepair)
|
||||
capturePromptMetadata(resources.prompts, resources.bases.prompts, resources.namespace, resolution, state.promptMetadata)
|
||||
}
|
||||
for _, resources := range resourceSets(config) {
|
||||
resolveBackends(resources.backends, resources.bases.backends, resolution)
|
||||
@@ -258,7 +257,6 @@ func configurationDefinition(state *loaded) configkit.Definition[document] {
|
||||
func load(main configkit.Input, underlays []configkit.Underlay) (*loaded, error) {
|
||||
state := &loaded{
|
||||
promptMetadata: make(map[string][]promptInputPresence),
|
||||
promptRepair: make(map[string]bool),
|
||||
}
|
||||
result, err := configkit.LoadLayered(main, configkit.LayeredOptions[document]{
|
||||
Underlays: underlays,
|
||||
@@ -328,7 +326,7 @@ type promptInputPresence struct {
|
||||
description fieldState
|
||||
}
|
||||
|
||||
func capturePromptMetadata(prompts []promptConfig, basePath configkit.Path, namespace string, resolution *configkit.Resolution, destination map[string][]promptInputPresence, repair map[string]bool) {
|
||||
func capturePromptMetadata(prompts []promptConfig, basePath configkit.Path, namespace string, resolution *configkit.Resolution, destination map[string][]promptInputPresence) {
|
||||
for promptIndex, prompt := range prompts {
|
||||
inputs := prompt.Inputs
|
||||
states := make([]promptInputPresence, len(inputs))
|
||||
@@ -342,7 +340,6 @@ func capturePromptMetadata(prompts []promptConfig, basePath configkit.Path, name
|
||||
}
|
||||
}
|
||||
destination[indexedResourceID(namespace, prompt.ID)] = states
|
||||
repair[indexedResourceID(namespace, prompt.ID)] = captureFieldState(basePath.Index(promptIndex).Key("output").Key("repair_attempts"), resolution) == fieldValue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user