feat(soup): notification style#3577
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis pull request adds end-to-end support for notifications in the Soup unified feed system. It introduces a 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 305ccf47-973b-4b80-bbce-eed0c2805d85
⛔ Files ignored due to path filters (1)
rust/cloud-storage/Cargo.lockis excluded by!**/*.lock,!**/Cargo.lock
📒 Files selected for processing (20)
rust/cloud-storage/document_storage_service/src/api/swagger.rsrust/cloud-storage/models_soup/Cargo.tomlrust/cloud-storage/models_soup/src/call_record.rsrust/cloud-storage/models_soup/src/comms.rsrust/cloud-storage/models_soup/src/email_thread.rsrust/cloud-storage/models_soup/src/item.rsrust/cloud-storage/models_soup/src/lib.rsrust/cloud-storage/models_soup/src/notification.rsrust/cloud-storage/soup/src/domain/models.rsrust/cloud-storage/soup/src/domain/ports.rsrust/cloud-storage/soup/src/domain/service.rsrust/cloud-storage/soup/src/domain/service/tests.rsrust/cloud-storage/soup/src/inbound/axum_router/tests.rsrust/cloud-storage/soup/src/inbound/toolset/list_entities.rsrust/cloud-storage/soup/src/inbound/toolset/mod.rsrust/cloud-storage/soup/src/inbound/toolset/test.rsrust/cloud-storage/soup/src/outbound/pg_soup_repo.rsrust/cloud-storage/soup/src/outbound/pg_soup_repo/expanded/tests.rsrust/cloud-storage/soup/src/outbound/pg_soup_repo/notification.rsrust/cloud-storage/soup/src/outbound/pg_soup_repo/notification/tests.rs
| let rows = build_user_notifications_query(UserNotificationsQueryArgs { | ||
| user_id: req.user_id.as_ref(), | ||
| limit: req.limit as i64, | ||
| cursor_id: cursor_id.copied(), | ||
| cursor_timestamp: cursor_timestamp.copied(), | ||
| }) | ||
| .build_query_as::<NotificationRow>() | ||
| .fetch_all(db) | ||
| .await?; | ||
|
|
||
| let mut notifications = Vec::with_capacity(rows.len()); | ||
| for row in rows { | ||
| if let Some(notification) = row_to_notification(row) { | ||
| notifications.push(SoupItem::Notification(Box::new(notification))); | ||
| } | ||
| } |
There was a problem hiding this comment.
Pagination can silently drop valid notifications due to post-LIMIT filtering.
Rows are limited in SQL first, then invalid rows are discarded in row_to_notification. If any row in that window is dropped, the page can return fewer than limit even when additional valid rows exist later, which can prematurely truncate pagination flows.
Suggested fix
fn build_user_notifications_query<'a>(
args: UserNotificationsQueryArgs<'a>,
) -> QueryBuilder<'a, Postgres> {
let mut builder = QueryBuilder::new(
r#"
@@
FROM user_notification un
JOIN notification n ON n.id = un.notification_id
WHERE un.user_id = "#,
);
builder.push_bind(args.user_id);
- builder.push(" AND un.deleted_at IS NULL AND un.done = false");
+ builder.push(" AND un.deleted_at IS NULL AND un.done = false");
+ builder.push(" AND n.event_item_type IN ('document', 'chat', 'project', 'emailThread', 'channel', 'call')");
@@
}Also applies to: 88-99, 102-156
b181382 to
2a3a61e
Compare
No description provided.