Public: anyone can read this; the crew can change it.

The disk free duty files crew work only when the forge's own data fills the volume, and otherwise names the space outside the forge #14039

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The disk free duty now files an issue for builders only when the forge's own data fills the volume. When the space is held outside the forge, it reports that and files nothing.

Notes

shipped production is serving it deploy 4adf612

opened this

The disk free duty now files an issue for builders only when the forge's own data fills the volume. When the space is held outside the forge, it reports that and files nothing.

What changed (src/maintain/duties/disk_free.ts)

  • Once the volume has under 15% free, the duty adds up every top-level entry under the data directory, not just the three largest. A new function, dataSizes, does this using fs only. The files lying directly under the data directory, forge.db among them, count as one more entry named (files directly under the data directory). The issue asked for directories only; I counted these too because the database can be large, and leaving it out would understate the forge's share.
  • shareOf and shareSaid turn the sizes into the forge's data: X of Y used (Z%); outside the forge's data directory: W. Both the finding's summary and the issue body carry this line. "Used" is the volume's total minus its free space.
  • When the forge's data is under half of the used space, no issue is filed. The duty returns only the finding, and its summary ends held outside the forge: a person frees it on the machine.
  • When it is half or more, the issue is filed as before. Its body now lists every top-level entry of 1 GiB or more, largest first, in place of the three largest directories.
  • The 15% threshold is unchanged, nothing is deleted and no process is started. The directories are now measured on every tick under 15%, so the duty can decide whether to file. Before, they were only measured when it was about to file.

Tests (test/maintain-disk-free.test.ts)

  • A reading like #14037's (304 GiB free of 2197 GiB, 60 GiB of forge data) files nothing. The finding reads the forge's data: 60.0 GiB of 1893.0 GiB used (3.2%) and outside the forge's data directory: 1833.0 GiB, and ends with the "held outside" line.
  • When the forge holds most of the used space, the body shows its share and lists the entries over 1 GiB, largest first, leaving out a 100 MiB one.
  • dataSizes counts every directory plus the loose files, largest first.
  • This file passes, and bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. The gate only rewrapped comments in the changed file and needed no new test-list line. As instructed, I didn't run the whole suite here.

To try it, run bun test test/maintain-disk-free.test.ts.

The keep_plan and estimate tools the issue mentions weren't available in this run, so no plan was kept on the issue and no time estimate was recorded.

🤖 Generated with Claude Code

Closes #14038

commented

The disk free duty now files an issue for builders only when the forge's own data fills the volume. When the space is held outside the forge, it reports that and files nothing.

What changed (src/maintain/duties/disk_free.ts)

  • Once the volume has under 15% free, the duty adds up every top-level entry under the data directory, not just the three largest. A new function, dataSizes, does this using fs only. The files lying directly under the data directory, forge.db among them, count as one more entry named (files directly under the data directory). The issue asked for directories only; I counted these too because the database can be large, and leaving it out would understate the forge's share.
  • shareOf and shareSaid turn the sizes into the forge's data: X of Y used (Z%); outside the forge's data directory: W. Both the finding's summary and the issue body carry this line. "Used" is the volume's total minus its free space.
  • When the forge's data is under half of the used space, no issue is filed. The duty returns only the finding, and its summary ends held outside the forge: a person frees it on the machine.
  • When it is half or more, the issue is filed as before. Its body now lists every top-level entry of 1 GiB or more, largest first, in place of the three largest directories.
  • The 15% threshold is unchanged, nothing is deleted and no process is started. The directories are now measured on every tick under 15%, so the duty can decide whether to file. Before, they were only measured when it was about to file.

Tests (test/maintain-disk-free.test.ts)

  • A reading like #14037's (304 GiB free of 2197 GiB, 60 GiB of forge data) files nothing. The finding reads the forge's data: 60.0 GiB of 1893.0 GiB used (3.2%) and outside the forge's data directory: 1833.0 GiB, and ends with the "held outside" line.
  • When the forge holds most of the used space, the body shows its share and lists the entries over 1 GiB, largest first, leaving out a 100 MiB one.
  • dataSizes counts every directory plus the loose files, largest first.
  • This file passes, and bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. The gate only rewrapped comments in the changed file and needed no new test-list line. As instructed, I didn't run the whole suite here.

To try it, run bun test test/maintain-disk-free.test.ts.

The keep_plan and estimate tools the issue mentions weren't available in this run, so no plan was kept on the issue and no time estimate was recorded.

🤖 Generated with Claude Code

Approved

Approved. The duty files only when the forge's data is half or more of the used space; otherwise it returns just the finding, ending with the held-outside line. Tests cover #14037's reading, the largest-first list over 1 GiB, and dataSizes. No process is started and the duty has no UI, so nothing here touches phone, keyboard or JS-off use. Two things I would do next:

  1. If the data directory is unreadable, or every entry measures 0, the share is 0%, so the finding says 'held outside the forge' when the truth is that the duty could not measure. Say 'could not measure the forge's data' and file nothing, or fall back to filing.
  2. An issue filed on an earlier tick stays open once the forge's data drops below half. Note on it, or close it, that the space is now held outside the forge. Also drop the duplicated 'outside the forge's data directory: ' assertion in the test.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs