Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (6)
📒 Files selected for processing (4)
📝 WalkthroughWalkthroughMerged abort signal (client + timeout) is introduced and threaded through the Mattermost bootstrap route and server helpers; React Query and RPC queryFns now accept/forward cancellation signals; CSS limits Twitter embed sizing; package versions and changelogs updated. Changes
Sequence DiagramsequenceDiagram
participant Client as HTTP Request
participant Route as Bootstrap Route
participant Signal as AbortSignal.any()
participant QueryCache as ReactQuery Cache
participant Mattermost as Mattermost Helpers
participant MMFetch as mmFetch
Client->>Route: POST /mattermost/bootstrap
Route->>Route: create timeout controller (ac)
Route->>Signal: merge req.signal + ac.signal
Signal-->>Route: combined signal returned
Route->>QueryCache: prepare subscriptions query key/options
Route->>Signal: register abort listener -> QueryCache cancelQueries(key)
Route->>Mattermost: ensureMattermostUser(username, signal)
Mattermost->>MMFetch: mmFetch(..., { signal })
MMFetch-->>Mattermost: response
Route->>Mattermost: ensureUserInTeam(userId, signal)
Mattermost->>MMFetch: mmFetch(..., { signal })
MMFetch-->>Mattermost: response
Route->>Mattermost: ensurePersonalToken(userId, signal)
Mattermost->>MMFetch: mmFetch(..., { signal })
MMFetch-->>Mattermost: response
alt Abort triggered (client cancel or timeout)
Signal->>QueryCache: cancelQueries(key)
Signal->>Mattermost: propagate AbortError to mmFetch
Route-->>Client: 499 if req.signal aborted, else timeout handling
end
Route->>Signal: remove abort listener (finally)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/web/src/app/api/mattermost/bootstrap/route.ts (1)
166-172:⚠️ Potential issue | 🟡 MinorSkip the warning on expected aborts in the left-channel lookup.
getMattermostUserWithProps()now receivessignal, so normal request cancellation can land in this catch. In that case this warning is noise, and Line 172 immediately turns the flow back into the abort path anyway. Re-throw whensignal.abortedand keep the warning for real fetch failures.🔧 Suggested fix
try { const userWithProps = await getMattermostUserWithProps(user.id, signal); leftChannels = getUserLeftChannels(userWithProps); } catch (e) { + if (signal.aborted) { + throw e; + } console.warn("MM bootstrap: failed to load left channels", { username, error: e }); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/src/app/api/mattermost/bootstrap/route.ts` around lines 166 - 172, The catch around getMattermostUserWithProps / getUserLeftChannels is noisy for expected aborts; inside the catch block check signal.aborted and re-throw the error when aborted, otherwise keep the console.warn using the existing context (username, error) so only real fetch failures are logged; update the catch that currently logs "MM bootstrap: failed to load left channels" to re-throw if signal.aborted and only call console.warn when not aborted.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/web/src/app/api/mattermost/bootstrap/route.ts`:
- Around line 25-38: The merged signal created with AbortSignal.any([req.signal,
ac.signal]) needs to distinguish timeout vs caller cancellation and handle
pre-aborted signals: before attaching the listener used in the Promise.race,
check if req.signal.aborted or ac.signal.aborted (or the merged signal.aborted)
and immediately reject with the appropriate AbortError so pre-aborted
cancellation wins; in the catch path use ac.signal.aborted (not signal.aborted)
to detect the 30s timeout so the log message accurately reports a timeout only
when ac.signal caused the abort; ensure the event listener attachment on signal
only occurs if neither req.signal nor ac.signal are already aborted.
---
Outside diff comments:
In `@apps/web/src/app/api/mattermost/bootstrap/route.ts`:
- Around line 166-172: The catch around getMattermostUserWithProps /
getUserLeftChannels is noisy for expected aborts; inside the catch block check
signal.aborted and re-throw the error when aborted, otherwise keep the
console.warn using the existing context (username, error) so only real fetch
failures are logged; update the catch that currently logs "MM bootstrap: failed
to load left channels" to re-throw if signal.aborted and only call console.warn
when not aborted.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 04e6971f-d7c1-43dd-b8b2-4c3166d8fc94
📒 Files selected for processing (1)
apps/web/src/app/api/mattermost/bootstrap/route.ts
Summary by CodeRabbit
Bug Fixes
Performance
Style
Chores