Commit 25c5c9c
committed
fix: address CodeRabbit review comments for webhook migration
- Fix silent proto deserialization corruption: use two separate
kafka.ProtoConsumer instances (one per topic) with the correct
typed msgFactory, preventing PaymentFailedEvent bytes from being
decoded as PaymentCapturedEvent
- Fix missing tenant context: change route to POST /webhooks/stripe/{tenantID}
and extract tenant via r.PathValue("tenantID") instead of relying on
middleware that was never wired; inject into ctx via tenant.WithTenant
- Fix nil OutboxPublisher not validated: panic in NewWebhookHandler
when OutboxPublisher is nil, consistent with ClientFactory guard
- Fix gRPC listener resource leak: add listenerClosed flag with deferred
close so listener is not abandoned on startup failures after bind
- Fix serverErrors channel buffer too small: increase from 2 to 3
to accommodate gRPC + HTTP + payment event consumer goroutines
- Use static sentinel errors (ErrUnexpectedCapturedMessageType,
ErrUnexpectedFailedMessageType) for type assertion failures in
consumers to satisfy err113 linter
- Update webhook_handler_test.go to use r.SetPathValue("tenantID")
instead of tenant.WithTenant context injection, matching new handler
behaviour; remove unused tenant import
- Update payment-order/cmd/main.go to use new Start(capturedTopic,
failedTopic string) signature for PaymentEventConsumer1 parent 3c7a5c2 commit 25c5c9c
5 files changed
Lines changed: 154 additions & 80 deletions
File tree
- services
- financial-gateway
- adapters/http
- cmd
- payment-order
- adapters/messaging
- cmd
Lines changed: 16 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
| |||
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
98 | 105 | | |
99 | 106 | | |
100 | | - | |
| 107 | + | |
101 | 108 | | |
102 | 109 | | |
103 | 110 | | |
| |||
124 | 131 | | |
125 | 132 | | |
126 | 133 | | |
127 | | - | |
128 | | - | |
129 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
130 | 139 | | |
131 | 140 | | |
132 | 141 | | |
| 142 | + | |
| 143 | + | |
133 | 144 | | |
134 | 145 | | |
135 | 146 | | |
| |||
Lines changed: 16 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
132 | 131 | | |
133 | 132 | | |
134 | 133 | | |
135 | | - | |
| 134 | + | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
149 | | - | |
150 | | - | |
| 148 | + | |
| 149 | + | |
151 | 150 | | |
152 | 151 | | |
153 | 152 | | |
| |||
161 | 160 | | |
162 | 161 | | |
163 | 162 | | |
164 | | - | |
165 | | - | |
166 | | - | |
| 163 | + | |
| 164 | + | |
167 | 165 | | |
168 | 166 | | |
169 | 167 | | |
| |||
180 | 178 | | |
181 | 179 | | |
182 | 180 | | |
183 | | - | |
184 | | - | |
185 | | - | |
| 181 | + | |
| 182 | + | |
186 | 183 | | |
187 | 184 | | |
188 | 185 | | |
| |||
208 | 205 | | |
209 | 206 | | |
210 | 207 | | |
211 | | - | |
212 | | - | |
213 | | - | |
| 208 | + | |
| 209 | + | |
214 | 210 | | |
215 | 211 | | |
216 | 212 | | |
| |||
247 | 243 | | |
248 | 244 | | |
249 | 245 | | |
250 | | - | |
251 | | - | |
252 | | - | |
| 246 | + | |
| 247 | + | |
253 | 248 | | |
254 | 249 | | |
255 | 250 | | |
| |||
281 | 276 | | |
282 | 277 | | |
283 | 278 | | |
284 | | - | |
285 | | - | |
286 | | - | |
| 279 | + | |
| 280 | + | |
287 | 281 | | |
288 | 282 | | |
289 | 283 | | |
| |||
313 | 307 | | |
314 | 308 | | |
315 | 309 | | |
316 | | - | |
317 | | - | |
318 | | - | |
| 310 | + | |
| 311 | + | |
319 | 312 | | |
320 | 313 | | |
321 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
147 | 154 | | |
148 | 155 | | |
149 | 156 | | |
| |||
220 | 227 | | |
221 | 228 | | |
222 | 229 | | |
223 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
224 | 234 | | |
225 | 235 | | |
226 | 236 | | |
| |||
232 | 242 | | |
233 | 243 | | |
234 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
235 | 248 | | |
236 | 249 | | |
237 | 250 | | |
| |||
Lines changed: 104 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
| |||
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
33 | 44 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
37 | 49 | | |
38 | 50 | | |
39 | 51 | | |
| |||
45 | 57 | | |
46 | 58 | | |
47 | 59 | | |
48 | | - | |
49 | | - | |
| 60 | + | |
| 61 | + | |
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
| |||
63 | 75 | | |
64 | 76 | | |
65 | 77 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
78 | 95 | | |
79 | 96 | | |
80 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
81 | 112 | | |
82 | | - | |
| 113 | + | |
| 114 | + | |
83 | 115 | | |
84 | 116 | | |
85 | | - | |
| 117 | + | |
| 118 | + | |
86 | 119 | | |
87 | 120 | | |
88 | 121 | | |
89 | 122 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
93 | 127 | | |
94 | 128 | | |
95 | | - | |
96 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
97 | 160 | | |
98 | 161 | | |
99 | | - | |
| 162 | + | |
100 | 163 | | |
101 | | - | |
102 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
103 | 169 | | |
104 | 170 | | |
105 | 171 | | |
106 | | - | |
| 172 | + | |
107 | 173 | | |
108 | | - | |
109 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
110 | 177 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
125 | 183 | | |
| 184 | + | |
126 | 185 | | |
127 | 186 | | |
128 | 187 | | |
| |||
0 commit comments