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

@@ -40,8 +40,11 @@ func loadApplication(ctx context.Context, selection ckconfig.Selection, _ struct
} else {
source = ck.SearchConfig("audita", ck.Searches(ck.WorkingDirectory(), ck.UserConfigDirectory(), ck.UnixSystemDirectories()))
}
loaded, report, err := appconfig.Load(ctx, ck.Input{Source: source}, selection.Overlay.Value, selection.Overrides...)
return loaded, reportBootstrap(ctx, report, err)
loaded, report, err := appconfig.Load(ctx, ck.Input{Source: source}, appconfig.Options{Overlay: selection.Overlay.Value, Overrides: selection.Overrides})
if err != nil {
return nil, reportBootstrap(ctx, report, err)
}
return loaded.Result, reportBootstrap(ctx, report, nil)
}
func loadPromptEngine(ctx context.Context, selection ckconfig.Selection, input struct{}, state *invocationState) (*pk.Engine, error) {

View File

@@ -37,8 +37,11 @@ func TestBootstrapConfigurationOutcomes(t *testing.T) {
loads := 0
load := func(ctx context.Context, selection ckconfig.Selection, _, _ struct{}) (*ck.Result[appconfig.Config], error) {
loads++
result, report, err := appconfig.Load(ctx, ck.Input{Source: ck.File(selection.Config.Value)}, "")
return result, reportBootstrap(ctx, report, err)
result, report, err := appconfig.Load(ctx, ck.Input{Source: ck.File(selection.Config.Value)}, appconfig.Options{})
if err != nil {
return nil, reportBootstrap(ctx, report, err)
}
return result.Result, reportBootstrap(ctx, report, nil)
}
scope := withBootstrapContext(ckconfig.FromConfigKit("app", "Application settings", load))
command := ckconfig.Command(ckconfig.Suite[struct{}, struct{}]{Scopes: []ckconfig.Scope[struct{}, struct{}]{scope}})
@@ -87,7 +90,7 @@ func TestBootstrapPreservesJoinedCancellation(t *testing.T) {
if err := os.WriteFile(main, []byte("version: 3\nconfig:\n secrets_dir: missing\n"), 0600); err != nil {
t.Fatal(err)
}
_, report, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, "")
_, report, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, appconfig.Options{})
joined := errors.Join(err, context.Canceled)
wrapped := reportBootstrap(context.Background(), report, joined)
var native *ck.SecretsError
@@ -110,7 +113,7 @@ func TestPromptBootstrapFailureReportsTerminalDetails(t *testing.T) {
t.Fatal(err)
}
load := func(ctx context.Context, selection ckconfig.Selection, _, _ struct{}) (*pk.Engine, error) {
_, report, err := appconfig.Load(ctx, ck.Input{Source: ck.File(selection.Config.Value)}, "")
_, report, err := appconfig.Load(ctx, ck.Input{Source: ck.File(selection.Config.Value)}, appconfig.Options{})
return nil, reportBootstrap(ctx, report, err)
}
suite := withPromptBootstrapContext(ckprompt.FromEngine(load))

View File

@@ -61,7 +61,7 @@ func TestMaintainedProjectsWithControlledProvider(t *testing.T) {
t.Setenv("AUDITA_EXAMPLE_KEY", "")
main = filepath.Join(dir, "config.yml")
}
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, tc.overlay)
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, appconfig.Options{Overlay: tc.overlay})
if err != nil {
t.Fatal(err)
}
@@ -93,7 +93,7 @@ func TestMaintainedProjectsWithControlledProvider(t *testing.T) {
mu.Unlock()
return &http.Response{StatusCode: 200, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(`{"model":"fixture","choices":[{"message":{"role":"assistant","content":"{\"corrections\":[]}"}}]}`)), Request: r}, nil
})
engine, err := llm.NewRuntime(context.Background(), loaded, &http.Client{Transport: transport})
engine, err := llm.NewRuntime(context.Background(), loaded.Result, &http.Client{Transport: transport})
if err != nil {
t.Fatal(err)
}
@@ -105,7 +105,7 @@ func TestMaintainedProjectsWithControlledProvider(t *testing.T) {
if err != nil {
t.Fatal(err)
}
inputs := &processInputs{Configuration: loaded, Runtime: engine, Source: source}
inputs := &processInputs{Configuration: loaded.Result, Runtime: engine, Source: source}
prepared, err := prepareProcess(context.Background(), processInput{Transcript: filepath.Join(root, tc.dir, "transcript.json")}, inputs, &bytes.Buffer{})
if err != nil {
t.Fatal(err)
@@ -157,11 +157,11 @@ func TestExamplePromptEditIsCapturedOnNextLoad(t *testing.T) {
}
}
inspect := func() string {
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)
}
engine, err := llm.NewRuntime(context.Background(), loaded, nil)
engine, err := llm.NewRuntime(context.Background(), loaded.Result, nil)
if err != nil {
t.Fatal(err)
}

View File

@@ -101,11 +101,11 @@ pipeline:
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)
}
runtime, err := llm.NewRuntime(context.Background(), loaded, &http.Client{Transport: transport})
runtime, err := llm.NewRuntime(context.Background(), loaded.Result, &http.Client{Transport: transport})
if err != nil {
t.Fatal(err)
}
@@ -113,7 +113,7 @@ pipeline:
if err != nil {
t.Fatal(err)
}
inputs := &processInputs{Configuration: loaded, Runtime: runtime, Source: source}
inputs := &processInputs{Configuration: loaded.Result, Runtime: runtime, Source: source}
loaded.Config.Application.Diagnostics.WorkDir = dir
loaded.Config.Application.Reporting.StdoutDir = dir
prepared, err := prepareProcess(context.Background(), processInput{Transcript: filepath.Join(dir, "transcript.json"), Debug: commandkit.Supplied[bool]{Value: true}}, inputs, &bytes.Buffer{})
@@ -213,14 +213,14 @@ func TestRecoverableModelFailureKeepsNormalizedTranscript(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)
}
transport := controlledTransport(func(r *http.Request) (*http.Response, error) {
return &http.Response{StatusCode: http.StatusServiceUnavailable, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(`{"error":{"message":"temporarily unavailable"}}`)), Request: r}, nil
})
runtime, err := llm.NewRuntime(context.Background(), loaded, &http.Client{Transport: transport})
runtime, err := llm.NewRuntime(context.Background(), loaded.Result, &http.Client{Transport: transport})
if err != nil {
t.Fatal(err)
}
@@ -228,7 +228,7 @@ func TestRecoverableModelFailureKeepsNormalizedTranscript(t *testing.T) {
if err != nil {
t.Fatal(err)
}
inputs := &processInputs{Configuration: loaded, Runtime: runtime, Source: source}
inputs := &processInputs{Configuration: loaded.Result, Runtime: runtime, Source: source}
loaded.Config.Application.Reporting.StdoutDir = dir
prepared, err := prepareProcess(context.Background(), processInput{Transcript: filepath.Join(dir, "transcript.json")}, inputs, &bytes.Buffer{})
if err != nil {
@@ -256,7 +256,7 @@ func TestMalformedPermissivePromptKeepsLaterWork(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)
}
@@ -281,7 +281,7 @@ func TestMalformedPermissivePromptKeepsLaterWork(t *testing.T) {
body := fmt.Sprintf(`{"model":%q,"choices":[{"message":{"content":%s}}]}`, request.Model, encoded)
return &http.Response{StatusCode: 200, Header: make(http.Header), Body: io.NopCloser(strings.NewReader(body)), Request: r}, nil
})
runtime, err := llm.NewRuntime(context.Background(), loaded, &http.Client{Transport: transport})
runtime, err := llm.NewRuntime(context.Background(), loaded.Result, &http.Client{Transport: transport})
if err != nil {
t.Fatal(err)
}
@@ -289,7 +289,7 @@ func TestMalformedPermissivePromptKeepsLaterWork(t *testing.T) {
if err != nil {
t.Fatal(err)
}
inputs := &processInputs{Configuration: loaded, Runtime: runtime, Source: source}
inputs := &processInputs{Configuration: loaded.Result, Runtime: runtime, Source: source}
loaded.Config.Application.Reporting.StdoutDir = dir
prepared, err := prepareProcess(context.Background(), processInput{Transcript: filepath.Join(dir, "transcript.json")}, inputs, &bytes.Buffer{})
if err != nil {