Make prompt tests resilient to wording changes

This commit is contained in:
2026-11-26 03:04:54 +00:00
parent 97e9d51db0
commit fef0530533
9 changed files with 84 additions and 103 deletions

View File

@@ -17,7 +17,7 @@ func TestNativeReconciliationPromptPairPreparesOffline(t *testing.T) {
if err != nil {
t.Fatal(err)
}
correction := CorrectionRequest(CorrectionPromptID, "test-profile", "session-1", []string{"Use only candidate numbers in the supplied range.", "Preserve distinct entities."})
correction := CorrectionRequest(CorrectionPromptID, "test-profile", "session-1", []string{"guidance-one-sentinel", "guidance-two-sentinel"})
if len(correction.Inputs) != 1 {
t.Fatal("correction regenerated fixed evidence")
}
@@ -37,23 +37,12 @@ func TestNativeReconciliationPromptPairPreparesOffline(t *testing.T) {
}
if i == 0 {
first = prepared
var system string
for _, message := range prepared.Messages {
if message.Role == "system" {
system += message.Content
}
}
for _, rule := range []string{"candidate_number_range", "not candidate numbers", "do not copy candidate names", "Preserve distinct entities"} {
if !strings.Contains(system, rule) {
t.Fatalf("missing enduring system principle %q", rule)
}
}
} else {
if !reflect.DeepEqual(first.OutputContract, prepared.OutputContract) || len(prepared.Messages) != 1 || prepared.Messages[0].Role != "user" {
t.Fatal("correction changed native contract or supplied more than a follow-up assignment")
}
text := prepared.Messages[0].Content
if !strings.Contains(text, "Use only candidate numbers") || !strings.Contains(text, "complete replacement proposal") {
if strings.Count(text, "guidance-one-sentinel") != 1 || strings.Count(text, "guidance-two-sentinel") != 1 {
t.Fatal("correction lost findings or assignment")
}
for _, material := range preparation.Materials() {