Compose runtime glossary files with native configuration

This commit is contained in:
2026-11-26 18:17:16 +00:00
parent b1cde637a2
commit a4b8fd0976
26 changed files with 292 additions and 92 deletions

View File

@@ -37,7 +37,7 @@ func TestRoleClientUsesSelectedNativeCredential(t *testing.T) {
if err := os.WriteFile(filepath.Join(dir, "prompts.yml"), []byte(document), 0644); err != nil {
t.Fatal(err)
}
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{})
if err != nil {
t.Fatal(err)
}
@@ -50,7 +50,7 @@ func TestRoleClientUsesSelectedNativeCredential(t *testing.T) {
}
return nil, providerErr
})}
runtime, err := NewRuntime(context.Background(), loaded, httpClient)
runtime, err := NewRuntime(context.Background(), loaded.Result, httpClient)
if err != nil {
t.Fatal(err)
}
@@ -75,7 +75,7 @@ func TestRoleClientExecutionBudgetsAndFailureClasses(t *testing.T) {
t.Fatal(err)
}
}
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{})
if err != nil {
t.Fatal(err)
}
@@ -104,7 +104,7 @@ func TestRoleClientExecutionBudgetsAndFailureClasses(t *testing.T) {
if err := os.WriteFile(filepath.Join(promptDir, "grammar.yml"), prompt, 0600); err != nil {
t.Fatal(err)
}
selected, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
selected, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{})
if err != nil {
t.Fatal(err)
}
@@ -116,7 +116,7 @@ func TestRoleClientExecutionBudgetsAndFailureClasses(t *testing.T) {
body := fmt.Sprintf(`{"model":"test-model","choices":[{"message":{"content":%s}}]}`, payload)
return &http.Response{StatusCode: 200, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body)), Request: r}, nil
})}
runtime, err := NewRuntime(context.Background(), selected, httpClient)
runtime, err := NewRuntime(context.Background(), selected.Result, httpClient)
if err != nil {
t.Fatal(err)
}
@@ -145,7 +145,7 @@ func TestRoleClientExecutionBudgetsAndFailureClasses(t *testing.T) {
}
ctx, cancel := context.WithCancel(context.Background())
cancel()
runtime, err := NewRuntime(context.Background(), loaded, nil)
runtime, err := NewRuntime(context.Background(), loaded.Result, nil)
if err != nil {
t.Fatal(err)
}
@@ -169,7 +169,7 @@ func TestRoleClientsShareBackendCapacity(t *testing.T) {
t.Fatal(err)
}
}
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{})
if err != nil {
t.Fatal(err)
}
@@ -180,7 +180,7 @@ func TestRoleClientsShareBackendCapacity(t *testing.T) {
body := `{"model":"one","choices":[{"message":{"content":"{\"corrections\":[]}"}}]}`
return &http.Response{StatusCode: 200, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body)), Request: r}, nil
})
runtime, err := NewRuntime(context.Background(), loaded, &http.Client{Transport: transport})
runtime, err := NewRuntime(context.Background(), loaded.Result, &http.Client{Transport: transport})
if err != nil {
t.Fatal(err)
}
@@ -218,7 +218,7 @@ func TestRoleClientRetriesFollowRequestBudget(t *testing.T) {
t.Fatal(err)
}
}
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{})
if err != nil {
t.Fatal(err)
}
@@ -231,7 +231,7 @@ func TestRoleClientRetriesFollowRequestBudget(t *testing.T) {
}
return &http.Response{StatusCode: status, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body)), Request: r}, nil
})
runtime, err := NewRuntime(context.Background(), loaded, &http.Client{Transport: transport})
runtime, err := NewRuntime(context.Background(), loaded.Result, &http.Client{Transport: transport})
if err != nil {
t.Fatal(err)
}
@@ -259,7 +259,7 @@ func TestNativeCredentialSelectionAndOptionalAbsence(t *testing.T) {
t.Fatal(err)
}
}
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{})
if err != nil {
t.Fatal(err)
}
@@ -269,7 +269,7 @@ func TestNativeCredentialSelectionAndOptionalAbsence(t *testing.T) {
body := `{"model":"fixture","choices":[{"message":{"content":"{\"corrections\":[]}"}}]}`
return &http.Response{StatusCode: 200, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body)), Request: r}, nil
})
runtime, err := NewRuntime(context.Background(), loaded, &http.Client{Transport: transport})
runtime, err := NewRuntime(context.Background(), loaded.Result, &http.Client{Transport: transport})
if err != nil {
t.Fatal(err)
}