Commit 65643f2
committed
Migration 0094 emits to two new pg_notify channels (cdc_oversized,
cdc_error) when the primary cdc payload would have been silently
dropped. Without consumers, those notifications go to /dev/null and AC
Wire the consumer side end-to-end:
- shared/database/src/cdc-listener.ts: define CdcOversizedEvent and
CdcErrorEvent shapes matching the SQL payloads; add onCdcOversizedEvent
and onCdcErrorEvent registrations; LISTEN on both new channels
alongside the existing cdc subscription in startCdcListener; clear
the new callback arrays in stopCdcListener.
- apps/backend/services/cdc/dispatcher.ts: wire the dispatcher's fallback
sinks to Sentry.captureMessage with stable fingerprints
('cdc-oversized-payload' / 'cdc-trigger-exception'). Module-level latch
keeps the registration idempotent across stray startCdcDispatcher
calls; shutdown drops the latch.
- apps/enrichment-worker/worker.ts: mirror the Sentry wiring in the
worker process so its independent LISTEN connection also surfaces the
fallback channels (consumer='enrichment-worker' tag for disambiguation).
Tests:
- BS#1120 describe block in cdc-listener.test.ts pins channel
subscription, callback dispatch, multi-callback fan-out, callback-error
isolation, malformed-payload tolerance, and stopCdcListener teardown
of the new callback arrays.
- BS#1120 describe block in cdc-websocket.test.ts (alongside the
existing dispatcher tests) pins the dispatcher's Sentry wiring,
captureMessage tag/extra/fingerprint shape, double-start idempotency,
and shutdown-resets-latch behavior.
- Updated the BS#1014 enableLivenessProbe channel-order assertion to
cover the new cdc_oversized + cdc_error subscriptions.
1 parent 9d9d6a4 commit 65643f2
5 files changed
Lines changed: 595 additions & 7 deletions
File tree
- apps
- backend/services/cdc
- enrichment-worker
- tests/unit
- apps/backend/services/cdc
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
12 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
13 | 43 | | |
14 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
15 | 82 | | |
16 | 83 | | |
17 | 84 | | |
18 | | - | |
19 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
20 | 89 | | |
21 | 90 | | |
| 91 | + | |
22 | 92 | | |
23 | 93 | | |
24 | 94 | | |
25 | 95 | | |
26 | 96 | | |
27 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
28 | 102 | | |
29 | 103 | | |
30 | 104 | | |
| 105 | + | |
31 | 106 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
214 | 216 | | |
215 | 217 | | |
216 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
217 | 264 | | |
218 | 265 | | |
219 | 266 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
13 | 22 | | |
14 | 23 | | |
15 | 24 | | |
| |||
22 | 31 | | |
23 | 32 | | |
24 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
25 | 71 | | |
26 | 72 | | |
| 73 | + | |
| 74 | + | |
27 | 75 | | |
28 | 76 | | |
29 | 77 | | |
| 78 | + | |
| 79 | + | |
30 | 80 | | |
31 | 81 | | |
32 | 82 | | |
33 | 83 | | |
| 84 | + | |
| 85 | + | |
34 | 86 | | |
35 | 87 | | |
36 | 88 | | |
| |||
45 | 97 | | |
46 | 98 | | |
47 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
48 | 134 | | |
49 | 135 | | |
50 | 136 | | |
| |||
118 | 204 | | |
119 | 205 | | |
120 | 206 | | |
121 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
122 | 243 | | |
123 | 244 | | |
124 | 245 | | |
| |||
227 | 348 | | |
228 | 349 | | |
229 | 350 | | |
| 351 | + | |
| 352 | + | |
230 | 353 | | |
231 | 354 | | |
232 | 355 | | |
0 commit comments