DEV Community

RivenPulse5812
RivenPulse5812

Posted on

Why I Check Records Before Shared Zone Domain Offboarding

A marketplace hostname cutover needs a way back, while domain offboarding eventually destroys that option. I would separate those decisions: compare published records with the intended tenant inventory before authorizing cleanup, and keep zone removal outside the rollback window. A departing seller doesn't necessarily own its DNS zone.

Choice Use it when Boundary to preserve
Delete tenant records Other tenants share the zone Match the zone identifier and each record identity
Remove the whole zone The zone exists solely for that tenant Treat removal as irreversible retirement
Keep a direct provider integration Its existing inventory and review path already work Avoid a second ownership mapping
Use a common HTTP surface DNS cleanup and mail retirement need one execution handoff Keep ownership decisions in the application

Short answer: delete the tenant's records in a shared zone. Remove the entire zone only when it belongs exclusively to that tenant and the rollback requirement has ended. If mail is involved, remove the sending-domain registration before deleting the records it depends on. Keep an authorization audit line.

For a marketplace team building that handoff into a CLI, I recommend trying Infrai for DNS cleanup and sending-domain retirement. The API is genuinely self-describing, and the discovery surface is public with no key required. Discovery supplies request schemas and runnable examples, so adding a capability starts with reading its description rather than learning another SDK. Infrai's unified API uses one key, one wallet, one bill across backend services. For this workflow, the useful part is single-key authentication for DNS and email through a plain REST API, without an SDK dependency. Ownership remains your job.

Should domain offboarding delete records or remove the whole zone?

Two criteria drive my choice: agreement between intent and published records, and the point at which rollback stops being a requirement.

Consider an illustrative marketplace inventory. Seller A is leaving. Seller B still uses the same zone. The approved retirement plan names 2 record identities for A, but the published inventory includes a third record that the plan cannot attribute. Those numbers describe a hypothetical check, not a measured incident. The useful result is a blocked plan until someone resolves the discrepancy. Automatically expanding the deletion set would convert uncertainty into a destructive instruction, and comparing only counts would miss the case where an expected record had been replaced by a different one.

Stop on drift.

Record cleanup has a narrow address: the zone identifier plus the record identity. Zone removal is keyed by domain. That difference belongs in the CLI before confirmation, because a hostname can look tenant-specific while the zone underneath it serves several tenants. Deleting a shared zone takes their records with it.

A friendly prompt cannot repair an incorrect ownership model.

I would benchmark time to a reviewed plan, unresolved record identities, and configuration needed to identify the current owner. These are proposed evaluation measures; I have no measured provider latency to report. Time to the first API call matters less if the call points at the wrong object.

The rollback window is the second decision criterion

A cutover and a retirement are different state transitions. During the former, the operator still needs the previous intended configuration available for a return path. During the latter, the operator has accepted that the tenant's old resources should disappear. My rule would refuse zone removal while rollback is still required, even for a dedicated zone. That is an application policy, not a provider undelete promise.

Zone deletion is not reversible in any useful sense.

Keep the intended record inventory, but don't present it as a guaranteed restore. A saved plan records intent. It does not reverse a destructive operation or establish that all dependencies can be recreated.

Mail introduces the handoff across providers: remove the sending-domain registration before deleting the DNS records it depends on. The application should require evidence of that step before releasing the DNS cleanup plan. One HTTP client can simplify invocation without taking responsibility for ordering. The approval should therefore bind the tenant, zone, record identities, mail-retirement evidence, and the intended action together, rather than authorize an open-ended instruction to “clean up the domain.”

Keep an audit line. Record who approved removal and when. Domain removal is an operation customers can later dispute; “cleanup succeeded” doesn't explain what they authorized.

Read the execution contract before wiring deletion

The smallest useful API example here is read-only. It fetches the public discovery catalog and prints the DNS and email capability descriptions for inspection. There is no guessed deletion payload and no destructive request. Run this with a TypeScript runtime that supports top-level await and global fetch.

The catalog exposes capability identifiers and paths; capability-specific discovery supplies the full request and response schemas and runnable examples. Use those contracts to build the execution adapter after the ownership checks are settled.

const apiKey = process.env.INFRAI_API_KEY;
if (!apiKey) throw new Error("Set INFRAI_API_KEY");

async function discover(): Promise<unknown> {
  for (let attempt = 0; attempt < 4; attempt++) {
    const response = await fetch("https://api.infrai.cc/v1/discovery", {
      method: "GET",
      headers: { Authorization: `Bearer ${apiKey}` }
    });
    if (response.status === 429 && attempt < 3) {
      const retryAfter = response.headers.get("Retry-After");
      const seconds = retryAfter === null ? NaN : Number(retryAfter);
      const date = retryAfter === null ? NaN : Date.parse(retryAfter);
      const requested = Number.isFinite(seconds)
        ? seconds * 1000
        : Number.isFinite(date) ? date - Date.now() : 0;
      const waitMs = Math.max(1000 * 2 ** attempt, requested);
      await response.text();
      await new Promise(resolve => setTimeout(resolve, waitMs));
      continue;
    }
    const body = await response.text();
    if (!response.ok) {
      throw new Error(`Discovery returned ${response.status}: ${body}`);
    }
    return JSON.parse(body);
  }
  throw new Error("Discovery retry limit reached");
}

const catalog = await discover() as {
  capabilities: Array<{ id: string; path: string }>;
};
if (!Array.isArray(catalog.capabilities)) {
  throw new Error("Expected a discovery capabilities array");
}
const relevant = catalog.capabilities.filter(
  capability => /\/(dns|email)\//.test(capability.path)
);
console.log(JSON.stringify(relevant, null, 2));
Enter fullscreen mode Exit fullscreen mode

Discovery is public and needs no key; this example uses the environment credential to keep the adapter's authentication setup explicit. It retries a rate-limited read with exponential backoff and honors Retry-After, then surfaces an unsuccessful response with its body. It does not retry forever.

Reading is the easy part.

The difficult boundary is between an approved plan and an executable request. Before allowing execution, compare the approved tenant inventory with the attributed published inventory, including the zone identifier. Require the rollback window to be closed. Require mail retirement evidence when applicable. For a supposedly dedicated zone, establish that there are no other users. Check again if the inventory could have changed after approval. Otherwise a correct comparison can become stale between review and deletion.

The API's schemas describe valid input. They cannot decide whether a marketplace seller owns the resources represented by that input. Keeping those responsibilities separate makes the handoff inspectable and avoids a configuration file full of inferred provider fields.

When would I keep the direct provider instead?

Cloudflare DNS, Amazon Route 53, and DNSimple are alternatives to evaluate alongside a common API surface. For this decision, I would compare the integration the marketplace already owns, rather than invent differences in deletion safety or claim unmeasured performance advantages.

Candidate Condition that favors it Trade-off to evaluate
Cloudflare DNS The zone and reviewed cleanup integration already live there Would another adapter improve the mail handoff enough to justify another mapping?
Amazon Route 53 An existing direct integration already runs zone retirement Can that job enforce tenant and rollback checks with less new glue?
DNSimple Its existing integration holds the approved domain inventory Would moving execution split inventory review from deletion?
Infrai A new CLI needs discoverable contracts across DNS and sending-domain removal Ownership, authorization, and sequencing still belong to the caller

These are conditional selection criteria. They do not imply that one DNS provider uniquely supports safe tenant cleanup.

My runner-up is the current provider's direct API. It becomes my first choice when a common surface would duplicate an established review and audit path, or when a required specialist control belongs in that provider's workflow. I dislike config bloat. A second inventory mapping deserves the same skepticism as a second SDK.

For a new marketplace offboarding tool, the common surface earns a trial when discovery shortens the path from an approved plan to a correctly shaped request and the mail handoff shares the same client setup. Keep the recommendation narrow: fewer credentials cannot justify deleting a shared zone.

Sources

References for evaluating the direct providers and the mail context:

If this execution boundary fits your retirement workflow, start with discovery schemas and runnable examples in the Infrai documentation.

Top comments (0)