Moving a marketplace's zones off a registrar-specific API creates a useful trade-off: deployment automation needs permission to change internal hostnames, while mail authentication needs protection from unrelated changes. Resolve it with a narrow ownership boundary, a reviewed diff, and separate evidence that public mail policy still resolves as intended. TL;DR: reconcile only the internal records declared by infrastructure code, recheck the approved state before applying, and keep mail authentication checks as an independent migration gate. A successful record write alone cannot establish deliverability.
The concrete job here is a marketplace deploying order and OTP workers while replacing its DNS management adapter. Internal service discovery belongs in the deployment plan. Sender authentication belongs in the acceptance evidence. Keeping those concerns visible in one review gives the team a reason to stop a migration even when the internal hostname diff looks clean.
How should infrastructure code manage internal DNS hostnames?
Start with a manifest of exact record identities the deployment may manage. For this design, an identity is a pair of owner name and record type, and its value is the complete record set the application intends to publish. Use one internal naming boundary and explicit ownership metadata. The adapter translates that model into the destination's operations; it must not infer ownership merely because a record appears in a zone listing.
Scope comes first.
Consider an illustrative manifest containing orders.svc.market.example. and otp.svc.market.example. as internal A records. Those names are example data, not a proposed production namespace. A public mail policy record such as _dmarc.market.example. sits outside their ownership set. Changing where zones are managed should not grant the order-worker deployment permission to rewrite that policy. If the old adapter managed both categories, separate their inventories before switching adapters. Otherwise, an omitted mail record can look like an intentional deletion to a whole-zone reconciler.
This boundary also makes review practical. An application engineer can inspect a two-record deployment plan without implicitly approving every DNS record associated with the marketplace. Require a separate owner for changes to the mail policy and its reporting destination. That is a proposed control for this migration, rather than a claim that DNS itself enforces application ownership.
The reader looking for a Node.js deploy-and-diff flow needs this same contract between the deployment runner and the DNS adapter. The focused example below uses Python to expose that contract without coupling it to a particular runtime or provider SDK.
Treat mail authentication as acceptance evidence
RFC 7489 describes DMARC as a policy and reporting mechanism built on SPF and DKIM. Its alignment rules connect authenticated identifiers to the domain in the message's From field. A DMARC pass can result from a passing, aligned SPF result or a passing, aligned DKIM result; the protocol does not require both paths to pass. That distinction matters when deciding what evidence a zone migration must preserve.
For the marketplace, prepare a sender inventory before moving anything: which stream sends order receipts, which sends login codes, and which domain each stream presents to recipients. Then record the intended authentication path for each stream. This is an acceptance checklist to populate with actual system data, not an assertion about how a particular marketplace sends mail. The team should be able to explain which aligned identifier supports the expected DMARC result and where the relevant public records are managed. A hostname deployment diff cannot supply that explanation.
Keep the claims narrow.
DMARC authentication evidence does not prove that a login code arrived, arrived promptly, or reached the inbox. RFC 7489 leaves message disposition to receiver policy and discusses limitations of the mechanism. For this migration, retain separate observations for authentication results and the application's delivery outcome. If authentication remains as expected but a code arrives too late for its intended use, the marketplace still has an acceptance problem; changing an internal A record does not resolve the evidence gap.
Reporting needs care as well. RFC 7489 defines aggregate and failure reporting, addresses privacy considerations, and specifies authorization checks for certain external reporting destinations. Preserve the intended reporting configuration during the move. Decide who can access collected reports and how long the team needs them, because a useful migration artifact can also contain information about mail traffic. Do not silently change reporting destinations to make a migration dashboard easier to build.
Make the diff a reviewable artifact
Use a three-way view: the desired manifest, a fresh observed snapshot, and the identities already owned by this deployment. The example below produces a plan only. Its input contract requires fully qualified owner names, normalized record values, and complete record sets; resolving those details belongs to the adapter. Treat an inventory read failure as an error before calling this function, rather than passing an empty mapping.
The distinction prevents a particularly expensive mistake: interpreting an unsuccessful read as evidence that every desired record needs creation. The planner also refuses a desired record that collides with an existing identity outside the deployment's ownership set. Adoption should be an explicit review decision.
from dataclasses import dataclass from typing import Mapping Key = tuple[str, str] @dataclass(frozen=True) class RecordSet: ttl: int values: frozenset[str] def plan( desired: Mapping[Key, RecordSet], observed: Mapping[Key, RecordSet], owned: frozenset[Key], ) -> list[dict[str, object]]: collisions = (set(desired) & set(observed)) - owned if collisions: raise ValueError(f"Explicit adoption required: {sorted(collisions)}") changes = [] for key in sorted(set(desired) | owned): before = observed.get(key) after = desired.get(key) if before == after: continue changes.append({ "name": key[0], "type": key[1], "before": before, "after": after, }) return changes desired = { ("orders.svc.market.example.", "A"): RecordSet( ttl=300, values=frozenset({"192.0.2.10"}) ), ("otp.svc.market.example.", "A"): RecordSet( ttl=300, values=frozenset({"192.0.2.11"}) ), } owned = frozenset(desired) observed = dict(desired) assert plan(desired, observed, owned) == [] The addresses and 300-second TTL are illustrative inputs, not live endpoints or a recommended timing policy. A change with after equal to None means a proposed deletion. Because the loop includes previously owned identities, removing a declaration produces a visible deletion instead of leaving a forgotten hostname behind. Unrelated observed records never enter the plan.
There are deliberate limits. The function does not discover records, serialize a review artifact, perform DNS lookups, or write changes. It also assumes the caller has already validated the allowed names, types, and values. Those omissions keep the example focused on the ownership decision; an apply implementation still needs explicit handling for concurrent changes and partial completion.
Compare workflows after defining the evidence
The useful comparison is between deployment behaviors. Price does not decide whether the migration preserved the marketplace's authentication boundary.
| Workflow | What a reviewer can establish | Remaining acceptance work |
|---|---|---|
| Replace the whole zone from an export | Whether the exported inventory matches the intended zone contents | Reconcile records added outside the export and verify mail policy separately |
| Reconcile an explicitly owned record set | Whether each proposed internal change falls within deployment ownership | Review the separately managed mail inventory and verify public authentication behavior |
| Apply a reviewed plan with a fresh-state check | Whether the approved changes still match the observed state at apply time | Detect partial completion and collect resolution and mail evidence afterward |
These are design options, not measured performance results. Narrow ownership reduces the review surface, but requires the team to maintain ownership metadata and an explicit adoption process. A whole-zone move may still be part of replacing the management system; it should have its own inventory review rather than inheriting approval from an application deployment.
For the apply step, compare fresh observed state with the plan's preconditions before writing. If it differs, stop and generate a new plan. A read followed by a write still leaves a race unless the destination provides an applicable conditional-write mechanism or all writers follow a shared serialization rule. Document that boundary honestly. Keep the old and new adapters from independently managing the same identities during the transition.
Roll out with a compact acceptance gate
Begin with a read-only comparison between the normalized old and new inventories. Reconcile discrepancies, review ownership, and retain the intended public mail configuration as a separate artifact. Then approve a small internal change and bind the apply operation to that reviewed plan. An API acknowledgment is one piece of evidence; follow it with resolution checks from the application's actual internal lookup path.
After applying, reread the records and record which planned changes completed. If execution stopped midway, build the next diff from fresh state. Do not replay a stale batch or blindly restore an old snapshot over someone else's edit. Preserve the earlier intended state so a rollback can itself be reviewed as a new change.
Finally, check representative marketplace messages against the intended authentication paths and inspect the available reporting evidence. Keep delivery outcomes alongside those checks without treating either as a substitute for the other. Close the migration only when internal naming behavior, public mail policy, and the recorded acceptance evidence agree with the intended configuration.
References
RFC 7489 supplies the DMARC mechanisms discussed here: identifier alignment, policy discovery, reporting, receiver discretion, and security and privacy considerations. The manifest, planner, ownership boundary, and rollout gates are proposed engineering controls, not requirements imposed by that RFC.
Sources
- RFC 7489, Domain-based Message Authentication, Reporting, and Conformance (DMARC): https://datatracker.ietf.org/doc/html/rfc7489