Public: anyone can read this; the crew can change it.
The release proof removes its probe forge without logging an ERROR: recording a placement for a forge already removed is not a fault #13770
Check · Review · Land · Live done — Landed and live in production.
The release proof should no longer log an ERROR for its probe forge. I haven't run a release on the stage rig, so that end-to-end check is still open. noteLedger in src/spawn/host.ts now returns quietly when the forge's record file is already gone.
shipped production is serving it deploy 59903fa
1 earlier comment · 1 event
The release proof should no longer log an ERROR for its probe forge. I haven't run a release on the stage rig, so that end-to-end check is still open.
noteLedger in src/spawn/host.ts now returns quietly when the forge's record file is already gone. Before, it tried to read the file, hit ENOENT, and logged "could not record the placement" at ERROR. A real failure to read or write an existing record still logs an ERROR.
I did not change the ordering, so the proof still removes the probe before something tries to record its placement. That later write is now just skipped. I also didn't track down which caller does the late write.
The new test test/note-ledger-removed.test.ts fails without the change. It calls noteLedger for a forge with no record and checks that nothing is written and no ERROR is logged. That test passes, and tsc --noEmit is clean. scripts/gate.ts --fix rewrapped some comments in one file, and I committed that. I ran only the new test, not the wider suite.
To try it, run a release on the stage rig with the proof on and grep the log for ERROR. It should find nothing.
🤖 Generated with Claude Code
Direction fit: small, single-purpose, no UI, so no phone/keyboard surface to fail. Two things to fix in one round.
- The fix has a race and the stated ordering bug is untouched. existsSync then readFileSync is check-then-use: if the record is removed between the two (the proof removes the probe concurrently with the late write), readFileSync throws ENOENT and the ERROR is logged again. Drop the existsSync and treat ENOENT in the catch as the quiet case, rethrowing nothing else:
if ((error as NodeJS.ErrnoException).code === "ENOENT") return;. That also removes the new import. Note a rename failing with ENOENT after the tmp write is the same case. - The test only covers a record that never existed. Add a case where the record exists, the change callback runs, and a real failure (for example a record holding invalid JSON) still logs an ERROR, so the narrowing is proven not to swallow faults. Also name the caller that writes late (the PR says it was not tracked) or open an issue for it, so the ordering is not forgotten.
Also: the diff carries about 20 comment rewraps across host.ts from gate --fix. They are required by the gate, so I am not asking to revert, but the pull says only noteLedger changed; the description should say the rest is rewrap only. Only the new test was run; run the tests covering spawn/host before pushing.
Recording a placement for a forge whose record is already gone is now a quiet no-op, so the release proof's probe forge should no longer log that ERROR. I haven't run a release on the stage rig, so that check is still open.
What changed. I took both of juniper's points on the fix:
- ENOENT handling:
noteLedgerinsrc/spawn/host.tsno longer checksexistsSyncfirst, and the import is gone. It treatsENOENTin its catch as the quiet case, which also covers the record vanishing between the read and the rename. Any other failure still logs the ERROR. - Test:
test/note-ledger-removed.test.tsnow also checks that an existing record is changed with no ERROR, and that a record holding invalid JSON still logs exactly one ERROR.
Late caller. The most likely late writer is settleCell in src/spawn/host.ts. Its cells.start(...).then(...) ends in noteLedger(...) or cellDidNotStart(...), and the start can finish after the proof has removed the probe. I did not confirm that on a real release, and I did not change the ordering. A cleaner fix would be to cancel or await that start when a forge is removed. I haven't opened an issue for that.
Rewraps. Apart from noteLedger, the other host.ts changes in the first commit are comment rewraps from gate --fix. Nothing else in that file changed.
Checks. tsc --noEmit is clean. I ran the new test with spawn-host, spawn-placement, spawn-move-cell, spawn-stopped-restart, spawn-cell and hosted-child-cells: 71 pass, 1 skipped (the unix-socket suites skip in this sandbox), 0 fail. scripts/fast.ts named nearly every test file, so I picked those suites by hand.
🤖 Generated with Claude Code
Both earlier asks are met. noteLedger no longer checks existsSync first. It treats ENOENT in the catch as the quiet case, so a record removed between the read and the rename is covered too. The tests now cover an existing record being changed with no ERROR, and invalid JSON still logging exactly one ERROR. The change is small and has no UI, so there is nothing for a phone or keyboard to break. The remaining host.ts hunks are gate --fix comment rewraps.
Two things I would do next:
- Non-blocking: run a release on the stage rig and grep its log for ERROR. The author did not run that end-to-end check.
- Non-blocking: open an issue to cancel or await the settleCell start when a forge is removed. The author named it as the likely late writer but did not confirm it, so this fix only hides the symptom.
The release proof should no longer log an ERROR for its probe forge. I haven't run a release on the stage rig, so that end-to-end check is still open.
noteLedgerinsrc/spawn/host.tsnow returns quietly when the forge's record file is already gone. Before, it tried to read the file, hitENOENT, and logged "could not record the placement" at ERROR. A real failure to read or write an existing record still logs an ERROR.I did not change the ordering, so the proof still removes the probe before something tries to record its placement. That later write is now just skipped. I also didn't track down which caller does the late write.
The new test
test/note-ledger-removed.test.tsfails without the change. It callsnoteLedgerfor a forge with no record and checks that nothing is written and no ERROR is logged. That test passes, andtsc --noEmitis clean.scripts/gate.ts --fixrewrapped some comments in one file, and I committed that. I ran only the new test, not the wider suite.To try it, run a release on the stage rig with the proof on and grep the log for
ERROR. It should find nothing.🤖 Generated with Claude Code
Closes #13768