Repository navigation
Conversation
…accounts CategoryStore.getTrashCategory()/getSpamCategory() return a Label (not a Folder) for Gmail-style accounts, since trash/spam are represented as labels rather than folders there. TaskFactory.tasksForMovingToTrash and tasksForMarkingAsSpam always built a ChangeFolderTask around the result, which throws in the ChangeFolderTask constructor whenever a Label is passed instead of a Folder. tasksForArchiving and tasksForMarkingNotSpam already branch on `instanceof Label` and use ChangeLabelsTask in that case (mirroring the same pattern used in thread-snooze's moveThreads); apply the same fix to trash/spam, removing the inbox label and adding the trash/spam label. Fixes MAILSPRING-CLIENT-AH
|
Important Indent Zero has shut down and no longer reviews pull requests.
Step 4 is only needed for pull requests that were already open when you switched. After that, Indent reviews new pull requests on its own. To stop this notice, turn PR reviews off in Indent Zero. |
|
|
The I confirmed this is pre-existing on No merged fix exists yet to port in. There's an open candidate, #2825 ("Update to electron 44"), but it hasn't had CI run on it at all yet and carries a large, unrelated lockfile-format migration (npm lockfile v2→v3) plus removal of custom dbus badge-count code — not something to speculatively pull into this minimal bugfix PR before it's verified. I'll keep watching for a verified fix to land on Generated by Claude Code |
|
It seems like the node version in the Mailspring/.github/workflows/test.yaml Lines 32 to 34 in b22339b From the |
Fixes MAILSPRING-CLIENT-AH — 17 users impacted, 1084+ occurrences over the last two months, "core:delete-item" (move-to-trash) throwing and doing nothing.
What I observed
The Sentry error is:
thrown from the
ChangeFolderTaskconstructor (change-folder-task.ts:74-78), which assertsthis.folder instanceof Folder. The stack trace shows it originates from thecore:delete-itemkeyboard/toolbar command →TaskFactory.tasksForMovingToTrash→new ChangeFolderTask({ folder: trash, ... }), wheretrashis aLabel, not aFolder.CategoryStore.getTrashCategory()/getSpamCategory()return whatever category object the sync engine created for thetrash/spamrole — aFolderfor IMAP-style accounts, but aLabelfor Gmail-style (label-based) accounts.TaskFactory.tasksForMovingToTrashandtasksForMarkingAsSpamalways wrapped the result in aChangeFolderTask, so any account where trash/spam is aLabelreliably crashed on delete/spam actions.This is exactly the same class of bug that
tasksForArchivingandtasksForMarkingNotSpamalready guard against — both branch oninstanceof Labeland useChangeLabelsTaskinstead — and the same pattern used inthread-snooze'smoveThreads.tasksForMovingToTrash/tasksForMarkingAsSpamwere just missing that check.ChangeLabelsTask's owndescription()even already has dedicated "Trashed"/"Marked as Spam" copy for label adds, so the label-based path was clearly intended, just not wired up here.The fix
In
app/src/flux/tasks/task-factory.ts,tasksForMovingToTrashandtasksForMarkingAsSpamnow check whether the category is aLabel. If so, they build aChangeLabelsTaskthat adds the trash/spam label and removes the inbox label (mirroringtasksForArchiving's inbox-removal andthread-snooze's add/remove pattern), instead of constructing an invalidChangeFolderTask. Non-label accounts keep usingChangeFolderTaskas before.Also corrected the stale doc comments on
CategoryStore.getTrashCategory/getSpamCategory, which claimed to always return aFolder.Testing
app/spec/tasks/task-factory-spec.tscovering both theFolderandLabelcategory cases fortasksForMovingToTrashandtasksForMarkingAsSpam.npm run typecheckandnpm run lintpass on the changed files (pre-existing, unrelated errors from missing optional native/test dependencies in this sandbox were not introduced by this change).npm test) in this headless sandbox — it hung with no output under Xvfb — so please double check CI runs clean.Generated by Claude Code