TWiT-Ads v2 Rebuild

Phase A Review & Handoff (Kenobi/Fable 5 → Opus 4.8)

Reviewed 2026-07-06 by Kenobi (Fable 5) before executor handoff. Scope: every line of app/ built in stages A1–A5.

Verdict

Sound. One real defect found and fixed during review; everything else is either working as designed or a consciously deferred risk listed below. All 8 packages green (run twice for idempotency), live stack verified, 30 commits, every mutation audited.

Fixed during review

Accepted risks / deferred items (the honest register)

# Item Why it's OK for now Falls due
1 No CSRF tokens SameSite=Lax cookie + POST-only mutations + tailnet-only exposure D3 hardening (TODO comment at templates.go pageData)
2 No login rate limiting bcrypt cost is the throttle; failures audited with usernames; 7 users on a tailnet E2 (Cloudflare Access will front auth anyway)
3 Templates parsed per request Milliseconds at 7-user scale; simplifies dev D3 polish, only if felt
4 Advertiser/agency delete unguarded No orders exist yet to reference them B5 MUST add the guardTODO(B5) at both delete sites in sponsors.go
5 Moving an episode onto a cancelled episode's date errors (unique constraint) Loud, not silent; the workflow answer is "reinstate instead" Revisit if Debi hits it in practice
6 Cost auto-compute truncates sub-cent Superseded 2026-07-06 by the whole-dollar house rule: all amounts round to nearest dollar via roundToDollar — inputs, computations, displays Closed
7 pctToBP parses percent via float64 then math.Round It's a rate (basis points), not money; deterministic for 2-decimal inputs Accepted
8 Cancel/reinstate reflows future episode numbers instantly Exactly Leo's rule; flagged to Leo 2026-07-06 with the external-reference caveat Warning banner if it ever bites
9 Backup is nightly pg_dump to ~/Backups/twit-ads (local disk) Testbed; revenue data is still mostly sample Leo: repoint BACKUP_DIR at a NAS-synced path before Checkpoint 1 (real orders)
10 login_failed audit rows record attempted usernames Useful diagnostics (proved itself day one); internal system Accepted

Architecture notes for the next executor (Opus 4.8)

Where Fable should be called back in (recommendation to Leo)

  1. B1 plan review + golden tests (before Opus implements) — the money-math core is the highest-stakes design in the system; the golden cases come from Lisa's interview examples.
  2. B5 design + post-implementation adversarial review — transactional finalize, the oversell impossibility proof, sea-of-red. Concurrency bugs here cost real revenue.
  3. Checkpoint 1 (after B6, Lisa's parallel week) — folding her feedback into spec adjustments.
  4. End-of-phase code reviews (end of B, end of C) — like this one.
  5. E0 legacy-import mapping — the legacy schema knowledge lives in the analysis docs, but the mapping decisions deserve senior eyes.
  6. E2 production cutover review — with Russell.
  7. Any debugging that stumps Opus twice — don't let it thrash; escalate with the failing test.