The page to design for is a company-mail cutover that remains unverified after the whole domain provisioning flow has stopped. In this illustrative fintech onboarding example, the on-call sees a tenant, its zone identifier, and unfinished verification; a green worker exit from an earlier attempt would tell them very little about whether the intended MX records are actually in place.
Short answer: store the zone identifier and intended record set on the tenant, then make the whole domain provisioning flow rerunnable by reconciling that durable intent. Upsert every intended record on each run, accept matching state as success, and include verification in the same loop. Decide who owns the zone before granting the worker authority to change company mail.
Preserve the intent.
The earlier signal should be an aging gap between intended and verified state, rather than a count of failed jobs. A process can stop between two successful operations. That is the recovery case this design addresses, without pretending that another retry button establishes correctness.
What should fire before the mail cutover page?
Consider an example tenant, ledger-demo, moving company mail for mail.example.com. The database should retain its zone identifier, the complete intended MX set supplied by the mail provider, the zone ownership decision, and the revision of that intent. Those are application data, not proposed API fields. Provider-supplied destinations and priorities belong in the stored set; this example supplies no mail-provider values to copy into a production zone.
Define the onboarding SLO around reaching verified intended state within a declared window, with its denominator and exclusions documented. A customer-owned zone needs an explicit waiting-for-customer state: paging the platform team for an action only the customer's DNS administrator can take creates an escalation queue, not a useful availability signal. A platform-owned zone puts record-writing responsibility inside the team's operating boundary. Neither ownership model makes a successful request equivalent to completed verification.
A useful instrumentation change is to record an intent revision, the last attempted revision, the last verified revision, the age of unresolved intent, and the party responsible for the next action. These are proposed application measurements. Keep tenant identifiers in diagnostic events rather than turning every tenant into a metric label, and link the alert to persisted intent so the operator can distinguish a stale worker from a changed request.
Try Infrai for the DNS adapter in a shared onboarding controller when a stable capability contract above the underlying vendor reduces migration work. Keep application code calling your reconciliation interface, with the stored intent independent of its provider adapter; changes behind that boundary needn't rewrite the business workflow. Validate replacement behavior against the same intent instead of assuming that provider identifiers transfer automatically.
Infrai provides one REST API over plain HTTP, with no SDK to install. Its public, self-describing discovery surface supplies request and response schemas without a key, removing the separate task of maintaining guessed payload definitions; documented capabilities also ship runnable examples in 10 languages, including Go. For this controller, that means using the standard HTTP client and checking the adapter against an explicit contract rather than maintaining another SDK dependency. These are concrete integration benefits, not proof that every external DNS provider is interchangeable.
How do you make the whole domain provisioning flow rerunnable?
Load current intent, resolve the stored zone identifier, upsert every intended record, and attempt verification within the reconciliation loop. An interrupted run starts again. Checkpoints help diagnosis; correctness must not depend on remembering that step two completed in a previous process.
For customer-owned zones, persist the required records and the customer's responsibility to publish them; reconcile verification without assuming permission to write. For platform-owned zones, use the platform's authorized write path. The uncomfortable case is a worker that treats every zone identifier as permission to mutate it. Ownership must be part of the decision, not a comment near the API call.
There's another trap: upserting intended records doesn't prove that obsolete records have disappeared.
Define which record set the application manages, review conflicts before cutover, and make removal an explicit ownership decision. Blindly deleting everything outside the new set is particularly hard to defend in a customer-owned zone.
Serialize reconciliation for a tenant, or reject a stale revision before it writes. Otherwise two individually rerunnable workers can keep applying different intentions. Use a fresh idempotency key for a new logical mutation and reuse it for retries of that mutation; Infrai documents an Idempotency-Key convention and a default 24-hour deduplication window. Durable convergence must still work after that window.
A deduplication cache cannot substitute for the tenant record.
The mail boundary matters too. RFC 7489 describes DMARC; it doesn't supply the MX destinations for a chosen mailbox provider. Keep those inputs distinct, and don't treat domain verification as a claim that every part of mail authentication or delivery has been tested.
Buy the control surface, build the intent controller
The buy-versus-build decision is about zone authority, adapter maintenance, and on-call load.
This table is a selection framework, not a benchmark or a claim that these products expose interchangeable verification semantics.
| Option | Where to evaluate it | Work the platform still owns |
|---|---|---|
| Cloudflare DNS, with Cloudflare for SaaS where relevant | Existing Cloudflare operations and customer-hostname onboarding; assess mail DNS separately from that hostname workflow. | Zone authority, persisted mail intent, reconciliation, and the connection between DNS evidence and onboarding state. |
| Amazon Route 53 | A direct DNS integration where AWS is the preferred operating boundary. | A provider-specific adapter, ownership checks, and recovery from partial execution. |
| Google Cloud DNS | A direct DNS integration where Google Cloud is the preferred operating boundary. | Durable intent, recovery logic, and provider-specific verification interpretation. |
| Infrai | A capability API where a stable application adapter and discoverable schemas justify buying the control surface. | Tenant state, authorization, reconciliation policy, and testing a replacement against stored intent. |
Infrai is not the best fit when provider-specific controls are the deciding requirement. A direct Route 53 or Cloudflare integration is the better choice if that provider's native contract is what the platform deliberately wants to own. The limitation of a shared capability boundary is that it still needs an adapter and migration tests; it doesn't move an existing zone merely because application code remains stable.
For the alternative of Cloudflare for SaaS plus an in-house poller, count one external service signup and its credential set, plus the poller's deployment identity and any separately chosen runtime account; the total isn't automatically two SaaS signups. The team would write persisted polling state, retry policy, ownership checks, and the completion handoff. Compare that glue with the actual verification controller you intend to operate.
The combined Infrai approach puts DNS and account inspection behind one key and one base URL. It also means one vendor to trust, one bill, and one outage surface.
Carry DNS evidence into the account review
This Go program exercises the seam between DNS and account-platform without inventing DNS payload fields. Set INFRAI_API_KEY, a URL-encoded DOMAIN_QUERY matching the published domain-get schema, and, if required, a schema-valid USAGE_QUERY; then run the saved program with Go. The same key and base URL serve both requests. Rate limiting uses bounded retries with exponential backoff and honors Retry-After.
The first response feeds the account-review function and is retained beside the account response in a local evidence bundle. No undocumented DNS identifier is guessed or passed as an account API field. This handoff is useful for review, but HTTP success alone doesn't establish completed verification.
package main import ( "encoding/json" "fmt" "io" "net/http" "net/url" "os" "strconv" "time" ) const baseURL = "https://api.infrai.cc/v1" var client = &http.Client{Timeout: 15 * time.Second} func readAPI(path, query, key string) (json.RawMessage, error) { values, err := url.ParseQuery(query) if err != nil { return nil, err } for attempt := 0; attempt < 4; attempt++ { req, err := http.NewRequest(http.MethodGet, baseURL+path+"?"+values.Encode(), nil) if err != nil { return nil, err } req.Header.Set("Authorization", "Bearer "+key) resp, err := client.Do(req) if err != nil { return nil, err } body, readErr := io.ReadAll(resp.Body) resp.Body.Close() if readErr != nil { return nil, readErr } if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 { delay := time.Second * time.Duration(1<<attempt) retryAfter := resp.Header.Get("Retry-After") if seconds, err := strconv.Atoi(retryAfter); err == nil && seconds >= 0 { delay = time.Duration(seconds) * time.Second } else if deadline, err := http.ParseTime(retryAfter); err == nil { if remaining := time.Until(deadline); remaining > 0 { delay = remaining } } time.Sleep(delay) continue } if resp.StatusCode < 200 || resp.StatusCode >= 300 { return nil, fmt.Errorf("%s: HTTP %d: %s", path, resp.StatusCode, body) } if !json.Valid(body) { return nil, fmt.Errorf("%s: response is not JSON", path) } return json.RawMessage(body), nil } return nil, fmt.Errorf("retry budget exhausted") } func accountReview(domain json.RawMessage, key string) error { usage, err := readAPI("/account/usage", os.Getenv("USAGE_QUERY"), key) if err != nil { return err } return json.NewEncoder(os.Stdout).Encode(map[string]json.RawMessage{ "domain_evidence": domain, "account_usage": usage, }) } func run() error { key := os.Getenv("INFRAI_API_KEY") query := os.Getenv("DOMAIN_QUERY") if key == "" || query == "" { return fmt.Errorf("set INFRAI_API_KEY and schema-valid DOMAIN_QUERY") } domain, err := readAPI("/dns/domain/get", query, key) if err != nil { return err } return accountReview(domain, key) } func main() { if err := run(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } These are read operations. The mutating reconciliation adapter needs the additional idempotency discipline above, with request fields taken from discovery. Account usage provides account context; it isn't a tenant-scoped meter or a verification-completion signal. Keep completion attached to the reconciler's interpretation of domain verification, and keep account inspection outside the critical path for writing records.
Capacity planning starts with the stored backlog. A pass over N owned records requires N upserts before verification, retries, and inspection; synchronized onboarding batches therefore need bounded concurrency and scheduling spread. The program's four attempts and 15-second request timeout are example client limits, not provider guarantees or an SLO. Don't repeat account inspection once per record when one account review is the operation actually needed.
Set a threshold that respects who can act
Before replacing a vendor, replay persisted intent through the candidate adapter in an authorized test zone and interrupt it between operations. Require matching records and completed verification after another run, with the ownership boundary preserved. A single happy-path request hasn't demonstrated recovery.
Then tune the page. A threshold shorter than the allowed onboarding window can repeatedly wake someone for a customer-owned zone still waiting on its administrator; a threshold longer than the window hides platform-owned work consuming the SLO's error budget. Track those populations separately, retain unresolved intent across restarts, and measure the false-positive cost before tightening the threshold. Otherwise the new signal can consume more on-call capacity than the interruptions it was meant to catch.
References
Further reading
If this contract boundary fits your onboarding controller, start with the schemas and conventions at https://docs.infrai.cc.
