feat: multi-zone-origin support via vns-targeted record updates - #4
Merged
Conversation
Add ResolveVirtualNameServer to the client package, so origin-to-vns resolution stays AutoDNS knowledge inside this library rather than being reimplemented by the Terraform provider that consumes it.
Alserda
force-pushed
the
feat/resolve-virtual-name-server
branch
from
July 22, 2026 13:02
98c2289 to
feb573d
Compare
…g, test) Fix a whole-branch review of Phase A (UpdateRecords/ErrAmbiguousZone): update the README's Usage example and Errors section to the new UpdateRecords surface, drop a public doc comment's reference to a never-committed planning doc, tighten two overlapping CHANGELOG bullets, and align a fakeautodns test's name and blank-line grouping with the file's conventions.
Single-zone scenarios used a_seeded_zone (vns implicit) but then named testVirtualNameServer in the WHEN and THEN steps, so the vns appeared from nowhere when reading top to bottom. Default helpers now hide the vns entirely; only the shared-origin scenario names it, on both sides.
TestZone_ResolveVirtualNameServerReturnsTheSeededVNS seeded via a_seeded_zone (vns implicit) then asserted testVirtualNameServer out of nowhere. Seeding explicitly at testVirtualNameServer makes the expected resolved value visible in the GIVEN.
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.
Context
An AutoDNS zone is identified by its origin plus its virtual name server, and one origin can carry more than one zone (the same domain served from two different virtual name servers). The record-mutation endpoint this client used,
POST /zone/{origin}/_stream, is keyed by the origin alone: it cannot target one of several zones that share an origin. This PR moves record mutation onto the vns-targetedPATCH /zone/{origin}/{virtualNameServer}and adds the resolution and error surface a caller needs for multi-zone origins.Related issues
Highlights
UpdateRecords(ctx, origin, virtualNameServer, adds, rems)applies record additions and removals to one specific zone viaPATCH, withmodels.ZonePatchRequest(resourceRecordsAdd/resourceRecordsRem) as its body.ErrAmbiguousZonesentinel:ResolveVirtualNameServerreturns it (viaerrors.Is) when more than one zone shares an origin, and the message enumerates the candidate virtual name servers.fakeautodnsserves thePATCHroute keyed by(origin, virtualNameServer).StreamRecords,models.RecordStreamRequest, and the_streamroute are removed;UpdateRecordsreplaces them.Out of scope
Note for reviewers
resourceRecordsRemmatches) was verified against the live API before this landed, and matches on name+type+value.Proof of work
make test(client, fakeautodns, e2e,-race): green.make lint: 0 issues.UpdateRecordsagainst a real zone and confirmed it was added (then removed it).