DEV Community

CrimsonWave9361502
CrimsonWave9361502

Posted on

Mail Routing Drift During Third Party Service Verification TXT Changes in Education

An education company's domain ownership check should have a smaller change boundary than its mail migration. Keep the intended MX records explicit, approve the verification TXT change separately, and compare the published result with both intentions. Short answer: preserve other services' entries unless their owners have approved a specific removal; a verification success alone is insufficient evidence that company mail still points where intended.

The useful engineering question is what changed between intent and publication. A school operations team may be connecting company mail while another team completes a third party ownership check on the same domain. Treat those as separate decisions, even when they share a deployment. This walkthrough uses an illustrative education domain and a local snapshot comparison to make that boundary executable. No production incident or measured result is implied.

How should third party verification TXT records preserve existing mail settings?

For this workflow, the approved change is one additional TXT value. The intended MX set is a separate input. Existing verification values remain protected, and the mail authentication policy has its own owner. This creates a useful rule for choosing a management workflow: it must expose individual record changes clearly enough to detect an unrelated deletion. A screen that merely says the domain is verified cannot answer that question.

The data flow is straightforward. Capture the approved starting records, describe the requested addition, obtain the intended mail destination from the mail change owner, and collect the published records through a separate observation step. Compare those inputs before declaring the change complete. Keep the observation time and collection method with the result, because a comparison without a known observation boundary is hard to interpret later. The example below starts after collection; its inputs are deliberately small, already normalized snapshots.

Keep TXT values exact.

That matters for ownership evidence: an unfamiliar string is not a reason to rewrite or delete it. RFC 7489 also gives a concrete example of why TXT content needs interpretation rather than a blanket cleanup policy. DMARC publishes policy using TXT records under a designated owner name, and its policy discovery procedure specifies how to handle candidate records. In particular, multiple remaining DMARC policy records cause policy discovery to terminate without applying DMARC processing. That rule belongs to DMARC; it is not a universal rule that a domain may have only one TXT value.

Turn the intended change into an executable check

Here is a runnable Python example using only the standard library. Every record and token is illustrative. The fictional starting snapshot contains two existing ownership values, one mail policy value, and one intended mail destination. The observed snapshot represents an accidental replacement of an existing ownership value during the new service's verification.

The record tuple is an internal comparison format: owner name, record type, and value. It is not a DNS response parser or a zone file format. Its inputs must already use consistent owner names and MX representations; TXT values retain their exact content.

from dataclasses import dataclass


@dataclass(frozen=True, order=True)
class Record:
    owner: str
    kind: str
    value: str


zone = "academy.example."
mail = Record(zone, "MX", "10 mx.mail.example.")
existing_a = Record(zone, "TXT", "service-a-proof=sample-a")
existing_b = Record(zone, "TXT", "service-b-proof=sample-b")
policy = Record("_dmarc.academy.example.", "TXT", "v=DMARC1; p=none")
new_proof = Record(zone, "TXT", "service-c-proof=sample-c")

before = {mail, existing_a, existing_b, policy}
approved_additions = {new_proof}
approved_removals = set()
intended_mx = {mail}

# This fixture models an unintended deletion during publication.
observed = {mail, existing_b, policy, new_proof}


def inspect_change(before, observed, additions, removals, intended_mx):
    if not removals <= before:
        raise ValueError("An approved removal is absent from the baseline")
    if additions & removals:
        raise ValueError("An entry cannot be both added and removed")
    expected = (before - removals) | additions
    published_mx = {r for r in observed if r.kind == "MX"}
    return {
        "missing": sorted(expected - observed),
        "unexpected": sorted(observed - expected),
        "mx_matches_intent": published_mx == intended_mx,
    }


result = inspect_change(
    before, observed, approved_additions, approved_removals, intended_mx
)
assert result["missing"] == [existing_a]
assert result["mx_matches_intent"]
print(result)

# An intact publication satisfies both checks.
intact = before | approved_additions
passing = inspect_change(
    before, intact, approved_additions, approved_removals, intended_mx
)
assert not passing["missing"]
assert not passing["unexpected"]
assert passing["mx_matches_intent"]
Enter fullscreen mode Exit fullscreen mode

The first comparison catches a specific pitfall: the new TXT value exists and the MX records match, yet a different service's ownership value has disappeared. A verification-only check would overlook the missing value. The second fixture establishes the desired passing behavior without contacting any external service.

This is a good notebook-to-prod boundary. Prototype the comparison with explicit fixtures, then keep that same comparison function when replacing the fixture with collected evidence. Collection, publication, and approval should remain distinct interfaces. The function does not publish changes, decide whether a service is still in use, or establish that a mailbox can receive a message.

Give cleanup a separate evidence threshold

Zone hygiene gets risky when an operator equates unfamiliar with obsolete. A token can look meaningless to the mail migration owner while remaining intentional for another team. Preserve it until someone can connect the exact owner name and value to a service, an accountable owner, and an approved disposition. If that connection is missing, record the uncertainty and assign a review instead of guessing.

For selection, favor workflows that can show the proposed before-and-after record sets and attach an owner to each requested deletion. This can be implemented with a reviewed change document and a small script. A larger system may justify a persistent inventory. The trade-off is additional review effort against the ability to explain why a particular value disappeared; choose according to how many independent teams can change the domain, rather than the attractiveness of a dashboard.

Keep mail policy review separate too. RFC 7489 defines DMARC policies including none, quarantine, and reject. The example uses p=none as fixture content, not as a deployment recommendation. An ownership check supplies no reason to change that policy. Any policy change should carry its own purpose and validation.

Deletion deserves evidence.

A useful inventory can hold the exact record identity, responsible team, reason for publication, approval reference, and next review date. Those fields are proposed operating conventions, not fields defined by the DNS protocol. A review date should trigger a decision about continued need; it should not automatically authorize removal. Where a service's continuing verification requirements are unknown, its current technical documentation and the responsible team's confirmation are the evidence needed to settle the question.

Keep the evaluation narrow enough to trust

An eval-driven workflow needs failure examples that reflect the change boundary. Retain the missing-other-service fixture above. Add cases for an unexpected MX change, an unapproved TXT addition, and an approved retirement. A clean comparison should mean that the collected record values match the approved intent within the declared scope. Keep that meaning precise.

The scope matters. This example has one domain, compares record values, and omits TTLs. It does not model an entire zone, DNS caching, mail delivery, or provider verification responses. Production collection must state which owner names and record types it examined. If the collector cannot obtain a complete observation for that scope, report an incomplete check instead of treating missing evidence as an empty record set. For a mail migration, add the mail team's own delivery acceptance criteria alongside the record comparison.

There is another boundary worth preserving for an AI application builder: exact record comparison needs no language model. Keep opaque TXT values out of summarization prompts unless the task actually requires them. If an assistant explains a failed comparison, feed it the minimum useful structured difference and retain the original evidence for review. This is prompt-cost aware by design: deterministic checks establish the result, while generated prose can help a person understand it. No claimed token savings are needed to justify that division of work.

The operational artifact can stay small: approved intent, timestamped observation, differences, and reviewer decision. Preserve the evidence that explains a failure, rather than only a green or red badge.

Close the change with a mail-focused handoff

Before publication, have the mail owner confirm the intended MX set and the verification owner confirm the exact TXT addition. Inspect every deletion against its approval. After publication, collect a fresh observation, compare it with the approved target, and record any collection uncertainty. Require both an intact record comparison and the mail team's acceptance evidence before closing the mail change.

If the comparison fails, pause completion and investigate the specific difference. Do not turn an unexpected value into an automatic cleanup action. Recheck the current published state before applying a correction so the response can account for intervening approved changes.

The decision rule is compact: a new ownership proof may coexist with existing entries, but each removal needs an explicit reason and the published mail routing must match its separate intent. That gives the education team a concrete way to select a workflow and a testable definition of completion.

Sources

References: RFC 7489 supplies the DMARC policy and discovery rules discussed above. The record inventory, comparison code, and handoff checks are an illustrative operating method.

Top comments (0)