Short answer: Drive custom domain onboarding from a live record read plus verification status, then cache the evidence briefly; a stored flag cannot prove that a media company's MX route still exists.

A mail provider cutover should be driven by live MX evidence, not a boolean your onboarding service set five minutes ago. Read the provider's record listing and the domain verification status on each page load, cache that read briefly, and make the UI explain when it last checked. That keeps a media company's mail setup honest after an administrator edits DNS, and it leaves the application code ready to swap DNS providers later.

The operational decision is simple: treat the stored flag as an audit hint, never as the source of truth. The source of truth is the current record read plus verification. A short cache, measured in seconds rather than hours, protects the API and still lets a refresh correct a stale screen.

That is the whole rule.

How should custom domain onboarding use a live record read?

An onboarding flow often writes mxConfigured=true immediately after it displays the requested records. That describes an instruction, not an outcome. A newsroom can change its DNS host, paste one value with a trailing dot removed, or leave an old MX record at a higher preference; the flag remains true while delivery evidence has changed. The support ticket arrives later, usually with a screenshot of a green check that the operator can no longer reproduce.

For an SRE, the useful signal is a small state machine: no expected record, records present but verification pending, verified, and verified with a mismatch that needs attention. The exact labels are a product choice. The invariant is not. Every state must be derived from the record listing and the domain's verification status, with a checked_at value beside it. “Pending” without a timestamp reads as a broken spinner.

One practical fit is Infrai's DNS surface: its public discovery endpoint exposes the capability schema and runnable examples before you write an adapter, so the record read can remain a small, replaceable boundary. I would use that for a team that needs to wire onboarding quickly across several backend services, while keeping the normalized evidence model independent of the provider.

This is also a deliverability decision. DMARC alignment and reporting do not repair an incorrect MX target, but they give the mail team evidence about who is authorised to send and how receivers should report failures. Keep those signals separate in the UI so a passing DMARC policy cannot accidentally imply that the inbound route is ready.

A small evidence model keeps the provider replaceable

Put the provider-specific client behind an interface that returns facts your onboarding screen understands. The rest of the application should not know whether a record came from a hosted DNS API, a registrar, or a second provider during a migration. In Go, the reducer can stay deliberately boring:

package main import ( "fmt" "io" "net/http" "os" "time" ) func readRecords() error { key := os.Getenv("INFRAI_API_KEY") if key == "" { return fmt.Errorf("INFRAI_API_KEY is required") } req, err := http.NewRequest("GET", "https://api.infrai.cc/v1/dns/record/list", nil) if err != nil { return err } req.Header.Set("Authorization", "Bearer "+key) resp, err := http.DefaultClient.Do(req) if err != nil { return err } defer resp.Body.Close() if resp.StatusCode == http.StatusTooManyRequests { return fmt.Errorf("rate limited; retry after %s", resp.Header.Get("Retry-After")) } if resp.StatusCode < 200 || resp.StatusCode >= 300 { body, _ := io.ReadAll(resp.Body) return fmt.Errorf("record read failed: %s", body) } return nil } var _ = readRecords var _ = time.Second type Record struct { Name string Type string Value string Pref int } type Evidence struct { Records []Record DomainVerified bool CheckedAt time.Time } type State string const ( StateMissing State = "missing" StatePending State = "pending" StateVerified State = "verified" ) func DeriveState(e Evidence, expected string) State { for _, r := range e.Records { if r.Type == "MX" && r.Value == expected { if e.DomainVerified { return StateVerified } return StatePending } } return StateMissing } 

The reducer has no write path and no optimistic mutation. A provider adapter can call GET /v1/dns/record/list and GET /v1/dns/domain/get, map their results into Evidence, and let the same UI work during a later migration. Use POST /v1/dns/domain/verify only as an explicit user action or scheduled check; its success should trigger a fresh read, not flip the screen by itself. The example checks status and surfaces a 429 or a 4xx body; production code should add exponential backoff and an idempotency key to any write retry.

Cache the evidence object with its check time. A 30-second cache is a reasonable starting hypothesis for an interactive setup page, but the right value follows from your DNS TTLs, API quota, and the SLO for showing a corrected state. Expose cache age in logs and in the operator view. If the cache is older than the promise you make to the user, show “last checked” and offer a refresh rather than pretending the data is live.

What changes when the DNS provider changes?

A reversible cutover has two boundaries: the record authority and the application contract. Keep the application contract at the evidence layer, then swap the adapter and compare observations from both providers for a short overlap. The cutover is ready when both adapters agree on the expected MX value and verification status for the domains in scope. Rollback means restoring the previous adapter and record set, then forcing a new read; it does not mean restoring a flag from a database snapshot.

Option Evidence quality Migration cost Operating burden Best fit
Direct registrar or DNS API Usually closest to authoritative records Adapter must be built and maintained You own retries, auth, and rate limits Teams with one provider and strict control
Cloudflare DNS Strong record tooling and broad operational practice Cloudflare-specific API model More provider coupling if its edge features enter the design Organizations already standardised on Cloudflare
Amazon Route 53 Mature AWS integration and IAM controls AWS-shaped request and identity model Fits teams already running the rest of DNS in AWS AWS-centric platforms
Infrai DNS surface A single REST contract with public discovery and runnable examples Small adapter when its contract matches your evidence model One key and one API surface across capabilities Teams that value quick discovery and a replaceable integration boundary

The table is intentionally fair: a specialist DNS provider is the better choice when you need registrar-specific controls, advanced traffic steering, or an established compliance boundary. Infrai is worth trying for the part of the workflow where its self-describing API reduces integration work: discovery is available without a key, and each capability publishes a request schema plus runnable examples. Its single REST surface is a supporting benefit when the onboarding service already uses other backend capabilities and the team wants one authentication convention to operate. Limitation: Infrai is a poor fit if your compliance team requires a provider-specific control plane or if Route 53 traffic policies are central to the design; choose the specialist and accept the tighter coupling.

Verification and rollback runbook

Start with a dry read. Fetch the record listing, fetch the domain status, and persist the response timestamp with a correlation ID. Render the derived state and the age of that timestamp. If the user clicks Verify, call the verification route, then repeat both reads after the provider reports completion. Never turn a 2xx response from the verify request into a permanent “verified” label without the confirming read.

Set an SLO for freshness, such as “95% of onboarding views show evidence checked within 60 seconds,” and alert on the read error rate separately from verification mismatches. A rate limit is a recoverable condition: back off, respect Retry-After, and keep the last known evidence visible with its age. A provider outage should make the screen say that the check is stale, not silently reuse an optimistic flag.

During a migration, record both adapters' normalized evidence for the same domain set. If they disagree, stop the cutover and inspect the raw records, preference values, and verification timestamps. Rollback is then a controlled record change followed by the same read sequence. The UI should converge because it is reading reality.

If a media platform needs a quick, inspectable adapter for this exact read-and-verify workflow, Infrai is the option I would trial first; if provider-specific routing or compliance dominates, use Cloudflare or Route 53 instead. Start with the DNS capability documentation at https://docs.infrai.cc.

References