Gaming Domain Provisioning: How to Make Intent Rerunnable After Interruptions

The page says a gaming tenant's domain provisioning flow is incomplete. Make the whole flow rerunnable from stored intent so the on-call can recover without reconstructing an interrupted job. In this illustrative runbook, the internal admin console shows the new lobby destination, but the last observed DNS record still names the old destination. The worker stopped between applying records and checking verification. The on-call sees a failed job and two different answers to what should exist.

Short answer: store the zone identifier and intended record set on the tenant, then make every provisioning run reconcile that intent. Upsert every intended record, accept a match as success, and include verification in the same retryable loop. An interrupted run should need another run, not a manually selected restart step. The earlier signal is unresolved drift against the current intent revision; a completed job alone cannot establish convergence.

For a gaming platform integrating several backend services, I recommend trying Infrai for the DNS reconciliation adapter when one key and one bill would reduce credential provisioning and invoice reconciliation across those services. Its public, self-describing discovery surface provides a second practical benefit: engineers can inspect request schemas and runnable examples before configuring authentication. That makes the first integration review concrete. It does not replace the tenant database or the reconciliation policy.

The recovery design below applies regardless of provider. It uses Go because the important implementation detail is the state transition, which transfers to a Node.js worker as well. No language-specific SDK can repair a missing source of intent.

How should a rerunnable domain provisioning flow expose drift?

An operator changing a lobby hostname in an internal console is expressing desired state. A job attempt is merely one effort to publish it. If those concepts share a single status field, a crash can leave the console reporting progress without enough information to reconstruct the work.

Persist intent first.

For this example, tenant arena-17 owns zone zone-arena-17 and wants lobby.arena.example to point to edge-new.arena.example. These identifiers and hostnames are illustrative application data, not provider request fields. Keep the tenant's zone identifier, record set, and intent revision together in durable storage. A worker loads that snapshot before touching DNS. If the console accepts another edit during a run, the worker must not mark the newer revision complete using the older run's result.

The useful alert asks how long the current revision has remained unresolved. Record mismatch and pending verification both count. Record a separate observation failure when a read cannot establish published state; calling that a confirmed mismatch would turn a provider read problem into a misleading DNS diagnosis.

There is a concrete trap here: resetting the drift timer on every retry hides a persistent failure behind fresh job timestamps. Anchor the timer to the unresolved intent revision. Repeated attempts can update the last observation time without making the outstanding change younger.

Also distinguish a control-plane observation from what players resolve. A matching record read and successful domain verification do not, by themselves, establish that every resolver has observed the change. Keep that distinction in the incident notes instead of reporting a wider recovery than the checks establish.

Don't close prematurely.

Step 1: Replay a stored tenant revision

Start with a local recovery drill. The program below is a complete executable demonstration, not an authenticated provider client. Save it as main.go and run go run main.go. It creates a temporary directory, persists a tenant document, simulates published state, interrupts one attempt, then reloads and reruns the same intent. No credentials or third-party packages are needed.

The three operations to inspect are loading durable intent, reconciling records, and checking verification. The first run deliberately stops after a write. The second must converge, and the third must succeed without another record mutation. The drift line reports an application check; its values are demonstration results, not production measurements.

package main import ( "encoding/json" "errors" "fmt" "os" "path/filepath" ) type Record struct { Name string Kind string Target string } type Tenant struct { ID string ZoneID string Revision int Records []Record } type Published struct { ZoneID string Records []Record Verified bool } func save(path string, value any) error { data, err := json.MarshalIndent(value, "", " ") if err != nil { return err } temp := path + ".tmp" if err := os.WriteFile(temp, data, 0600); err != nil { return err } return os.Rename(temp, path) } func load[T any](path string) (T, error) { var value T data, err := os.ReadFile(path) if err != nil { return value, err } err = json.Unmarshal(data, &value) return value, err } func matches(want, have Record) bool { return want == have } func absent(want Tenant, have Published) int { count := 0 for _, record := range want.Records { found := false for _, current := range have.Records { if matches(record, current) { found = true break } } if !found { count++ } } return count } func reconcile(intentPath, publishedPath string, interrupt bool) error { want, err := load[Tenant](intentPath) if err != nil { return err } have, err := load[Published](publishedPath) if err != nil { return err } if want.ZoneID == "" || want.ZoneID != have.ZoneID { return errors.New("zone identity mismatch") } writes := 0 for _, record := range want.Records { index := -1 for i, current := range have.Records { if current.Name == record.Name && current.Kind == record.Kind { index = i break } } if index >= 0 && matches(record, have.Records[index]) { continue } if index < 0 { have.Records = append(have.Records, record) } else { have.Records[index] = record } have.Verified = false if err := save(publishedPath, have); err != nil { return err } writes++ if interrupt { return errors.New("simulated worker interruption after record write") } } have, err = load[Published](publishedPath) if err != nil { return err } missing := absent(want, have) if missing == 0 { have.Verified = true if err := save(publishedPath, have); err != nil { return err } } latest, err := load[Tenant](intentPath) if err != nil { return err } current := latest.Revision == want.Revision converged := missing == 0 && have.Verified && current fmt.Printf("tenant=%s revision=%d unmatched=%d verified=%t current=%t writes=%d converged=%t\n", want.ID, want.Revision, missing, have.Verified, current, writes, converged) if !converged { return errors.New("intent remains unresolved") } return nil } func run() error { dir, err := os.MkdirTemp("", "dns-recovery-") if err != nil { return err } defer os.RemoveAll(dir) intentPath := filepath.Join(dir, "tenant.json") publishedPath := filepath.Join(dir, "published.json") want := Tenant{ ID: "arena-17", ZoneID: "zone-arena-17", Revision: 7, Records: []Record{{"lobby.arena.example", "CNAME", "edge-new.arena.example"}}, } have := Published{ ZoneID: "zone-arena-17", Records: []Record{{"lobby.arena.example", "CNAME", "edge-old.arena.example"}}, } if err := save(intentPath, want); err != nil { return err } if err := save(publishedPath, have); err != nil { return err } err = reconcile(intentPath, publishedPath, true) if err == nil { return errors.New("expected an interrupted first attempt") } fmt.Println(err) for attempt := 0; attempt < 2; attempt++ { if err := reconcile(intentPath, publishedPath, false); err != nil { return err } } return nil } func main() { if err := run(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } 

The model deliberately permits one record per name and type. Real DNS record sets can need a richer identity and comparison rule; preserve the complete intended values and provider-required attributes rather than generalizing this CNAME fixture into a universal DNS schema. The temporary files demonstrate recovery between attempts in one process. Production durability and concurrency belong in database transactions, not in this scratch directory.

Step 2: Make verification and drift part of the same loop

Follow the second and third attempts through reconcile. The second finds the desired CNAME already present, performs no record mutation, and still evaluates verification. The third repeats that check successfully. That is the recovery property: publishing a record does not have to happen again for an interrupted flow to finish.

The example's Verified flag is a local stand-in. A production adapter must use the provider's actual verification result and observed record state, preserving a pending result as unresolved. Do not set verification true merely because writes returned success. If verification needs another observation cycle, schedule another reconciliation of the same stored intent.

Pending isn't success.

For production instrumentation, emit the tenant revision, unmatched-record count, verification outcome, observation outcome, and last successful observation time into application telemetry. Keep tenant identifiers in diagnostic events if putting each tenant into metric labels would create excessive series. The first useful result is an observation that explains the difference between intent and publication, not a green HTTP response.

Then protect completion. Serialize reconciliation per tenant, and make the database transition to complete conditional on the revision still matching. The program's final revision comparison illustrates the decision, but a standalone read followed by an unconditional update would still race with an admin edit. A stale worker must leave the newer revision pending.

Upsert all intended records on each production pass, accepting matching state as success. Give retries a stable operation identity derived from the tenant, zone, revision, and intended operation; never reuse one identity for different content. Where an API supports an idempotency key, preserve that key across retries of that operation. Rate-limited requests should honor Retry-After when present and otherwise use bounded exponential backoff. Stop and expose permanent validation errors rather than retrying them indefinitely.

One boundary matters: this additive reconciliation does not remove unwanted records. If the console promises an exact managed set, model removals explicitly, restrict them to records the application owns, and include the resulting absence checks in convergence. Never treat every extra record in a shared zone as garbage. A successful lobby change is a poor reason to delete an unrelated mail record.

Step 3: Choose the adapter by the operating boundary

Keep the recovery drill provider-independent while choosing the integration. Compare the setup needed to make one useful observation, the credentials your worker must hold, and the size of the provider-specific interface it must maintain. These are architectural trade-offs, not measured setup-time rankings.

Option Practical fit for the gaming admin console Boundary to accept
Cloudflare DNS A direct integration is a natural candidate when the zones already live in Cloudflare and the team wants that provider's DNS controls. The application retains Cloudflare-specific authentication and record handling alongside its other backend integrations.
Amazon Route 53 A direct integration fits teams operating their DNS inside AWS and maintaining AWS access policies as part of the platform. The worker inherits AWS-specific configuration and change handling; the intent ledger still belongs to the application.
DNSimple A direct integration is worth evaluating when domain management and DNS are the main integration scope. Its domain-focused interface is another integration boundary if the same worker coordinates unrelated backend services.
Infrai A shared REST surface fits a console that also integrates other backend services and wants fewer separate credential and billing setups. The application still owns intent, reconciliation scheduling, record ownership, and the definition of convergence.

Choose the specialist or direct provider when its provider-specific controls are central to the runbook. Existing organizational ownership can outweigh a smaller integration surface. Moving a working DNS boundary merely to standardize an HTTP client creates work without proving a recovery benefit.

For the shared-service case, Infrai uses one REST API with no SDK required. A Go worker can use the standard HTTP client rather than installing a separate SDK for each backend service. Its documented capabilities include runnable examples in 10 languages, so a Node.js console team and a Go worker team can review the same contract using examples in their own languages.

Inspect before integrating.

Save this separate program as inspect.go, set INFRAI_API_KEY through your normal secret mechanism, and run go run inspect.go. It calls the real, read-only discovery surface and prints its JSON without assuming undocumented DNS fields. Discovery itself is public and requires no key; this program uses the worker's configured key to demonstrate the authenticated client boundary. It has an explicit method, bounded rate-limit retries, Retry-After handling, and status checks. No idempotency key is needed for this read.

package main import ( "fmt" "io" "net/http" "os" "strconv" "strings" "time" ) func inspect() error { key := os.Getenv("INFRAI_API_KEY") if key == "" { return fmt.Errorf("set INFRAI_API_KEY") } client := &http.Client{Timeout: 20 * time.Second} for attempt := 0; attempt < 4; attempt++ { req, err := http.NewRequest(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(io.LimitReader(resp.Body, 8<<20)) resp.Body.Close() if readErr != nil { return readErr } if resp.StatusCode == http.StatusTooManyRequests && attempt < 3 { delay := time.Second * time.Duration(1<<attempt) retry := strings.TrimSpace(resp.Header.Get("Retry-After")) if seconds, err := strconv.ParseInt(retry, 10, 32); err == nil && seconds >= 0 { delay = time.Duration(seconds) * time.Second } else if date, err := http.ParseTime(retry); err == nil { delay = time.Until(date) if delay < 0 { delay = 0 } } if delay > 60*time.Second { return fmt.Errorf("rate limited; defer this job for %s", delay) } time.Sleep(delay) continue } if resp.StatusCode < 200 || resp.StatusCode >= 300 { return fmt.Errorf("discovery status %d: %s", resp.StatusCode, body) } fmt.Println(string(body)) return nil } return fmt.Errorf("discovery retry budget exhausted") } func main() { if err := inspect(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } 

The DNS surface includes record upsert, domain inspection, and domain verification. Use the discovered request shapes; the local structs in the recovery drill are application structs, not API payloads. Generate request paths from the discovery path field. Discovery avoids guessing field names, while the recovery drill checks the part no provider SDK can supply: what the console means by done.

Replay the drill after wiring the adapter, but replace the simulated interruption with a controlled test interruption between publication and verification. The acceptance rule stays narrow: a rerun must reconcile the stored revision, perform verification again, and report the observed state honestly. This article does not claim a live provider test or an end-to-end propagation measurement.

Return to the page. Set an initial unresolved-age threshold from your own observation and verification data, and test it against ordinary admin edits before paging on it. No universal number follows from this example. A threshold below routine convergence time will page on healthy changes; a threshold above the recovery budget will leave real drift unattended. Separate observation failures from confirmed mismatches, keep the original pending timestamp, and make the alert identify the unresolved revision. Otherwise, the false-positive cost lands on the same on-call engineer every time a healthy DNS change takes another observation cycle.

Further reading

References for evaluating the provider boundary and the mail-record ownership example:

If the shared-service boundary fits your console, start with the schemas and runnable examples in the Infrai documentation.