Migrate facade tests to the new configuration contracts

This commit is contained in:
2026-11-21 14:36:07 +00:00
parent cf03bca753
commit bab3422e62
47 changed files with 183 additions and 155 deletions

View File

@@ -62,7 +62,7 @@ func TestPreparedObservationCountsCompletedUsageBeforeRepairFailure(t *testing.T
client := &preparedRecordingClient{responses: []*promptkit.GenerateResponse{{Content: "invalid json", Usage: promptkit.TokenUsage{PromptTokens: 4}}, nil}}
engine := newPreparedContractEngine(t, client, "hello")
var events []promptkit.ExecutionEvent
prepared, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{PromptID: "prepared", Validation: &promptkit.OutputContract{Format: promptkit.FormatJSON, ValidationMode: promptkit.ValidationJSON, RepairAttempts: 1}, Observer: func(event promptkit.ExecutionEvent) { events = append(events, event) }})
prepared, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{PromptID: "prepared", Validation: &promptkit.OutputContractInput{Format: promptkit.FormatJSON, ValidationMode: promptkit.ValidationJSON, RepairAttempts: new(1)}, Observer: func(event promptkit.ExecutionEvent) { events = append(events, event) }})
if err != nil {
t.Fatal(err)
}
@@ -133,7 +133,7 @@ func TestPreparedObservationFinishesAfterCredentialAndCapacityFailures(t *testin
const envName = "PROMPTKIT_PREPARED_OBSERVATION_KEY"
t.Setenv(envName, "available")
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Main: &configkit.Input{
Source: configkit.Mapping("credential preparation", map[string]any{
Destination: configkit.Keys("promptkit"), Source: configkit.Mapping("credential preparation", map[string]any{
"profiles": []any{map[string]any{"id": "profile",
"endpoint": "https://example.invalid/v1", "model": "model", "api_key_required": true,
}},