Domain Onboarding Pipeline
1. Extract domains from CSV โ deduplicate against existing zones
2. Create zones in batches of ~40-50 (pending limit). 2s delay between, 5s pause every 15.
3. Each batch gets unique NS pair assigned by CF (jakub/magali, natasha/sid, etc.)
4. Update NS at registrar to EXACT pair assigned (not just "any Cloudflare NS")
5. Trigger activation_check via API after NS update
6. Wire Worker Custom Domains (root + www) for each activated zone
7. UPDATE D1 status = 'active'
8. Verify: /api/status, themed page, beacon, agent.json
โ Critical Gotchas
โข Old CF NS โ new CF NS โ domains may show "cloudflare" but wrong pair
โข Rate limit (code 971): pause 90s+ and retry
โข Pending zone limit (~50): must activate before creating more
โข service_catalog can be objects or strings โ handle both in templates
โข SQLite UPDATE doesn't support ORDER BY/LIMIT โ use subquery