Remove public prompt version metadata
This commit is contained in:
@@ -46,41 +46,28 @@ func TestGenerateResponseUsagePresenceJSON(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPromptVersionJSONDistinguishesAbsenceAndDeclaredEmpty(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
value *string
|
||||
wantPresent bool
|
||||
wantValue string
|
||||
}{
|
||||
{name: "absent"},
|
||||
{name: "declared empty", value: stringPointerForTest(""), wantPresent: true},
|
||||
{name: "declared text", value: stringPointerForTest("release/v1"), wantPresent: true, wantValue: "release/v1"},
|
||||
func TestRemovedPromptVersionIsAbsentFromJSON(t *testing.T) {
|
||||
values := map[string]any{
|
||||
"prepared": promptkit.PreparedRun{PromptID: "prompt"},
|
||||
"result": promptkit.RunResult{PromptID: "prompt"},
|
||||
"observation": promptkit.ExecutionEvent{PromptID: "prompt"},
|
||||
"diagnostic target": promptkit.SmokeTestTarget{PromptID: "prompt"},
|
||||
"inspection": promptkit.PromptInspection{PromptID: "prompt"},
|
||||
"requirements": promptkit.RequirementInspection{PromptID: "prompt"},
|
||||
"identity": promptkit.PromptIdentity{ID: "prompt"},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
check := func(label string, marshal func() ([]byte, error)) {
|
||||
t.Helper()
|
||||
payload, err := marshal()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
object := decodeJSONObject(t, payload)
|
||||
value, present := object["prompt_version"]
|
||||
if present != test.wantPresent {
|
||||
t.Errorf("%s prompt_version present=%t, want %t: %s", label, present, test.wantPresent, payload)
|
||||
}
|
||||
var decoded string
|
||||
if test.wantPresent && (json.Unmarshal(value, &decoded) != nil || decoded != test.wantValue) {
|
||||
t.Errorf("%s prompt_version=%#v, want %q", label, value, test.wantValue)
|
||||
for name, value := range values {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
payload, err := json.Marshal(value)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
object := decodeJSONObject(t, payload)
|
||||
for _, key := range []string{"prompt_version", "PromptVersion", "Version"} {
|
||||
if _, ok := object[key]; ok {
|
||||
t.Fatalf("removed field %q serialized: %s", key, payload)
|
||||
}
|
||||
}
|
||||
check("prepared", func() ([]byte, error) {
|
||||
return json.Marshal(promptkit.PreparedRun{PromptVersion: test.value})
|
||||
})
|
||||
check("result", func() ([]byte, error) {
|
||||
return json.Marshal(promptkit.RunResult{PromptVersion: test.value})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -95,7 +82,6 @@ func TestPreparedRunJSONContractRoundTripsAllFields(t *testing.T) {
|
||||
object := decodeJSONObject(t, payload)
|
||||
assertJSONFields(t, object,
|
||||
"prompt_id",
|
||||
"prompt_version",
|
||||
"prompt_hash",
|
||||
"selected_profile_id",
|
||||
"selected_backend_id",
|
||||
@@ -169,7 +155,6 @@ func TestRunResultJSONContractRoundTripsAllFields(t *testing.T) {
|
||||
"raw_output",
|
||||
"validation",
|
||||
"prompt_id",
|
||||
"prompt_version",
|
||||
"prompt_hash",
|
||||
"session_id",
|
||||
"rendered_prompt_hash",
|
||||
@@ -259,7 +244,6 @@ func fullyPopulatedPreparedRun() promptkit.PreparedRun {
|
||||
start := time.Date(2026, time.August, 11, 12, 13, 14, 150_000_000, time.UTC)
|
||||
return promptkit.PreparedRun{
|
||||
PromptID: "prompt.prepared",
|
||||
PromptVersion: stringPointerForTest("2.1.0"),
|
||||
PromptHash: "prompt-hash",
|
||||
SelectedProfileID: "profile-prepared",
|
||||
SelectedBackendID: "backend-prepared",
|
||||
@@ -326,7 +310,6 @@ func fullyPopulatedRunResult() promptkit.RunResult {
|
||||
IsValid: false,
|
||||
},
|
||||
PromptID: "prompt.result",
|
||||
PromptVersion: stringPointerForTest("3.2.1"),
|
||||
PromptHash: "result-prompt-hash",
|
||||
SessionID: "session-result",
|
||||
RenderedPromptHash: "result-rendered-hash",
|
||||
|
||||
Reference in New Issue
Block a user