feat(provider): enumerate + import infra.dns_delegation (registrar+live NS)#33
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add DelegationDriver.ReadForImport which fetches the Hover registrar NS (authoritative intent) first, then the live public NS best-effort, and returns both as separate Outputs keys. HoverProvider.Import now routes infra.dns_delegation through this path so a catalog import captures registrar intent rather than TTL-cached live NS during an NS switch. The primary "nameservers" key is set to the registrar NS, keeping existing Diff/nameserversFromOutputs semantics consistent. DelegationDriver.Read is unchanged (drift/apply path unaffected). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds bulk enumeration and import support for infra.dns_delegation so the Hover provider can populate the DNS catalog with both registrar-intended and live-propagated nameserver delegation for each domain.
Changes:
- Extend
EnumerateAllto acceptinfra.dns_delegation(sameListDomainslisting asinfra.dns). - Add an
Importfast-path forinfra.dns_delegationthat uses a newDelegationDriver.ReadForImportdual-fetch (registrar NS + best-effort live NS) while keeping existing drift/apply semantics unchanged. - Add targeted unit tests covering
EnumerateAll(infra.dns_delegation)and the delegation import behavior, plus driver-level tests forReadForImport.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/provider.go | Adds delegation-aware Import path and allows EnumerateAll for infra.dns_delegation. |
| internal/provider_test.go | Adds tests for delegation enumeration and delegation import behavior. |
| internal/drivers/delegation.go | Introduces ReadForImport to capture registrar + live NS during import. |
| internal/drivers/delegation_test.go | Adds tests validating ReadForImport dual-fetch and failure handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+283
to
+292
| if dd, ok := d.(*drivers.DelegationDriver); ok { | ||
| out, err := dd.ReadForImport(ctx, ref) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("hover import %q: %w", cloudID, err) | ||
| } | ||
| if out == nil { | ||
| return nil, fmt.Errorf("hover import %q: driver returned nil output", cloudID) | ||
| } | ||
| return buildResourceState(cloudID, out), nil | ||
| } |
Comment on lines
+236
to
+239
| outputs := map[string]any{ | ||
| "nameservers": nameserversToAny(dom.Nameservers), | ||
| "registrar_nameservers": nameserversToAny(dom.Nameservers), | ||
| } |
Comment on lines
+250
to
+254
| // fakeDelegationClientForImport satisfies HoverDelegationClient and | ||
| // hoverDomainLister so it can be injected into both the DelegationDriver | ||
| // and HoverProvider.domains field. It also satisfies hoverclient.HoverClient | ||
| // via a nil client stored in drivers so we need a separate provider-level stub. | ||
| type fakeDelegationClientForImport struct { |
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.
Lets the Hover provider bulk-import registrar NS delegation so the DNS catalog can capture each domain's delegation alongside its hosted records. Part 2 of 3; design
workflow/docs/plans/2026-06-02-dns-delegation-portfolio-design.md+ ADR 0047.Changes
EnumerateAllnow acceptsinfra.dns_delegation(lists domains, sameListDomainscall) in addition toinfra.dns; unknown types still rejected.Importgets a delegation branch: a newDelegationDriver.ReadForImportdual-fetches registrar NS (GetDomainDelegation= authoritative intent) + live NS (public lookup = propagation), emittingOutputs{nameservers(=registrar, primary), registrar_nameservers, live_nameservers}. This bypasses the live-firstDelegationDriver.Read— so during an NS-switch the catalog records the registrar's intended NS, not the stale live NS. The registrar-vs-live gap is the staging signal.DelegationDriver.Read/drift/apply semantics are untouched (zero blast radius).nameserversstays the primary key so existingDiff/nameserversFromOutputsare consistent (no spurious drift).go test ./...green incl. existing delegation Diff/Read tests + real-browser tests.Needs a hover v0.5.1 release after merge; consumed by gocodealone-dns (PR3).
🤖 Generated with Claude Code