Skip to content

fix(unified-inbox): don't discard every account's envelopes if one account fails#13204

Open
ktogias wants to merge 4 commits into
nextcloud:mainfrom
ktogias:fix/unified-inbox-one-account-failure
Open

fix(unified-inbox): don't discard every account's envelopes if one account fails#13204
ktogias wants to merge 4 commits into
nextcloud:mainfrom
ktogias:fix/unified-inbox-one-account-failure

Conversation

@ktogias

@ktogias ktogias commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

fetchEnvelopes() and fetchNextEnvelopes() combine every constituent account's envelope fetch into the unified/priority inbox via Promise.all(), which rejects as soon as any single promise rejects. A single account that's temporarily unreachable (throttled provider, network hiccup, provisioned account with an unavailable server, etc.) was therefore enough to make the whole unified mailbox render nothing at all, discarding every other account's already-successful envelopes too.

This matches the failure shape described in #9072 ("Other section of unified inbox doesn't load for new accounts") — one account's IMAP server being unavailable breaking the combined view for every account.

Fix

Catches each individual account's fetch before it reaches Promise.all(), so a failing account contributes an empty list instead of failing the whole batch. Same reasoning applied to the pagination path in fetchNextEnvelopes().

Test plan

  • Added a unit test with two accounts where one throws — confirms the working account's envelopes still render.
  • Verified the new test fails without the fix (reproduces the original bug) and passes with it.
  • npx vitest --run src/tests/unit/store/actions.spec.js — 24/24 passing.
  • npx eslint src/store/mainStore/actions.js — 0 errors (pre-existing unrelated jsdoc warnings only).

Fixes #9072

Summary by CodeRabbit

  • Bug Fixes
    • Unified inboxes now continue displaying available messages when fetching mail from one account fails.
    • Pagination can proceed using successful mailbox results even if another mailbox encounters an error.

…count fails

fetchEnvelopes() and fetchNextEnvelopes() combine every constituent
account's envelope fetch into the unified/priority inbox via
Promise.all(), which rejects as soon as any single promise rejects.
A single account that's temporarily unreachable (throttled provider,
network hiccup, etc.) was therefore enough to make the whole unified
mailbox render nothing at all, discarding every other account's
already-successful envelopes too.

Catches each individual account's fetch before it reaches Promise.all(),
so a failing account contributes an empty list instead of failing the
whole batch. Same reasoning applied to the pagination path in
fetchNextEnvelopes().

Fixes nextcloud#9072

Signed-off-by: Konstantinos Togias <info@ktogias.gr>
@ktogias

ktogias commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

You're right, and I'm sorry. I missed the guideline about the disclosure.

ktogias added 2 commits July 4, 2026 02:31
… one account fails

fix(unified-inbox): don't discard every account's envelopes if one account fails

Fixes nextcloud#9072

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Konstantinos Togias <info@ktogias.gr>
…ilure' into fix/unified-inbox-one-account-failure
@github-actions

Copy link
Copy Markdown

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@ChristophWurst

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Unified mailbox resilience

Layer / File(s) Summary
Unified envelope fetch resilience
src/store/mainStore/actions.js, src/tests/unit/store/actions.spec.js
Per-constituent unified mailbox fetches now log failures and return empty lists, while tests verify successful envelopes remain available when another account fails.
Unified pagination resilience
src/store/mainStore/actions.js
Per-constituent next-page fetches now log failures and return empty lists so pagination can continue with successful results.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: kesselb, christophwurst, gretad

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main fix: preserving unified inbox envelopes when one account fails.
Linked Issues check ✅ Passed The code now keeps successful unified inbox results when one account fetch fails, matching #9072's expected behavior.
Out of Scope Changes check ✅ Passed The changes stay within inbox envelope-fetching error handling and a targeted unit test, with no unrelated scope added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/store/mainStore/actions.js (1)

837-849: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the rejected pagination request path.

The existing pagination test returns [] for the second mailbox, so it does not exercise this new .catch(). Make one constituent reject and assert the successful page is still added.

src/tests/unit/store/actions.spec.js (1)

237-264: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert that the failing account was fetched.

The result assertion also passes if account 14 is skipped. Assert that MessageService.fetchEnvelopes was invoked for both account IDs so the rejection branch is definitely exercised.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e2fbe548-50fe-40b4-bfe3-aefb7159cbb3

📥 Commits

Reviewing files that changed from the base of the PR and between d07997c and 288e2ed.

📒 Files selected for processing (2)
  • src/store/mainStore/actions.js
  • src/tests/unit/store/actions.spec.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

*Other* section of unified inbox doesn't load for new accounts

2 participants