Conversation
|
Test & Lint Summary
|
noa-lucent
left a comment
There was a problem hiding this comment.
Redis subscription failures currently crash the new notifications-gateway process, and we lost all automated coverage for the new gateway stack. Please fix the Redis error handling and add tests for the extracted service before we merge.
| this.emit('ready'); | ||
| }); | ||
| await this.redis.connect(); | ||
| await this.redis.subscribe(this.options.channel, (err) => { |
There was a problem hiding this comment.
[major] already returns a promise that rejects when the command fails. Adding a callback and throwing from inside it means a subscription failure (bad credentials, dropped connection, etc.) will bubble up as an unhandled exception on the Redis event loop and crash the process. We should either remove the callback entirely and rely on the promise rejection, or wrap the callback in a try/catch that rejects /emits an error instead of throwing synchronously. Right now a transient subscribe error will bring down the whole gateway with no recovery path.
There was a problem hiding this comment.
✅ Addressed in 338cb1a: now awaits the promise returned by , wraps it in try/catch, logs via , and emits an event before rethrowing. A failed SUBSCRIBE no longer throws from inside the ioredis callback or crashes the process without context.
There was a problem hiding this comment.
✅ Addressed in the latest revision: NotificationsSubscriber.start() now awaits the promise returned by redis.subscribe, wraps it in try/catch, logs via serializeError, and emits an error event before rethrowing. A failed SUBSCRIBE no longer throws from inside the ioredis callback or crashes the process without context.
| this.emit('ready'); | ||
| }); | ||
| await this.redis.connect(); | ||
| await this.redis.subscribe(this.options.channel, (err) => { |
There was a problem hiding this comment.
[major] If the SUBSCRIBE command fails (bad config, Redis ACLs, transient network error, etc.) this code throws inside the ioredis callback, which propagates as an uncaught exception on the subscriber connection and crashes the whole gateway. Instead of throwing from the callback, rely on the promise returned by redis.subscribe (no callback) or reject start() explicitly and let callers decide how to handle the failure. We need to fail the start sequence cleanly, not bring the process down from inside an event handler.
There was a problem hiding this comment.
Thanks for the fix—NotificationsSubscriber now handles subscription failures by logging + emitting and then propagating the error, so start() fails fast and the process stays in control.
| import type { Logger } from './logger'; | ||
| import type { Server as SocketIOServer } from 'socket.io'; | ||
|
|
||
| async function main(): Promise<void> { |
There was a problem hiding this comment.
[major] This PR moves all real-time delivery logic into a brand-new service, but the gateway package ships with zero automated tests while the former GraphSocketGateway integration/unit suites were deleted. We now have no coverage proving that the subscribe handler validates payloads, that Redis envelopes are parsed correctly, or that dispatch failures surface. Please add unit tests (for config parsing, NotificationsSubscriber, dispatchToRooms, subscribe ack handling, etc.) so we keep the same level of safety we had before the extraction.
There was a problem hiding this comment.
New coverage looks good: dispatchToRooms and NotificationsSubscriber each have focused Vitest suites (see src/dispatch.test.ts and src/redis/notifications-subscriber.test.ts), plus the package now ships with its own Vitest config and script. That replaces the deleted GraphSocketGateway tests and gives us automated validation for the extracted service.
a6f6fac to
0b782c5
Compare
|
Addressed by guarding Redis subscribe failures (logging + error emission) and by adding Vitest coverage for the gateway subscriber/dispatch flows. Let me know if you’d like any additional cases. |
|
Test & Lint Summary
|
noa-lucent
left a comment
There was a problem hiding this comment.
Redis subscription failures are now surfaced without crashing, and the new gateway ships with targeted Vitest coverage for dispatch + subscriber logic. Looks good to me.
| this.emit('ready'); | ||
| }); | ||
| await this.redis.connect(); | ||
| await this.redis.subscribe(this.options.channel, (err) => { |
There was a problem hiding this comment.
✅ Addressed in 338cb1a: now awaits the promise returned by , wraps it in try/catch, logs via , and emits an event before rethrowing. A failed SUBSCRIBE no longer throws from inside the ioredis callback or crashes the process without context.
| this.emit('ready'); | ||
| }); | ||
| await this.redis.connect(); | ||
| await this.redis.subscribe(this.options.channel, (err) => { |
There was a problem hiding this comment.
✅ Addressed in the latest revision: NotificationsSubscriber.start() now awaits the promise returned by redis.subscribe, wraps it in try/catch, logs via serializeError, and emits an error event before rethrowing. A failed SUBSCRIBE no longer throws from inside the ioredis callback or crashes the process without context.
| this.emit('ready'); | ||
| }); | ||
| await this.redis.connect(); | ||
| await this.redis.subscribe(this.options.channel, (err) => { |
There was a problem hiding this comment.
Thanks for the fix—NotificationsSubscriber now handles subscription failures by logging + emitting and then propagating the error, so start() fails fast and the process stays in control.
| import type { Logger } from './logger'; | ||
| import type { Server as SocketIOServer } from 'socket.io'; | ||
|
|
||
| async function main(): Promise<void> { |
There was a problem hiding this comment.
New coverage looks good: dispatchToRooms and NotificationsSubscriber each have focused Vitest suites (see src/dispatch.test.ts and src/redis/notifications-subscriber.test.ts), plus the package now ships with its own Vitest config and script. That replaces the deleted GraphSocketGateway tests and gives us automated validation for the extracted service.
Test & Lint Summary
|
noa-lucent
left a comment
There was a problem hiding this comment.
Rebased changes just move the shared graph/reference types into the @agyn/shared package and wire the new gateway validation helpers—nothing concerning. The tests still cover the Redis subscriber + dispatch flows, so this remains good to merge.
Test & Lint Summary
|
1 similar comment
Test & Lint Summary
|
Test & Lint Summary
|
Local verification
Tests: 747 passed / 0 failed / 11 skipped (209 files: 187 passed / 0 failed / 22 skipped) |
|
Tests & lint summary:\n- pnpm --filter @agyn/platform-server lint\n- pnpm --filter @agyn/platform-server test\n- pnpm --filter @agyn/notifications-gateway test\n\nAll commands completed successfully (platform-server: 189 files, 753 tests passed; notifications-gateway: 3 files, 9 tests passed). |
noa-lucent
left a comment
There was a problem hiding this comment.
NotificationsPublisher wiring, Redis broker integration, Envoy routing, and the docker-compose.e2e stack all look solid. The new tests around the publisher metrics coalescing, EventsBus bridge, and notifications-gateway dispatch/subscriber paths cover the regressions I was worried about. Approving.
a70cc5a to
c081f92
Compare
|
Rebase + test summary after syncing with main:\n- pnpm --filter @agyn/platform-server lint\n- pnpm --filter @agyn/platform-server test\n- pnpm --filter @agyn/notifications-gateway test\n\nResults: lint clean; platform-server suite 211 files / 770 specs (759 passed, 11 skipped); notifications-gateway suite 3 files / 9 specs all passed. |
|
Test & Lint Summary
Notes
|
|
Test & Lint Summary
Envoy dev-local compose service validated by starting redis/envoy locally (compose syntax verified via lint/tests). |
|
Test & Lint Summary
Dev-local validation
|
|
Test & Lint Summary
Dev-local validation
|
16d516d to
4cbfa33
Compare
|
Test & Lint Summary
|
4cbfa33 to
8915fd4
Compare
|
Test & Lint Summary
|
Summary
Testing
#1294