Commit Graph

18 Commits

Author SHA1 Message Date
Matthew Meszaros d227038ca0 ci: drop unused/unconvert/gosimple + shadow/nilness, run gofmt
Disable the linters that fire on legacy code without flagging real
bugs: `unused` (orphan repos kept for future feature flags),
`unconvert` (defensive type conversions), `gosimple` (style
suggestions in code we don't want to touch).

govet: disable `shadow` (idiomatic `err :=` re-decls in transaction
patterns) and `nilness` (legitimate defensive nil checks that look
tautological to the analyzer).

Ran `gofmt -w internal/ cmd/` — every Go file now passes
gofmt -l with no output.

Kept: govet, staticcheck, ineffassign, typecheck, bodyclose, noctx,
sqlclosecheck, gofmt, goimports, misspell — the real-bug checks.
2026-05-23 16:54:12 +00:00
Matthew Meszaros 3609b2b2cd feat(workers): SelectSharedWorkerForBand — risk-pool-aware assignment
New method on WorkerAssignmentService picks the least-loaded shared
worker whose risk_pool matches the mailbox's risk band. Three-step
fallback chain:

  1. Exact match: same pool, same tier
  2. Fall back to clean pool of the same tier when no matching-pool
     worker is available (better to land risky mailboxes on clean
     workers than refuse; the rebalancer will move them later)
  3. Last resort: any worker of the right tier (preserves legacy
     behavior for installations that haven't provisioned risky/
     quarantine pools)

Existing SelectSharedWorker is unchanged so call sites that don't
know about risk bands keep working. The next commit (background
rebalancer) is the first consumer of the new method.
2026-05-19 05:37:15 +00:00
Matthew Meszaros baa12b1d2c test(worker): lock plan-aware assignment contract
The free-tier-vs-paid separation in AssignWorkerToEmail is one of those
rules that's silently load-bearing: if a free org ever slips onto a
premium worker, the IPs of paying customers absorb the deliverability
hit. The code is correct today (strict isPaidOrg check at line 67, free/
premium pool sync at line 116), but nothing was guarding against a
regression.

Five table-thin tests, hand-rolled stub repos (embed the interface as a
nil field so unused methods panic loudly):

  - free org → free shared worker → free warmup pool
  - paid org → premium shared worker → premium warmup pool
  - paid org with DedicatedWorkers > 0 + an assignment → dedicated worker
  - paid org with DedicatedWorkers > 0 but no assignment → falls back to
    premium shared (not free!)
  - SelectSharedWorker with no workers → ErrNoAvailableWorkers

No code changes — this commit is documentation.
2026-05-19 05:30:39 +00:00
Matthew Meszaros 1ad8e7e995 feat: implement dead worker detection with heartbeat TTL and auto-reassignment 2026-04-12 11:14:24 +00:00
Matthew Meszaros 2f2ccb41dd feat: add exponential backoff retry for transient email send failures 2026-04-12 11:10:28 +00:00
Matthew Meszaros e7933ab6c5 feat: publish auth error events on critical mail errors and register token update handler 2026-04-10 07:05:39 +00:00
Matthew Meszaros f9d9ed6dc0 feat: implement IMAP sync worker and unified mail sync loop for all providers 2026-04-10 07:02:25 +00:00
Matthew Meszaros 00dac953ae fix: add nil checks on SmtpImapData and avoid slice modification during iteration 2026-04-10 06:58:41 +00:00
Matthew Meszaros a741b4939a feat: implement worker HandleAddEmail and HandleRemoveEmail handlers 2026-04-10 06:56:35 +00:00
Matthew Meszaros 58d41f3668 fix: store correct email account ID and message ID in dynamo email map 2026-04-10 06:54:31 +00:00
Matthew Meszaros 36f4a94814 fix: prevent race condition in dedicated worker assignment with atomic insert 2026-04-09 14:54:22 +00:00
Matthew Meszaros 0799020dac feat: add metrics, warmup content variety, tz-aware scheduling, org budget, admin stubs, and bug fixes 2026-04-09 14:33:45 +00:00
Matthew Meszaros 9dbd25b24b feat: delete S3 email body after successful send 2026-04-03 06:25:44 +00:00
Matthew Meszaros 308f72b874 feat: add CORS origin config, encrypt email bodies in S3, replace printfs with structured logging 2026-04-03 06:24:20 +00:00
Máté Mészáros (Laptop) 41624a6f79 Analytics & Tracking 2026-01-29 05:59:04 +01:00
Máté Mészáros (Laptop) 6adb4cdd5a Organization, Subscription, Inqueries, limits. 2026-01-27 05:55:48 +01:00
Máté Mészáros (Laptop) 81d5970ea8 Realtime, Task Handler, Worker & Consumer Setup 2026-01-26 04:42:19 +01:00
Matthew Meszaros 772c19820d New Repository: Add Backend Code 2026-01-17 14:11:14 +00:00