iterate.com / kernel

git clone https://git.iterate.com/repos/kernel

deploy: the zone's protocol settings are written before the erase of a domain's records

The reviewer's read of pull 25: a write that Cloudflare refused came after the erase, and left a domain in use with no records and no mind.

Session: claude 43d5b6fd-f237-4950-852b-07316816fe13 on beelink

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013me8fU1WnM35S6E9K79ywj

Jonas Templestein, 2026-11-27 14:24 UTC · bffdba838e26cee6265ba6d5be1e93aa840cc288 · parent 1869162

2 files changed

M core/lib/src/cli/README.md
@@ -144,9 +144,10 @@
    there and asks before it goes on. With your yes (or `--erase-records`) it erases every DNS
    record and Workers route of that domain, right before the deploy and after every other check.
    Every run, a new mind's and a later one's, leaves each domain of the mind with HTTP/3 on and
-   0-RTT Connection Resumption off: it reads both settings and writes one that differs, right
-   before the deploy ([zone-protocols.ts](zone-protocols.ts) says why). `--plan` says what a
-   deploy would turn, and writes nothing.
+   0-RTT Connection Resumption off: it reads both settings and writes one that differs, before
+   the deploy and before it erases anything ([zone-protocols.ts](zone-protocols.ts) says why).
+   The settings are the whole domain's. `--plan` says what a deploy would turn, and writes
+   nothing.
 4. **Telemetry: no token.** The deploy makes no telemetry tables (`events`, `logs`, `spans`), and
    no bucket or Pipelines stream for them. The mind reads Cloudflare's own datasets and `metrics` through
    `itx.telemetry.query`, with no token (`onboarding/telemetry.md` of `/repos/onboarding`). A mind
M core/lib/src/cli/deploy.ts
@@ -3339,7 +3339,7 @@
     writeFileSync(configFile, `${JSON.stringify(deployedConfig, null, 2)}\n`);
     access = await renewed();
     // HTTP/3 on and 0-RTT off on each zone of the mind (./zone-protocols.ts): read at every run,
-    // and written right before the deploy
+    // and written before the deploy, and before anything of the domain is erased
     const protocolChanges = await zoneProtocolChanges(cf, account.id, config.cloudflare.zones);
     if (input.plan) {
       for (const change of protocolChanges) p.log.info(protocolChangeLine(change, false));
@@ -3367,14 +3367,15 @@
       p.outro(`Nothing was changed. Done in ${seconds(began)}.`);
       return;
     }
+    // before the erase: a write that Cloudflare refuses stops the run with the domain as it was
+    await setZoneProtocols(cf, protocolChanges);
+    for (const change of protocolChanges) p.log.success(protocolChangeLine(change, true));
     if (holdings) {
       const erased = await eraseHoldings(cf, zone.id);
       p.log.success(
         `Erased ${erased.records} DNS records and ${erased.routes} Workers routes of ${domain}.`,
       );
     }
-    await setZoneProtocols(cf, protocolChanges);
-    for (const change of protocolChanges) p.log.success(protocolChangeLine(change, true));
     const deployBegan = Date.now();
     const deploying = wait(`Deploying the mind at ${c.domain(controlPlaneHostname)}`);
     const progress = createDeployProgress();