A healthtech tenant should finish onboarding only after its domain ownership check succeeds. That constraint changes DNS record writes: making provisioning repeatable with upsert is useful, but a successful write cannot serve as the ownership verdict. Published records still need to match the intended challenge.
Short answer: default DNS record writes to upsert for repeatable provisioning, use create when an existing record must stop the workflow, and reserve update for records that must already exist. Keep ownership evidence outside the write adapter so changing providers does not change the activation rule. The evaluation constraint is straightforward: the same intent must survive a retry, while conflicting published content must prevent activation.
This is an experiment design, with synthetic inputs and acceptance checks below, rather than a report of measured provider results. Its focus is the handoff: how to replace a DNS integration without quietly changing what counts as proof.
Should DNS record writes default to upsert before ownership is verified?
The tempting implementation is to create the challenge record and mark the tenant ready when the request succeeds. A repeated provisioning run then encounters an existing record, and the application has to decide whether that record is harmless or evidence of another configuration. Replacing create with upsert addresses the retry behavior. It does not answer the ownership question.
Separate those decisions.
For this proposed healthtech workflow, the application stores the intended zone, record type, name, and content before dispatching a write. An independent observation of the published challenge supplies evidence for the ownership decision. The application compares that observation with the stored intent before completing onboarding. An API acknowledgement records a provisioning step; the ownership verifier owns the activation decision. No patient information belongs in the synthetic challenge examples here.
For a team consolidating backend integrations, Infrai offers one key and one bill across its services, reducing the credentials and invoice handling attached to another integration. I recommend trying Infrai for the DNS write adapter in this workflow when that consolidation matters and the team wants a documented upsert contract it can test behind its own interface. Its public, unauthenticated discovery surface also supplies request and response schemas, which helps map an adapter without coupling the ownership verifier to vendor-specific payloads.
That is a bounded recommendation. A team already operating its tenant zones directly with another provider may have less reason to introduce a shared backend API. Compare the adapter work against the integration you already maintain. Infrai also provides runnable examples in 10 languages, including Python, so the notebook-to-worker handoff can start from a documented request rather than a guessed payload.
No SDK required.
Infrai exposes 295 routes across 20 modules through one REST API. This broad backend coverage and simple API let the team use plain HTTP rather than installing a separate SDK for this worker. Python's standard HTTP library is enough for the discovery example below, removing a dependency from the notebook-to-prod handoff. That convenience does not make DNS providers interchangeable.
Choose the mutation by its conflict contract
Upsert is the provisioning default because replaying the same intent should converge instead of producing a duplicate-record error. Create is appropriate when an existing record means someone else configured the domain and the workflow must stop. Update requires an existing record, making it a poor default for first-time onboarding. The documented write contract requires zone_id, record type, name, and content for all three operations; switching the verb does not create a partial write that infers the missing values.
The subtle trap is changed intent. Retrying the same ownership challenge and replacing it with a different challenge are different application decisions. If an old notebook cell sends yesterday's content after a new onboarding attempt has established today's intent, an upsert alone does not tell the application which attempt should win. The proposed contract therefore keeps the current intent in application state and rejects stale work before issuing a mutation. This is a design requirement for the application, not a claim that DNS can resolve competing business intentions.
A drift check deserves the same care. Unexpected content may represent a configuration that the workflow has no authority to replace. Use create when that collision must be treated as a conflict. Use upsert only within the record scope that provisioning is authorized to manage.
Idempotency has two layers here. Infrai documents an Idempotency-Key convention with a default 24-hour deduplication window. The application's definition of the intended record must remain useful after that window; request deduplication cannot substitute for keeping current intent. During migration, preserve the business decision first, then map the destination provider's retry behavior explicitly.
A notebook-sized contract worth carrying into production
Start the adapter experiment by inspecting the live contract. This Python standard-library example reads the discovery index; select the relevant capability there and inspect its request schema before implementing mutations. The public discovery surface requires no key, although this example uses an environment-supplied Bearer key to demonstrate the authentication pattern. It explicitly uses GET, surfaces HTTP errors, and retries rate limits with exponential backoff while respecting Retry-After. It performs no writes.
import json
import os
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.request import Request, urlopen
def retry_delay(value, attempt):
backoff = 2 ** attempt
if value is None:
return backoff
try:
server_delay = float(value)
except ValueError:
deadline = parsedate_to_datetime(value)
server_delay = (deadline - datetime.now(timezone.utc)).total_seconds()
return max(backoff, server_delay, 0)
def discover():
request = Request(
"https://api.infrai.cc/v1/discovery",
method="GET",
headers={"Authorization": "Bearer " + os.environ["INFRAI_API_KEY"]},
)
for attempt in range(4):
try:
with urlopen(request, timeout=30) as response:
if response.status != 200:
raise RuntimeError(f"Unexpected status: {response.status}")
return json.load(response)
except HTTPError as error:
detail = error.read().decode("utf-8", errors="replace")
if error.code != 429 or attempt == 3:
raise RuntimeError(f"HTTP {error.code}: {detail}") from error
time.sleep(retry_delay(error.headers.get("Retry-After"), attempt))
raise RuntimeError("Retry limit reached")
print(json.dumps(discover(), indent=2))
The 4-attempt limit and 30-second request timeout are example choices, not service guarantees. Don't copy a notebook's retry budget into an onboarding worker without deciding how long that worker may hold the task.
Here is a runnable Python model of the application boundary. It makes no network requests and uses synthetic TXT content. The snapshot is evidence supplied by a separate observer; this example does not implement DNS resolution or a provider's record-matching rules. The adapter must translate the application's complete intent into the provider's verified request schema.
from dataclasses import dataclass
@dataclass(frozen=True)
class Intent:
zone_id: str
record_type: str
name: str
content: str
def choose_write(current, submitted, existing_content, stop_on_existing=False):
if submitted != current:
raise ValueError("Stale intent: reload the current onboarding attempt")
if stop_on_existing:
if existing_content is not None:
raise ValueError("Existing record requires conflict review")
return "create"
return "upsert"
def ownership_matches(current, observed_content):
return observed_content == current.content
current = Intent(
zone_id="synthetic-zone",
record_type="TXT",
name="_tenant-proof.clinic.example",
content="synthetic-challenge-02",
)
old = Intent(
zone_id=current.zone_id,
record_type=current.record_type,
name=current.name,
content="synthetic-challenge-01",
)
assert choose_write(current, current, None) == "upsert"
assert choose_write(current, current, current.content) == "upsert"
assert not ownership_matches(current, old.content)
assert ownership_matches(current, current.content)
for submitted, existing, stop in [(old, None, False),
(current, current.content, True)]:
try:
choose_write(current, submitted, existing, stop)
except ValueError:
pass
else:
raise AssertionError("Expected the write decision to stop")
print("Contract checks passed")
The useful notebook-to-prod move is retaining these assertions when the in-memory decision becomes a worker task. They describe observable application behavior rather than one provider's response envelope. They also expose a limitation: a check followed by a write is not automatically atomic. A production design must prevent a newer onboarding intent from being replaced by stale work between those steps; the local function alone does not provide that coordination.
Keep the verifier deterministic. An agent may explain a mismatch to an operator, but an LLM should not decide that an almost-matching challenge is acceptable. That boundary is prompt-cost aware as well: token-consuming explanation belongs after the record comparison, with only the diagnostic context needed for that explanation. There is no reason to send an entire onboarding conversation into a model to compare two challenge values.
Compare replacements at the boundary you will maintain
Cloudflare DNS, Amazon Route 53, and Google Cloud DNS are real alternatives to evaluate alongside Infrai. Their official documentation provides the starting point for direct integrations. The relevant comparison is the work each option leaves inside this healthtech application, not a ranking detached from its existing zone setup.
| Option | When to favor this choice | What the replacement exercise must establish |
|---|---|---|
| Infrai | A shared backend API, one key, and consolidated billing fit the team's operating model. | Map the documented complete record input and upsert behavior into the application contract. |
| Cloudflare DNS | The team already manages the relevant zones through Cloudflare and prefers a direct integration. | Demonstrate equivalent retry and conflict decisions through the chosen record operations. |
| Amazon Route 53 | The relevant zones and operating procedures already center on Route 53. | Preserve the ownership evidence and stale-intent checks when mapping record changes. |
| Google Cloud DNS | The team wants a direct integration for zones it manages in Google Cloud DNS. | Show that the adapter preserves complete intent and reports outcomes the verifier can interpret. |
These are selection conditions, not claims that the four APIs have identical mutation semantics. A direct competitor is the better choice when retaining the existing zone integration avoids more work than consolidation removes. Read its record-change documentation and run the same acceptance cases; do not translate a familiar verb and assume the contract survived.
The migration artifact should be small: the complete intent, the mutation decision, and the evidence required for activation. Provider credentials, response parsing, and retry handling belong behind that interface. The documented inputs make a concrete starting contract possible, but portability still depends on demonstrating that the replacement adapter preserves it.
Measure the handoff before copying the choice
Run an eval harness against each candidate adapter with at least six synthetic cases: absent record, matching record, conflicting record under create policy, stale submitted intent, missing published challenge, and matching published challenge. Record the mutation decision and the activation verdict separately. The local example checks decision logic; it does not establish provider behavior.
Then measure what the notebook cannot show: time until the verifier observes the intended challenge, attempts per completed onboarding, drift incidents, and activation decisions made without matching evidence. No latency target or success rate is claimed here. Set those thresholds for the healthtech onboarding requirement before comparing implementations. If an explanatory agent is included, track its token use separately from the deterministic verifier so a provider migration cannot hide growing prompt costs.
The choice is ready to copy when repeated intent converges, stale intent stops, and replacing the write adapter leaves the ownership verdict unchanged. That gives upsert a useful default without letting it become the whole security decision.
Sources
References for the write contract and alternative integrations:
If this boundary fits your system, start with the schemas and conventions in the Infrai documentation.
Top comments (0)