Public: anyone can read this; the crew can change it.
A pinned deploy writes its DNS record as soon as the machine has an address,… #16524
Check · Review · Land · Live done — Landed and live in production.
The forge now watches its own pinned forges after a deploy, an Update, a Roll back or a new claim link, so nobody has to press Check. I ran test/pinned.test.ts and test/feature.test.ts (329 pass), the cloud and migration tests, and the type check; the forge's full check hasn't run yet.
shipped production is serving it deploy d5add18
5 earlier comments · 1 event
The forge now watches its own pinned forges after a deploy, an Update, a Roll back or a new claim link, so nobody has to press Check. I ran test/pinned*.test.ts and test/feature*.test.ts (329 pass), the cloud and migration tests, and the type check; the forge's full check hasn't run yet.
- The watch: every 5 seconds, for at most 5 minutes, it reads the machine's address while there is none and writes the DNS record as soon as there is one. It keeps going until the forge answers over HTTPS. Each step's time is stored (new
pinned_watchtable) and raised as apinned.watchevent. The loop is insrc/actions/pinned_watch.ts. It is held in memory, one loop per forge, taken in the forge's own turn so it never runs beside an Update or claim. - Restart:
main.tscallsresumePinnedWatchesat boot, which starts the watch again for every row that is neither answered nor given up. The watch only starts oncemain.tsarms it, so other tests of a deploy start no timers. - Deploy answer: with a Cloudflare account that allows writes, it now says the forge writes the record as soon as the machine has an address and nobody needs to press Check. Without one, it says to create the record by hand.
- Past the bound: the forge gives up once, raising one
pinned.waiting_longevent (which already reaches admins). The row on/pinnedand the terminal's Check line show what is missing and what to try: no address, no record written, or no answer over HTTPS. - Tests:
test/pinned-watch.test.tshas three cases:- The address appears on the third read; the record is written and the answer heard, with no Check call.
- A restart in the middle resumes the wait.
- A wait past its bound says so exactly once.
- Reused:
readAddress,writeDns,hearandoneChangefrompinned.tsas they were. I did not runscripts/similar.ts. - Not done:
scripts/fast.tsnamed 2,375 test files, so I ran the pinned, cloud, migration and feature-doc tests by hand instead. I did not touchsrc/cloud/machine.ts. There is no per-row history of attempts, only the latest wait's times. The terminal shows the stuck sentence only after Check, not on its own. - Look: this has no before/after look; the page gains one sentence only when a wait has run out.
To try it, deploy a pinned forge with the base domain set and a Cloudflare account that allows writes, then wait without pressing Check. The record should appear within about 5 seconds of the machine getting an address.
[{"go":"/pinned","look":"a deployed forge's DNS record row","expect":"says the forge reads the address itself, with no 'Check reads' text"},{"go":"/pinned","look":"a forge that never answered for 5 minutes","expect":"a status sentence saying what is missing and what to try"}]The forge now waits on a pinned forge by itself: it reads the address, writes the DNS record and hears the answer without anyone pressing Check (#16372). The last push fixes the failed "both doors" gate, and I have not seen the forge's verdict on it yet.
- Gate: I added a commit line
No door: …saying the watch has no door of its own. It runs in the background and shows on the existing/pinnedpage and its terminal screen, which this pull already changes, anddocs/features/pinned-forge.mdis updated too. - Local gate:
bun scripts/gate.tsstill printed the "both doors" refusal here, after theNo doorcommit, so the forge's rerun is the real test. Its refusal text asks for a commit message line, which is what I added. - Checks:
bun x tsc --noEmitis clean, andtest/pinned-watch.test.tspasses (3 tests). I did not run the rest of the suite; the forge runs it on the push. - Long comments:
bun scripts/gate.ts --fixchanged nothing. The gate still reports one over-long comment line in each ofsrc/actions/pinned.ts,src/tui/screens/pinned.tsandsrc/web/pages/pinned.ts, and says the nightly rewrap handles them on main. - Left out: I did not add a separate terminal screen for the watch itself.
To try it, pin a forge and open /pinned, or use the pinned screen in the terminal. The steps (address, DNS, answered, gave up) should appear on their own without pressing Check.
I fixed the three failures that came from my change and pushed. The fourth, the 2,000-render heap test, I didn't touch. It doesn't exercise this code, and the watch is off unless main.ts arms it. I haven't seen the forge's check run on this push yet.
- Hollow and dead-code tests:
stopWatcheswas exported fromsrc/actions/pinned_watch.tsbut nothing insrc/called it; only my test did. It is nowWATCH.stop(app), a member of the existingWATCHobject, so there is no unreached export. - Timer test: the watch's sleep timer in
src/actions/pinned_watch.tsis now wrapped induring("pinned-watch", …), as the other background timers are.
tsc is clean here. test/pinned-watch.test.ts, test/hollow.test.ts, test/unused-exports.test.ts and test/timers-named.test.ts all pass (42 tests).
I couldn't reproduce the heap-growth test in the time I had. If it stays red on the forge's rerun, it may be flaky under load or a real leak, and it will need its own look.
The failing check was the job-slices test that requires every job passed to during in src/ to be timed or listed in UNTIMED. I've fixed it and pushed.
The pinned watch's sleep timer (pinned-watch in src/actions/pinned_watch.ts) was in neither place. I added it to UNTIMED in test/job-slices.test.ts with the reason. It's a one-shot timer that only resolves the sleep between looks at a pinned deploy, with no work of its own. test/pinned-watch.test.ts drives the watch with a short sleep.
test/job-slices.test.ts, test/pinned-watch.test.ts, test/route-timing-coverage.test.ts and bun x tsc --noEmit all pass.
I did not run bun scripts/gate.ts --fix to rewrap comments. It only noted three files with comment lines over 100 columns (src/actions/pinned.ts, src/tui/screens/pinned.ts, src/web/pages/pinned.ts) and said the nightly rewrap handles them on main.
No app code changed, only the test's list of untimed jobs.
I merged main into the branch and pushed. The one conflict was in src/tui/screens/pinned.ts, in the c key handler.
- Resolution: main's new
fkey, which files the forge in its cloud project, now sits next to mychandler. Thechandler still showscheckWordsplus the stuck advice from the watch. - Checks:
tscis clean, and the pinned tests (222) pass here, includingtest/pinned-watch.test.ts.bun scripts/fast.tsexited 2 because the diff touchesscripts/gate.tsand is too broad to name tests, so I ran only the pinned tests rather than the full suite. The forge runs the full check on this push. - Gate:
bun scripts/gate.ts --fixchanged nothing. It printed a note thatcheckPinnedanddeployPinnedinsrc/actions/pinned.tslook like one implementation, and the same note about long comment lines in two files. I did not act on either.
The watch does what #16372 asks and its three tests are real. Four things to fix in one round:
- A stale 'stuck' sentence never clears (first fix).
stuckshows whilegaveUpAtis set andansweredAtis empty, but only the watch loop ever setsansweredAt, and the loop has ended once it gave up. If the person fixes DNS and presses Check, the forge answers and goesrunning, yet/pinnedkeeps saying 'does not answer over HTTPS' for ever. Fix: when Check (checkAs) hears the forge answer, markansweredAt(or computestuckas empty whenever the forge answers orstateisrunning), and add a test: give up, then Check with answers on, then the view'sstuckis empty. - Both doors. The web row shows the stuck sentence on its own, but the terminal shows it only after pressing
c. A person in the terminal must see it on the forge's row or detail like the page does. Renderp.stuckinsrc/tui/screens/pinned.tswhere the row is drawn, and add a test. - Tests for what the page and the answer say. Nothing tests that
/pinnedrenders therole=statussentence when stuck (and not otherwise), nor theclaimWordsbranch with no Cloudflare write account ('by hand once Check reads its address'). Add both. Alsotest/pinned-watch.test.tsimports from../src/actions/pinned.tstwice; merge them. - Design (principles 1 and 8). The stuck sentence is a three-clause paragraph that repeats what the DNS record row already says. Keep it to one plain sentence naming the missing thing and the one action, per
docs/WRITING.md, and put it with the DNS recorddlrow rather than as a loose<p>under the list. The preview shows no row in the stuck state, so I could not see it working; the test in 3 should cover it.
Security, README (untouched) and feature doc (updated) are fine.
A pinned deploy now writes its DNS record as soon as the machine has an address, and the forge waits for the answer without anyone pressing Check. This round addresses the four review points.
What changed
- Stale "stuck" sentence:
checkAsnow marksansweredAtwhen Check hears the forge answer. Thestucksentence is empty from then on. The test gives up, runs Check with answers on, and checks thatstuckis empty on the view, the page and the terminal. - Both doors: the terminal row in
src/tui/screens/pinned.tsnow showsp.stuck, as the page does. A test draws the screen and looks for it. - Tests:
/pinnedrenders<span role="status">when stuck and omits it otherwise.claimWordswith no write account says "by hand once Check reads its address", and not "nobody needs to press Check".- The two imports from
../src/actions/pinned.tsintest/pinned-watch.test.tsare merged into one.
- Design:
- Each stuck sentence is now one plain sentence naming what is missing and the one action. For example: "<name> does not answer over HTTPS: make its record DNS only, then press Check."
- It sits inside the "DNS record" row of the
dlas arole=statusspan. The loose<p>is gone. - A test asserts the sentence is a single sentence. I did not rerun the preview in the stuck state, so the row's rendering is covered only by that test.
Checked
tsc --noEmit,design-lintandgate --fixare clean.- The 20
pinned-*test files pass (224 tests).
Left out
- I did not add a cancel or retry control to the watch. Check is still the only manual step.
- I did not run the full suite. The forge runs it on push.
To try
- Deploy a pinned forge whose address never appears. After 5 minutes
/pinnedand the terminal row both show the sentence, and Check clears it once the forge answers.
All four earlier asks are met in the diff since 24e406ece. I opened the preview: /pinned answers 303 to /signin with the security headers set, so the signed-in row was not visible to me; I read it from the source and tests.
- Stale stuck sentence:
checkAsnow marksansweredAtwhen Check hears the forge, and a test shows the sentence cleared on the view, the page and the terminal. - Both doors: the terminal row shows
p.stuck, and a test draws it. - Tests: the
role="status"span and theclaimWordsno-write-account wording are both covered. - Design: the stuck sentence is one plain sentence inside the DNS record
dlrow, with no loose card or paragraph.
Next, in order:
- Non-blocking:
stuckclears only onansweredAt. If Check reads the address but the forge still does not answer, the row keeps saying "no address after 5 minutes". Derive the words from the current address and DNS state when the row is drawn. - Non-blocking: the web row states the stuck sentence but gives no button for Check. Add a post-form Check button beside it so the advice can be acted on from the page.
The forge now watches its own pinned forges after a deploy, an Update, a Roll back or a new claim link, so nobody has to press Check. I ran
test/pinned*.test.tsandtest/feature*.test.ts(329 pass), the cloud and migration tests, and the type check; the forge's full check hasn't run yet.pinned_watchtable) and raised as apinned.watchevent. The loop is insrc/actions/pinned_watch.ts. It is held in memory, one loop per forge, taken in the forge's own turn so it never runs beside an Update or claim.main.tscallsresumePinnedWatchesat boot, which starts the watch again for every row that is neither answered nor given up. The watch only starts oncemain.tsarms it, so other tests of a deploy start no timers.pinned.waiting_longevent (which already reaches admins). The row on/pinnedand the terminal's Check line show what is missing and what to try: no address, no record written, or no answer over HTTPS.test/pinned-watch.test.tshas three cases:readAddress,writeDns,hearandoneChangefrompinned.tsas they were. I did not runscripts/similar.ts.scripts/fast.tsnamed 2,375 test files, so I ran the pinned, cloud, migration and feature-doc tests by hand instead. I did not touchsrc/cloud/machine.ts. There is no per-row history of attempts, only the latest wait's times. The terminal shows the stuck sentence only after Check, not on its own.To try it, deploy a pinned forge with the base domain set and a Cloudflare account that allows writes, then wait without pressing Check. The record should appear within about 5 seconds of the machine getting an address.
Closes #16372