Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions internal/classifier/classify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,28 @@ func TestNoClassification_HealthyTrace(t *testing.T) {
t.Errorf("expected 0 classifications for healthy trace, got %d: %v", len(results), results)
}
}

func TestDetectFalseCompletion_NoVerification(t *testing.T) {
tr := trace.New([]trace.Iteration{
{Number: 1, Phase: trace.PhaseAct, Action: trace.Action{Type: "Edit", Target: "src/a.ts"}},
{Number: 2, Phase: trace.PhaseTerminate, Decision: "stop"},
})
tr.Summary.TerminationReason = "goal_met"

results := Classify(tr)
found := false
for _, r := range results {
if r.Category == CatFalseComplete {
found = true
if r.Confidence != 0.60 {
t.Errorf("confidence = %f, want 0.60", r.Confidence)
}
if r.Evidence != "Loop claimed success but no verification was ever performed." {
t.Errorf("unexpected evidence: %q", r.Evidence)
}
}
}
if !found {
t.Error("expected false completion when success claimed with zero verifications")
}
}
6 changes: 5 additions & 1 deletion internal/classifier/false_complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ func detectFalseCompletion(t *trace.Trace) *Classification {
}

if lastVerify == nil {
return nil
return &Classification{
Category: CatFalseComplete,
Confidence: 0.60,
Evidence: "Loop claimed success but no verification was ever performed.",
}
}

if lastVerify.Status == "fail" {
Expand Down