Skip to content

Release notes 4.0.3

Inboxora docs edited this page Sep 18, 2026 · 1 revision

Release notes 4.0.3

Status: released 2026-09-18 · Previous version: 4.0.2 · Type: patch

What this release fixes

4.0.3 adapts the upstream MailFlow 3.4-3.5 reliability fixes that still applied to Inboxora's dev: physical-copy identity, explicit IMAP IDLE, STATUS-gated folder refresh, plus frontend hardening (Error Boundary, BFCache wake reuse, dangerous-attachment download warning). It also ships the missing antispam v0.2 layer (hybrid rules + per-user Naive Bayes, hardened against connection storms) and a one-time repair pass for databases that ran the old Message-ID relocation. Apply the included migrations before deploying; antispam auto-move is opt-in per account.

Physical-copy identity

  • Physical messages are now identified by (account, uid, folder); an RFC Message-ID match no longer relocates one physical copy onto another. Self-sent Gmail and mailing-list copies that share a Message-ID persist as separate rows and are grouped only at the Conversation Engine layer.

IMAP IDLE

  • Persistent sync connections enter IDLE explicitly after each sync tick instead of relying on ImapFlow's delayed auto-IDLE, which never started at the supported 15-second interval. Health now distinguishes idleAttemptedAt (we called idle()) from idleEnteredAt (the server acknowledged IDLE), and concurrent _enterExplicitIdle calls share one in-flight promise per account instead of issuing duplicate IDLE commands.

Post-relocate repair

  • The old Message-ID relocation is gone, but rows it already collapsed across folders stay missing — including old UIDs far below the recent sync window. Repair is now a backfill-style SEARCH ALL → UID diff → fetch-only-missing pass per selectable folder (metadata-only), per account. Completion is recorded in the new account_maintenance_state table (migration 0096) — never as a pseudo-folder row, which syncFolders() would prune and backfillAllFolders() would try to SELECT on IMAP. The in-process guard covers only runs in flight, so a failed run retries on the next tick instead of waiting for a restart; each folder is re-diffed after repair and the marker is written only when every folder verifies clean, so a parse failure that leaves a UID missing does not mark the account repaired. The first successful sync tick per account triggers it once, fire-and-forget.

Antispam v0.2 (hybrid rules + per-user Naive Bayes)

  • Deterministic 14-rule engine always on (pharma/money keywords, CTA phrases, URL shorteners, reply-to mismatch, executable/double-extension attachments, DKIM/SPF/DMARC fail only from a trusted authserv-id, mailing-list and known-contact ham signals — contacts limited to is_auto = false plus own identity addresses resolved through the same helper the Conversation Engine uses, so inbound spam cannot whitelist itself). Multinomial Naive Bayes joins at distinct-message maturity: >= minRecords usable unique samples with a minimum of each class (default 10), blending 60/40 to softRecords then 20/80; verdict/auto-move use the configured spamThreshold/autoMoveThreshold. One mail confirmed 50x, or 50 spams with zero hams, stays rules-only; legacy featureless rows no longer mature the model (new spam_models.usable_spam/usable_ham, migration 0097). Manual feedback goes through recordManualFeedback: the training INSERT (carrying a stable training_identity, migration 0098) and the incremental model update share one per-user serializer hold and one database transaction, so concurrent clicks cannot double-mint a sample and the row plus the model commit together. Identities are stable for messages without a Message-ID: the normalized content hash outranks the (account, folder, uid) triple, so a Spam→Ham correction stays one sample after the server re-keys folder+UID (migration 0099 re-derives identities for databases that applied the first 0098 revision). One rule holds everywhere — one identity = exactly one effective sample = the user's latest decision: a repeat confirmation is logged without moving the vocabulary or the usable counters, and a label flip rebuilds the model from the log with latest-decision-wins, so the incrementally maintained model equals the post-retrain model.
  • Training is DB-only and atomic: /spam and /ham compute features from the already-loaded row and INSERT one complete training row (no UPDATE...ORDER BY...LIMIT, which PostgreSQL rejects); the already-in-folder path trains too. Incremental updates and full retrains serialize per user (lock slots released after each run); the hourly scheduler staggers by hash(user_id) % 24, refuses overlap (409), and awaits slow users instead of interleaving.
  • Live ingest tagging is fire-and-forget with deferAutoMove on the backfill path (no per-message IMAP storm); auto-move is INBOX-only (Sent/Archive/custom folders are classified but never auto-moved), resolves the full account row, issues exactly one IMAP MOVE per physical copy (double-MOVE fixed, concurrent callers coalesced), re-reads the row immediately before the MOVE so an Inbox-Rule/Block-List relocation, delete or fresh user override skips the move, keeps folder badges in step, and broadcasts folder_updated. User override always wins, including under races; auto-verdicts never train the model.
  • GET /api/spam/explain answers from stored spam_details (recompute only for legacy rows); thresholds live in users.preferences.spam_thresholds and actually drive the pipeline. PATCH /api/spam/thresholds validates minRecords/softRecords, enforces softRecords >= minRecords, and drops the dead hardRecords key; GET /api/spam/status derives maturity from the configured thresholds and the usable per-class split instead of hardcoded 50/500.
  • Defaults are safe: master switch on, per-account antispam_enabled off (opt-in via PUT /api/accounts/:id and the account form, alongside trusted_authserv_id). Migrations 0095–0100 must be applied in order before rollout. POST /api/spam/retrain-now retrains only the caller; fleet-wide rebuilds are admin-only via POST /api/spam/retrain-all. POST /api/accounts/:id/spam/reset-training erases one account's feedback and immediately rebuilds the user's model from the remaining records (rules-only when nothing is left), so a multi-account user does not lose antispam on the untouched accounts until the next scheduled retrain.
  • Frontend: SpamBadge verdict chip + explain dialog (mounted in MessageDetailContent, fed by spam_verdict/spam_score_ml/spam_score_blended projections in the list, thread, message and resolve-message queries — including the threaded final projection; the chip shows the blended score the verdict was decided on, and omits the percentage for rows classified before that column existed), SpamSettings status/master-switch/retrain panel mounted as Settings → Rules → Antispam (with search index entry; maturity reported from distinct usable samples with a per-class breakdown; Retrain now rebuilds only the caller's model), per-account antispam toggle in the account form, locale keys in all 9 locales.
  • Repair hardening: an empty local folder list defers instead of recording completion, and one-time repairs share the per-host background-connection budget so multi-account upgrades do not fire concurrent SEARCH ALL passes. Concurrent auto-move callers share the first outcome instead of reporting a phantom moved=true.

Folder freshness and STATUS

  • After each LIST, cached non-INBOX folders are revalidated with a lightweight STATUS check. A folder whose server UIDNEXT, message count, and unseen count all match the cache is skipped on reopen; folders with an advanced UIDNEXT are queued for a metadata sync. New folders.uid_next column; migration 0094_folder_uidnext_status.sql must be applied before rollout.
  • Fix STATUS gate self-cancellation: uid_next now represents the watermark of the last completed sync, not the last observed STATUS. Detecting a change no longer writes the new value to the DB before the fetch runs (which previously caused _folderNeedsSync to see matching values and skip the sync).

Frontend hardening

  • A React Error Boundary wraps the router at the entrypoint; a render-time exception now shows a translated recovery screen with a reload action instead of a blank page.
  • The WebSocket wake effect handles pageshow for BFCache (event.persisted) by reusing the existing refresh-and-reconnect path.
  • Attachments classified as potentially dangerous (common executable, script and shortcut extensions and matching media types) trigger a confirmation dialog before download; the Download-all ZIP path cannot bypass the prompt. Downloads are never blocked outright.

Verification

  • Backend: tsc --noEmit clean, eslint src --max-warnings 0 clean, migration integrity suite clean (0094–0100). Focused regression suites cover physical-copy identity, explicit IDLE (attempted vs entered, reject path, and two concurrent _enterExplicitIdle calls collapsing to one idle()), STATUS no-self-cancel including an end-to-end gate test (cached uid_next → STATUS advances → the folder is queued and the watermark is untouched → syncMessages ingests the message → only then is uid_next advanced), SEARCH-ALL-diff repair with maintenance-table marker (retry, per-folder verification, empty-list deferral), the single-MOVE auto-move (concurrency + reject + shared outcome), INBOX-only eligibility with pre-move revalidation, spam field projections (including the threaded final SELECT and the blended score), training-identity MOVE stability (content outranks folder+UID, normalization equivalence, copy fallback), distinct-message maturity with stable training_identity (duplicate-feedback, per-class minimum, legacy rows, latest-wins correction), latest-wins incremental semantics (repeat logged without touching the model, label flip rebuilds, single transaction), threshold validation, per-user retrain scope, per-account reset rebuilding the model from the remaining records (fallback to rules-only when empty or the rebuild fails), and the per-user lock release — plus the full spam stack (tokenizer/rules/Bayes/store/pipeline/scheduler plus HTTP route tests for atomic training, per-account enable and explain-from-stored).
  • Frontend: production build passes, spam contract + i18n parity green (1717), plus Error Boundary contract, BFCache wake contract, and dangerous-attachment classifier.

See docs/CHANGELOG.md for the concise release record.

Clone this wiki locally