Verify ConfigKit integration and record release handoff

This commit is contained in:
2026-09-26 18:21:38 +00:00
parent 41304e4eea
commit 47c2a711f0
6 changed files with 124 additions and 11 deletions

View File

@@ -1148,6 +1148,64 @@ backends:
}
}
func TestConfiguredBackendPreservesIntegerParameterAndOptionalCredential(t *testing.T) {
lib := newCLITestLibrary(t)
writePromptDefinition(t, lib.promptDir, "custom.yaml", `id: custom
version: "1"
default_profile: local-gpu
messages:
- role: user
content: "hello"
output:
format: text
validation_mode: none
`)
if err := os.WriteFile(filepath.Join(lib.profileDir, "local-gpu.yaml"), []byte("id: local-gpu\nbackend: local-gpu\nmodel: local-model\n"), 0o644); err != nil {
t.Fatal(err)
}
const credentialName = "SCRIPTORIUM_OPTIONAL_BACKEND_KEY"
t.Setenv(credentialName, "")
type observedRequest struct {
number json.Number
authorization string
}
observed := make(chan observedRequest, 1)
provider := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
request := observedRequest{authorization: r.Header.Get("Authorization")}
var body map[string]any
decoder := json.NewDecoder(r.Body)
decoder.UseNumber()
if err := decoder.Decode(&body); err == nil {
request.number, _ = body["synthetic_count"].(json.Number)
}
observed <- request
w.Header().Set("Content-Type", "application/json")
_, _ = w.Write([]byte(`{"choices":[{"message":{"role":"assistant","content":"generated"}}]}`))
}))
defer provider.Close()
configPath := writeAppConfigFile(t, fmt.Sprintf(`prompt_dir: %q
profile_dir: %q
backends:
local-gpu:
endpoint: %q
api_key_env: %s
extra_params:
synthetic_count: 7
`, lib.promptDir, lib.profileDir, provider.URL+"/v1", credentialName))
cfg, err := parseRunArgs([]string{"--config", configPath, "--prompt", "custom"})
if err != nil || len(cfg.backends) != 1 || cfg.backends[0].ExtraParams["synthetic_count"] != int64(7) {
t.Fatalf("ConfigKit integer did not reach runtime settings: cfg=%+v err=%v", cfg, err)
}
code, stdout, stderr := runCLICommand(t, runCommand, []string{"--config", configPath, "--prompt", "custom"})
if code != ExitOK {
t.Fatalf("backend run failed: code=%d out=%q err=%q", code, stdout, stderr)
}
request := <-observed
if !strings.Contains(stdout, "generated") || request.number != "7" || request.authorization != "" {
t.Fatalf("backend request changed: code=%d out=%q err=%q count=%q auth=%q", code, stdout, stderr, request.number, request.authorization)
}
}
func TestRenderCommandMapsReasoningEffortAndSessionID(t *testing.T) {
lib := newCLITestLibrary(t)
writePromptDefinition(t, lib.promptDir, "session.yaml", `id: session