Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.
JavaScript agent-orchestrationagentic-workflowai-agentsai-codingclaude-codecode-reviewcodebuddycodexcoding-agentscursordeveloper-toolshuman-on-the-loopllmmcpmulti-agentsdlcself-hostedsopworkflow-automationworkflow-engine
refactor(repo): use slices.Contains in notificationEventSelected (#349)
fx-kurumic60f8a14c8a5
diff --git a/internal/repo/notification_event_selected_test.go b/internal/repo/notification_event_selected_test.gonew file mode 100644index 00000000..db00419b--- /dev/null+++ b/internal/repo/notification_event_selected_test.go@@ -0,0 +1,29 @@+package repo++import (+ "agentflow/internal/domain"+ "testing"+)++func TestNotificationEventSelected(t *testing.T) {+ cases := []struct {+ name string+ events []string+ event string+ want bool+ }{+ {"hit", []string{"succeeded", "failed"}, "failed", true},+ {"miss", []string{"succeeded"}, "waiting", false},+ {"nil events", nil, "succeeded", false},+ {"empty event not selected", []string{"succeeded"}, "", false},+ {"case sensitive", []string{"Succeeded"}, "succeeded", false},+ }+ for _, tc := range cases {+ t.Run(tc.name, func(t *testing.T) {+ binding := domain.NotificationBinding{Events: tc.events}+ if got := notificationEventSelected(binding, tc.event); got != tc.want {+ t.Fatalf("notificationEventSelected(%v, %q) = %v, want %v", tc.events, tc.event, got, tc.want)+ }+ })+ }+}diff --git a/internal/repo/notifications.go b/internal/repo/notifications.goindex 3b31013e..fe075d9a 100644--- a/internal/repo/notifications.go+++ b/internal/repo/notifications.go@@ -8,6 +8,7 @@ import ("fmt""gorm.io/gorm""gorm.io/gorm/clause"+ "slices""time")@@ -281,12 +282,7 @@ func (r *NotificationsRepo) notificationProjectName(tx *gorm.DB, id string) strireturn id}func notificationEventSelected(binding domain.NotificationBinding, event string) bool {- for _, selected := range binding.Events {- if selected == event {- return true- }- }- return false+ return slices.Contains(binding.Events, event)}func notificationStatus(trigger, scope string) string {switch trigger {