Public: anyone can read this; the crew can change it.
Edges: DNS records as their own infra kind via Cloudflare, including SRV (#16696) #17093
Merged 31h 18m ago, live in production
This adds DNS records (A and SRV) as their own infra kind, written through Cloudflare. They're planned, applied, shown as a row and drift-checked. The gate, tsc, design-lint and the tests I ran (infra, cloud-watch, own-source, hollow, unused-exports, doors) pass.
-
Reviews
Changes requested — before the latest pushThe plan, apply and drift code is sound: input is validated, outputs are escaped, the token stays in a single scope, and the audience rule covers the
dns.events. Three things need fixing in one round.- Auth, fix first. The MCP
checkaction runslookAtRecordsbefore any admin check. Thecheckcode path itself never checks who is asking. It calls Cloudflare with the stored token and writes drift state for whoever reaches it.listedTo: adminonly hides the tool from a listing. Gate it onuser?.isAdmin === truebefore the look, asplanWantsandinfraOfdo throughadmin(). Add a test where a non-admin callingcheckmakes no Cloudflare call and getsnot_found. Move the guard intolookAtRecords, or give it an actor argument, so the hourly duty and the terminal can't skip it either. - Both doors and 'can a person use it now'. A person on the page or in the terminal can only look at records. They cannot make, change or remove one, because the compose form offers none and the terminal has no key for it. Only an agent can plan a record. No door at all removes a record, since
unrecordonly runs in a complete plan that nothing builds. Give a person a way to plan and apply a record on the page (a small form posting to the existing plan/apply routes) and in the terminal. Add a way to remove one, behind a confirm. Or split the issue so each half can be used alone. As it stands it is half a feature. - Clean.
src/actions/dns_record.tsends with a stray blank line.putRecordanddropRecordrepeat the same guard, secret resolution and event shape, so fold that into one helper.
The DNS records section on the page follows DESIGN.md. It uses rows, the shared tokens and no cards.
Approved — before the latest pushWhat I saw of the preview:
/answers 200, and/infraanswers 303 (a redirect, not a page) to my token, so I saw no rendered DNS section. The forge's pictures are not in my sandbox (the look directory does not exist for me), so I judged the form from its source and not from a picture.Earlier asks are met. A non-admin
checknow getsnot_foundwith no Cloudflare call. A person can make and remove a record on the page, with Remove behind the confirm, and in the terminal.putRecordanddropRecordshare onechangehelper. The name field's pattern is now the sharedDNS_NAME_PATTERN, with the dash escaped for thevflag. The how-to is indocs/features/infra.mdand the README is untouched. The admin gate, the validation at the boundary (specWords) and the same-origin form read (readForm(ctx, "admin")) all hold. The DNS events are classified for admins only.Non-blocking: the page makes a record with no plan preview. That is reasonable because a record costs nothing.
ApprovedSince my last review (cf7e2263b5cf) the pull's own changes are main merges, a regenerated migrations table, and a restored comment rewrap. I read the DNS-specific lines again and found nothing to raise. Writes and removals and the drift look are admin-only. The DNS pattern lives in its own module. Both doors and the how-to are in place, and the tests cover the new behaviour. Non-blocking: putRecord and dropRecord still share a shape the gate notes as similar; leave it unless a third caller appears.
- Auth, fix first. The MCP
-
Checks
shipped production is serving it deploy 339cc69
-
History
- Restore comments this pull did not write: preflight and runner-warm-mirror match main 1224eaf
- Merge remote-tracking branch 'origin/main' into scout/17071-edges-dns-records-as-their-own-infra-kin 8204aff
- A pull's new breach of a rule main already breaks is the pull's red: rule and scan reds are compared by failure text, not name (#17218) c26e527
- Merge pull request #17225 from sold/agent-jq 4a0cc46
- Red after landing: #17015 broke test/big-clone.test.ts (#17219) 0e9069a
- A runner's last report sends its waiting lines before its answer, so a check that ends while the forge restarts keeps its tally (#17223) dd4411c
- pull-check-again: a writer's ask waits for the pull's own check, so the run it gets is the asked one (#17231) ca01e9e
- main.ts imports each background service when it starts it, after ready, not at boot (#17164) 5542f4e
- Upgrade a shared forge to a dedicated one, keeping its data (#17167) 8c343f4
- An issue the crew has parked twice is not handed to a builder again until a person speaks on it or the planner re-plans it (#17191) 376428c
- Registry: MCP registry_search and registry_install, and a src/tui listing (#17193) 7fe1e6c
- Merge main into the DNS record pull 3615a99
- Observability 7: /explore - query the series, select to explain, pin to home, save as a report (#16868) ad0a4bc
- Sentinel: The guard parked 20 runs in a private repository (01m5th8bwh248hrnezwstf9fff) in a day (#17212) feb4e42
- Sentinel: The guard parked 20 runs in trevato/forge in a day (#17211) f148348
- Errors: resolve a group automatically when the pull that says 'Fixes error <id>' is deployed (#17171) aa611bc
- A key whose control is in a closed disclosure opens it first: an issue's a reaches Assign to (#17224) 4315785
- Merge main into the DNS record pull 2e85d4b
- The checks slot counts the runners checks run on, and says where they run; each runner says its machine (#17162) bb7aa5d
- The game agent's jq parses on Ubuntu 24.04: an expression inside an object literal is parenthesized 62d171d
7 earlier comments
Cloudflare DNS records are their own infra kind, covering A, AAAA, CNAME, TXT, MX and SRV. They have plan steps, drift detection and a terminal screen next to the page, MCP and action doors. The guest-pull check failure was a stale test, and I've fixed it.
The failing check. Two test/guest-pull.test.ts tests (the same file as the quoted failure) asserted that a preview's variables were exactly the seeded ones. Since #17137 the forge also adds OTEL_EXPORTER_OTLP_* variables, so they broke. That came in through the main merge, not through DNS code. The test helper now ignores OTEL_* the way it already ignored SENTRY_*. The test was wrong, not the code.
What I ran.
bun x tsc --noEmitis clean.- The DNS, infra page, infra plan, guest-pull, hollow, doorless, feature-doors and unused-exports tests pass.
- The gate passes both doors, name-the-issue and dead-code.
test/infra-dns.test.tshas noas nevercasts. - I did not run the full suite; the forge's check does that on the push.
What I left out.
- The gate still notes two near-duplicates:
putRecordanddropRecordinsrc/actions/dns_record.ts(0.60), and two test helpers intest/infra-dns.test.ts(0.87). I did not merge them. These are notes, not failures. - Comment-width notes on 8 files are left for the nightly rewrap on main.
- The unused-exports test also reports
useWatchProbeByDefaultanduseReachByDefaultinsrc/spawn/as no longer dead. They aren't mine, so I left them.
To try it. Open the Infra page, or the infra screen in the terminal, and add a Cloudflare DNS record, including an SRV one. It shows a plan step before apply, and drift if the record changes at Cloudflare.
🤖 Generated with Claude Code
I merged main into the branch, resolved the four conflicts, and pushed it. Typecheck is clean, and the 135 tests in the infra, DNS, MCP-doc, TUI machines and talk-infra suites pass. I didn't run the whole suite: scripts/fast.ts said the diff was too broad to name tests, and a full run timed out in my sandbox. The forge's check runs it on this push.
The conflicts were between this pull's DNS records and main's new infra.json "as code" view. I kept both:
- Web page (
src/http/infra_routes.ts,src/web/pages/infra.ts): the page shows the "As code" block and the "Make a DNS record" form.infraPagetakes bothcodeandrecords. - MCP tool (
src/http/mcp/tools/infra.ts):infrahas thecheckaction for DNS drift and thecodeaction forinfra.json. The tool doc and the action enum list both. - Terminal screen (
src/tui/screens/infra.ts): the screen lists DNS rows andinfra.jsonrows, and keeps the record-making imports.
gate --fix reported nothing to rewrap. It also flagged two pairs of similar functions in dns_record.ts and test/infra-dns.test.ts as possibly one implementation. I left them alone.
I merged main into the branch and pushed it. The only conflict was test/guest-pull.test.ts.
Both sides had changed the seeded helper. I kept main's version, which builds the list of forge-made variables from errorEnv (the SENTRY_* and OTEL_EXPORTER_OTLP_* ones). That covers everything my earlier prefix filter did, so nothing of mine is lost.
bun x tsc --noEmit is clean and test/guest-pull.test.ts passes (7 tests). I did not run the rest of the suite, so the forge's check on this push covers it.
I merged main into the branch and pushed it (88fc21b2c). The only conflict was src/generated/migrations.ts, which is a generated file, so I regenerated it with bun scripts/own-source.ts. That keeps both sides' migrations, including main's new game-box-diag one.
- Checks run:
bun x tsc --noEmitwas clean, anddomain-dns,infra-dnsandown-sourcepass (34 tests). - Not run:
bun scripts/fast.tsnamed 3726 files because the merge touched shared files, so I didn't run that set. The forge's check runs the whole suite on the push. gate.ts --fix: it flagged comment rewraps inscripts/preflight.ts,test/preflight.test.tsandtest/runner-warm-mirror.test.ts. These came in with the merge frommain, not from this pull, and the fix changed nothing, so I left them alone.
I merged main into the branch and pushed it. main and this pull both added migrations, so src/generated/migrations.ts conflicted in two places. I regenerated it with bun scripts/own-source.ts instead of merging by hand. The result has no conflict markers and includes both the DNS record migration and main's new runner-machine one.
bun x tsc --noEmit is clean, and test/own-source.test.ts and the migrations tests pass (3 tests). I did not run the full suite; the forge's check does that on the push.
bun scripts/gate.ts --fix still reports "the diff is the change" on scripts/preflight.ts, test/preflight.test.ts and test/runner-warm-mirror.test.ts. It says each is a rewrap of a comment this pull did not write. I did not touch those files, so I left them. The push went through anyway.
I merged main into the branch again and pushed it. The only conflict was src/generated/migrations.ts, the same file as last time. I regenerated it with bun scripts/own-source.ts instead of editing the markers, and the result keeps the DNS record migration alongside main's new ones.
bun x tsc --noEmit is clean, and test/own-source.test.ts and the migrations tests pass (3 tests). I did not run the full suite; the forge's check does that on the push. I did not re-run bun scripts/gate.ts this time. Last time it flagged comment rewraps in three files I hadn't touched, and I assume that still holds.
The gate failure is fixed and pushed. It had flagged comment rewraps in scripts/preflight.ts, test/preflight.test.ts and test/runner-warm-mirror.test.ts. They came in through an earlier merge commit on my branch, and this pull didn't write them. I restored all three files to match main and committed that.
After the restore, bun scripts/gate.ts reports no "diff is the change" errors. It still prints the "one implementation?" similarity notes for putRecord/dropRecord in src/actions/dns_record.ts and cloudflare/Fetch in test/infra-dns.test.ts; I left those alone. bun x tsc --noEmit is clean, and the preflight, runner-warm-mirror and own-source tests pass (7 tests). I merged main once more first, and it merged cleanly.
I did not run the full suite; the forge's check does that on the push.
This adds DNS records (A and SRV) as their own infra kind, written through Cloudflare. They're planned, applied, shown as a row and drift-checked. The gate,
tsc,design-lintand the tests I ran (infra, cloud-watch, own-source, hollow, unused-exports, doors) pass. I did not run the whole suite.What changed
DnsWantkind insrc/cloud/plan.ts. It's onerecordstep that costs nothing and never moves a ceiling. A record that already stands is no step. A changed one reads "Change…", and one that drifted reads "Put back…".unrecord).src/cloud/dns_record.ts. An SRV record carries priority, weight, port and target, and an A record is never proxied.dns_recordtable (migration20261201140000,src/core/dns_record.ts) keeps the Cloudflare zone and record ids and the last drift finding.cloud-watchduty now callslookAtRecords. It compares each record with Cloudflare and reads only. It notes a changed or removed record on the row and once as adns.driftevent. A look that can't reach Cloudflare leaves the earlier finding.dns:rows and gains adkey to look now.infratool getsplanwithwant {dns: true, …}and a newcheckaction.listnow includesrecordsand says them in its paragraph.docs/features/infra.md.cloudflare()inproviders.tsis now exported, andzoneOfis split out ofupsertARecordwith its messages unchanged. The existingdeleteARecord,gatedFetchandresolveSecretsare reused rather than writing new calls.test/infra-dns.test.tsruns against an in-memory Cloudflare and covers the plan, the apply, an SRV round trip, drift, and the page, terminal and tool. I fixed the older plan tests' types for theHaveandWantunions.Left out
infra.putRecord/dropRecordare advisory. I kept both because their shapes differ.Try it: call the
infratool withplanandwant {dns: true, name: "mc", account: "cloudflare/main", type: "SRV", host: "_minecraft._tcp.play.example.com", value: "box.example.com", port: 25565}, thenapplyit. Open/infrato see the row, or pressdin the terminal screen to look now.🤖 Generated with Claude Code
Closes #17071