Keep classroom names resolving while moving DNS administration off a registrar-specific API. The least complex safe starting point is an explicit inventory of the records being moved, followed by a separate cleanup decision. A school leaving an application does not establish that every record in its DNS zone can disappear.
Short answer: delete only explicitly owned records when offboarding from a shared zone. Consider removing an entire old zone only after confirming exclusive ownership, completing the authority transition, and checking that remaining dependencies no longer need it. For an edtech migration, the useful trade-off is cutover speed versus the time cached DNS answers can remain in use. A successful API response doesn't prove that transition has finished.
This walkthrough uses three gates: ownership, transition evidence, and deletion scope. The data flows from an inventory into a proposed action, through a small local policy check, and finally to an executor that rechecks the live state. Keep those gates outside the prompt. A classroom assistant can explain the result, while a deterministic check decides whether a destructive operation is eligible.
Make the proposed deletion executable as a local check
Start in a notebook with a deliberately small fixture. Here, a school has a classroom endpoint and a mail-policy record in a zone that also serves another school. These are invented example identifiers and planning values, not observations from a production migration. The example evaluates a proposal; it makes no network calls and deletes nothing.
from dataclasses import dataclass @dataclass(frozen=True) class Record: key: str tenant: str purpose: str def evaluate(records, tenant, requested, action, exclusive, transition_verified, mail_retired): inventory = {record.key: record for record in records} if action not in {"delete_records", "remove_zone"}: return False, "Unknown action" if not transition_verified: return False, "Transition evidence is missing" if action == "remove_zone": if not exclusive or any(r.tenant != tenant for r in records): return False, "Zone ownership is not exclusive" selected = records else: if not requested or not set(requested) <= inventory.keys(): return False, "Explicit known record keys are required" selected = [inventory[key] for key in requested] if any(r.tenant != tenant for r in selected): return False, "Requested records cross tenant ownership" if not mail_retired and any(r.purpose == "mail" for r in selected): return False, "Mail retirement evidence is missing" return True, "Eligible for executor recheck" records = [ Record("classroom.school-a.example|A", "school-a", "app"), Record("_dmarc.school-a.example|TXT", "school-a", "mail"), Record("classroom.school-b.example|A", "school-b", "app"), ] checks = [ ("delete_records", [records[0].key], False, True), ("remove_zone", [], False, True), ("delete_records", [records[1].key], False, True), ("delete_records", [records[0].key], False, False), ] results = [ evaluate(records, "school-a", keys, action, exclusive, verified, False) for action, keys, exclusive, verified in checks ] assert [allowed for allowed, _ in results] == [True, False, False, False] for allowed, reason in results: print(allowed, reason) The first proposal passes the local policy. The next three stop at shared ownership, mail retirement, and missing transition evidence respectively. That's a useful notebook-to-prod boundary: the same decision function can travel with the service, and the adapter around it can change as the registrar API is replaced.
There's an intentional limit here.
Record keys stand in for identifiers from a complete inventory. An executor needs actual record-set boundaries, current values, and an ownership mapping that doesn't come from guessing at a hostname prefix. If two schools share one record set, a tenant-level delete proposal needs a narrower representation before it can pass review. Don't delete the whole set because one value belongs to the departing tenant.
Should domain offboarding delete records or remove the whole zone?
Only when the evidence supports a zone-sized action. Treat an unverified or incomplete inventory as a reason to stop. The exclusive flag above is an input to policy, not a discovery mechanism; in a deployed service, it should be derived from reviewed inventory and dependency evidence, with the review tied to the exact zone being changed.
Scope comes first.
For the school migration, distinguish leaving an application from leaving a DNS host. Leaving the application may require retiring its classroom record while preserving mail and other school services. Leaving the old DNS host may require copying those same records to the destination and retaining them there. Deleting source records is cleanup after that migration, not a substitute for it. Keep registration changes, authoritative DNS changes, and application retirement as separate proposed actions so one API permission cannot silently stand in for the others. The whole-zone option reduces the amount of individual cleanup work, but it expands the consequence of a mistaken ownership assumption. Selective deletion takes more inventory work and lets the operation stay inside a smaller verified scope. For a shared school zone, that extra work buys a concrete property: unrelated classroom names stay outside the requested change.
Faster API cutover does not shorten a cached answer's lifetime
DNS caching makes the timing decision more interesting than an API migration checklist suggests. RFC 1034 and RFC 1035 describe caching and TTLs; they do not provide a universal propagation deadline for a particular school's migration. Lowering a TTL now cannot retroactively shorten the lifetime of an answer already cached under its earlier TTL.
Suppose the migration fixture has an old record TTL of 3,600 seconds and a proposed TTL of 300 seconds. Those are planning inputs. Waiting only 300 seconds immediately after changing the TTL would ignore answers cached under the previous value. Also track delegation and negative-cache behavior separately; an application record's TTL alone is not sufficient evidence that every relevant lookup path has moved.
That is where speed has a cost in operational complexity. An earlier cutover needs a longer period in which old and new serving paths remain compatible. A slower cutover gives more room to gather evidence before cleanup, but keeps the migration open longer and demands discipline about changes to both inventories. Choose the schedule around acceptable classroom disruption and the evidence available, rather than treating a short TTL as a promise.
For an AI tutoring application, keep a DNS cutover probe separate from the tutoring eval. Test name resolution and a representative application request before spending tokens on a full RAG answer. Otherwise, failed connectivity can consume prompt budget without telling you anything useful about retrieval quality. The migration's success criterion should include the classroom path working through the intended destination, with observations recorded at specific times and from relevant resolver paths.
Preserve mail policy until its dependency is resolved
Mail deserves its own gate even when the classroom frontend has already moved. RFC 7489 describes DMARC policy discovery through DNS, including the _dmarc name and Organizational Domain policy discovery. Removing a policy record can change the policy receivers discover; an application offboarding event alone does not establish that the school's mail dependency has ended.
In the fixture, mail_retired=False deliberately blocks deleting the mail-policy entry. A real migration needs evidence from the mail owner, or evidence that the required policy has been preserved at the destination. Do not infer mail retirement from a successful classroom endpoint test. They answer different questions.
Carry the gates into the deployment runbook
Before execution, capture the source inventory and the intended destination state, identify every shared dependency, and record the approved scope. Associate transition evidence with that specific proposal. A free-floating boolean is convenient for a notebook fixture; deployment needs a reviewable record of what was checked, when, and against which inventory.
Then re-read the live records.
If they differ from the approved snapshot, stop and rebuild the proposal. Where the API supports conditional writes, use them to protect the check-to-change interval; otherwise document how concurrent edits are controlled. After a timeout, inspect current state before retrying a destructive request.
An uncertain response is insufficient evidence of either success or failure.
Keep a small eval harness around these decisions: shared ownership must block whole-zone removal, foreign record keys must fail, missing transition evidence must fail, and active mail dependencies must survive application cleanup. Add cases from the actual inventory model before connecting an executor. Record the proposal, decision, execution result, and follow-up DNS observations so an operator can reconstruct what happened without reading an assistant's conversation history.
Finish by verifying both the departing school's intended state and the remaining school's classroom path. Retain the inventory needed for recovery, while recognizing that restoring records also interacts with caches. Close the migration when the evidence supports closure. For shared zones, the default remains selective, verified cleanup; whole-zone removal requires a separate, stronger case.
References
The DNS specifications support the caching and authority discussion. The mail-policy section uses the DMARC specification; negative caching has its own DNS specification.
Further reading
- RFC 1034, Domain Names—Concepts and Facilities: https://datatracker.ietf.org/doc/html/rfc1034
- RFC 1035, Domain Names—Implementation and Specification: https://datatracker.ietf.org/doc/html/rfc1035
- RFC 2308, Negative Caching of DNS Queries: https://datatracker.ietf.org/doc/html/rfc2308
- RFC 7489, Domain-based Message Authentication, Reporting, and Conformance: https://datatracker.ietf.org/doc/html/rfc7489
