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

The data volume has under 15% free #13844

Merged opened this in answer to

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

Merged

mason/forge:mason/13843-the-data-volume-has-under-15-free → main 1 commit fork

  • Merged. mason/13843-the-data-volume-has-under-15-free was merged into main as 55284ee.

Review

Sign in to review this change.
4 files changed +11 −11
docs/features/disk-free.md +2 −2
@@ -41,10 +41,10 @@ checkout and install. `dropCheckouts` (`src/apps/dormant_checkout.ts`) removes i
4141 directories (`<env>/<sha7>`, `node_modules` and all) as it goes dormant, in the idle sweep and at
4242 boot. Its data, home and build cache stay.
4343
44 ## A clone idle for a week goes whole (#13734)
44 ## A clone idle for three days goes whole (#13734, #13843)
4545
4646 `sweepStaleClones` (`src/crew/orphans.ts`) removes a kept clone, sources and `.git`, whose `.git`
47 nothing has touched for seven days and no live run holds. The week is counted from `.git` alone, so
47 nothing has touched for three days (it was seven; about 150 clones of ~150 MB were holding 22.8 GiB) and no live run holds. The window is counted from `.git` alone, so
4848 trimming `node_modules` at one day does not restart it. The remote is truth: a run fetches and
4949 resets to it, and clones afresh when the directory is gone.
5050
src/crew/dispatch.ts +1 −1
@@ -323,7 +323,7 @@ export async function startCrew(
323323 })
324324 .then(() => sweepStaleClones(crewRoot(app.config.dataDir), isClaimed))
325325 .then(({ removed, kept }) => {
326 if (removed > 0) log.info("removed clones idle for a week", { count: removed });
326 if (removed > 0) log.info("removed clones idle for three days", { count: removed });
327327 if (kept > 0) log.info("kept idle clones holding unpushed work", { count: kept });
328328 })
329329 .catch((error) => log.warn("clone sweep failed", { error: String(error) }));
src/crew/orphans.ts +2 −2
@@ -148,7 +148,7 @@ export async function sweepIdleDependencies(
148148 }
149149
150150 /** A kept clone goes whole once it has been idle this long (#13734). */
151 export const CLONE_IDLE_MS = 7 * 86_400_000;
151 export const CLONE_IDLE_MS = 3 * 86_400_000;
152152
153153 /** Run a fixed git argv in a clone; its stdout, or undefined when git fails. */
154154 async function gitOut(dir: string, args: string[]): Promise<string | undefined> {
@@ -183,7 +183,7 @@ export async function holdsUnpushedWork(dir: string): Promise<boolean> {
183183 * Remove clones kept for an open issue or pull whose `.git` nothing has touched for `idleMs` and
184184 * no live run holds, unless they hold work never pushed. Idleness reads `.git` only: trimming
185185 * `node_modules` (`sweepIdleDependencies`) stamps the clone directory and must not restart the
186 * week. The remote is truth: a run fetches and resets to it, and clones afresh when the directory
186 * window. The remote is truth: a run fetches and resets to it, and clones afresh when the directory
187187 * is missing. How many were removed and how many kept for unpushed work.
188188 */
189189 export async function sweepStaleClones(
test/orphan-clones.test.ts +6 −6
@@ -61,7 +61,7 @@ describe("trimming idle clones' installed packages (#13514)", () => {
6161 });
6262 });
6363
64 describe("removing clones idle for a week (#13734)", () => {
64 describe("removing clones idle for three days (#13734)", () => {
6565 const git = (cwd: string, ...args: string[]): void => {
6666 const r = Bun.spawnSync(["git", "-c", "user.name=t", "-c", "user.email=t@t", ...args], { cwd });
6767 if (r.exitCode !== 0) throw new Error(r.stderr.toString());
@@ -91,13 +91,13 @@ describe("removing clones idle for a week (#13734)", () => {
9191 return dir;
9292 };
9393
94 test("only a week-idle, unheld, fully pushed clone goes", async () => {
94 test("only a three-day-idle, unheld, fully pushed clone goes", async () => {
9595 const { sweepStaleClones } = await import("../src/crew/orphans.ts");
9696 const root = mkdtempSync(join(process.env.TMPDIR ?? tmpdir(), "orphans-"));
9797 const stale = clone(root, "10"), recent = clone(root, "11"), live = clone(root, "12");
98 await age(stale, 8);
99 await age(live, 8);
100 await age(recent, 2);
98 await age(stale, 4);
99 await age(live, 4);
100 await age(recent, 1);
101101 expect(await sweepStaleClones(root, (d) => d === live)).toEqual({ removed: 1, kept: 0 });
102102 expect(existsSync(stale)).toBe(false);
103103 expect(existsSync(recent)).toBe(true);
@@ -119,7 +119,7 @@ describe("removing clones idle for a week (#13734)", () => {
119119 expect(readFileSync(join(dirty, "a"), "utf8")).toBe("edited");
120120 });
121121
122 test("trimming node_modules does not restart the week", async () => {
122 test("trimming node_modules does not restart the clock", async () => {
123123 const { sweepStaleClones, sweepIdleDependencies } = await import("../src/crew/orphans.ts");
124124 const root = mkdtempSync(join(process.env.TMPDIR ?? tmpdir(), "orphans-"));
125125 const dir = clone(root, "10");

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs