Repository navigation
fix(dns): change a retained record's TTL by delete-then-create in dns set - #352
Merged
jpage-godaddy merged 1 commit intoNov 2, 2026
Merged
Conversation
… set `dns set --ttl N` for a value the zone already holds paired the value with its existing record (same content), then `apply_replace` created the new-TTL record before deleting the old one. v3 identifies a record by its content, not its TTL, so that create is an exact duplicate and fails with DUPLICATE_RECORD, leaving the old TTL in place and the command failing. A kept value with a different explicit `--ttl` now goes through `retime_record`: delete the old record, create it with the new TTL, and if the create fails put the old record back unchanged. Only when that restore also fails is a `cleanup` outcome added saying the record is gone. An omitted `--ttl` is still a no-op. The `write.rs` test module moves to `write_tests.rs` (as in `hosting/client.rs`) to keep the file under the 1000-line limit; the move is a dedent only.
AshutoshMore142k4
requested review from
axburgess-godaddy,
jpage-godaddy,
jpearlman-godaddy,
mguerrero3-godaddy,
qcai-godaddy and
rts1-godaddy
as code owners
November 1, 2026 20:31
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
jpage-godaddy
approved these changes
Nov 2, 2026
Collaborator
|
Thanks for the contribution, @AshutoshMore142k4 |
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.
Follow-up to #257. That PR was merged with one review finding still open: a retained value with an explicit TTL change was treated as already held.
Problem
gddy dns set --type A --name www --data 1.2.3.4 --ttl 7200on a zone that already holds1.2.3.4at 3600:plan_setpairs the value with its existing record (same_contentignoresttl, on purpose).apply_replacesees the explicit TTL change and creates the new record before deleting the old one.DUPLICATE_RECORD. The old record stays at 3600 and the command fails.This predates #257 (positional pairing paired the same two records), but the TTL-only case is the one #257's review flagged and it was never addressed.
Fix
In
apply_replace, a kept value (same_content) is now one of two things:--ttl, or the same TTL as stored: no-op, as before.--ttlthat differs:retime_recorddeletes the old record, creates it with the new TTL, and puts the old record back unchanged if the create fails. Only if that restore also fails is acleanupoutcome added saying the record is gone and how to re-create it.Deleting first opens a short window where the value is missing. With only create/delete on the record endpoint (no in-place update, see #136) that cannot be avoided for a TTL-only change, hence the restore.
Values that are not kept still go through create-then-delete, unchanged.
Tests
retime_*inrust/src/dns/set/write_tests.rs:cleanupoutcomeThe existing
apply_replace_is_not_a_no_op_when_ttl_explicitly_changesand..._is_still_a_no_op_when_ttl_is_omitted...still pass.write.rswould have passed the 1000-line limit, so its test module moves towrite_tests.rs(same#[path]pattern ashosting/client.rs). That part of the diff is a dedent only; the only changed lines are rustfmt re-wrapping a fewjson_bodycalls.Checks
cargo check --workspace,cargo clippy --workspace -- -D warnings,cargo test --workspace,cargo fmt --checkandrust/scripts/check-module-size.shall pass.Not verified against the live API: the create-after-delete order is exercised with mock servers only.