Add appended message request validation
This commit is contained in:
@@ -220,6 +220,14 @@ func TestRunRequestFormattingRedactsDirectAPIKey(t *testing.T) {
|
||||
"transcript": promptkit.InlineWithURI(inputURI, inputBody),
|
||||
},
|
||||
Vars: map[string]string{"audience": variableValue},
|
||||
AppendedMessages: []promptkit.RenderedMessage{{
|
||||
Role: "private-role-sentinel",
|
||||
Content: "private-appended-content-sentinel",
|
||||
CacheControl: &promptkit.CacheControl{
|
||||
Type: "private-cache-sentinel",
|
||||
TTL: "private-ttl-sentinel",
|
||||
},
|
||||
}},
|
||||
}
|
||||
|
||||
for _, formatted := range []string{
|
||||
@@ -229,7 +237,7 @@ func TestRunRequestFormattingRedactsDirectAPIKey(t *testing.T) {
|
||||
fmt.Sprintf("%+v", req),
|
||||
fmt.Sprintf("%#v", req),
|
||||
} {
|
||||
for _, privateValue := range []string{secret, inputURI, inputBody, variableValue} {
|
||||
for _, privateValue := range []string{secret, inputURI, inputBody, variableValue, "private-role-sentinel", "private-appended-content-sentinel", "private-cache-sentinel", "private-ttl-sentinel"} {
|
||||
if strings.Contains(formatted, privateValue) {
|
||||
t.Fatalf("formatted RunRequest leaked private value %q: %s", privateValue, formatted)
|
||||
}
|
||||
@@ -240,6 +248,7 @@ func TestRunRequestFormattingRedactsDirectAPIKey(t *testing.T) {
|
||||
"APIKeySet:true",
|
||||
"Inputs:1",
|
||||
"Vars:1",
|
||||
"AppendedMessages:1",
|
||||
} {
|
||||
if !strings.Contains(formatted, summary) {
|
||||
t.Fatalf("formatted RunRequest omitted structural summary %q: %s", summary, formatted)
|
||||
|
||||
Reference in New Issue
Block a user