Files
Maven/internal/router/barecapture_test.go
claude ea0eb167fd a missing slot asks, whatever the confidence (V-557)
The clarify path was gated on dec.Clarify, so a turn the cascade routed
confidently but incompletely skipped it. "напомни позвонить" reached applyAction,
failed on the missing time and parked nothing, and the "в семь вечера" that
followed was routed as a world question and web-searched.

The gate now also fires when missingFor names a required slot. A bare capture
verb gets a stage-0 rule of its own: it was reaching the resident model as chat,
which answered by agreeing to a wording change nobody asked for.
2026-08-06 00:08:43 +04:00

38 lines
1.4 KiB
Go

package router
import "testing"
// TestBareCaptureIsAFactWithNoKey — Vikunja #557. The whole point is the gap:
// she must route it as a fact she cannot write yet, so the clarify path asks.
func TestBareCaptureIsAFactWithNoKey(t *testing.T) {
for _, u := range []string{"запиши", "Запиши.", "запомни, пожалуйста", "отметь!", "note", "запиши-ка"} {
m := bareCapturePattern.FindStringSubmatch(u)
if m == nil {
t.Errorf("%q did not match the shape", u)
continue
}
dec, ok := bareCaptureBuild(m)
if !ok {
t.Errorf("%q should route as a fact with no key", u)
continue
}
if dec.Intent != IntentFact || dec.Slots.HasKey || dec.Slots.Text != "" {
t.Errorf("%q built %+v, want an empty fact", u, dec)
}
}
}
// TestBareCaptureDeclinesAnythingWithAnObject — the object cases belong to the
// capture markers and the cascade, and a lone non-capture word is not this rule.
func TestBareCaptureDeclinesAnythingWithAnObject(t *testing.T) {
for _, u := range []string{"запиши что я пил воду", "добавь задачу купить хлеб", "привет", "вода", "расскажи"} {
m := bareCapturePattern.FindStringSubmatch(u)
if m == nil {
continue // shape already declined it
}
if _, ok := bareCaptureBuild(m); ok {
t.Errorf("%q must not be claimed as a bare capture", u)
}
}
}