GeezerVison is showing github.com — fix(server): storage cleanup keeps worktrees whose file listing excee… · pingdotgg/t3code@bc8583b
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/server/src/storageCleanup.test.ts +30Lines changed: 30 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2678,6 +2678,36 @@ describe("storage cleanup reports and local file policies", () => { | 2678 | 2678 | }), | 2679 | 2679 | ), | 2680 | 2680 | ); | | 2681 | + it.live.each([ | | 2682 | + ["uncommitted-changes", "untracked", "Local changes exceed the inspection limit"], | | 2683 | + ["any-local-files", "ignored", "Ignored files exceed the inspection limit"], | | 2684 | + ] as const)( | | 2685 | + "keeps a worktree under %s when its %s file listing exceeds the inspection limit", | | 2686 | + ([policy, kind, reason]) => | | 2687 | + runCleanupTest( | | 2688 | + Effect.gen(function* () { | | 2689 | + const { service, fs, worktree, setPolicy } = yield* cleanupFixture(); | | 2690 | + setPolicy(policy); | | 2691 | + const files = Array.from({ length: 3000 }, (_, i) => | | 2692 | + kind === "untracked" | | 2693 | + ? `${worktree}/many/untracked-file-with-a-long-name-${i}.txt` | | 2694 | + : `${worktree}/many/ignored-directory-with-a-long-name-${i}/.env`, | | 2695 | + ); | | 2696 | + yield* fs.makeDirectory(`${worktree}/many`); | | 2697 | + yield* Effect.forEach( | | 2698 | + files, | | 2699 | + (file) => | | 2700 | + Effect.gen(function* () { | | 2701 | + if (kind === "ignored") yield* fs.makeDirectory(file.slice(0, -"/.env".length)); | | 2702 | + yield* fs.writeFileString(file, "local\n"); | | 2703 | + }), | | 2704 | + { concurrency: 64, discard: true }, | | 2705 | + ); | | 2706 | + expect((yield* service.runNow).entries[0]).toMatchObject({ outcome: "kept", reason }); | | 2707 | + expect(yield* fs.exists(files[0]!)).toBe(true); | | 2708 | + }), | | 2709 | + ), | | 2710 | + ); | 2681 | 2711 | it.live("serializes concurrent requests and returns each run's report", () => | 2682 | 2712 | runCleanupTest( | 2683 | 2713 | Effect.gen(function* () { | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/storageCleanup.ts +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -654,6 +654,7 @@ const make = Effect.gen(function* () { | 654 | 654 | : "--untracked-files=all", | 655 | 655 | ], | 656 | 656 | maxOutputBytes: 64 * 1024, | | 657 | + appendTruncationMarker: true, | 657 | 658 | }); | 658 | 659 | if (status.stdoutTruncated) return "local changes exceed the inspection limit"; | 659 | 660 | const records = status.stdout.split("\0").filter(Boolean); | @@ -669,6 +670,7 @@ const make = Effect.gen(function* () { | 669 | 670 | cwd, | 670 | 671 | args: ["ls-files", "--others", "--ignored", "--exclude-standard", "--directory", "-z"], | 671 | 672 | maxOutputBytes: 64 * 1024, | | 673 | + appendTruncationMarker: true, | 672 | 674 | }); | 673 | 675 | if (ignored.stdoutTruncated) return "ignored files exceed the inspection limit"; | 674 | 676 | const file = ignored.stdout | |
|