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") } }