GoWeBaKnowledge Center

THE UNIFIED PLATFORM BIBLE — ADDENDUM 07

Triple Verification — Migration Pipeline & Fixes June 2026

Version: 1.0
Date: June 16, 2026
Author: Alain Bessette, CFO/Product Owner, ABI Conglomerate
Domain: GoWeBa.com
Status: Official Strategic Addendum — Binding Specification
Constraints: ZERO data loss · ZERO force-reset · ZERO email disruption


⚠️ CRITICAL NOTICE
This addendum has the SAME authority as Part 1, Part 2, and all preceding Addendums of the Bible.
All fixes described herein are production-deployed and checkpointed.
No breaking schema changes were made.

📋 TABLE OF CONTENTS

  1. Context & Objective
  2. Phase M — Google Pull Verification
  3. Phase C — V10 Classification Verification
  4. Phase E — Email Forward/Reply Fix
  5. Phase A — ARCHIVED Tab & 15-Card Grid
  6. Bounce Address Fix
  7. Domain Registry — Initial Seed
  8. Database State
  9. Final Verdict & Recommendations
  10. Modified Files — Complete Inventory
  11. Checkpoint Timeline

<a id="context"></a>

SECTION 1: CONTEXT & OBJECTIVE

After several iterations on the Google → GoWeBa migration pipeline, this addendum documents the exhaustive triple verification performed on June 16, 2026, before official launch of user migrations.

The verified phases cover the entire lifecycle:

PhaseScopeStatus
MAutomated migration (Google Pull API)✅ Verified
CV10 Classification (12-layer cascade)✅ Verified
EEmail Forward/Reply (attachments + From)✅ Fixed & deployed
AARCHIVED tab + 15-card grid✅ Fixed & deployed
BounceBounce address inbound fix✅ Fixed & deployed
Domain RegistryInitial seed of 333 domains✅ Executed

<a id="phase-m"></a>

SECTION 2: PHASE M — GOOGLE PULL VERIFICATION

2.1 Retrieval Architecture

The module lib/migration/google-pull.ts handles Google data extraction via native APIs (People, Gmail, Calendar, Drive) without dependency on the googleapis package.

2.2 Verified Performance Parameters

ParameterValueJustification
QUERIES_PER_MIN200Below Gmail's 250/min limit
MICRO_BATCH8 concurrent requestsControlled parallelism
DELAY_BETWEEN_BATCHES_MS2,400 ms8 / 2.4s ≈ 3.33 req/sec = 200/min
MACRO_BATCH_SIZE2,250Processing in chunks
FLUSH_SIZE200Flush to DB every 200 emails
MAX_RETRIES4Attempts with exponential backoff
INITIAL_BACKOFF_MS2,000 msInitial backoff (2s → 4s → 8s → 16s)
MAX_CONSECUTIVE_ERRORS20Safety stop

2.3 Robustness Mechanisms

  • Exponential backoff: 2s → 4s → 8s → 16s + random 1s jitter
  • Rate limit detection: isRateLimitError() detects HTTP 429 and Google-specific errors
  • Preventive stop: After 20 consecutive errors, import stops cleanly with explicit error message
  • Progressive flush: Emails are not held in memory — flushed to DB in batches of 200
  • Progress logging: Log emitted every ~500 emails with elapsed time
  • Time estimation: System calculates and displays estimated remaining time

2.4 Verdict

SOLID — Parameters are conservative, retry and stop mechanisms are in place, progressive flush prevents memory issues.

<a id="phase-c"></a>

SECTION 3: PHASE C — V10 CLASSIFICATION VERIFICATION

3.1 12-Layer Cascade

The file lib/weba/classification-cascade.ts implements the complete V10 cascade as documented in the WebaBox Classification Guide V10 (Document 2):

LayerNameConfidenceDescription
1USER SENDER RULES1.00User rules — BLOCK→SPAM, ALLOW→skip
2GMAIL STARRED0.95isStarred=true → URGENT
3EXPLICIT URGENCY0.92Legal/urgency regex (FR/EN/ES)
4DOMAIN REGISTRY0.90lookupDomain() — 333 mapped domains
5FROM-ADDRESS PATTERNS0.88noreply→OFFICE, newsletter→JOURNAL
6GMAIL CATEGORY LABELS0.85CATEGORY_SOCIAL→SOCIAL, etc.
7SUBJECT LINE PATTERNS0.72Trilingual keyword matching
8TEMPORAL ANALYSIS0.70Deadlines→URGENT/IMPORTANT
9CONTACT GRAPH0.68Known CRM contact → IMPORTANT
10LLM INTELLIGENCEvariableGPT-4.1-mini + 6E few-shot
11(part of L10)Few-shot injected into LLM prompt
12FALLBACK0.10NONE

3.2 Batch Classification (V10 Migration)

The endpoint POST /api/weba/migration/start handles mass classification:

  • Batches of 50 threads (configurable up to 100)
  • Automatic self-chaining: Server calls itself via selfChain() to process next batch
  • Self-chain retry: 3 attempts (localhost → external URL → fallback)
  • Combined action: action: 'both' allows classify + archive in a single operation
  • Cumulative counters: _totalProcessed and _totalChanged track global progress

3.3 Feature Flags

All V10 flags are enabled by default (via lib/weba/feature-flags.ts):

FlagFunction
V10_WEBABOX_UI4×4 grid interface
V10_NEW_CATEGORIESTRAVEL, SOCIAL, PROMOTIONS
V10_AUTO_ARCHIVEAuto-archive cron 90 days
V10_CONTACT_CLASSIFIERContact type classification
V10_SECURITY_SCOREREmail security scoring
V10_DOMAIN_REGISTRYDomain registry (layer 4)
V10_REALTIME_PIPELINEReal-time cascade pipeline

3.4 Verdict

SOLID — The 12-layer cascade is complete, self-chaining works, all feature flags are enabled.

<a id="phase-e"></a>

SECTION 4: PHASE E — EMAIL FORWARD/REPLY FIX

4.1 Identified Issues

Two bugs in WebaBox Forward/Reply:

  1. Attachments not transferred: When forwarding, original email attachments were not included.
  2. Incorrect send account: The "From" selector did not default to the thread's email account.

4.2 Fixes Applied

4.2.1 Forward Attachments

Modified files:

  • app/(app)/inbox/compose-modal.tsx — Added initialAttachments prop + loading logic (presigned URL → base64)
  • app/(app)/inbox/webabox-client.tsx — Added attachments to replyComposeState
  • app/(app)/inbox/ongoing/[threadId]/ongoing-client.tsx — Same propagation for thread mode

4.2.2 Default From Account

Modified file: app/(app)/inbox/compose-modal.tsx

Bug: The useEffect that loaded email accounts systematically overwrote the initial selectedAccountId.

Fix: Added if (!initialAccountId && ...) condition to prevent overwriting an already-selected account.

4.3 Verdict

FIXED AND DEPLOYED

<a id="phase-a"></a>

SECTION 5: PHASE A — ARCHIVED TAB & 15-CARD GRID

5.1 UI Changes

BeforeAfter
"Unread" tab at top"Archived" tab at top
16 cards (4×4 with ARCHIVED)15 cards (3×4 + 1×3, without ARCHIVED)
ARCHIVED in the gridARCHIVED accessible via dedicated tab

5.2 Grid Layout

RowCategories
1Urgent · Important · Conversations · Awaiting
2Journal · Office · Reply Later · Set Aside
3Travel · Social · Promotions · Clips
4Snooze · Spam · Trash

5.3 Verdict

FIXED AND DEPLOYED

<a id="bounce-fix"></a>

SECTION 6: BOUNCE ADDRESS FIX

6.1 Identified Issue

Inbound emails displayed sender addresses like:

bounce+982d51.e8c12e-admin=goweba.com@m.relayfi.com

instead of the real sender address, making Reply and Forward unusable.

6.2 Root Cause

File: app/api/webhooks/sendgrid-inbound/route.ts
Function: handleRawMode()

The code correctly extracted the real address from the MIME From: header via parsed.from.address, but then overwrote it with envelope.from — the technical bounce/return-path address.

// ❌ BEFORE — Bug
const envelopeFrom = parsed.from.address; // ← Correct initially
if (envelope.from) envelopeFrom = envelope.from; // ← OVERWRITES with bounce

// ✅ AFTER — Fix
const mimeFrom = parsed.from.address; // ← Real sender (MIME From:)
let envelopeFrom = mimeFrom; // ← Copy for spam checks
if (envelope.from) envelopeFrom = envelope.from; // ← Envelope for SPF/DKIM only
// mimeFrom → stored in DB and used for contacts
// envelopeFrom → used only for checkSpamAndSpoofing()

6.3 Impact

ContextBeforeAfter
fromEmail in DBbounce+xxx@m.relayfi.comrealsender@domain.com
Reply functionReplies to bounceReplies to real person
Forward functionShows bounceShows real sender
Auto-created contactBounce contactReal contact
Anti-spam/SPF✅ Works✅ Works (unchanged)

6.4 Known Limitation

30 existing messages still have bounce addresses as fromEmail. Only new inbound emails are fixed. A retroactive migration script can be run on request.

6.5 Verdict

FIXED AND DEPLOYED

<a id="domain-registry"></a>

SECTION 7: DOMAIN REGISTRY — INITIAL SEED

7.1 Discovery

During the triple verification, it was found that the DomainRegistry table was empty (0 entries). Layer 4 of the V10 cascade (Domain Registry) could not function.

7.2 Corrective Action

Seed executed from lib/weba/domain-registry-seed-data.ts:

  • 334 domains defined in source file
  • 333 domains created in database (1 duplicate resolved by update)
  • 5 categories covered: SOCIAL, TRAVEL, PROMOTIONS, JOURNAL, OFFICE

7.3 Impact on Classification

With 333 domains in the database, layer 4 (confidence 0.90) can now classify most emails from known services without calling the LLM (layer 10), improving speed, accuracy, and cost.

7.4 Verdict

FIXED — Seed executed and verified

<a id="db-state"></a>

SECTION 8: DATABASE STATE

8.1 Snapshot — June 16, 2026

MetricValue
Email threads884
Email messages1,284
Archived threads184
Contacts1,045
Classification logs59
Domain registry entries333
Migration projects9

8.2 Category Distribution

CategoryThreads%
NONE78188.3%
JOURNAL424.8%
IMPORTANT323.6%
OFFICE171.9%
URGENT80.9%
PROMOTIONS40.5%
TRAVEL00%
SOCIAL00%

Note: 781 threads (88.3%) are categorized NONE because V10 classification has not yet been run on existing threads. After batch classification, this distribution should approach the target documented in the V10 Guide.

8.3 Old Migration Cleanup

Both test migrations (alainbessette55@gmail.com and alainbessette.com/iwant@) were fully deleted:

  • 0 residual data found in migration projects
  • 0 orphaned data linked to these accounts

<a id="verdict"></a>

SECTION 9: FINAL VERDICT & RECOMMENDATIONS

9.1 Verification Summary

ComponentVerifiedStatusAction Required
Google Pull (rate limits, retry, batching)SOLIDNone
Import (self-chaining, stall detection)SOLIDNone
V10 Classification (12-layer cascade)SOLIDNone
Auto-Archive (cron, batch 2000, protected categories)SOLIDNone
Feature Flags (7/7 enabled)ACTIVENone
Inbound webhook (bounce address)FIXEDNone
Domain registry (333 entries)SEEDEDNone
Old migrations (cleaned)CLEANNone
CRON_SECRETCONFIGUREDNone
Google OAuth credentialsCONFIGUREDNone

9.2 Post-Deployment Recommendations

  1. Run V10 classification on 781 existing threads categorized NONE via admin /admin/weba/migration
  2. Run auto-archive to archive threads >90 days in eligible categories
  3. Verify first inbound emails after bounce fix to confirm addresses are correct
  4. Consider a retroactive correction script for the 30 messages with bounce addresses
  5. Consider adding a replyTo field to the EmailMessage model (future improvement)

9.3 Conclusion

🟢 THE MIGRATION PIPELINE IS READY. All verifications passed. Critical fixes applied. Domain registry populated. The system is ready to process new migrations with confidence.


<a id="files"></a>

SECTION 10: MODIFIED FILES — COMPLETE INVENTORY

FileModification
app/(app)/inbox/compose-modal.tsxinitialAttachments prop + presigned URL → base64 + account overwrite fix
app/(app)/inbox/webabox-client.tsxreplyComposeState type + forward attachments + ARCHIVED tab + grid
app/(app)/inbox/ongoing/[threadId]/ongoing-client.tsxcomposeState type + forward attachments
app/api/inbox/snapshot/route.tsarchived counter in totals
app/api/webhooks/sendgrid-inbound/route.tsmimeFrom vs envelopeFrom separation

<a id="checkpoints"></a>

SECTION 11: CHECKPOINT TIMELINE

DateCheckpointDescription
June 15, 2026Phase EForward attachments + From default fix
June 15, 2026Phase AArchived tab + 15-card grid
June 16, 2026Bounce FixFix bounce address in fromEmail for inbound emails

End of Addendum 07 — Triple Verification Migration

© 2024–2026 GOWEBA INC. — Make it Simple, Make it Possible, Make it Real.