Skip to content

Commit 6ad0827

Browse files
only21milcodex
andauthored
fix(web): name inherited background activity profiles (#23450)
Co-authored-by: GPT-6.1 Sol <[email protected]>
1 parent c40b32a commit 6ad0827

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,31 @@ const environmentId = EnvironmentId.make("laptop");
88
const projectId = ProjectId.make("project");
99

1010
describe("settingInheritanceLayers", () => {
11+
it("identifies the background activity profile supplied by each layer", () => {
12+
const settings = {
13+
...DEFAULT_SERVER_SETTINGS,
14+
backgroundActivity: {
15+
schemaVersion: 1 as const,
16+
profile: "performance" as const,
17+
overrides: {},
18+
},
19+
};
20+
const layers = settingInheritanceLayers(
21+
{
22+
environmentId,
23+
label: "Laptop",
24+
projectId: null,
25+
...resolveProjectSettings(settings, projectId),
26+
},
27+
settings,
28+
"backgroundActivity",
29+
);
30+
expect(layers.map((layer) => [layer.key, layer.value, layer.effective])).toEqual([
31+
["environment", "Performance", true],
32+
["built-in", "Balanced", false],
33+
]);
34+
});
35+
1136
it("shows the checkout's t3.json as a layer for file-backed keys", () => {
1237
const file = { defaultThreadEnvMode: "worktree" as const };
1338
const fromFile = settingInheritanceLayers(

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ const WRITING_STYLE_LABELS: Record<string, string> = {
3737
custom: "Custom instructions",
3838
};
3939

40+
const BACKGROUND_ACTIVITY_PROFILE_LABELS: Record<string, string> = {
41+
balanced: "Balanced",
42+
performance: "Performance",
43+
"battery-saver": "Battery saver",
44+
custom: "Advanced",
45+
};
46+
4047
function formatValue(key: keyof ServerSettings, value: unknown): string {
4148
if (value === null || value === undefined) {
4249
return key === "pullRequestMergeMethod"
@@ -75,6 +82,9 @@ function formatValue(key: keyof ServerSettings, value: unknown): string {
7582
}
7683
if (Array.isArray(value)) return `${value.length} ${value.length === 1 ? "item" : "items"}`;
7784
if (typeof value === "object") {
85+
if (key === "backgroundActivity" && "profile" in value && typeof value.profile === "string") {
86+
return BACKGROUND_ACTIVITY_PROFILE_LABELS[value.profile] ?? value.profile;
87+
}
7888
if ("model" in value && typeof value.model === "string") return value.model;
7989
if ("mode" in value && typeof value.mode === "string") {
8090
return WRITING_STYLE_LABELS[value.mode] ?? value.mode;

0 commit comments

Comments
 (0)