Cancel a reminder by voice, and honour a refusal (V-719)

reminder_cancel.go is a stateful pre-route resolver ahead of a parked
clarification and the statistical cascade. It accepts only an addressed
command-position imperative plus the reminder or alarm noun, so questions,
reported speech, past-tense reports and prohibitions establish no mutation
authority. Subject terms keep negation and quantity, and a parsed time
passes the same resolved-hour gate as capture.

One match cancels through the typed IPC method. Several are stored as
session candidates in the spoken order, capped at five, and only a whole
affirmative ordinal consumes that list: re-querying on the follow-up would
let a state change move the ordinal underneath him. No match, an unread
time, a spent ordinal and an ambiguous delivery result are all explicit
no-ops.

command_prohibition.go is the first mutation boundary in a turn. A direct
prohibition clears the three confirmation slots under their shared mutex,
so a later bare "да" cannot revive authority he has just revoked. A parked
clarify question is not authority and survives, suspended and repeated.
refusesCommand is the same belt at the executor entry points, checked
against the original utterance so a model rewriting Slots.Text cannot get
around it.

The rung is named in preRouteLadder, so /trace records whether it won or
declined on every surface.

--no-verify: master is the working branch this session by the owner's call.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-15 17:19:25 +04:00
parent 0b057df2a3
commit 85a3397bf4
26 changed files with 1746 additions and 37 deletions
+30
View File
@@ -294,6 +294,36 @@ func TestResolveTaskStatusMovesTheNamedTask(t *testing.T) {
}
}
// The regression crosses the grammar/action seam instead of handing the
// action a repaired Decision. The stored title is a normal imperative title,
// while the spoken marker names only its topic; framing words must not become
// identity and the unrelated live row must remain untouched.
func TestActionActMarkerReferentMovesOnlyTheNamedStoredTask(t *testing.T) {
api := &taskAPI{tasks: []ipc.Task{
{ID: 17, Text: "настроить бэкапы", Status: "open"},
{ID: 18, Text: "обновить сертификаты", Status: "open"},
}}
h := taskHandler(api)
dec, matched, accepted := router.TaskStatusGrammar().Evaluate("отметь задачу про бэкапы как сделанную")
if !matched || !accepted {
t.Fatalf("task-status grammar matched=%v accepted=%v", matched, accepted)
}
reply := h.actionAct(context.Background(), dec)
if api.listArg != "live" {
t.Errorf("listed %q, want live", api.listArg)
}
if len(api.moved) != 1 {
t.Fatalf("moved %+v, want exactly the named stored task", api.moved)
}
if got := api.moved[0]; got.id != 17 || got.status != "done" || got.by != "tap:voice" {
t.Errorf("moved %+v, want task 17 → done by tap:voice", got)
}
if !strings.Contains(reply, "настроить бэкапы") {
t.Errorf("reply = %q, want the transitioned stored title", reply)
}
}
func TestResolveTaskStatusRefusesToGuess(t *testing.T) {
cases := []struct {
name string