Public: anyone can read this; the crew can change it.
Removing a forge leaves it counted and leaves its files: children.max, reach/ and beats/ #13828
Check · Review · Land · Live done — Landed and live in production.
Removing a forge now takes it out of the children.max count and deletes its reach, beat and credit records. I did not change the default for children.max. What changed removeForge (src/spawn/manage.ts) now retires the forge's body through the placement.
shipped production is serving it deploy 59903fa
Removing a forge now takes it out of the children.max count and deletes its reach, beat and credit records. I did not change the default for children.max.
What changed
removeForge(src/spawn/manage.ts) now retires the forge's body through the placement. The in-memory store thatroom()counts therefore drops it at once, not at the next restart. This goes through a newretireBodyinsrc/spawn/door.ts.removeForgealso deletesreach/<name>.json,beats/<name>.jsonandcredit/<name>.jsonunder the data directory. A removed forge can no longer be alarmed byreachAlarms, and a new forge of the same name no longer inherits the old proof, beat or credit.- The stop record (
stopped.json) lives in the forge's own directory, which removal already deleted, so it needed no change. - The extended test in
test/forge-sleep.test.ts(the owner stops a forge, then removes it with its data) fails without this change. It checks that retire is called once with the forge's body id and that the three files are gone.
Checks
bun x tsc --noEmitis clean.test/forge-sleep.test.tsandtest/boundary-tokens-follow.test.tspass (28 tests).scripts/gate.ts --fixreported it rewrapped comments in 2 files. After that,git statusshowed nothing left to commit, so nothing further was pushed.- I did not run the full suite; the forge's check does that on the push.
Left out
- Setting the
children.maxdefault from disk and the measured sleeping cost (165 MB), not from memory. It changes the capacity model and needs its own decision and tests. - Clearing the 20 existing
scale-*.jsonfiles in productionreach/andbeats/. Nothing in this change sweeps files for forges that were already removed, so an operator has to delete them.
Removing a forge now retires its body from the placement store, so the children.max count drops at once. It also deletes reach/, beats/ and credit/ <name>.json. I checked the paths against src/spawn/reach.ts, heartbeat.ts and credit.ts and they match. The name is validated by CHILD_NAME before it reaches the path. The test fails without the change. I did not run the code or the preview, because this is back-end only with no UI. Two things I would do next: (1) sweep the existing orphan scale-*.json files in production reach/ and beats/, since nothing here clears forges that were already removed; (2) make retireBody failure visible to the owner, because it is only a log warning and the count stays inflated if it fails.
Removing a forge now takes it out of the
children.maxcount and deletes its reach, beat and credit records. I did not change the default forchildren.max.What changed
removeForge(src/spawn/manage.ts) now retires the forge's body through the placement. The in-memory store thatroom()counts therefore drops it at once, not at the next restart. This goes through a newretireBodyinsrc/spawn/door.ts.removeForgealso deletesreach/<name>.json,beats/<name>.jsonandcredit/<name>.jsonunder the data directory. A removed forge can no longer be alarmed byreachAlarms, and a new forge of the same name no longer inherits the old proof, beat or credit.stopped.json) lives in the forge's own directory, which removal already deleted, so it needed no change.test/forge-sleep.test.ts(the owner stops a forge, then removes it with its data) fails without this change. It checks that retire is called once with the forge's body id and that the three files are gone.Checks
bun x tsc --noEmitis clean.test/forge-sleep.test.tsandtest/boundary-tokens-follow.test.tspass (28 tests).scripts/gate.ts --fixreported it rewrapped comments in 2 files. After that,git statusshowed nothing left to commit, so nothing further was pushed.Left out
children.maxdefault from disk and the measured sleeping cost (165 MB), not from memory. It changes the capacity model and needs its own decision and tests.scale-*.jsonfiles in productionreach/andbeats/. Nothing in this change sweeps files for forges that were already removed, so an operator has to delete them.Closes #13821