Files
weichen b5a782bb38 feat(chat): dialogue triggers for comments/reopen/pending-supplements with mistouch guards
Wire intent→coordinator DocResolver confirm cards→action_executor kinds for comment, reopen, pending-supplements query, and real submit-review execution.
2026-09-25 20:14:10 +00:00

48 lines
1.9 KiB
Go

package intent
import "testing"
func TestDefaultRegistry_CoversAllLegacyIntents(t *testing.T) {
r := DefaultRegistry()
legacyIntents := []IntentType{
IntentQueryProgress, IntentSupplementInfo, IntentAdvanceStage, IntentTriggerTask,
IntentTriggerAdhocTask, IntentCasualChat, IntentDeclineExpectation,
IntentDocGovClaim, IntentDocGovSubmitReview, IntentDocGovReviewApprove,
IntentDocGovReviewReject, IntentDocGovFinalApprove, IntentDocGovFinalReject,
IntentDocGovProposalDecide,
IntentDocGovCommentAdd, IntentDocGovCommentResolve, IntentDocGovReopenRequest, IntentDocGovReopenApprove,
IntentQueryRegulations, IntentQuerySimilarCases, IntentQueryUserRights, IntentQueryRejectReason,
IntentQueryPendingSupplements,
IntentConfirmAction, IntentExecuteStageAdvance, IntentSecurityForbidden,
IntentSwitchWorkflow, IntentTriggerWorkflow, IntentQueryWorkflowStatus,
IntentQueryDocStatus, IntentHelpCapabilities, IntentUnsupportedAction,
IntentRunStatusQuery, IntentRunResume, IntentRunRestart,
IntentImpactAnalyze, IntentRevisePropose,
}
for _, lt := range legacyIntents {
spec, ok := r.GetByLegacyIntent(lt)
if !ok {
t.Errorf("missing registry entry for legacy intent %s", lt)
continue
}
if spec.Key == "" || spec.LegacyIntent != lt {
t.Errorf("invalid spec for %s: key=%s legacy=%s", lt, spec.Key, spec.LegacyIntent)
}
}
if len(r.All()) < len(legacyIntents) {
t.Errorf("expected at least %d specs, got %d", len(legacyIntents), len(r.All()))
}
}
func TestActionRegistry_RegisterDuplicateKey(t *testing.T) {
r := NewActionRegistry()
s1 := ActionSpec{Key: "test.action", Domain: "test", Object: "test", Goal: GoalQuery, LegacyIntent: IntentCasualChat}
s2 := ActionSpec{Key: "test.action", Domain: "test", Object: "test", Goal: GoalMutate, LegacyIntent: IntentSupplementInfo}
if err := r.Register(s1); err != nil {
t.Fatalf("register s1: %v", err)
}
if err := r.Register(s2); err == nil {
t.Fatal("expected duplicate key error")
}
}