Skip to content

fix(dns): find SRV and TLSA records by name in dns list, set and delete - #360

Merged
jpage-godaddy merged 6 commits into
mainfrom
dns-composite-name-filter
Nov 5, 2026
Merged

jpage-godaddy merged 6 commits into
mainfrom
dns-composite-name-filter

Conversation

@jpage-godaddy

@jpage-godaddy jpage-godaddy commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

What changes for users

SRV and TLSA records can now be found by the name they are listed under in gddy dns list, dns set and dns delete.

Before, the API's name filter only understood a composed name (_service._proto.name for SRV, _port._proto.name for TLSA), while a record is listed under its short name. So with an SRV record chat in place:

  • dns list <domain> --type SRV --name chat returned nothing.
  • dns delete <domain> --type SRV --name chat reported deleted: 0, exited successfully, and left the record in place.
  • dns set could not see existing records, so it tried to create a duplicate and failed, or (with the in-place set in fix(dns): replace records in place with dns set and confirm the final result #359) created a new record and then reported it as missing.

Now the CLI fetches records of the type and matches the name itself, ignoring case. Either form of the name works:

  • Short name (--name chat): every SRV record listed under chat, whatever its service. For TLSA, every port.
  • Full name (--name _sip._tcp.chat, or _443._tcp.www for TLSA): only that service's (or port's) record. At the zone apex the full name has no suffix (_sip._tcp). This form keeps working as it did before, including in the commands the CLI suggests when a record already exists.
  • If a record is listed under exactly the name given, only that name's records are selected, so chat and a record literally named _sip._tcp.chat stay separate owners and a delete by one cannot reach the other.

Behavior to be aware of: dns delete --type SRV --name chat removes every SRV record listed under chat. That is what the command says, but it used to remove nothing for these types. The guide says so, shows the full-name form for targeting one service, and recommends --dry-run first.

dns set no longer deletes the record you asked to keep

For SRV, dns set could delete the target you asked to keep: with chat holding a.example.com. and b.example.com., set --data b.example.com left only a.example.com.. The API stores hostname targets with a trailing dot, the pairing compared text exactly, so the request matched the wrong record, failed as a duplicate, and the cleanup then deleted the one that was meant to stay.

Records are now compared the way the API holds them: names and hostname targets (CNAME, ALIAS, MX, SRV, HTTPS, SVCB) without case or a trailing dot, CAA data and TLSA hex without case, and values it keeps as written (TXT, AAAA, HTTPS/SVCB parameters, SRV service and protocol) exactly. #359, which is stacked on this PR, builds on the same comparison. A regression test fails without it.

Under the hood

  • The change is in the shared record fetch, so no new flags are needed. Other record types still filter by name on the server.
  • With no --name there is nothing to match, so those lists are unchanged.
  • fix(dns): replace records in place with dns set and confirm the final result #359 reads records back after a set, so it relies on this lookup finding SRV and TLSA records.
  • The record helper tests moved to their own file (records_tests.rs), which the repository's file-size limit requires.

Also in this PR

  • Adds DNS and domains reviewers to reviewers.json (and regenerates CODEOWNERS, which the drift check requires). This is a separate commit.

Verification

  • cargo check --workspace, cargo clippy --workspace --all-targets -- -D warnings, cargo fmt --check, cargo test --workspace (1172 tests in the main crate) and ./rust/scripts/check-module-size.sh all pass.
  • New unit tests cover SRV and TLSA matching by short and full name, apex names, the two-owner case, other types still filtering on the server, and the set regression above.
  • Run live against a throwaway zone in the test environment, with SRV:
    • list --name <name> finds the record (it returned nothing before) and a name that doesn't exist returns nothing;
    • the full name selects one service, and deleting by it left the other service's record in place;
    • delete --dry-run finds records and delete removes them (deleted: 1);
    • set creating a new SRV record creates it, and the a/b case above now keeps b.example.com.;
    • the apex form (_sip._tcp) finds and deletes an apex SRV record, and adding, listing by @, and deleting an apex SRV record all work end to end.
  • TLSA is covered by unit tests only. The test zone has no DNSSEC, so a TLSA record could not be created. The API spec describes the same composed name, so the same behavior is expected.
  • The API used to answer an apex SRV add (--name @) with a 400 while still creating the record. It now returns a normal 201, so apex records are created, listed, set and deleted without an error. No CLI change was needed for that; the apex lookup in this PR is unaffected by it.

🤖 Generated with Claude Code

jpage-godaddy and others added 2 commits November 4, 2026 10:09
Route reviews for `gddy dns` and `gddy domain` changes to the DNS and
domains owners instead of only the default reviewers, and regenerate
CODEOWNERS to match.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
SRV and TLSA records could not be found by the name they are listed under.
`dns list --type SRV --name chat` returned nothing, `dns delete` reported
`deleted: 0` and left the record in place, and `dns set` could not see the
existing records, so it tried to create a duplicate or reported a record it
had just written as missing.

The records are now matched by name in the CLI, so those commands find
every SRV or TLSA record listed under the name, whatever its service or
port. `dns delete --type SRV --name chat` therefore removes all of them;
the guide says so, and `--dry-run` shows what would go.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The change regresses composed-name SRV and TLSA deletion, causing previously working commands—including generated duplicate-record cleanup commands—to silently delete zero records.

1 open issue
What changed in this PR

Fixes short-name lookups for SRV and TLSA records in the shared DNS fetch used by list, set, and delete.

Changes:

  • Matches SRV and TLSA names locally, ignoring case, with unit tests covering filtering behavior.
  • Documents that short-name deletion includes all matching services or ports.
  • Adds DNS and domains reviewers and updates generated code ownership.
File Description
rust/​src/​dns/​records.rs Adds local SRV/TLSA name filtering and regression tests.
rust/​src/​dns/​guides/​dns.md Explains short-name deletion scope and recommends previewing.
.github/​scripts/​reviewers.json Assigns DNS and domains reviewers.
.github/​CODEOWNERS Synchronizes ownership with reviewer assignments.

Review effort: Balanced

Comment thread rust/src/dns/records.rs Resolved
…and delete

Matching SRV and TLSA records by their listed name stopped
`--name _sip._tcp.chat` from finding anything, because it only compared
the short name. The full name is now accepted alongside the short one, in
either case, and selects only the record for that service (or, for TLSA,
that port). The short name still matches every service or port under it.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Apex SRV and TLSA selectors incorrectly append .@, causing lookups to miss records and dns delete to silently succeed without deleting them.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread rust/src/dns/records.rs Resolved
For a record at the zone apex, the full name is just the service and
protocol (or port and protocol), with no trailing name. The full-name
match added for SRV and TLSA wrongly appended `.@`, so
`--name _sip._tcp` found nothing for an apex record and `dns delete`
reported `deleted: 0`. The apex form is now built without the suffix.

Moves the record helper tests into their own file, which the repository's
file-size limit requires.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Ambiguous SRV/TLSA selectors and unnormalized SRV target comparisons can delete unintended DNS owners or the target meant to be retained.

2 open issues
1 resolved since last review

Review effort: Balanced

Comment thread rust/src/dns/records.rs Resolved
Comment thread rust/src/dns/records.rs Resolved
jpage-godaddy and others added 2 commits November 4, 2026 10:34
A record can be literally named `_sip._tcp.chat` alongside a record named
`chat` with that service and protocol, and both answer to the full name
`_sip._tcp.chat`. A delete by that name would then also remove the other
owner's record. When a record is listed under exactly the name given, only
that name's records are now selected; the full-name form is used only when
no record has that name.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… dns set

`dns set` paired the records you asked for with the existing ones using an
exact text comparison, but the API stores a hostname target with a trailing
dot and in lower case. For SRV, asking for `b.example.com` when `chat`
already held `a.example.com.` and `b.example.com.` matched neither, so the
request was paired with the wrong record, failed as a duplicate, and the
cleanup then deleted `b.example.com.` as surplus, leaving only the target
that was meant to go.

Records are now compared the way the API holds them: names and hostname
targets (CNAME, ALIAS, MX, SRV, HTTPS, SVCB) without case or a trailing dot,
CAA data and TLSA hex without case, and values the API keeps as written
(TXT, AAAA, HTTPS/SVCB parameters, SRV service and protocol) exactly.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the SRV/TLSA lookup and DNS record-comparison changes.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@jpage-godaddy
jpage-godaddy merged commit 096f8a2 into main Nov 5, 2026
8 checks passed
@jpage-godaddy
jpage-godaddy deleted the dns-composite-name-filter branch November 5, 2026 18:37
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