Skip to content

Commit bdd0dcd

Browse files
StiensWoutGrok 4.7
andcommitted
fix(server): avoid unchecked Git claims in cleanup reports
Co-authored-by: GPT 6.1 Sol <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Grok 4.7 <[email protected]>
1 parent 428d920 commit bdd0dcd

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎apps/server/src/storageCleanup.test.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,12 +2244,16 @@ describe("storage cleanup reports and local file policies", () => {
22442244
}),
22452245
),
22462246
);
2247-
it.live("keeps a recent age-only worktree without inspecting Git or reporting it clean", () =>
2247+
it.live.each([
2248+
{ days: 8, reason: "Inactive for 1 of 8 days" },
2249+
{ days: null, reason: "No rules apply" },
2250+
])("keeps an ineligible age/delete-only worktree without Git ($days)", ({ days, reason }) =>
22482251
runCleanupTest(
22492252
Effect.gen(function* () {
22502253
const fixture = yield* cleanupFixture({
22512254
...DEFAULT_SERVER_SETTINGS.storageCleanup,
2252-
worktreeAfterDays: 8,
2255+
worktreeAfterDays: days,
2256+
worktreeOnDelete: true,
22532257
});
22542258
fixture.setThreads([
22552259
shell({
@@ -2264,7 +2268,7 @@ describe("storage cleanup reports and local file policies", () => {
22642268
const report = yield* fixture.service.runNow;
22652269
expect(report.entries[0]).toMatchObject({
22662270
outcome: "kept",
2267-
reason: "Inactive for 1 of 8 days",
2271+
reason,
22682272
bytes: null,
22692273
});
22702274
expect(fixture.gitInspections()).toBe(0);

‎apps/server/src/storageCleanup.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,9 @@ const make = Effect.gen(function* () {
975975
: `settled for ${settledDays} of ${settings.worktreeSettledAfterDays} days`
976976
: settings.worktreeOnMerge
977977
? "not merged"
978-
: "has commits beyond the default branch";
978+
: settings.worktreeUnchanged
979+
? "has commits beyond the default branch"
980+
: "no rules apply";
979981
// Only Git-based rules can make a not-yet-due worktree eligible, so skip Git otherwise.
980982
if (!eligible && !settings.worktreeUnchanged && !settings.worktreeOnMerge)
981983
return keep(notDueReason);

0 commit comments

Comments
 (0)