Skip to content

LPX-695: destroy:app — never tear down the hosted zone, withdraw only its records#162

Open
stevethomas wants to merge 1 commit into
mainfrom
steve/lpx-695-destroy-app-preserve-hosted-zone
Open

LPX-695: destroy:app — never tear down the hosted zone, withdraw only its records#162
stevethomas wants to merge 1 commit into
mainfrom
steve/lpx-695-destroy-app-preserve-hosted-zone

Conversation

@stevethomas

Copy link
Copy Markdown
Member

Hey, I made a thing! 🥳

Follow-up to the merged #158. (LPX-695)

What problems are you solving?

  • destroy:app could delete the whole Route 53 hosted zone (when it was reduced to NS/SOA). That's the wrong call: a hosted zone is domain-level infrastructure — the registrar's NS delegation points at it, and the domain's email/verification DNS and any sibling environment's records all live in it — so it outlives any single app. App teardown should withdraw only the records YOLO inserted and leave the zone standing.
  • Worth noting: YOLO does create the zone on first sync (SyncHostedZoneStep), but create ≠ own-to-destroy here — same stance as the BYO data bucket.

Is there anything the reviewer needs to know to deploy this?

  • No deploy/runtime change. Only destroy:app's Route 53 teardown behaviour changes (and destroy:app is admin-tier, human-gated, not in any automated path).
  • HostedZone no longer implements Deletable. New removeAppRecords() deletes only this app's A/AAAA records (canonical host + apex/www sibling); the zone is never deleted. TeardownHostedZoneStep withdraws those records — no ownership gate (it only ever touches this app's own record names, so the shared-zone hazard is gone).
  • Arch invariant updated: HostedZone joins S3Bucket as a deliberate non-Deletable App-scoped resource, asserted directly so the exclusion can't rot.
  • Supersedes the two Route 53 review blockers from LPX-695: yolo destroy:app — app teardown (reverse of sync:app) #158 (fail-open ownership read; wiping all DNS records incl. email) — both disappear when nothing deletes the zone.
  • Green: full suite 1351; Pint, Rector, PHPStan, Coverage all pass in CI.

🤖 Generated with Claude Code

…rds (LPX-695)

A hosted zone is domain-level infrastructure — the registrar's NS delegation
points at it, and the domain's email/verification DNS and any sibling
environment's records all live in it — so it outlives any single app. The
previous teardown deleted the whole zone when it was "pure-YOLO", which is the
wrong call: app teardown should withdraw only the records YOLO inserted and
leave the zone (and everything else in it) standing.

(YOLO *does* create the zone on first sync — SyncHostedZoneStep — but create ≠
own-to-destroy, exactly like the BYO data bucket.)

- HostedZone no longer implements Deletable. `removeAppRecords()` deletes only
  this app's A/AAAA records (canonical host + apex/www sibling); the zone is
  never deleted. `appRecordsExist()` is the plan/re-run check.
- TeardownHostedZoneStep withdraws those records (no ownership gate, no zone
  deletion — the fail-open/fail-closed concern is moot once nothing deletes the
  zone; we only ever touch this app's own record names).
- Arch invariant: HostedZone joins S3Bucket as a deliberate non-Deletable
  App-scoped resource, asserted directly so the exclusion can't rot.
- Docs updated (the teardown order + a "zone is never deleted" preservation note).

This also supersedes the two Route 53 review blockers from #158 (fail-open
ownership read; wiping all DNS records) — both vanish when the zone is never
deleted. Full suite 1351 green; Pint/Rector/PHPStan clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant