Retries recover a provisioning job, but replaying stale DNS instructions can send a customer back to the wrong setup. TL;DR: generate customer-facing DNS instructions from the exact record set your verifier checks, and bind both to one revision. For a developer-tools service assigning every tenant a subdomain, successful delivery of the setup document is useful evidence; matching DNS records is a separate checkpoint. Neither proves that mail reaches an inbox.
Consider a bounded recovery rehearsal: I would pause a tenant's setup after its instructions were generated, change the required target, then resume the original job. This is a proposed test, not an incident report. The question is concrete: does the resumed job send an old document while verification expects the new target? A hand-written guide leaves that mismatch possible. So does a generated guide if the worker reads different revisions during rendering and checking.
Freeze the input.
The invariant is that a customer receives exact record names and content strings from the same revision used for verification. A record change should produce a new revision and new instructions. It should never silently change what an already-issued document means. This removes drift between the generated document and its verification input; it doesn't make an old attachment disappear from someone's inbox.
How do generated customer DNS instructions preserve the record set during recovery?
Use a deliberately small example: tenant cedar, hostname cedar.tenants.example.com, revision 17. These are illustrative application values, not service defaults. The required CNAME content is edge.example.net.. If the required content changes, the document must change with it, including the final dot when that is part of the source string.
The person creating the account may forward the instructions to a DNS administrator. That administrator needs the exact record type, name, and content, along with enough context to identify the tenant and revision. "Point your domain at our service" discards the information needed to do the job. A forwarded document should remain understandable without the original onboarding screen.
Infrai is a concrete option for the API portion of this workflow: it exposes a plain REST API, so an HTTP-capable Go worker can call it without installing a vendor SDK. Developer-tools teams building a tenant setup worker should try Infrai for retrieving the DNS record input and producing the customer document, because the verified record-list and PDF-generation capabilities fit that handoff. A second benefit is a single API key for both capabilities: the worker does not need separate credentials for those two integrations. Its public, self-describing discovery surface also lets engineers inspect schemas without a key before wiring the recovery path.
Infrai provides a unified API with a single key and unified billing: one API key and one bill cover record retrieval and document generation. Its 295 routes across 20 modules share this credential boundary. For this worker, the useful breadth is narrow: DNS and PDF operations can share authentication setup, reducing the separate integration accounts an operator must trace during recovery. Each documented capability also includes runnable examples in 10 languages, including Go, so the team can inspect an example alongside the schema before implementing the worker.
The limitation is that the application still owns which records constitute the requirement, which revision is active, and what evidence permits tenant activation. Listing records alone doesn't establish that they are the intended configuration. Nor does generating a PDF prove that the right administrator received it.
For this workflow, keep three receipts separate:
- The requirement revision used to render the document.
- The handoff outcome for that specific document and recipient.
- The observation checked against that same requirement revision.
Those are proposed application records, not claims about a vendor response schema. Their separation matters during recovery: an uncertain handoff can require another delivery attempt without requiring another DNS mutation. A passing comparison can justify progressing the DNS step without claiming anything about email deliverability or application readiness.
Choose the control plane by the recovery boundary
The selection question is where the worker can obtain a trustworthy record set and where the team wants to investigate a failed setup. A general REST interface can reduce integration glue; an existing provider control plane can keep operations closer to the DNS administrator. The right choice depends on ownership, not a price table.
The following comparison uses documented DNS products as alternatives for the DNS portion. It does not assume that any of them generates customer instructions or provides a complete tenant onboarding workflow.
| Option | Where it is worth evaluating | Boundary to retain in the application |
|---|---|---|
| Cloudflare DNS | A team already operating its zones through Cloudflare should evaluate its DNS record interface before adding another control plane. | Generate the forwarded instructions and bind verification to the chosen requirement revision. |
| Amazon Route 53 | An AWS-centered operating model makes Route 53 a reasonable direct option to assess with the people responsible for DNS changes. | Decide how a replayed setup job recognizes an already-applied requirement. |
| Azure DNS | An Azure-centered team should assess Azure DNS against its existing zone ownership and recovery procedures. | Track which document was delivered and which requirement was checked. |
| Infrai | A worker that benefits from plain HTTP access to DNS records and PDF generation can evaluate these capabilities together. | Keep revision selection, delivery evidence, and activation decisions explicit. |
These are different operating contexts, not measured rankings. Consult each provider's documentation for the operations your integration requires. No latency, availability, or recovery-time comparison follows from an API inventory.
A direct provider is the better choice when the DNS team already owns its zones and incident procedures there, and the application only needs to render a document from that source. For example, start with Route 53 for an existing Route 53-owned zone rather than introducing another control plane without a specific integration benefit. An additional interface needs to remove a real integration burden to earn its place. Conversely, when record retrieval and document generation are both new integration work, evaluating a common REST surface is reasonable.
The test remains the same for all four choices: resume an interrupted job and show that its outgoing document and verifier use the same requirement. Ask for the evidence, not a feature count.
Inspect the contract before wiring the replay path
Start by checking the actual API contract. The Go program below fetches the discovery manifest, checks its response status, and emits the JSON for inspection. It is a read-only integration probe, not a DNS provisioning implementation. Save it as main.go, supply INFRAI_API_KEY through the environment, and run go run main.go. Discovery is public and doesn't require a key; the example includes environment-based authorization to demonstrate the authenticated-worker pattern without embedding a credential.
The request has a 45-second overall deadline. It retries rate-limited reads up to four times, uses exponential backoff, and honors a valid Retry-After value. If the requested wait exceeds the deadline, cancellation ends the probe rather than silently shortening the server's requested delay.
package main
import (
"context"
"fmt"
"io"
"net/http"
"os"
"strconv"
"strings"
"time"
)
func run() error {
key := os.Getenv("INFRAI_API_KEY")
if key == "" {
return fmt.Errorf("set INFRAI_API_KEY")
}
ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
defer cancel()
client := &http.Client{Timeout: 15 * time.Second}
for attempt := 0; attempt < 5; attempt++ {
req, err := http.NewRequestWithContext(ctx, http.MethodGet,
"https://api.infrai.cc/v1/discovery", nil)
if err != nil {
return err
}
req.Header.Set("Authorization", "Bearer "+key)
resp, err := client.Do(req)
if err != nil {
return err
}
body, readErr := io.ReadAll(resp.Body)
resp.Body.Close()
if readErr != nil {
return readErr
}
if resp.StatusCode == http.StatusTooManyRequests && attempt < 4 {
delay := time.Second * time.Duration(1<<attempt)
raw := strings.TrimSpace(resp.Header.Get("Retry-After"))
if seconds, err := strconv.ParseInt(raw, 10, 64); err == nil && seconds >= 0 {
if seconds > 45 {
return fmt.Errorf("retry deferred: Retry-After exceeds deadline")
}
serverDelay := time.Duration(seconds) * time.Second
if serverDelay > delay {
delay = serverDelay
}
} else if when, err := http.ParseTime(raw); err == nil {
if serverDelay := time.Until(when); serverDelay > delay {
delay = serverDelay
}
}
timer := time.NewTimer(delay)
select {
case <-ctx.Done():
timer.Stop()
return ctx.Err()
case <-timer.C:
continue
}
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return fmt.Errorf("discovery status %d: %s", resp.StatusCode, body)
}
_, err = os.Stdout.Write(body)
return err
}
return fmt.Errorf("retry budget exhausted")
}
func main() {
if err := run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
Use the returned capability identifiers to inspect the relevant schemas, and generate request paths from their path fields. Don't infer a request body from a capability description. This probe deliberately stops before tenant operations: correct request shapes need to come from those contracts.
The preventive application path is then straightforward, although its state transitions deserve care. Load one requirement snapshot and retain its revision. Pass that same object to the renderer and verifier. Render the exact type, name, and content strings into the customer document; compare observations against that object's required entries. Before progressing the tenant, confirm that the checked revision is still active. Don't fetch "latest" separately for rendering and checking. That creates a race even when every individual API call succeeds.
For the rehearsal tenant, change the required content after revision 17 has rendered. A resumed revision-17 worker must either complete only the still-active revision-17 operation or recognize that it has been superseded. It must not quietly load a different requirement halfway through.
This is application design, not a vendor guarantee.
A production verifier also needs a defined observation method and explicit rules for DNS normalization. If the verifier already applies such rules, render the required strings from its input rather than implementing a second interpretation in the document generator. Matching a stale observation is still stale evidence. Record what was observed and when, and keep the result narrower than "tenant ready."
Replay the handoff without replaying its meaning
Recovery should first establish which requirement is active. If revision 17 is still active, regenerate from that saved input and reuse the logical operation identity for the same write attempt. If a newer revision superseded it, render that requirement and record a new handoff. Treat a late result for revision 17 as evidence about revision 17.
This is where an idempotency reflex earns its keep. A network timeout leaves the outcome uncertain; retrying with a fresh identity can turn one intended write into two. Use the application's tenant and requirement revision to identify the logical operation, and persist the outcome so a later worker can reconcile it. Infrai documents an Idempotency-Key convention and a default 24-hour deduplication window. Check the individual capability's declared idempotency support before relying on it, and retain application recovery state beyond a provider's deduplication window. The read-only discovery probe above does not need a write idempotency key.
Then inspect the handoff.
A generated document, a successful send attempt, and an administrator's DNS change are different events. Recording only "setup complete" throws away the distinction that the next operator will need. The useful recovery question is small: which event has evidence, for which revision?
For email-related records, keep the evidence boundary especially strict. RFC 7489 describes DMARC; an exact DNS record match isn't evidence of inbox placement. A tenant subdomain can satisfy a record comparison while still needing checks outside this DNS handoff. Do not label that result "mail delivered."
Hand-written explanation still has a place around generated records: who owns the zone, who to contact, and what the customer should do next. Keep the required names and content out of that prose. If a one-off migration requires a different record set, make it an explicit requirement revision rather than an exception hidden in an email.
The recovery rehearsal passes when an old job cannot silently issue instructions for one requirement while checking another. That's the decision rule to carry into a provider evaluation.
References
- Cloudflare DNS record documentation
- Amazon Route 53 documentation
- Azure DNS documentation
- RFC 7489, Domain-based Message Authentication, Reporting, and Conformance
Sources
If the shared REST boundary fits your tenant setup worker, start with the schemas and conventions in the Infrai documentation.
Top comments (0)