mirror of
https://github.com/okieselbach/AutopilotMonitor.git
synced 2026-10-25 13:10:13 +00:00
d3a10dfb96
Double signup on two instances enqueued two auto-approve envelopes; both workers could pass the approved-check (stale 30s negative cache) and both ran the activation side effects - duplicate welcome mail plus duplicate TenantAutoApproved ops event/Telegram ping. Same duplicate on queue redelivery after a failed message delete. The whitelist add is now a conditional INSERT (AddEntity, 409 = already approved) so storage arbitrates concurrent activations: exactly one caller sees "newly added" and runs mail/promote/ops event; losers drop quietly. The GA approve endpoint stays idempotent (200 + alreadyApproved instead of a duplicate mail on re-approve). Also fixes a silent-failure path: the repo swallowed storage errors and returned false, which ApproveAsync ignored - a failed whitelist write still sent the welcome mail and reported success. Storage errors now throw (queue path retries, HTTP path 500s). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>