Skip to content

feat(dns): point the apex at www and stop managing the www handover - #77

Closed
devantler wants to merge 31 commits into
mainfrom
claude/dns-apex-cutover
Closed

devantler wants to merge 31 commits into
mainfrom
claude/dns-apex-cutover

Conversation

@devantler

@devantler devantler commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Why

devantler.tech itself should move to the platform with www, and keep following the gateway if its address ever changes.

What

  • Edits the existing apex record in place so it points at www, proxied. One record changes its target, so the site is never without an address.
  • Stops tracking the one-time www ownership record. external-dns now owns it, and has already replaced it with its own records.
  • Keeps the encrypted state from the www handover apply (feat(dns): hand www to the platform's external-dns without a gap #76, run 43675268687) as the retained recovery copy. The DNS workflow requires it before it will run this change.

The rollback plan is in the comment below: an in-place edit back to devantler.github.io, with no gap.

⚠️ Hold: merge and apply only after the platform cutover confirms that www works on the gateway.

Part of #21

🤖 Generated with Claude Code

devantler and others added 16 commits November 15, 2026 02:51
Declare the records this repository owns in dns.tf and add a main-only
"DNS plan and guarded apply" workflow against the authoritative R2 state.
It imports a declared record only when exactly one unowned live record
matches it, refuses deletes, replacements and changing imports, encrypts
state before and after every apply, and proves a clean plan from a fresh
runner. External-dns records, including the SES bounce records, stay with
external-dns. The email-only import proposal is superseded and removed.

Part of #21. Part of #65.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Create external-dns's ownership record for the existing www CNAME and
forget the CNAME here, so external-dns replaces it with the gateway
addresses in one batch.

Part of #21.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Edit the existing apex CNAME in place to follow www, which external-dns
points at the platform gateway, and forget the one-time ownership record
that let external-dns take over www.

Part of #21.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Refuse a create that an external-dns ownership record already claims,
  even when the claimed record itself is missing.
- Compare record names in full lower-case form, so a relative or
  differently written `_externaldns` name cannot pass the apex guard.
- Keep OpenTofu's errored.tfstate in the encrypted evidence when an apply
  cannot save its state to R2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jq 1.8 parses `X and Y as $v | body` with the whole and-expression as the
binding, so the external-dns ownership check always found no owner on the
Ubuntu 26.04 runner. Bind the name first; the tests pass on jq 1.7 and 1.8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the names of live records that nothing owns in the encrypted evidence
and print a count by type, so the public log never lists hostnames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From a fresh local review:
- Never import a live record that a resource already manages, and leave
  managed siblings out of the content-differs check.
- Let an `_externaldns.` ownership record claim only a record that the same
  plan stops managing, read both typed and typeless, so no marker can hand
  a mail record such as the DKIM CNAME to external-dns.
- Refuse a create or update of a record external-dns owns, or one without
  a known name.
- Print addresses only for the records in dns.tf; anything keyed by the
  private configuration appears as a count.
- Stop the apply with SIGTERM only, so a timeout cannot leave the R2 lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@devantler

Copy link
Copy Markdown
Contributor Author

Rollback plan, written before the apply

What this apply does: it edits the apex CNAME in place, from devantler.github.io (DNS only) to www.devantler.tech (proxied). One record changes its target, so devantler.tech always resolves. The apex then follows www, which external-dns points at the gateway. This repository also forgets the one-time www ownership record.

How to check it worked: devantler.tech resolves to Cloudflare and serves the platform's business site. The platform cutover session verifies this, including the parity crawl.

Rollback, with no gap:

  1. Open a pull request that reverts the apex record to content = "devantler.github.io", proxied = false, comment = "GitHub Pages Personal".
  2. Merge it, then run the DNS workflow: plan first, then apply. It is again an in-place update of one record, so the boundary admits it and there is no gap.

Keep GitHub Pages and its devantler.tech custom domain configured until the new site has been stable for a while, so this rollback stays available. The ownership record this change forgets belongs to external-dns, so it is never restored here.

🤖 Generated with Claude Code

devantler and others added 12 commits November 15, 2026 04:32
…ide private refusals

- Refuse an update that moves a record external-dns owns, not only one
  that lands on an owned name.
- Require an upper-case record type for every write and compare types
  case-insensitively when resolving imports, so a `txt` marker cannot skip
  the claims check.
- Report a refusal for a record keyed by the private configuration
  without its address.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From a second local review round:
- An `_externaldns.` ownership record must claim at least one live record,
  and every live record it claims must be one the same plan forgets. It can
  no longer hand an unmanaged record, such as another DKIM selector, to
  external-dns.
- Record names on writes use hostname characters only.
- Import resolution stops if the plan's prior state lacks the zone, instead
  of treating the managed set as empty.
- The apply gets a fresh 15-minute state session and a 5-minute SIGTERM
  bound, so its state save and unlock never run on expired credentials.
- The runbook describes what to do after a failed or partial apply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pply

From the third local review round:
- Match write names against the whole string (\A…\z), so a trailing
  newline cannot slip past the hostname pattern or the ownership check.
- Stop a slow apply with SIGINT sent to OpenTofu alone (--foreground), so
  the provider plugin finishes its in-flight call and the result is saved.
- Test that a marker is refused when the forget lacks or mismatches the
  claimed record's id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	dns.tf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The import-only apply in run 43674749476 (source 457727e) moved the
authoritative state from serial 3 to 4 on the same lineage, with the
configuration unchanged. Its `after` package and the fresh runner's
`recovered` package both authenticate with the independent identity and
carry the same state digest. The DNS workflow requires this generation
before its next run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from claude/dns-www-handover to main November 15, 2026 04:05
devantler and others added 2 commits November 15, 2026 05:08
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	dns.tf
Run 43675268687 (source 81ab7a9) created the www ownership record and
forgot the www CNAME, moving the state from serial 4 to 5 on the same
lineage with the configuration unchanged. The `after` and fresh-runner
`recovered` packages authenticate with the independent identity and carry
the same state digest. The fresh runner's plan wanted to recreate the
ownership record only because external-dns had already taken it over;
this pull request forgets it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
devantler added a commit that referenced this pull request Nov 15, 2026
Edit the existing apex CNAME in place from devantler.github.io (DNS only)
to www.devantler.tech (proxied). One record changes its target, so the
site is never without an address, and the apex then follows www and the
gateway. This replaces #77, which carried the same edit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@devantler

Copy link
Copy Markdown
Contributor Author

Superseded by #78, which makes the same in-place apex edit in one apply with the restored www ownership records (agreed with the platform cutover). The rollback plan is copied there.

🤖 Generated with Claude Code

@devantler devantler closed this Nov 15, 2026
devantler added a commit that referenced this pull request Nov 15, 2026
…ership of www (#78)

* chore(recovery): retain the state after the www handover apply

Run 43675268687 (source 81ab7a9) created the www ownership record and
forgot the www CNAME, moving the state from serial 4 to 5 on the same
lineage with the configuration unchanged. The `after` and fresh-runner
`recovered` packages authenticate with the independent identity and carry
the same state digest. The fresh runner's plan wanted to recreate the
ownership record only because external-dns had already taken it over;
this pull request forgets it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(dns): restore external-dns ownership of www

external-dns took over www at 04:06:52Z and wrote its ownership records
for the new A and AAAA addresses, but both were gone within a minute.
www still points at the gateway, but nothing owns it now.

- Create `_externaldns.a-www` and `_externaldns.aaaa-www` with exactly
  external-dns's content, so it re-owns the existing records without
  changing them, and forget the one-time cname-www marker.
- Add a reviewed handover list, .github/dns-handover.json. A marker may
  claim a live record nothing here manages only when that list names it;
  every other claim still has to be a record the same plan forgets. This
  avoids adopting the www addresses here, which would publish the
  gateway's origin addresses.

Part of #21.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(dns): point the apex at www in the same apply

Edit the existing apex CNAME in place from devantler.github.io (DNS only)
to www.devantler.tech (proxied). One record changes its target, so the
site is never without an address, and the apex then follows www and the
gateway. This replaces #77, which carried the same edit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(dns): let a listed handover claim only its own typed marker

From the local review of the handover list:
- A listed record may only be claimed by its own typed marker
  (`_externaldns.<type>-<name>`), never by a wider typeless one.
- Listed names use hostname characters without `_`, so the list can
  never name a DKIM or other service record.
- Test a listed name with an unlisted type, a typeless marker, an extra
  top-level key, the 20-entry cap, an underscore name, and the
  repository's own .github/dns-handover.json; each rule fails a test when
  removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <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