Skip to content

Commit 13f9bc4

Browse files
only21milcodex
andauthored
fix(web): label inherited worktree cleanup modes correctly (#23678)
Co-authored-by: GPT-6.1 Sol <[email protected]>
1 parent d18690d commit 13f9bc4

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

‎apps/web/src/components/settings/SettingInheritance.test.ts‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,36 @@ import { settingInheritanceLayers } from "./SettingInheritance";
77
const environmentId = EnvironmentId.make("laptop");
88
const projectId = ProjectId.make("project");
99

10+
describe("worktree cleanup inheritance", () => {
11+
it("distinguishes project and environment worktree cleanup policies", () => {
12+
const settings = {
13+
...DEFAULT_SERVER_SETTINGS,
14+
worktreeCleanup: {
15+
mode: "custom" as const,
16+
rules: DEFAULT_SERVER_SETTINGS.storageCleanup,
17+
},
18+
projectSettingsOverrides: {
19+
[projectId]: { worktreeCleanup: { mode: "off" as const } },
20+
},
21+
};
22+
const layers = settingInheritanceLayers(
23+
{
24+
environmentId,
25+
label: "Laptop",
26+
projectId,
27+
...resolveProjectSettings(settings, projectId),
28+
},
29+
settings,
30+
"worktreeCleanup",
31+
);
32+
expect(layers.map((layer) => [layer.key, layer.value, layer.effective])).toEqual([
33+
["project", "Off", true],
34+
["environment", "Custom", false],
35+
["built-in", "Not set", false],
36+
]);
37+
});
38+
});
39+
1040
describe("settingInheritanceLayers", () => {
1141
it("identifies the background activity profile supplied by each layer", () => {
1242
const settings = {

‎apps/web/src/components/settings/SettingInheritance.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ function formatValue(key: keyof ServerSettings, value: unknown): string {
8787
}
8888
if ("model" in value && typeof value.model === "string") return value.model;
8989
if ("mode" in value && typeof value.mode === "string") {
90-
return WRITING_STYLE_LABELS[value.mode] ?? value.mode;
90+
if (key === "worktreeCleanup") return value.mode === "off" ? "Off" : "Custom";
91+
return key === "sourceControlWritingStyle"
92+
? (WRITING_STYLE_LABELS[value.mode] ?? value.mode)
93+
: value.mode;
9194
}
9295
}
9396
return "Custom";

0 commit comments

Comments
 (0)