• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rom8726 / floxy / 18849131494

27 Oct 2025 04:51PM UTC coverage: 37.768% (-5.3%) from 43.091%
18849131494

push

github

rom8726
Notification Engine plugin implemented.

0 of 160 new or added lines in 7 files covered. (0.0%)

1410 existing lines in 3 files now uncovered.

2592 of 6863 relevant lines covered (37.77%)

32.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/plugins/engine/notifications/plugin.go
1
package notifications
2

3
import (
4
        "context"
5

6
        "github.com/rom8726/floxy"
7
)
8

9
var _ floxy.Plugin = (*NotificationsPlugin)(nil)
10

11
type NotificationType string
12

13
const (
14
        NotificationTypeWorkflowStarted   NotificationType = "workflow_started"
15
        NotificationTypeWorkflowCompleted NotificationType = "workflow_completed"
16
        NotificationTypeWorkflowFailed    NotificationType = "workflow_failed"
17
        NotificationTypeStepStarted       NotificationType = "step_started"
18
        NotificationTypeStepCompleted     NotificationType = "step_completed"
19
        NotificationTypeStepFailed        NotificationType = "step_failed"
20
)
21

22
type Notification struct {
23
        Type       NotificationType
24
        InstanceID int64
25
        WorkflowID string
26
        StepID     *int64
27
        StepName   string
28
        Status     string
29
        Error      string
30
}
31

32
type NotificationChannel interface {
33
        Send(ctx context.Context, notification Notification) error
34
}
35

36
type NotificationsPlugin struct {
37
        floxy.BasePlugin
38

39
        channel NotificationChannel
40
}
41

NEW
42
func New(channel NotificationChannel) *NotificationsPlugin {
×
NEW
43
        return &NotificationsPlugin{
×
NEW
44
                BasePlugin: floxy.NewBasePlugin("notifications", floxy.PriorityNormal),
×
NEW
45
                channel:    channel,
×
NEW
46
        }
×
NEW
47
}
×
48

NEW
49
func (p *NotificationsPlugin) OnWorkflowStart(ctx context.Context, instance *floxy.WorkflowInstance) error {
×
NEW
50
        if p.channel == nil {
×
NEW
51
                return nil
×
NEW
52
        }
×
53

NEW
54
        notification := Notification{
×
NEW
55
                Type:       NotificationTypeWorkflowStarted,
×
NEW
56
                InstanceID: instance.ID,
×
NEW
57
                WorkflowID: instance.WorkflowID,
×
NEW
58
                Status:     string(instance.Status),
×
NEW
59
        }
×
NEW
60

×
NEW
61
        return p.channel.Send(ctx, notification)
×
62
}
63

NEW
64
func (p *NotificationsPlugin) OnWorkflowComplete(ctx context.Context, instance *floxy.WorkflowInstance) error {
×
NEW
65
        if p.channel == nil {
×
NEW
66
                return nil
×
NEW
67
        }
×
68

NEW
69
        notification := Notification{
×
NEW
70
                Type:       NotificationTypeWorkflowCompleted,
×
NEW
71
                InstanceID: instance.ID,
×
NEW
72
                WorkflowID: instance.WorkflowID,
×
NEW
73
                Status:     string(instance.Status),
×
NEW
74
        }
×
NEW
75

×
NEW
76
        return p.channel.Send(ctx, notification)
×
77
}
78

NEW
79
func (p *NotificationsPlugin) OnWorkflowFailed(ctx context.Context, instance *floxy.WorkflowInstance) error {
×
NEW
80
        if p.channel == nil {
×
NEW
81
                return nil
×
NEW
82
        }
×
83

NEW
84
        var errorMsg string
×
NEW
85
        if instance.Error != nil {
×
NEW
86
                errorMsg = *instance.Error
×
NEW
87
        }
×
88

NEW
89
        notification := Notification{
×
NEW
90
                Type:       NotificationTypeWorkflowFailed,
×
NEW
91
                InstanceID: instance.ID,
×
NEW
92
                WorkflowID: instance.WorkflowID,
×
NEW
93
                Status:     string(instance.Status),
×
NEW
94
                Error:      errorMsg,
×
NEW
95
        }
×
NEW
96

×
NEW
97
        return p.channel.Send(ctx, notification)
×
98
}
99

100
func (p *NotificationsPlugin) OnStepStart(
101
        ctx context.Context,
102
        instance *floxy.WorkflowInstance,
103
        step *floxy.WorkflowStep,
NEW
104
) error {
×
NEW
105
        if p.channel == nil {
×
NEW
106
                return nil
×
NEW
107
        }
×
108

NEW
109
        notification := Notification{
×
NEW
110
                Type:       NotificationTypeStepStarted,
×
NEW
111
                InstanceID: step.InstanceID,
×
NEW
112
                WorkflowID: instance.WorkflowID,
×
NEW
113
                StepID:     &step.ID,
×
NEW
114
                StepName:   step.StepName,
×
NEW
115
                Status:     string(step.Status),
×
NEW
116
        }
×
NEW
117

×
NEW
118
        return p.channel.Send(ctx, notification)
×
119
}
120

121
func (p *NotificationsPlugin) OnStepComplete(
122
        ctx context.Context,
123
        instance *floxy.WorkflowInstance,
124
        step *floxy.WorkflowStep,
NEW
125
) error {
×
NEW
126
        if p.channel == nil {
×
NEW
127
                return nil
×
NEW
128
        }
×
129

NEW
130
        notification := Notification{
×
NEW
131
                Type:       NotificationTypeStepCompleted,
×
NEW
132
                InstanceID: step.InstanceID,
×
NEW
133
                WorkflowID: instance.WorkflowID,
×
NEW
134
                StepID:     &step.ID,
×
NEW
135
                StepName:   step.StepName,
×
NEW
136
                Status:     string(step.Status),
×
NEW
137
        }
×
NEW
138

×
NEW
139
        return p.channel.Send(ctx, notification)
×
140
}
141

142
func (p *NotificationsPlugin) OnStepFailed(
143
        ctx context.Context,
144
        instance *floxy.WorkflowInstance,
145
        step *floxy.WorkflowStep,
146
        err error,
NEW
147
) error {
×
NEW
148
        if p.channel == nil {
×
NEW
149
                return nil
×
NEW
150
        }
×
151

NEW
152
        var errorMsg string
×
NEW
153
        if step.Error != nil {
×
NEW
154
                errorMsg = *step.Error
×
NEW
155
        } else if err != nil {
×
NEW
156
                errorMsg = err.Error()
×
NEW
157
        }
×
158

NEW
159
        notification := Notification{
×
NEW
160
                Type:       NotificationTypeStepFailed,
×
NEW
161
                InstanceID: step.InstanceID,
×
NEW
162
                WorkflowID: instance.WorkflowID,
×
NEW
163
                StepID:     &step.ID,
×
NEW
164
                StepName:   step.StepName,
×
NEW
165
                Status:     string(step.Status),
×
NEW
166
                Error:      errorMsg,
×
NEW
167
        }
×
NEW
168

×
NEW
169
        return p.channel.Send(ctx, notification)
×
170
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc