router: update all Route callers for NormalizedInput + add invariant tests (slice 11)
Migrate 54 test call sites to construct NormalizedInput{Text: ...}.
Add invariant tests:
- TestNormalizedInputReachesRouteIntact: ingress NormalizedInput reaches Route
- TestTryFastPathReceivesMatchText: TryFastPath gets the same input
- TestMatchTextDoesNotChangeRouting: same Text + different MatchText → same Decision
- TestDecisionUtteranceEqualsInputText: Decision.Utterance == input.Text
This commit is contained in:
@@ -123,7 +123,7 @@ func reportConfidences(t *testing.T, name string, emb router.Embedder) {
|
||||
byMargin := map[string]*bucket{}
|
||||
var cosines, margins []float64
|
||||
for _, c := range f.Cases {
|
||||
d, err := r.Route(context.Background(), c.Utterance, now)
|
||||
d, err := r.Route(context.Background(), router.NormalizedInput{Text: c.Utterance}, now)
|
||||
if err != nil {
|
||||
t.Fatalf("%s: %v", c.ID, err)
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ func TestResolutionMethodMatrix(t *testing.T) {
|
||||
resolved := 0
|
||||
counts := [5]int{} // fixed, matcher, raw, llm, fallback
|
||||
for _, c := range rf.Cases {
|
||||
d, err := r.Route(ctx, c.Utterance, rfNow)
|
||||
d, err := r.Route(ctx, router.NormalizedInput{Text: c.Utterance}, rfNow)
|
||||
if err != nil || d.Intent != router.IntentAct {
|
||||
continue
|
||||
}
|
||||
@@ -132,7 +132,7 @@ func TestResolutionMethodMatrix(t *testing.T) {
|
||||
resolved := 0
|
||||
counts := [5]int{}
|
||||
for _, c := range ef.Cases {
|
||||
d, err := r2.Route(ctx, c.Utterance, efNow)
|
||||
d, err := r2.Route(ctx, router.NormalizedInput{Text: c.Utterance}, efNow)
|
||||
if err != nil || d.Intent != router.IntentAct {
|
||||
continue
|
||||
}
|
||||
@@ -189,7 +189,7 @@ func TestShadowMatcherComparison(t *testing.T) {
|
||||
|
||||
same, different, routeOnly, matcherOnly, missBoth, total := 0, 0, 0, 0, 0, 0
|
||||
for _, c := range f.Cases {
|
||||
d, err := r.Route(ctx, c.Utterance, now)
|
||||
d, err := r.Route(ctx, router.NormalizedInput{Text: c.Utterance}, now)
|
||||
if err != nil || d.Intent != router.IntentAct {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user