fix(chat): correct push notification click-through URL#831
Conversation
The push notification URL was built as `/chat/{session_key}` (e.g.
`/chat/session:42`), but the SPA router expects `/chats/session/42` —
plural prefix with colons replaced by slashes. This caused a 404 when
tapping "View" on a PWA push notification.
Extract `push_notification_url()` to mirror the frontend `sessionPath()`
logic and add unit tests for standard, nested, and plain session keys.
Closes #773
Entire-Checkpoint: 2a575930b294
Greptile SummaryThis PR fixes a broken push notification click-through URL by replacing the old Confidence Score: 5/5Safe to merge — the fix is correct, well-tested, and the only remaining note is a minor feature-gate alignment. All findings are P2 (style/cleanup); the logic fix itself is correct and unit-tested. No data integrity or runtime issues found. No files require special attention.
|
| Filename | Overview |
|---|---|
| crates/chat/src/channels.rs | Introduces push_notification_url() helper fixing the URL from /chat/session:42 → /chats/session/42; adds three unit tests. Minor: function lacks the same #[cfg(feature = "push-notifications")] guard as its only caller. |
Sequence Diagram
sequenceDiagram
participant Runtime as ChatRuntime
participant Channels as channels.rs
participant PushSvc as PushNotificationService
participant Client as Mobile Client
Runtime->>Channels: send_chat_push_notification(session_key, text)
Channels->>Channels: push_notification_url(session_key)
Note over Channels: "session:42" → "/chats/session/42"
Channels->>PushSvc: send_push_notification(title, summary, url, session_key)
PushSvc-->>Client: Push notification with url="/chats/session/42"
Client->>Client: Tap "View" CTA
Client->>Client: Navigate to /chats/session/42 ✅
Note over Client: was /chat/session:42 → 404 ❌
Reviews (1): Last reviewed commit: "fix(chat): correct push notification cli..." | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
Add #[cfg(any(feature = "push-notifications", test))] to avoid dead-code warnings when the feature is disabled, while keeping unit tests compilable unconditionally. Entire-Checkpoint: 783c8e3f7c41
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
/chat/session:42which doesn't match any SPA route, causing a 404/chats/session/42, matching the frontendsessionPath()inrouter.tspush_notification_url()helper with unit testsCloses #773
Validation
Completed
cargo +nightly-2025-11-30 fmt --all -- --checkpassescargo test -p moltis-chat push_notification_url— 3 tests pass/chat/prefixRemaining
just lintjust testManual QA