You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Welcome credits: atomic $1 grant for the first 50 accounts #32
Grant $1.00 in hosted credits once to each of the first 50 eligible PickForge accounts, without allowing races, retries, or client calls to exceed the budget.
Locked contract
Exactly 100 USD cents per recipient
At most 50 recipients globally
At most one welcome grant per user
Atomic under concurrent account creation/retries
Server-side kill switch, default-on for launch and reversible without a client release
No recurring free allowance
Ledger remains the balance source of truth
No client-controlled amount, reason, or eligibility
Implementation plan
Characterize the existing auth/profile/ledger provisioning path
Add the smallest transactional database contract with explicit privileges/RLS
Wire the existing server-owned provisioning path
Add concurrency, retry/idempotency, cap, kill-switch, and authorization tests
Run Supabase advisors plus platform typecheck/test/build
Document rollout and emergency disable procedure
Validation
100 concurrent eligible attempts produce exactly 50 grants
repeated attempts for a recipient do not change balance or recipient count
disabled switch produces no grant
anon/authenticated clients cannot forge or directly invoke a grant
No pricing packs or refund policy are decided here.
Implementation started in isolated worktree/branch feat/welcome-credits-first-50.
Current phase: characterize existing auth provisioning, credit ledger, Edge Function ownership, migrations, and database-test conventions before locking the transaction shape.
Architecture locked after repository + adversarial review:
Account identity = Supabase user UUID. Delete/recreate may consume another remaining slot, but lifetime spend never exceeds $50. No durable email/provider fingerprint tombstone.
Eligible = new non-anonymous auth.users inserts after the campaign is enabled; no backfill.
Private singleton campaign row: enabled + monotonic issued_count constrained 0..50. Amount and cap are fixed SQL constants, not configurable/client input.
Separate AFTER INSERT trigger, SECURITY DEFINER with empty search_path, no public RPC/Edge Function.
Row lock, fixed ledger insert, and counter increment share the auth transaction. Unexpected failures abort account creation rather than committing an eligible account without its grant.
Kill switch is an operator SQL update documented in the runbook.
Real local database tests and a 100-way Bun SQL concurrency harness are required; string assertions alone are insufficient.
changed the title [-]Welcome credits: atomic grant for the first 50 accounts[/-][+]Welcome credits: atomic $1 grant for the first 50 accounts[/+]on Jul 12, 2026
Activity
ElbertePlinio commentedon Jul 12, 2026
Implementation started in isolated worktree/branch feat/welcome-credits-first-50.
Current phase: characterize existing auth provisioning, credit ledger, Edge Function ownership, migrations, and database-test conventions before locking the transaction shape.
ElbertePlinio commentedon Jul 12, 2026
Architecture locked after repository + adversarial review:
[-]Welcome credits: atomic grant for the first 50 accounts[/-][+]Welcome credits: atomic $1 grant for the first 50 accounts[/+]ElbertePlinio commentedon Jul 12, 2026
Implementation complete; shipping PR next.
ElbertePlinio commentedon Jul 12, 2026
PR opened: #33
CI and the automatic Codex review are in progress on commit bd7f4b1.
ElbertePlinio commentedon Jul 12, 2026
PR #33 is review-clean on bd7f4b1: both CI jobs passed and the automatic Codex review returned a clean thumbs-up with no findings. Merging.
ElbertePlinio commentedon Jul 12, 2026
Merged via #33 as 0e65485. The first-50 welcome-credit contract and its real database CI gate are now on main.