fix(deploy): package-app apex as zone route, never a custom domain - #1396
Conversation
…m domain The 2026-08-11 deploy took kodyapps.dev down: replacing a zone's Worker route table detaches any Workers custom domain in that zone and deletes its DNS record, and the generated config mixed the apex custom domain with the wildcard zone route in the same zone. Production was restored manually by re-creating the apex as a proxied AAAA 100:: record plus a kodyapps.dev/* zone route and detaching the custom domain. The runtime worker config now publishes both package-app routes as zone routes, and production-resources ensure idempotently provisions proxied placeholder AAAA records for both the apex and the wildcard (renamed ensurePackageAppDnsRecords). Custom domains stay reserved for app-origin zones, whose route tables the deploy never publishes. Docs updated with the incident rationale. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughPackage-app deployment now uses apex and wildcard Cloudflare zone routes. Production CI provisions proxied AAAA records for both hostnames. Runtime route tests and deployment documentation reflect the new routing and DNS model. ChangesPackage-app routing and DNS
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🔎 Preview deployed: https://kody-pr-1396.kody-a99.workers.dev Worker: Mocks:
|
* chore(identity): remove the legacy underscore-username tier Production had exactly one underscore username (debs_obrien); it was renamed by hand on 2026-08-12 (users.username, email_inbox_addresses, saved_packages names -> debs-obrien), so the two-tier validation shipped in #1395/#1396 no longer guards anyone. Username validation is one strict DNS-label rule everywhere again: the lenient recognition pattern, the separate DNS-safe validator, the 409 rename prompt on the package-app entry, and the hosted-URL path-mount fallback for non-DNS-safe usernames are all removed. The shared dnsSafeUsernamePattern stays as the single source of truth (also validating wildcard-routed subdomain labels). Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com> * docs(0017): drop the obsolete rename-before-hosting consequence The sole underscore account was already migrated; CodeRabbit caught the stale Consequences bullet still requiring renames before hosting. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com> * fix(preview): SQLite-backed DO namespaces for the mock cloudflare worker Cloudflare now rejects creating key-value backed Durable Object namespaces (error 10099). Every PR preview deploys a fresh kody-pr-<n>-mock-cloudflare script that runs these migrations from scratch, so preview resource deploys started failing repo-wide. Existing long-lived scripts already applied tags v1/v2 and are unaffected. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Intent
Prevent a repeat of the 2026-08-11
kodyapps.devoutage: replacing a zone's Worker route table detaches any Workers custom domain in that zone and deletes its DNS record. The per-user-subdomain deploy (#1395) published the wildcard zone route alongside the apex custom domain in the same zone, which took the apex dark for ~1.5h (status page showed "Package apps is down — HTTP 530"). The runtime-worker extraction (#1384) carries the same hazardous mix intools/ci/runtime-worker-config.ts, so its next successful deploy would repeat the outage.Summary
tools/ci/runtime-worker-config.tspublishes both package-app routes as zone routes:{ pattern: "kodyapps.dev/*", zone_name }and{ pattern: "*.kodyapps.dev/*", zone_name }— no custom domain in that zone, ever.ensurePackageAppWildcardDnsRecordbecomesensurePackageAppDnsRecords: it idempotently provisions proxied placeholder AAAA100::records for both the apex and the wildcard (zone routes do not create DNS records).setup-manifest.md,environment-variables.md) and code comments record the incident rationale: custom domains stay reserved for app-origin zones, whose route tables the deploy never publishes.Production state (already remediated manually)
Production was restored at ~00:15–00:50 UTC by re-attaching, then deliberately migrating the apex to the exact state this PR's tooling generates: apex + wildcard proxied AAAA
100::records,kodyapps.dev/*and*.kodyapps.dev/*zone routes, custom domain detached. Verified: apex/302 → app origin, legacy/@user/packages/...302 → per-user subdomain, subdomains serving. The ensure step in this PR is a no-op against that state.Note: main production deploys are currently red for an unrelated reason — #1384's runtime config generation fails with
main generated config env.production.queues.producers has no entry for binding "SCHEDULED_DISPATCH_QUEUE"(merge skew with the jobs-lane extraction #1389/#1394, which removed that producer from the main worker). This PR does not attempt to fix that; it should land before or with that fix so the recovery deploy does not re-trigger the custom-domain outage.Testing
npm run typecheck,npm run format:check, lint — green.vitest --project node-unit tools/ci/resource-utils.node.test.ts tools/ci/runtime-worker-config.node.test.ts— 16 tests green, covering: both routes generated as zone routes, apex+wildcard record creation sequence, reuse of existing records, conflict fail-closed (wrong type; conflict even when the required record exists).Summary by CodeRabbit
Documentation
Bug Fixes