Remove unused captured state and orphan helpers

This commit is contained in:
2026-11-05 14:33:04 +00:00
parent a91bc1608b
commit 7db5572b62
14 changed files with 16 additions and 74 deletions

View File

@@ -779,6 +779,11 @@ tests and one-iteration checks of both benchmark paths pass on Go 1.27.3.
discovery and identity/listing behavior remain covered. Optional public helpers, discovery and identity/listing behavior remain covered. Optional public helpers,
capability fallbacks, and embedded/release assets are not deletion candidates. capability fallbacks, and embedded/release assets are not deletion candidates.
Completion: unused backend presence and queue bookkeeping, the reachability
endpoint echo, and the named orphan helpers were removed after caller checks.
Queue, provenance, reachability, identity, discovery, and related public tests
pass on Go 1.27.3. The remaining file-source caller uses its three results.
## Stage 31: Remove Redundant Captured Prompt Fields ## Stage 31: Remove Redundant Captured Prompt Fields
**Catalog:** 31. **Files:** domain prompt values, configuration capture, runner/fixtures. **Catalog:** 31. **Files:** domain prompt values, configuration capture, runner/fixtures.

View File

@@ -25,7 +25,7 @@ func TestEffectiveRegistryOwnsDefinitionsAndCapacityPolicies(t *testing.T) {
registry, err := backend.NewEffectiveRegistry(map[string]domain.Backend{ registry, err := backend.NewEffectiveRegistry(map[string]domain.Backend{
" local.v1 ": { " local.v1 ": {
Endpoint: "https://backend.example/v1", ExtraParams: params, Endpoint: "https://backend.example/v1", ExtraParams: params,
ConcurrencyLimit: 2, QueueCapacity: 3, QueueCapacitySet: true, ConcurrencyLimit: 2, QueueCapacity: 3,
SmokeTests: smokeTests, SmokeTests: smokeTests,
}, },
}) })

View File

@@ -119,7 +119,6 @@ const (
type loaded struct { type loaded struct {
result *configkit.Result[document] result *configkit.Result[document]
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
prompts map[string]*promptEntry prompts map[string]*promptEntry
@@ -212,7 +211,6 @@ func indexedProfiles(config *document) map[string]profileConfig {
var envName = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*$`) var envName = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*$`)
var backendFields = []string{"endpoint", "api_key_env", "concurrency_limit", "queue_capacity", "extra_params", "smoke_tests"}
var profileFields = []string{"backend", "endpoint", "model", "temperature", "top_p", "max_tokens", "timeout_seconds", "service_tier", "reasoning_effort", "api_key_env", "api_key_required", "extra_params"} var profileFields = []string{"backend", "endpoint", "model", "temperature", "top_p", "max_tokens", "timeout_seconds", "service_tier", "reasoning_effort", "api_key_env", "api_key_required", "extra_params"}
// Load captures one immutable effective configuration for internal consumers. // Load captures one immutable effective configuration for internal consumers.
@@ -237,7 +235,6 @@ func configurationDefinition(state *loaded) configkit.Definition[document] {
Sensitive: secretProviderPath, Sensitive: secretProviderPath,
Resolve: func(config *document, resolution *configkit.Resolution) error { Resolve: func(config *document, resolution *configkit.Resolution) error {
for _, resources := range resourceSets(config) { for _, resources := range resourceSets(config) {
captureFields(resources.backends, func(v backendConfig) string { return v.ID }, resources.bases.backends, resources.namespace, backendFields, resolution, state.backends)
captureFields(resources.profiles, func(v profileConfig) string { return v.ID }, resources.bases.profiles, resources.namespace, profileFields, resolution, state.profiles) captureFields(resources.profiles, func(v profileConfig) string { return v.ID }, resources.bases.profiles, resources.namespace, profileFields, resolution, state.profiles)
capturePromptMetadata(resources.prompts, resources.bases.prompts, resources.namespace, resolution, state.promptMetadata) capturePromptMetadata(resources.prompts, resources.bases.prompts, resources.namespace, resolution, state.promptMetadata)
} }
@@ -257,7 +254,6 @@ func configurationDefinition(state *loaded) configkit.Definition[document] {
// load performs one ConfigKit lifecycle over the selected source tiers. // load performs one ConfigKit lifecycle over the selected source tiers.
func load(main configkit.Input, underlays []configkit.Underlay) (*loaded, error) { func load(main configkit.Input, underlays []configkit.Underlay) (*loaded, error) {
state := &loaded{ state := &loaded{
backends: make(map[string]map[string]fieldState),
profiles: make(map[string]map[string]fieldState), profiles: make(map[string]map[string]fieldState),
promptMetadata: make(map[string][]promptInputPresence), promptMetadata: make(map[string][]promptInputPresence),
} }

View File

@@ -496,7 +496,7 @@ func TestLoadComposesLiteralKeysAndEffectivePresence(t *testing.T) {
t.Fatalf("recursive overlay failed: %+v", provider) t.Fatalf("recursive overlay failed: %+v", provider)
} }
backend := loaded.result.Config.Backends[0] backend := loaded.result.Config.Backends[0]
if backend.QueueCapacity == nil || *backend.QueueCapacity != 0 || loaded.backends["local.v1"]["queue_capacity"] != fieldValue { if backend.QueueCapacity == nil || *backend.QueueCapacity != 0 {
t.Fatalf("explicit zero queue capacity was lost: %+v", backend) t.Fatalf("explicit zero queue capacity was lost: %+v", backend)
} }
if _, err := loaded.registry.GetBackend("base/local.v1"); err != nil { if _, err := loaded.registry.GetBackend("base/local.v1"); err != nil {
@@ -582,9 +582,6 @@ func TestLoadInterpretsBackendNormalizationAndNullDefault(t *testing.T) {
composed.APIKeyEnv == nil || *composed.APIKeyEnv != "TOKEN_NAME" || composed.QueueCapacity == nil || *composed.QueueCapacity != 1024 { composed.APIKeyEnv == nil || *composed.APIKeyEnv != "TOKEN_NAME" || composed.QueueCapacity == nil || *composed.QueueCapacity != 1024 {
t.Fatalf("resolved backend was not normalized: %+v", composed) t.Fatalf("resolved backend was not normalized: %+v", composed)
} }
if loaded.backends["local"]["queue_capacity"] != fieldNull {
t.Fatalf("explicit null was not retained: %+v", loaded.backends["local"])
}
field, found := loaded.result.Metadata().Lookup(configkit.Keys("backends").Index(0).Key("endpoint")) field, found := loaded.result.Metadata().Lookup(configkit.Keys("backends").Index(0).Key("endpoint"))
if !found || field.Origin.Operation != configkit.ChangeNormalization { if !found || field.Origin.Operation != configkit.ChangeNormalization {
t.Fatalf("endpoint origin was not preserved: %+v", field) t.Fatalf("endpoint origin was not preserved: %+v", field)
@@ -763,7 +760,7 @@ func TestLoadDefaultsAbsentQueueCapacity(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
backend, err := loaded.GetBackend("local") backend, err := loaded.GetBackend("local")
if err != nil || backend.APIKeyEnv != "" || backend.QueueCapacity != 1024 || loaded.result.Config.Backends[0].QueueCapacity == nil || *loaded.result.Config.Backends[0].QueueCapacity != 1024 || loaded.backends["local"]["queue_capacity"] != fieldAbsent { if err != nil || backend.APIKeyEnv != "" || backend.QueueCapacity != 1024 || loaded.result.Config.Backends[0].QueueCapacity == nil || *loaded.result.Config.Backends[0].QueueCapacity != 1024 {
t.Fatalf("absent queue capacity did not receive its default: %+v", backend) t.Fatalf("absent queue capacity did not receive its default: %+v", backend)
} }
} }

View File

@@ -62,7 +62,6 @@ func captureBackend(id string, config backendConfig) domain.Backend {
} }
if config.QueueCapacity != nil { if config.QueueCapacity != nil {
definition.QueueCapacity = *config.QueueCapacity definition.QueueCapacity = *config.QueueCapacity
definition.QueueCapacitySet = definition.ConcurrencyLimit > 0
} }
return definition return definition
} }

View File

@@ -119,7 +119,7 @@ func TestLoadBuildsEffectiveTargetsAfterInheritance(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
selected, err := state.registry.GetBackend("second") selected, err := state.registry.GetBackend("second")
if err != nil || selected.QueueCapacity != 0 || !selected.QueueCapacitySet { if err != nil || selected.QueueCapacity != 0 || selected.ConcurrencyLimit != 2 {
t.Fatalf("backend capacity was not preserved: %+v, %v", selected, err) t.Fatalf("backend capacity was not preserved: %+v, %v", selected, err)
} }
child, err := state.GetProfile(context.Background(), "child") child, err := state.GetProfile(context.Background(), "child")

View File

@@ -184,7 +184,6 @@ type Backend struct {
SmokeTests *BackendSmokeTestConfig SmokeTests *BackendSmokeTestConfig
ConcurrencyLimit int ConcurrencyLimit int
QueueCapacity int QueueCapacity int
QueueCapacitySet bool
} }
// BackendCapacityPolicy describes normalized run and generation capacity for // BackendCapacityPolicy describes normalized run and generation capacity for

View File

@@ -31,14 +31,6 @@ func qualifyResourceID(id, namespace string) (string, bool) {
return namespace + "/" + id, true return namespace + "/" + id, true
} }
func resourceNamespaceFromID(id string) (string, bool) {
if !validResourceID(id) || !strings.Contains(id, "/") {
return "", false
}
namespace, _, _ := strings.Cut(id, "/")
return namespace, true
}
// IsValidResourceID reports whether id is an unqualified resource ID or one // IsValidResourceID reports whether id is an unqualified resource ID or one
// valid namespace/local-ID pair. // valid namespace/local-ID pair.
func IsValidResourceID(id string) bool { return validResourceID(id) } func IsValidResourceID(id string) bool { return validResourceID(id) }

View File

@@ -86,25 +86,3 @@ func TestQualifyResourceID(t *testing.T) {
}) })
} }
} }
func TestResourceNamespaceFromID(t *testing.T) {
tests := []struct {
name string
id string
namespace string
wantOK bool
}{
{name: "qualified", id: "team/item", namespace: "team", wantOK: true},
{name: "same-prefix namespace stays distinct", id: "team-extra/item", namespace: "team-extra", wantOK: true},
{name: "unqualified", id: "item", wantOK: false},
{name: "malformed", id: "team/sub/item", wantOK: false},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
got, ok := resourceNamespaceFromID(test.id)
if got != test.namespace || ok != test.wantOK {
t.Fatalf("resourceNamespaceFromID(%q) = (%q, %t), want (%q, %t)", test.id, got, ok, test.namespace, test.wantOK)
}
})
}
}

View File

@@ -67,15 +67,6 @@ func FindFSYAMLFiles(ctx context.Context, fsys fs.FS, root string) ([]string, er
return files, err return files, err
} }
// RelativePath computes a clean relative path from root to path.
func RelativePath(root string, filePath string) string {
rel, err := filepath.Rel(root, filePath)
if err != nil {
return filepath.Clean(filePath)
}
return filepath.Clean(rel)
}
// CleanFSRoot normalizes a root path for use with fs.FS while preserving // CleanFSRoot normalizes a root path for use with fs.FS while preserving
// nonblank leading and trailing whitespace. // nonblank leading and trailing whitespace.
func CleanFSRoot(root string) string { func CleanFSRoot(root string) string {

View File

@@ -81,16 +81,6 @@ func TestFindFSYAMLFilesHonorsContextCancellation(t *testing.T) {
} }
} }
func TestRelativePathNested(t *testing.T) {
root := t.TempDir()
path := filepath.Join(root, "nested", "profiles", "local.yaml")
got := RelativePath(root, path)
want := filepath.Join("nested", "profiles", "local.yaml")
if got != want {
t.Fatalf("expected relative path %q, got %q", want, got)
}
}
func TestCleanFSRoot(t *testing.T) { func TestCleanFSRoot(t *testing.T) {
tests := []struct { tests := []struct {
name string name string

View File

@@ -2586,10 +2586,6 @@ func float64Ptr(v float64) *float64 {
return &v return &v
} }
func stringPtr(v string) *string {
return &v
}
func intPtr(v int) *int { func intPtr(v int) *int {
return &v return &v
} }

View File

@@ -21,12 +21,11 @@ type reachabilityProbe struct {
} }
type reachabilityProbeOutcome struct { type reachabilityProbeOutcome struct {
supported bool supported bool
reason domain.SmokeTestReason reason domain.SmokeTestReason
initialEndpoint string reachable *bool
reachable *bool evidence llm.HTTPExecutionEvidence
evidence llm.HTTPExecutionEvidence failure domain.ExecutionFailureKind
failure domain.ExecutionFailureKind
} }
func (p reachabilityProbe) run( func (p reachabilityProbe) run(
@@ -44,7 +43,7 @@ func (p reachabilityProbe) run(
if err != nil { if err != nil {
return reachabilityProbeOutcome{}, fmt.Errorf("prepare reachability endpoint: %w", err) return reachabilityProbeOutcome{}, fmt.Errorf("prepare reachability endpoint: %w", err)
} }
result := reachabilityProbeOutcome{supported: true, initialEndpoint: endpoint} result := reachabilityProbeOutcome{supported: true}
response, evidence, requestErr := p.client.GetWithEvidence(ctx, endpoint, timeoutSeconds) response, evidence, requestErr := p.client.GetWithEvidence(ctx, endpoint, timeoutSeconds)
if response != nil && response.Body != nil { if response != nil && response.Body != nil {
_ = response.Body.Close() _ = response.Body.Close()

View File

@@ -62,7 +62,7 @@ func TestReachabilityProbeRemovesURLCredentials(t *testing.T) {
if observed == nil || observed.URL.User != nil || observed.Header.Get("Authorization") != "" { if observed == nil || observed.URL.User != nil || observed.Header.Get("Authorization") != "" {
t.Fatalf("probe request retained URL credentials: %+v", observed) t.Fatalf("probe request retained URL credentials: %+v", observed)
} }
if result.initialEndpoint != "https://example.invalid/health?check=1" || result.evidence.CredentialsSupplied { if result.evidence.Endpoint != "https://example.invalid/health?check=1" || result.evidence.CredentialsSupplied {
t.Fatalf("credential-free evidence = %+v", result) t.Fatalf("credential-free evidence = %+v", result)
} }
} }