a97764c5f7
MavenHelpGrammar keeps "как отменить напоминание" on SourceSelf, where the answer names the command Maven accepts, instead of leaking to search. PublicCurrentVersionGrammar anchors an explicitly current release on SourceWorld and declines first-person ownership. AmbiguousFragmentGrammar refuses filler plus an unresolved demonstrative rather than letting a statistical head invent context. ImplicitElapsedQueryGrammar reads Russian question word order in "давно я не тренировался" as recall; the declarative order stays a statement. ReminderCancellationReportGrammar keeps "я отменил напоминание" in the non-mutating chat lane. CommandProhibitionGrammar routes a direct negative command to a sentinel fn that can never collide with an enabled tool. ActHasEntityTarget stops a bare verb or a demonstrative-only tail from crossing into Nexus. Praxis attention now accepts "что там с X" for the four service names only. taskstatus separates command mood from result words so a first-person report cannot mutate the board. question.go exports the open-question and locative shapes the recall gate reads. --no-verify: master is the working branch this session by the owner's call. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
44 lines
1.7 KiB
Go
44 lines
1.7 KiB
Go
package router
|
|
|
|
import "testing"
|
|
|
|
func TestMavenHelpGrammarKeepsFeatureHowToLocal(t *testing.T) {
|
|
g := MavenHelpGrammar()
|
|
for _, testCase := range []struct {
|
|
utterance string
|
|
topic HelpTopic
|
|
}{
|
|
{"как отменить напоминание про молоко?", HelpReminderCancel},
|
|
{"как удалить будильник на девять?", HelpReminderCancel},
|
|
{"как отменить задачу настроить бэкапы?", HelpTaskDrop},
|
|
{"how do I remove a task?", HelpTaskDrop},
|
|
{"можно ли отменить напоминание?", HelpReminderCancel},
|
|
{"can I cancel a reminder?", HelpReminderCancel},
|
|
{"could I cancel a task?", HelpTaskDrop},
|
|
} {
|
|
decision, matched, accepted := g.Evaluate(testCase.utterance)
|
|
if !matched || !accepted || decision.Intent != IntentQuery || decision.Source != SourceSelf {
|
|
t.Errorf("%q = %+v, matched=%v accepted=%v; want self query", testCase.utterance, decision, matched, accepted)
|
|
}
|
|
if got := LocalHelpTopic(testCase.utterance); got != testCase.topic {
|
|
t.Errorf("LocalHelpTopic(%q) = %q, want %q", testCase.utterance, got, testCase.topic)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestMavenHelpGrammarDoesNotStealCommandsOrWorldAdvice(t *testing.T) {
|
|
g := MavenHelpGrammar()
|
|
for _, utterance := range []string{
|
|
"отмени напоминание про молоко",
|
|
"убери из задач настроить бэкапы",
|
|
"как убрать царапину с моего стола?",
|
|
"как работает напоминание?",
|
|
"запиши как отменить задачу",
|
|
"can you cancel a reminder",
|
|
} {
|
|
if decision, matched, accepted := g.Evaluate(utterance); matched || accepted {
|
|
t.Errorf("%q was claimed as %+v", utterance, decision)
|
|
}
|
|
}
|
|
}
|