Files
Agent-System/internal/intent/registry_test.go
T
weichenandCursor 5e05d966b4 feat(intent): bridge chat into impact analysis and revision proposals
Analysis stays read-only, and a revoked project member cannot confirm an old proposal.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-20 15:35:07 +00:00

46 lines
1.8 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,
IntentQueryRegulations, IntentQuerySimilarCases, IntentQueryUserRights, IntentQueryRejectReason,
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")
}
}