Skip to content

fix(hostnames): make pointing a Bunny DNS name at a pull zone actually stick - #239

Open
jamie-at-bunny wants to merge 7 commits into
mainfrom
claude/custom-domain-ssl-cert-503d64
Open

jamie-at-bunny wants to merge 7 commits into
mainfrom
claude/custom-domain-ssl-cert-503d64

Conversation

@jamie-at-bunny

@jamie-at-bunny jamie-at-bunny commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Fixes the custom domain Bunny DNS flow so it really creates a PullZone record, instead of reporting success without changing anything.

Why

On bunny sites domains add launchmade.com, the apex had only MX and TXT records. The flow:

  1. Took the first record at the name (the MX) as a conflict.
  2. "Repointed" it by updating that record in place to type PullZone. The update endpoint returns 2xx but ignores Type changes, so the MX stayed an MX.
  3. Printed "Repointed ... via Bunny DNS". No PullZone record existed, so SSL failed with "not pointing to our servers".

Separately, routesHere compared the PullZone record's Value to the pull zone ID. The API stores the ID in LinkName; Value is the pull zone name, so an existing correct record was never recognized.

What changed

  • Only routing record types (A, AAAA, CNAME, Redirect, Flatten, PullZone, Script, SVCB, HTTPS) count as a conflict. MX, TXT, NS, CAA and similar records sit alongside the new PullZone record.
  • Repointing a record of another type adds a PullZone record, verifies it routes, then deletes the old one. A failed add leaves the original record and its settings untouched. PullZone to PullZone still updates in place.
  • After every add or repoint, the zone is read back, and the flow throws with a manual bunny dns records add command if the name still doesn't route to the pull zone.
  • routesHere reads LinkName and ignores disabled records.
  • Tests: MX at the apex is ignored, replacing another record type, a failed add keeping the original, and the read-back failure. Fixtures now use LinkName.

Reviewer notes

  • If the add succeeds on the server but its response is lost, the new PullZone record can sit alongside the original, and the error is surfaced.
  • A name with both A and AAAA records still only replaces one of them.
  • The "the update endpoint ignores Type changes" behaviour was observed on an MX record. I didn't write to live DNS to confirm it for A or CNAME.

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b82c72c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@bunny.net/cli Patch
@bunny.net/cli-darwin-arm64 Patch
@bunny.net/cli-darwin-x64 Patch
@bunny.net/cli-linux-arm64 Patch
@bunny.net/cli-linux-x64 Patch
@bunny.net/cli-windows-x64 Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

…type, and verify the pull zone route after writing
@jamie-at-bunny jamie-at-bunny changed the title fix(hostnames): don't repoint MX or other non-routing records at a pull zone fix(hostnames): make pointing a Bunny DNS name at a pull zone actually stick Sep 28, 2026
@jamie-at-bunny
jamie-at-bunny marked this pull request as ready for review September 28, 2026 13:30
@bunnynet-devops

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T13:34:39.302597Z 494e48e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[High risk] Fixes DNS record routing logic for pull zones.

The PR is not ready to merge because a failed deletion can leave a competing DNS route while the command reports a successful repoint.

Fix All in Claude CodeFindings

  1. P1 Failed cleanup reports success ▶

Summary

The PR changes Bunny DNS custom-domain setup to distinguish routing records from coexisting records, add and verify a PullZone record before deleting an old route, and verify writes through a zone read-back.

  • Tests cover MX coexistence, replacement, failed addition, and a write that does not produce the intended route.
  • The latest change allows SSL setup to continue after a DELETE error, but needs to distinguish a lost DELETE response from an old record that remains.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Confirm repoint] --> B[Add PullZone record]
  B --> C[Read back and verify new route]
  C --> D[Delete old routing record]
  D -->|Success| E[Report repointed; continue SSL]
  D -->|Error| F[Warn; report repointed; continue SSL]
  F --> G[Old route may still be present]
Loading

Reviews (5) · Last reviewed commit: "fix(hostnames): warn instead of failing ..."

Comment thread packages/cli/src/core/hostnames/bunny-dns.ts Outdated
Comment thread packages/cli/src/core/hostnames/bunny-dns.ts
Comment thread packages/cli/src/core/hostnames/bunny-dns.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 494e48e9b0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/cli/src/core/hostnames/bunny-dns.ts
Comment thread packages/cli/src/core/hostnames/bunny-dns.ts
Comment thread packages/cli/src/core/hostnames/bunny-dns.ts Outdated
Comment thread packages/cli/src/core/hostnames/bunny-dns.ts Outdated
Comment thread packages/cli/src/core/hostnames/bunny-dns.ts Outdated
Comment thread packages/cli/src/core/hostnames/bunny-dns.ts Outdated
Comment thread packages/cli/src/core/hostnames/bunny-dns.ts Outdated
Comment thread packages/cli/src/core/hostnames/bunny-dns.ts Outdated
Comment thread packages/cli/src/core/hostnames/bunny-dns.ts
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.

3 participants