@bobfrankston/mailx-imap 0.1.82 → 0.1.84
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/index.js +25 -0
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -1272,6 +1272,15 @@ export class ImapManager extends EventEmitter {
|
|
|
1272
1272
|
const __qrT0 = Date.now();
|
|
1273
1273
|
const qr = await client.resyncFolder(folder.path, prevUidValidity, prevModSeq);
|
|
1274
1274
|
console.log(` [qresync] ${accountId}/${folder.path}: vanished=${qr.vanishedUids.length} changed=${qr.changedMessages.length} newModSeq=${qr.newHighestModSeq} in ${Date.now() - __qrT0}ms`);
|
|
1275
|
+
// No real folder vanishes this many UIDs in one QRESYNC cycle.
|
|
1276
|
+
// iflow-direct can mis-expand a VANISHED *range* (e.g. the
|
|
1277
|
+
// server reports "VANISHED 1:4828883" when our modseq watermark
|
|
1278
|
+
// is stale) into millions of individual UIDs. Applying that
|
|
1279
|
+
// literally = 4.8M synchronous DB calls that wedge the whole
|
|
1280
|
+
// event loop (frozen window) AND delete every local row caught
|
|
1281
|
+
// in the range (INBOX wiped → the viewer's open message
|
|
1282
|
+
// vanishes / shows a stale unrelated eml). Bob 2026-06-04.
|
|
1283
|
+
const VANISHED_ABSURD_CAP = 50000;
|
|
1275
1284
|
if (qr.uidValidityChanged) {
|
|
1276
1285
|
// UIDVALIDITY rolled — our local UIDs are stale. Fall through
|
|
1277
1286
|
// to the full set-diff path; that'll discover the new state
|
|
@@ -1279,6 +1288,22 @@ export class ImapManager extends EventEmitter {
|
|
|
1279
1288
|
// from wiping anything we shouldn't.
|
|
1280
1289
|
console.log(` [qresync] ${accountId}/${folder.path}: UIDVALIDITY changed (was ${prevUidValidity}, now ${qr.exists}); falling back to full sync`);
|
|
1281
1290
|
}
|
|
1291
|
+
else if (qr.vanishedUids.length > VANISHED_ABSURD_CAP) {
|
|
1292
|
+
// Refuse the absurd VANISHED set; do NOT iterate/apply it.
|
|
1293
|
+
const localCount = this.db.getMessageCount(accountId, folderId);
|
|
1294
|
+
console.error(` [qresync] ${accountId}/${folder.path}: REFUSING VANISHED of ${qr.vanishedUids.length} UIDs (folder has ${localCount} locally) — mis-parsed range; self-healing (advance watermark) + falling back to set-diff.`);
|
|
1295
|
+
// SELF-HEAL: advance the modseq watermark to the server's
|
|
1296
|
+
// CURRENT value. Without this the next QRESYNC re-requests the
|
|
1297
|
+
// same giant `(EARLIER) 1:N` range every cycle forever (Bob saw
|
|
1298
|
+
// it recur 21:03 → 21:20) — refusing without advancing isn't
|
|
1299
|
+
// self-healing. The set-diff reconcile below discovers + applies
|
|
1300
|
+
// the ACTUAL deletions via Message-ID identity (bounded, 50%
|
|
1301
|
+
// guard), so skipping the literal VANISHED loses nothing; it
|
|
1302
|
+
// just breaks the stale-modseq loop so future QRESYNCs are clean.
|
|
1303
|
+
if (qr.newHighestModSeq !== undefined) {
|
|
1304
|
+
this.db.updateFolderSync(folderId, prevUidValidity, String(qr.newHighestModSeq));
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1282
1307
|
else {
|
|
1283
1308
|
// Apply VANISHED — server says these UIDs are gone. No
|
|
1284
1309
|
// tombstone, no diff, just delete the local rows.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/mailx-imap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.84",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@bobfrankston/mailx-types": "^0.1.18",
|
|
13
13
|
"@bobfrankston/mailx-settings": "^0.1.26",
|
|
14
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
15
|
-
"@bobfrankston/iflow-direct": "^0.1.
|
|
14
|
+
"@bobfrankston/mailx-store": "^0.1.45",
|
|
15
|
+
"@bobfrankston/iflow-direct": "^0.1.52",
|
|
16
16
|
"@bobfrankston/tcp-transport": "^0.1.6",
|
|
17
17
|
"@bobfrankston/smtp-direct": "^0.1.8",
|
|
18
18
|
"@bobfrankston/mailx-sync": "^0.1.19",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@bobfrankston/mailx-types": "^0.1.18",
|
|
41
41
|
"@bobfrankston/mailx-settings": "^0.1.26",
|
|
42
|
-
"@bobfrankston/mailx-store": "^0.1.
|
|
43
|
-
"@bobfrankston/iflow-direct": "^0.1.
|
|
42
|
+
"@bobfrankston/mailx-store": "^0.1.45",
|
|
43
|
+
"@bobfrankston/iflow-direct": "^0.1.52",
|
|
44
44
|
"@bobfrankston/tcp-transport": "^0.1.6",
|
|
45
45
|
"@bobfrankston/smtp-direct": "^0.1.8",
|
|
46
46
|
"@bobfrankston/mailx-sync": "^0.1.19",
|