Repository navigation
fix(dns): stop dns set from wiping zones via the v3 replace-record PUT - #143
Merged
Merged
Conversation
`PUT /v3/domains/zones/{zone}/dns-records/{recordId}` responds 200 but
doesn't perform a single-record replace as its description promises —
it silently replaces the entire record collection with the system
records plus whatever's in the request body, discarding everything
else in the zone (reproduced live against a test zone; see
#136).
`dns set`'s "replace" reconcile action now creates the new value and
only deletes the record it's replacing once that create has succeeded,
so a failed create never touches the old record. The vendored v3 spec,
the merged domains.oas3.json, and the embedded API catalog no longer
expose the PUT operation at all, so it can't be reintroduced by
accident or invoked directly via `gddy api call`.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
`action: "would delete"` read oddly when nothing matched (0 records, 0 deletes) — the preview now reports `"nothing to delete"` in that case instead of implying a delete with no target. Addresses #141 (comment) Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens dns set against a destructive v3 API behavior where a purported single-record PUT .../dns-records/{recordId} can silently replace the entire zone’s record collection. It removes that unsafe operation from the generated/embedded API surfaces and changes dns set “replace” reconciliation to a safer create-then-delete sequence, plus a small dry-run UX fix for dns delete.
Changes:
- Reworked
dns setreplace reconciliation to create the new record value first, then delete the old record (never issuing the v3PUT). - Improved
dns delete --dry-runmessaging to report"nothing to delete"when no records match. - Removed the v3
replaceDNSRecordPUT operation from the vendored OpenAPI specs and the embedded API catalog (and adjusted endpoint counts accordingly).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| rust/src/dns/set.rs | Stops using the unsafe v3 replace-record PUT and implements replace as create-then-delete, with additional reporting/test updates. |
| rust/src/dns/delete.rs | Tweaks dry-run preview "action" to clearly indicate the zero-match case. |
| rust/schemas/api/manifest.json | Updates Domains API endpoint count after removing the PUT operation. |
| rust/schemas/api/domains.json | Removes the PUT replace-record operation from the embedded API catalog. |
| rust/domains-client/src/lib.rs | Removes tests referring to the replace-record PUT behavior. |
| rust/domains-client/openapi/swagger_domains.v3.yaml | Removes the put operation and adds an explicit safety note explaining why. |
| rust/domains-client/openapi/domains.oas3.json | Removes the PUT replace-record operation from the merged OAS3 spec. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
`apply_replace` always created the new value before deleting the old record, but when the old record already holds the desired data (e.g. re-running the same `set`, or only some of several values actually changed), that create hits v3's exact-duplicate `DUPLICATE_RECORD` since the old record hasn't been deleted yet — failing an operation that had nothing to do. Short-circuit as a no-op success when the old record's current value already matches the desired one. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
rts1-godaddy
approved these changes
Jul 22, 2026
This was referenced Aug 12, 2026
This was referenced Aug 19, 2026
This was referenced Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dns set's "replace" reconcile calledPUT /v3/domains/zones/{zone}/dns-records/{recordId}to update an existing record in place. That route responds200but doesn't perform a single-record replace as its description promises — it silently replaces the entire record collection with the system records plus whatever's in the request body, discarding every other record in the zone. Reproduced live against a test zone; seegddy dns setwipes the entire zone — issues a PUT to a non-existent v3 dns-records endpoint that the API executes as a full-collection replace #136.dns setnow reconciles the "replace" case as create-the-new-value-then-delete-the-old-record: if the create fails, the old record is left untouched, so a failure can never touch more than the record actually being written. The vendored v3 spec, the mergeddomains.oas3.json, and the embedded API catalog no longer expose the PUT operation at all.set, or only some of several--datavalues actually changed) — otherwise that create would fail against v3's exact-duplicateDUPLICATE_RECORDsince the old record hasn't been deleted yet. (Caught in Copilot review.)dns delete --dry-run's preview now reports"nothing to delete"on a zero-match instead of the misleading"would delete".Test plan
cargo test(344 passed)cargo clippy -- -D warningscargo fmt --checkCNAME/TXT/Arecords elsewhere in the zone, randns set --dry-runthen for real — only the targeted name's records changed, everything else in the zone survived (this is the exact scenario that used to wipe the zone).dns settwice with the same--datavalue — second run reportsreplaced: 1with no failure instead of an exact-duplicate error.Co-authored-by: Claude Sonnet 5 noreply@anthropic.com