@bobfrankston/mailx-imap 0.1.105 → 0.1.106

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.
Files changed (2) hide show
  1. package/index.js +12 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1339,7 +1339,13 @@ export class ImapManager extends EventEmitter {
1339
1339
  */
1340
1340
  async fetchServerOnlyUids(client, accountId, folderId, folder, statusMessageCount, excludeUids) {
1341
1341
  const folderPath = folder.path;
1342
- const existingUids = this.db.getUidsForFolder(accountId, folderId);
1342
+ // Diff against UIDs we actually have a MESSAGE ROW for (messages table),
1343
+ // NOT message_folders memberships. An orphan membership (member row but
1344
+ // no message row) would otherwise look "present" and never get its real
1345
+ // data fetched — leaving the message permanently missing from the list
1346
+ // while the folder count looks full (Bob 2026-06-20: ~1k old INBOX
1347
+ // messages stuck missing behind orphan memberships).
1348
+ const existingUids = this.db.getStoredUids(accountId, folderId);
1343
1349
  // Small folders (Drafts, Sent, …) get a FULL UID fetch so server-side
1344
1350
  // deletions of OLDER messages are reflected; large folders (134k INBOX)
1345
1351
  // get a date-bounded query so we don't enumerate the whole mailbox.
@@ -1631,7 +1637,11 @@ export class ImapManager extends EventEmitter {
1631
1637
  // retries instead of locking out for RECONCILE_THROTTLE_MS
1632
1638
  // (Bob 2026-06-20: boot-time "Not connected" failure locked
1633
1639
  // INBOX recovery out for 15 min).
1634
- const localCount = this.db.getMessageCount(accountId, folderId);
1640
+ // Compare STORED-ROW count (messages table) to the server's
1641
+ // count — not getMessageCount (message_folders), which orphan
1642
+ // memberships can inflate to match the server while real rows
1643
+ // are still missing.
1644
+ const localCount = this.db.getStoredCount(accountId, folderId);
1635
1645
  const hasDeficit = statusMessageCount !== null && localCount < statusMessageCount;
1636
1646
  const lastRecon = this.lastReconcileMs.get(folderId) ?? 0;
1637
1647
  const throttleElapsed = Date.now() - lastRecon > RECONCILE_THROTTLE_MS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-imap",
3
- "version": "0.1.105",
3
+ "version": "0.1.106",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",