Verify prepared notification ownership and cleanup

This commit is contained in:
2026-11-14 17:43:40 +00:00
parent 2b9badb3a5
commit a8698d45a8
5 changed files with 203 additions and 1 deletions

View File

@@ -46,10 +46,12 @@ func TestPublicRetryRepairSequenceKeepsUsageAndEventsConsistent(t *testing.T) {
}
var events []promptkit.ExecutionEvent
req := simpleGenerationRequest()
notifications := 0
req.OnPrepared = func(context.Context, promptkit.PreparedRun) { notifications++ }
req.Validation = &promptkit.OutputContract{Format: promptkit.FormatJSON, ValidationMode: promptkit.ValidationJSON, RepairAttempts: 1}
req.Observer = func(event promptkit.ExecutionEvent) { events = append(events, event) }
result, err := engine.Run(context.Background(), req)
if err != nil || result == nil || !result.Validation.IsValid || calls != 4 {
if err != nil || result == nil || !result.Validation.IsValid || calls != 4 || notifications != 1 {
t.Fatalf("result=%+v error=%v calls=%d", result, err, calls)
}
if len(events) != 8 {