@remit/imap-worker 0.0.55 → 0.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ import { SQSClient } from "@aws-sdk/client-sqs";
|
|
|
17
17
|
import { getClient, type RemitClient, setClient } from "@remit/backend/client";
|
|
18
18
|
import type {
|
|
19
19
|
IAddressRepository,
|
|
20
|
+
IMailboxSpecialUseRepository,
|
|
20
21
|
IMessageFlagPushRepository,
|
|
21
22
|
IMessageFlagRepository,
|
|
22
23
|
IMessagePlacementMoveRepository,
|
|
@@ -181,6 +182,12 @@ const buildHarness = (): Harness => {
|
|
|
181
182
|
addressService: {
|
|
182
183
|
reconcileJunkOnlyForMessage: async () => {},
|
|
183
184
|
} as unknown as IAddressRepository,
|
|
185
|
+
mailboxSpecialUseService: {
|
|
186
|
+
resolveJunkRolesForConfig: async () => ({
|
|
187
|
+
junkMailboxIds: [],
|
|
188
|
+
trashMailboxIds: [],
|
|
189
|
+
}),
|
|
190
|
+
} as unknown as IMailboxSpecialUseRepository,
|
|
184
191
|
sqsQueueUrl: "https://sqs.eu-west-1.amazonaws.com/000/message-mgmt",
|
|
185
192
|
});
|
|
186
193
|
|
|
@@ -689,7 +689,6 @@ describe("handleMessageDelete", () => {
|
|
|
689
689
|
assert.equal(called("message.delete").length, 0);
|
|
690
690
|
assert.equal(called("threadMessage.deleteMany").length, 0);
|
|
691
691
|
assert.equal(called("threadMessage.update").length, 0);
|
|
692
|
-
assert.equal(called("emitEvent").length, 0);
|
|
693
692
|
|
|
694
693
|
// The row's mailbox and uid stay put, but `status` must leave
|
|
695
694
|
// `moving`: `isPlacementUnsettled` reads exactly that value, so a row
|
|
@@ -702,6 +701,27 @@ describe("handleMessageDelete", () => {
|
|
|
702
701
|
assert.equal(await imapFailures("MESSAGE_DELETE_EXHAUSTED"), 1);
|
|
703
702
|
});
|
|
704
703
|
|
|
704
|
+
// The optimistic `updateForMove` already pointed the row at Trash. The
|
|
705
|
+
// server has now confirmed the message never left the source, so the row
|
|
706
|
+
// and the server disagree about where the mail is, and only a resync of
|
|
707
|
+
// both folders settles that. Without it the user is shown the message in
|
|
708
|
+
// Trash indefinitely while it sits in the source folder.
|
|
709
|
+
it("resyncs both folders when the server confirms the message never left the source", async () => {
|
|
710
|
+
h.connection.moveMessages = async () => ({ uidMap: new Map() });
|
|
711
|
+
h.destinationSearchUids = [100];
|
|
712
|
+
|
|
713
|
+
await handleMessageDelete(moveEvent, noopLog, 3, deps());
|
|
714
|
+
|
|
715
|
+
assert.deepEqual(
|
|
716
|
+
called("emitEvent").map((c) => c.args[0]),
|
|
717
|
+
[
|
|
718
|
+
{ type: "SYNC_MESSAGES", accountId: "acc-1", mailboxId: "src-mbx" },
|
|
719
|
+
{ type: "SYNC_MESSAGES", accountId: "acc-1", mailboxId: "trash-mbx" },
|
|
720
|
+
],
|
|
721
|
+
"a confirmed divergence resyncs on the broken verdict too, not only on the reconciled one",
|
|
722
|
+
);
|
|
723
|
+
});
|
|
724
|
+
|
|
705
725
|
// Issue #980, the failure the budget exists for: every redelivery
|
|
706
726
|
// re-MOVEs a uid the source no longer holds and throws identically. The
|
|
707
727
|
// ceiling lives in the error catch, so a throwing `moveMessages` settles
|
|
@@ -357,9 +357,16 @@ export const handleMessageDelete = async (
|
|
|
357
357
|
|
|
358
358
|
if (outcome === "broken") {
|
|
359
359
|
recordImapFailure("MESSAGE_DELETE_EXHAUSTED", "other");
|
|
360
|
-
return;
|
|
361
360
|
}
|
|
362
361
|
|
|
362
|
+
// Both verdicts end in a row the server has contradicted, so this delete
|
|
363
|
+
// reconciles rather than waits (R2): whichever folder actually holds the
|
|
364
|
+
// message re-projects it with the server's own uid. RECONCILED, the local
|
|
365
|
+
// rows are gone and the resync rebuilds them. BROKEN, the server has just
|
|
366
|
+
// confirmed the message is still at the source while the optimistic
|
|
367
|
+
// `updateForMove` left the row pointing at Trash — without the resync the
|
|
368
|
+
// user sees it in Trash for as long as that row stands, which is the
|
|
369
|
+
// silent misdirection the settle exists to end.
|
|
363
370
|
if (destinationMailboxId) {
|
|
364
371
|
await emitMoveResync(emitEvent, {
|
|
365
372
|
accountId,
|