@devries-cameron20 / t3code-1 / commits / fa8949a28c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): project settings can reach each checkout on one environment (#29441)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Emanuel André Medina Araujo committed Nov 12, 2026 at 22:08 UTC fa8949a28c0be92ec8cfeacf19533a744291b963
6 files changed +160 -5
apps/web/src/components/settings/ProjectActionsSettings.tsx
+2 -2
@@ -173,8 +173,8 @@ export function ProjectActionsSettings() {
173 />
174 {mixed ? (
175 <SettingsRow
176 - title="Different actions across environments"
177 - description="Choose one environment to edit its list. Adding an action here adds it on every selected environment."
176 + title="Different actions across checkouts"
177 + description="Narrow the selection above to one checkout to edit its list. Adding an action here adds it to every selected checkout."
178 />
179 ) : (
180 <ProjectActionsList
apps/web/src/components/settings/ProjectSettingsPanel.browser.test.tsx
+30
@@ -602,6 +602,36 @@ describe("project settings scope", () => {
602 await expect.element(remoteOption()).not.toBeInTheDocument();
603 });
604
605 + it("reaches each checkout on one environment and returns to all of them", async () => {
606 + setup();
607 + const [first] = state.projects;
608 + state.projects = [
609 + { ...first!, id: ProjectId.make("clone-a"), workspaceRoot: "/work/clone-a" },
610 + { ...first!, id: ProjectId.make("clone-b"), workspaceRoot: "/work/clone-b" },
611 + ];
612 + const key = projectKey();
613 + await using screen = await mountSettings({ project: key, machine: primaryId });
614 +
615 + await userEvent.click(page.getByRole("button", { name: "Checkout scope: All checkouts" }));
616 + await userEvent.click(page.getByRole("menuitemradio", { name: /clone-b/ }));
617 +
618 + await expect
619 + .element(page.getByRole("button", { name: "Checkout scope: clone-b" }))
620 + .toBeVisible();
621 + expect(screen.router.state.location.search).toMatchObject({
622 + project: key,
623 + machine: primaryId,
624 + checkout: expect.stringContaining("clone-b"),
625 + });
626 +
627 + await userEvent.click(page.getByRole("button", { name: "Checkout scope: clone-b" }));
628 + await userEvent.click(page.getByRole("menuitemradio", { name: "All checkouts" }));
629 +
630 + await vi.waitFor(() =>
631 + expect(screen.router.state.location.search).toEqual({ project: key, machine: primaryId }),
632 + );
633 + });
634 +
635 it("keeps an unknown project recoverable from any environment", async () => {
636 setup();
637 state.projects = state.projects.filter((project) => project.environmentId === primaryId);
apps/web/src/components/settings/SettingsScopeSentence.tsx
+46 -1
@@ -1,6 +1,7 @@
1 import { resolveEnvironmentMachineKind } from "@t3tools/contracts";
2 +import { fileBasename } from "@t3tools/shared/path";
3 import { useLocation } from "@tanstack/react-router";
3 -import { CheckIcon, ChevronDownIcon, LayersIcon } from "lucide-react";
4 +import { CheckIcon, ChevronDownIcon, FolderIcon, LayersIcon } from "lucide-react";
5 import { Fragment, useState, type ReactNode } from "react";
6
7 import type { SidebarProjectSnapshot } from "../../sidebarProjectGrouping";
@@ -29,13 +30,17 @@ import {
30 import { useOptionalSettingsScope } from "./SettingsScopeContext";
31 import { resolveSettingsScope, type SettingsScopeSearch } from "./settingsScope";
32 import {
33 + ALL_CHECKOUTS_VALUE,
34 ALL_ENVIRONMENTS_VALUE,
35 ALL_PROJECTS_VALUE,
36 environmentAxisValue,
37 projectAxisValue,
38 projectScopeMenuGroups,
39 + selectCheckoutAxis,
40 selectEnvironmentAxis,
41 selectProjectAxis,
42 + settingsScopeCheckoutChoices,
43 + settingsScopeCheckoutLabel,
44 settingsScopeEnvironmentAddress,
45 settingsScopeEnvironmentLabel,
46 settingsScopeEnvironmentLabels,
@@ -86,6 +91,7 @@ export function SettingsScopeSentence() {
91 </span>
92 <EnvironmentScopeMenu {...props} />
93 </span>
94 + <CheckoutScopeMenu {...props} />
95 </p>
96 );
97 }
@@ -303,6 +309,45 @@ function EnvironmentScopeMenu({
309 );
310 }
311
312 +function CheckoutScopeMenu({ value, groups, onChange }: SettingsScopeMenuProps) {
313 + const group = groups.find((candidate) => candidate.projectKey === value.project);
314 + const checkouts = group ? settingsScopeCheckoutChoices(group, value) : [];
315 + if (checkouts.length === 0) return null;
316 + const selected = checkouts.find((member) => member.physicalProjectKey === value.checkout);
317 + return (
318 + <span className="flex min-w-0 items-center gap-1.5">
319 + <span className="shrink-0">in</span>
320 + <ScopeMenu
321 + ariaLabel="Checkout scope"
322 + icon={<FolderIcon aria-hidden className="size-3.5 shrink-0" />}
323 + label={
324 + selected
325 + ? settingsScopeCheckoutLabel(selected, checkouts)
326 + : value.checkout
327 + ? "Unavailable checkout"
328 + : "All checkouts"
329 + }
330 + value={value.checkout ?? ALL_CHECKOUTS_VALUE}
331 + onChange={(next) =>
332 + onChange(
333 + selectCheckoutAxis(
334 + value,
335 + checkouts.find((member) => member.physicalProjectKey === next) ?? null,
336 + ),
337 + )
338 + }
339 + searchLabel="Search checkouts"
340 + allOption={{ value: ALL_CHECKOUTS_VALUE, label: "All checkouts" }}
341 + options={checkouts.map((member) => ({
342 + value: member.physicalProjectKey,
343 + label: fileBasename(member.workspaceRoot),
344 + secondary: member.workspaceRoot,
345 + }))}
346 + />
347 + </span>
348 + );
349 +}
350 +
351 function ProjectScopeMenu({ value, groups, environments, onChange }: SettingsScopeMenuProps) {
352 const selected = groups.find((group) => group.projectKey === value.project);
353 const projects = projectScopeMenuGroups(groups, value).map((group) => ({
apps/web/src/components/settings/settingsScopeAxis.test.ts
+37 -1
@@ -1,6 +1,21 @@
1 import { describe, expect, it } from "vite-plus/test";
2
3 -import { selectEnvironmentAxis, selectProjectAxis } from "./settingsScopeAxis";
3 +import type { SidebarProjectSnapshot } from "../../sidebarProjectGrouping";
4 +import {
5 + selectEnvironmentAxis,
6 + selectProjectAxis,
7 + settingsScopeCheckoutChoices,
8 + settingsScopeCheckoutLabel,
9 +} from "./settingsScopeAxis";
10 +
11 +const member = (environmentId: string, physicalProjectKey: string, workspaceRoot = "") =>
12 + ({
13 + environmentId,
14 + physicalProjectKey,
15 + workspaceRoot,
16 + }) as SidebarProjectSnapshot["memberProjects"][number];
17 +const group = (...memberProjects: SidebarProjectSnapshot["memberProjects"]) =>
18 + ({ memberProjects }) as SidebarProjectSnapshot;
19
20 describe("settings scope axes", () => {
21 it("drops a checkout narrowing from older links when either axis changes", () => {
@@ -11,4 +26,25 @@ describe("settings scope axes", () => {
26 });
27 expect(selectProjectAxis(checkout, "app")).toEqual({ project: "app", machine: "first" });
28 });
29 +
30 + it("offers checkouts only where an environment cannot tell them apart", () => {
31 + const a = member("laptop", "a");
32 + const b = member("laptop", "b");
33 + const c = member("server", "c");
34 +
35 + expect(settingsScopeCheckoutChoices(group(a, b, c), { machine: "laptop" })).toEqual([a, b]);
36 + expect(settingsScopeCheckoutChoices(group(a, b), {})).toEqual([a, b]);
37 + expect(settingsScopeCheckoutChoices(group(a, b, c), { checkout: "b" })).toEqual([a, b]);
38 + expect(settingsScopeCheckoutChoices(group(a, b, c), {})).toEqual([]);
39 + expect(settingsScopeCheckoutChoices(group(a, b, c), { machine: "server" })).toEqual([]);
40 + });
41 +
42 + it("labels a checkout by its full path only when its folder name repeats", () => {
43 + const first = member("laptop", "a", "/work/one/app");
44 + const second = member("laptop", "b", "C:\\work\\two\\app");
45 + const other = member("laptop", "c", "/work/tools");
46 +
47 + expect(settingsScopeCheckoutLabel(second, [first, second, other])).toBe("C:\\work\\two\\app");
48 + expect(settingsScopeCheckoutLabel(other, [first, second, other])).toBe("tools");
49 + });
50 });
apps/web/src/components/settings/settingsScopeAxis.ts
+43
@@ -1,7 +1,9 @@
1 +import { fileBasename } from "@t3tools/shared/path";
2 import type { SidebarProjectSnapshot } from "../../sidebarProjectGrouping";
3 import type { EnvironmentPresentation } from "../../state/environments";
4 import type { ResolvedSettingsScope, SettingsScopeSearch } from "./settingsScope";
5
6 +type ScopeCheckout = SidebarProjectSnapshot["memberProjects"][number];
7 type ScopeEnvironment = Pick<EnvironmentPresentation, "environmentId" | "label" | "displayUrl">;
8
9 export function settingsScopeEnvironmentAddress(environment: ScopeEnvironment) {
@@ -57,6 +59,7 @@ export function settingsScopeProjectMachines(
59
60 export const ALL_ENVIRONMENTS_VALUE = "all";
61 export const ALL_PROJECTS_VALUE = "all";
62 +export const ALL_CHECKOUTS_VALUE = "all";
63
64 export function environmentAxisValue(
65 search: SettingsScopeSearch,
@@ -97,6 +100,46 @@ export function selectProjectAxis(search: SettingsScopeSearch, value: string): S
100 return next;
101 }
102
103 +/** Empty unless the selection spans several checkouts of one environment, which only this axis can split. */
104 +export function settingsScopeCheckoutChoices(
105 + group: SidebarProjectSnapshot,
106 + search: Pick<SettingsScopeSearch, "machine" | "checkout">,
107 +): readonly ScopeCheckout[] {
108 + const selected = group.memberProjects.find(
109 + (member) => member.physicalProjectKey === search.checkout,
110 + );
111 + const environmentId = search.machine ?? selected?.environmentId;
112 + const members =
113 + environmentId === undefined
114 + ? group.memberProjects
115 + : group.memberProjects.filter((member) => member.environmentId === environmentId);
116 + return members.length > 1 &&
117 + members.every((member) => member.environmentId === members[0]!.environmentId)
118 + ? members
119 + : [];
120 +}
121 +
122 +export function selectCheckoutAxis(
123 + search: SettingsScopeSearch,
124 + checkout: ScopeCheckout | null,
125 +): SettingsScopeSearch {
126 + const { checkout: _previous, ...rest } = search;
127 + return checkout
128 + ? { ...rest, machine: checkout.environmentId, checkout: checkout.physicalProjectKey }
129 + : rest;
130 +}
131 +
132 +/** Repeated folder names fall back to the full path so the closed menu still identifies the checkout. */
133 +export function settingsScopeCheckoutLabel(
134 + checkout: ScopeCheckout,
135 + checkouts: readonly ScopeCheckout[],
136 +) {
137 + const name = fileBasename(checkout.workspaceRoot);
138 + return checkouts.filter((other) => fileBasename(other.workspaceRoot) === name).length > 1
139 + ? checkout.workspaceRoot
140 + : name;
141 +}
142 +
143 export function selectSingleEnvironmentScope(
144 search: SettingsScopeSearch,
145 scope: ResolvedSettingsScope,
docs/user/project-settings.md
+2 -1
@@ -180,7 +180,8 @@ project crumb.
180 The Projects category, under Code, holds the project's name, icon, actions,
181 checkouts and removal. Actions belong to a project: editing them creates the project's own list
182 on each selected environment, and reset returns to the environment's shared list. A project's
183 -`t3.json` actions can be imported there.
183 +`t3.json` actions can be imported there. When a project has several checkouts on one environment,
184 +choose one in the scope line at the top to see or change only that checkout's settings.
185
186 Settings a repository can also declare in `t3.json`, such as the workspace for new threads,
187 resolve in one order: a project override, then the environment setting, then `t3.json`, then the