Conversation
WalkthroughRefactors event dispatch to a centralized Events-based publish/consume model: replaces per-entity queue methods with Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant API as API (web/atrium)
participant Q as queue.publish
participant EX as Events Exchange
participant TG as Telegram Consumer
rect rgb(240,248,255)
note over API: create message / beacon
API->>Q: publish(Events.ticketMessageCreated, data)
API->>Q: publish(Events.notificationUserBeaconOnEpicCommentCreated, data)
Q->>EX: route by event key
end
rect rgb(245,255,240)
EX-->>TG: ticketMessageCreated / notificationUserBeaconOnEpicCommentCreated + data
TG->>TG: dispatch via EventHandlerMap
TG->>TG: handler(data) → boolean
end
sequenceDiagram
autonumber
participant EX as Events Exchange
participant Q as queue.consume(name, handlers)
participant H1 as handleTicketMessageCreated
participant H2 as handleUserBeaconOnEpicCommentCreated
EX-->>Q: event + data
alt event == ticketMessageCreated
Q->>H1: data
H1-->>Q: true / false
else event == notificationUserBeaconOnEpicCommentCreated
Q->>H2: data
H2-->>Q: true / false
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/essence/src/queue/types.ts (1)
13-14: Key handler map on the discriminant propertyIndexing by
EventMessage['event']widens the key tostring, so each handler is typed to accept the full union of all payloads, which makes it easy to wire the wrong handler/data pair without the compiler catching it. Switching to the literaltypediscriminant and deriving the payload withExtractrestores event-to-payload coupling.-export type EventHandlerMap = Record(EventMessage['event'], EventMessageHandler) +export type EventHandlerMap = { + [K in EventMessage['type']]: EventMessageHandler<Extract<EventMessage, { type: K }>['data']> +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (10)
apps/atrium-telegram/server/api/ticket/id/[ticketId]/message.post.ts(2 hunks)apps/core-telegram/server/services/queue/index.ts(2 hunks)apps/web-app/server/api/beacon/epic/comment.post.ts(2 hunks)apps/web-app/server/api/ticket/id/[ticketId]/message.post.ts(2 hunks)packages/essence/src/index.ts(1 hunks)packages/essence/src/queue/entities/notification.ts(0 hunks)packages/essence/src/queue/entities/telegram.ts(1 hunks)packages/essence/src/queue/entities/ticket.ts(0 hunks)packages/essence/src/queue/types.ts(2 hunks)pnpm-workspace.yaml(1 hunks)
💤 Files with no reviewable changes (2)
- packages/essence/src/queue/entities/ticket.ts
- packages/essence/src/queue/entities/notification.ts
🧰 Additional context used
🧬 Code graph analysis (5)
apps/atrium-telegram/server/api/ticket/id/[ticketId]/message.post.ts (2)
packages/essence/src/queue/types.ts (1)
TicketMessageCreated(15-26)packages/essence/src/index.ts (1)
Events(3-3)
apps/core-telegram/server/services/queue/index.ts (3)
packages/essence/src/queue/types.ts (3)
EventHandlerMap(13-13)TicketMessageCreated(15-26)NotificationUserBeaconOnEpicCommentCreated(28-39)apps/core-telegram/server/services/telegram/wasabi-bot.ts (1)
useWasabiBot(327-333)apps/core-telegram/server/services/telegram/atrium-bot.ts (1)
useAtriumBot(95-101)
apps/web-app/server/api/ticket/id/[ticketId]/message.post.ts (1)
packages/essence/src/queue/types.ts (1)
TicketMessageCreated(15-26)
packages/essence/src/queue/types.ts (1)
packages/essence/src/index.ts (1)
Events(3-3)
apps/web-app/server/api/beacon/epic/comment.post.ts (2)
packages/essence/src/queue/types.ts (1)
NotificationUserBeaconOnEpicCommentCreated(28-39)packages/essence/src/index.ts (1)
Events(3-3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
| const text = `${data.userName} ${data.userSurname}: ${data.userText}` | ||
| await useWasabiBot().api.sendMessage(wasabiUser.telegramId, text) |
There was a problem hiding this comment.
Avoid sending “undefined” in Wasabi notifications
data.userSurname can be undefined, so the current template produces messages like “Alice undefined: …”. This is a regression from the previous defensive formatting and breaks the user experience.
Apply this diff to guard the optional surname:
- const text = `${data.userName} ${data.userSurname}: ${data.userText}`
+ const surname = data.userSurname ? ` ${data.userSurname}` : ''
+ const text = `${data.userName}${surname}: ${data.userText}`📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const text = `${data.userName} ${data.userSurname}: ${data.userText}` | |
| await useWasabiBot().api.sendMessage(wasabiUser.telegramId, text) | |
| const surname = data.userSurname ? ` ${data.userSurname}` : '' | |
| const text = `${data.userName}${surname}: ${data.userText}` | |
| await useWasabiBot().api.sendMessage(wasabiUser.telegramId, text) |
🤖 Prompt for AI Agents
In apps/core-telegram/server/services/queue/index.ts around lines 21-22, the
message template interpolates data.userSurname directly which can be undefined
and yields messages like "Alice undefined: ..."; change the interpolation to
safely include the surname only when present (e.g., use a conditional or nullish
coalescing to fall back to an empty string and trim any extra spaces) so that
the final text becomes "Alice: ..." when surname is missing, then send that
sanitized text to useWasabiBot().api.sendMessage.
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
apps/webinar/public/vk-pixel.min.jsis excluded by!**/*.min.js
📒 Files selected for processing (1)
apps/webinar/app/app.vue(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
| script: [ | ||
| { | ||
| type: 'text/javascript', | ||
| src: '/vk-pixel.min.js', | ||
| }, | ||
| ], |
There was a problem hiding this comment.
🧩 Analysis chain
Verify this change belongs in the PR and assess privacy/consent requirements.
This script injection appears unrelated to the PR's stated objective (queue event dispatch refactoring). Additionally, adding a tracking pixel raises several concerns:
- Scope: This change doesn't align with "queue updated" - consider moving it to a separate PR with proper context.
- Privacy/Compliance: VK pixel tracking may require user consent under GDPR/CCPA. Verify that consent management is properly implemented before this script executes.
- Security: Confirm this tracking script addition has been reviewed and approved by the appropriate stakeholders.
Optional: Consider async loading for better performance.
The script currently blocks page parsing. If the tracking script is non-critical for initial render, consider adding the async attribute:
script: [
{
type: 'text/javascript',
src: '/vk-pixel.min.js',
+ async: true,
},
],🏁 Script executed:
#!/bin/bash
rg -n --color=never "consent" -C3 .
rg -n --color=never "cookie" -C3 .
rg -n --color=never "gdpr" -C3 .
rg -n --color=never "useHead" -C3 apps/webinar/app/app.vueLength of output: 7611
Separate tracking pixel addition and implement consent gating
- Remove or move the VK pixel script from this PR; introduce it in a dedicated change with proper context.
- Gate the tracking script behind explicit user consent (GDPR/CCPA) before injecting.
- Once consent is granted, load the script asynchronously, for example:
script: [
{
type: 'text/javascript',
src: '/vk-pixel.min.js',
+ async: true,
},
],📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| script: [ | |
| { | |
| type: 'text/javascript', | |
| src: '/vk-pixel.min.js', | |
| }, | |
| ], | |
| script: [ | |
| { | |
| type: 'text/javascript', | |
| src: '/vk-pixel.min.js', | |
| async: true, | |
| }, | |
| ], |
🤖 Prompt for AI Agents
In apps/webinar/app/app.vue around lines 24 to 29, the VK tracking pixel script
is being added directly in this PR; remove it from this change and introduce the
pixel in a separate PR with context, and implement consent gating so the script
is only injected after explicit user consent (GDPR/CCPA). Add a consent check
(persisted user choice), and when consent is granted load the pixel
asynchronously by creating and appending a script element at runtime (or using
an async loader) rather than including it in the static script array; ensure the
consent flow and gating logic are covered in the dedicated change.



Summary by CodeRabbit
New Features
Improvements
Refactor
Chores