Skip to content

feat: sync with ans Discovery Profiles - #101

Merged
jhateley-godaddy merged 2 commits into
mainfrom
feat/sync-with-ans-discovery-profiles
Jul 31, 2026
Merged

feat: sync with ans Discovery Profiles#101
jhateley-godaddy merged 2 commits into
mainfrom
feat/sync-with-ans-discovery-profiles

Conversation

@jhateley-godaddy

@jhateley-godaddy jhateley-godaddy commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Related issue

Fixes #87

Summary

Issue #87 asked us to bring the Java SDK to parity with the ANS reference implementation. That implementation shipped Adapter-style DNS Discovery Profiles (agentnameservice/ans#25): the ANS-family DNS discovery styles (SVCB and TXT) and the trust records that go with them.

Most of that sync landed already in commit 9c26e91 (PR #92). That commit regenerated the models from the ANS repo spec. It also added the v1/v2 API routing and the first cut of discoveryProfiles handling. This PR is the final fix on top of that work. It corrects the discoveryProfiles default and the version semantics.

discoveryProfiles is a v2-only field. The v1 lane ignores it on the server.

The first cut defaulted the field to [ANS_DNSAID]. It removed the field from the wire body without notice when the target was v1. That approach hid a client mistake. It also sent a default that the caller did not choose.

Now the behavior is different:

  • The default is an empty set. An empty set holds no selection, so the client omits it from the wire body through @JsonInclude(NON_EMPTY).
  • An explicit discoveryProfiles selection on the v1 lane is a client misconfiguration. The client rejects it with IllegalArgumentException instead of a silent drop. The message tells the caller to remove the selection or to build the client with ApiVersion.V2.
  • On v2, the client sends an explicit selection on the wire. It omits the empty default.

Changes

  • AgentRegistrationRequest: the default discoveryProfiles is now an empty LinkedHashSet. The getter has the @JsonInclude(NON_EMPTY) annotation, so the client omits the empty default.
  • RegistrationService: added rejectDiscoveryProfilesOnV1. It throws when a caller uses a non-empty selection on v1. Serialization no longer removes the field.
  • AnsApiClient: removed the unused serializeToJsonWithoutField JSON-tree helper.

Testing

  • Removed AnsApiClientTest, which covered the deleted helper.
  • ApiVersionRoutingTest: v1 omits the empty default. v1 rejects an explicit selection before any HTTP call.
  • RegistrationClientTest: v2 sends an explicit selection on the wire. v2 omits the empty default.

e2e tests ran against v1 and v2.

AI assistance

Assisted-by: Claude Code (claude-fable-5)

Checklist

  • The PR title follows Conventional Commits — release notes are generated from it
  • Tests cover the change
  • The linked issue above uses a closing keyword
  • Every commit is signed off (git commit -s) certifying the DCO

Signed-off-by: James Hateley <jhateley@godaddy.com>
Signed-off-by: James Hateley <jhateley@godaddy.com>

@bchen-godaddy bchen-godaddy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@jhateley-godaddy
jhateley-godaddy merged commit a505742 into main Jul 31, 2026
3 checks passed
@jhateley-godaddy
jhateley-godaddy deleted the feat/sync-with-ans-discovery-profiles branch July 31, 2026 03:00
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.

feat: sync with ans Discovery Profiles (Adapter Style DNS discovery)

2 participants