From 342b3903e1c5d74ae33f746628b2e2ee81054e14 Mon Sep 17 00:00:00 2001 From: vikingowl <26+vikingowl@noreply.somegit.dev> Date: Tue, 19 May 2026 20:54:27 +0200 Subject: [PATCH] test(slm): align HappyPath with task-type complexity floor The Debug floor (0.4) added in eb0583f was bumping the SLM-returned 0.25 up, breaking the HappyPath assertion. Bump the SLM value to 0.55 so the test still verifies "SLM value preserved" (its original intent), and add a dedicated TestClassifier_AppliesTaskTypeFloor that exercises the under-reporting case the floor was added to handle. --- internal/slm/classifier_test.go | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/internal/slm/classifier_test.go b/internal/slm/classifier_test.go index 2dfe9be..d434bb5 100644 --- a/internal/slm/classifier_test.go +++ b/internal/slm/classifier_test.go @@ -51,7 +51,9 @@ func (s *mockStream) Err() error { return nil } func (s *mockStream) Close() error { return nil } func TestClassifier_HappyPath(t *testing.T) { - p := &mockProvider{text: `{"task_type":"Debug","complexity":0.25,"requires_tools":false}`} + // SLM complexity 0.55 stays above the Debug floor (0.4), so the SLM + // value is preserved verbatim. + p := &mockProvider{text: `{"task_type":"Debug","complexity":0.55,"requires_tools":false}`} cls := NewClassifier(p, "default", nil) task, err := cls.Classify(context.Background(), "fix the failing test", nil) @@ -61,14 +63,31 @@ func TestClassifier_HappyPath(t *testing.T) { if task.Type != router.TaskDebug { t.Errorf("Type = %s, want Debug", task.Type) } - if task.ComplexityScore != 0.25 { - t.Errorf("ComplexityScore = %v, want 0.25", task.ComplexityScore) + if task.ComplexityScore != 0.55 { + t.Errorf("ComplexityScore = %v, want 0.55 (SLM value preserved above floor)", task.ComplexityScore) } if task.RequiresTools != false { t.Errorf("RequiresTools = true, want false") } } +func TestClassifier_AppliesTaskTypeFloor(t *testing.T) { + // Debug floor is 0.4; SLM under-reports at 0.25. The classifier should + // bump ComplexityScore up to the floor so the SLM arm can't be picked + // for its own kind of misclassification. + p := &mockProvider{text: `{"task_type":"Debug","complexity":0.25,"requires_tools":false}`} + cls := NewClassifier(p, "default", nil) + + task, err := cls.Classify(context.Background(), "fix the failing test", nil) + if err != nil { + t.Fatalf("Classify: %v", err) + } + floor := router.MinComplexityForType(router.TaskDebug) + if task.ComplexityScore != floor { + t.Errorf("ComplexityScore = %v, want floor %v", task.ComplexityScore, floor) + } +} + func TestClassifier_BlendHeuristic(t *testing.T) { // SLM returns one type; other Task fields should come from heuristic. p := &mockProvider{text: `{"task_type":"Boilerplate","complexity":0.1,"requires_tools":false}`}