Update public preparation and execution fixtures

This commit is contained in:
2026-11-02 12:53:00 +00:00
parent 3e67743fbf
commit f661176b06
6 changed files with 71 additions and 72 deletions

View File

@@ -87,18 +87,13 @@ func TestPreparedExecutionFreezesSourcesAndReturnsIndependentDetails(t *testing.
reader.set("changed artifact", "changed-input-hash")
first := prepared.Details()
if first.PromptVersion == nil || *first.PromptVersion != "1" {
t.Fatalf("prepared label = %v, want 1", *first.PromptVersion)
}
*first.PromptVersion = "mutated details"
first.Messages[0].Content = "changed details"
first.InputHashes["input"] = "changed-details-hash"
first.EffectiveModelParams.ExtraParams["nested"].(map[string]any)["source"] = "changed details"
first.StructuredOutput.JSONSchema.Schema.(map[string]any)["title"] = "changed details"
second := prepared.Details()
if second.PromptVersion == nil || *second.PromptVersion != "1" ||
second.Messages[0].Content != "Input=original artifact Label=original variable" {
if second.Messages[0].Content != "Input=original artifact Label=original variable" {
t.Fatalf("details message changed: %q", second.Messages[0].Content)
}
if second.InputHashes["input"] != "original-input-hash" {
@@ -137,7 +132,6 @@ func TestPreparedExecutionFreezesSourcesAndReturnsIndependentDetails(t *testing.
t.Fatalf("generation did not use frozen details:\nrequest=%+v\ndetails=%+v", generated, second)
}
if result.PromptID != second.PromptID ||
result.PromptVersion == nil || second.PromptVersion == nil || *result.PromptVersion != *second.PromptVersion ||
result.PromptHash != second.PromptHash ||
result.SessionID != second.SessionID ||
result.RenderedPromptHash != second.RenderedPromptHash ||
@@ -147,13 +141,6 @@ func TestPreparedExecutionFreezesSourcesAndReturnsIndependentDetails(t *testing.
!reflect.DeepEqual(result.InputHashes, second.InputHashes) {
t.Fatalf("result provenance does not match details:\nresult=%+v\ndetails=%+v", result, second)
}
if result.PromptVersion == second.PromptVersion {
t.Fatal("run result and prepared details share a mutable version label")
}
*result.PromptVersion = "mutated result"
if *second.PromptVersion != "1" {
t.Fatal("run result label mutation reached prepared details")
}
}
func TestPreparedExecutionLifecycleAndEngineBinding(t *testing.T) {
@@ -776,11 +763,11 @@ func newPreparedContractEngine(
func preparedContractConfig(message string, keyRequired bool) promptkit.Config {
return promptkit.Config{Sources: promptkit.ConfigurationSources{Main: &configkit.Input{
Source: configkit.Mapping("prepared execution", map[string]any{
"profiles": map[string]any{"profile": map[string]any{
"profiles": []any{map[string]any{"id": "profile",
"endpoint": "http://example.test/v1", "model": "model", "api_key_required": keyRequired,
}},
"prompts": map[string]any{"prepared": map[string]any{
"version": "1",
"prompts": []any{map[string]any{
"id": "prepared",
"default_profile": "profile",
"messages": []any{map[string]any{"role": "user", "content": message}},
"output": map[string]any{"format": "text", "validation_mode": "none"},
@@ -792,8 +779,7 @@ func preparedContractConfig(message string, keyRequired bool) promptkit.Config {
func preparedPromptSource(label string) fstest.MapFS {
return fstest.MapFS{
"prompt.yaml": &fstest.MapFile{Data: []byte(`prompts:
prepared:
version: "1"
- id: prepared
default_profile: profile
inputs:
- name: input
@@ -813,7 +799,7 @@ func preparedPromptSource(label string) fstest.MapFS {
func preparedProfileSource(model string) fstest.MapFS {
return fstest.MapFS{
"profile.yaml": &fstest.MapFile{Data: []byte(`profiles:
profile:
- id: profile
endpoint: http://example.test/v1
model: ` + model + `
`)},