Skip to content

Commit 259246d

Browse files
donjorrsi-pr-agent
authored andcommitted
fix(upstream-fixes): fork tests and setup marker follow upstream's latest web and auth changes
Upstream's settle trigger (`079e4bccdcf`) runs the bare setup command, so the fork's completion marker stays on the other triggers. Fork tests follow upstream's standard scopes (`365aa87982a`, `28ce9d1c175`), `aria-disabled` terminal actions (`cc41482df02`), and the draft store now reached from `lib/utils` (`b83d731cabb`) and the toast manager: upstream's own tests mock the fork modules that load it. Squashes: - cb987be fix(upstream-fixes): fork tests and setup marker follow upstream's latest web and auth changes - 3ba2dbe fixup! fix(upstream-fixes): fork tests and setup marker follow upstream's latest web and auth changes Fork-Domain: upstream-fixes Fork-Tier: bugfix Fork-Upstreamable: no
1 parent f7f3b66 commit 259246d

7 files changed

Lines changed: 97 additions & 88 deletions

‎apps/desktop/src/app/DesktopAttachedPrimary.fork.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ describe("DesktopAttachedPrimary RSI-Software/t3code-hyprws#1350", () => {
225225
"orchestration%3Aread",
226226
"orchestration%3Aoperate",
227227
"terminal%3Aoperate",
228-
"review%3Awrite",
228+
"source-control%3Awrite",
229229
"relay%3Aread",
230230
]) {
231231
assert.ok(

‎apps/server/src/project/ProjectSetupScriptRunner.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,9 @@ export const make = Effect.gen(function* () {
530530
completionShell,
531531
completionSentinel(completionToken),
532532
)
533-
: `${script.command} && echo '[t3] setup script completed' || echo '[t3] setup script FAILED'`;
533+
: trigger === "settle"
534+
? script.command
535+
: `${script.command} && echo '[t3] setup script completed' || echo '[t3] setup script FAILED'`; // fork-hook: upstream-fixes/setup-script-marker
534536

535537
// Subscribe before opening so neither startup activity nor the sentinel can race the listeners.
536538
const observed =

‎apps/web/src/components/ChatMarkdown.fork.test.tsx‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { AuthEnvironmentScope, EnvironmentId } from "@t3tools/contracts";
12
import { renderToStaticMarkup } from "react-dom/server";
23
import { describe, expect, it, vi } from "vite-plus/test";
34

@@ -9,13 +10,25 @@ vi.mock("@effect/atom-react", () => ({
910
revealInFileManagerLabel: undefined,
1011
}),
1112
}));
12-
vi.mock("../hooks/useTheme", () => ({ useTheme: () => ({ resolvedTheme: "dark" }) }));
13+
vi.mock("../hooks/useTheme", () => ({
14+
useTheme: () => ({ resolvedTheme: "dark" }),
15+
useRenderedAppearance: () => "dark",
16+
}));
1317
vi.mock("../state/use-atom-query-runner", () => ({ useAtomQueryRunner: () => vi.fn() }));
1418
vi.mock("../state/use-atom-command", () => ({ useAtomCommand: () => vi.fn() }));
15-
vi.mock("../state/session", async (importOriginal) => ({
16-
...(await importOriginal<typeof import("../state/session")>()),
17-
usePreparedConnection: () => ({ _tag: "Loading" }),
18-
}));
19+
vi.mock("../state/session", async (importOriginal) => {
20+
const actual = await importOriginal<typeof import("../state/session")>();
21+
const { AuthStandardClientScopes } = await import("@t3tools/contracts");
22+
const grantedScopes = new Set<AuthEnvironmentScope>(AuthStandardClientScopes);
23+
const hasScope = (environmentId: EnvironmentId | null, scope: AuthEnvironmentScope) =>
24+
environmentId !== null && grantedScopes.has(scope);
25+
return {
26+
...actual,
27+
useEnvironmentScope: hasScope,
28+
readEnvironmentScope: hasScope,
29+
usePreparedConnection: () => ({ _tag: "Loading" }),
30+
};
31+
});
1932
vi.mock("../state/entities", () => ({
2033
readThreadShell: () => null,
2134
useProjects: () => [],

‎apps/web/src/components/PullRequestThreadDialog.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,7 @@ describe("pull request worktree permissions", () => {
177177
expect(state.setupScripts).toBe(0);
178178
});
179179
});
180+
vi.mock("./ui/toast", () => ({
181+
// The fork's zmux session notice reaches the toast manager, which loads the draft store.
182+
toastManager: { add: vi.fn() },
183+
})); // fork-hook: zmux-estate/pr-thread-zmux-notice-test
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { describe, expect, it, vi } from "vite-plus/test";
2+
3+
import { act, render } from "../../test/render";
4+
import { TerminalCheckoutModeButton } from "./ThreadTerminalDrawer";
5+
6+
describe.each(["floating", "sidebar"] as const)("%s terminal controls", (layout) => {
7+
it("changes the active terminal between Follow and Pin", async () => {
8+
const onModeChange = vi.fn();
9+
await using screen = await render(
10+
<TerminalCheckoutModeButton
11+
layout={layout}
12+
terminalId="terminal-2"
13+
mode="follow"
14+
onModeChange={onModeChange}
15+
/>,
16+
);
17+
const { container } = screen;
18+
19+
const button = container.querySelector("button");
20+
expect(button?.getAttribute("aria-label")).toBe("Pin terminal checkout");
21+
await act(() => button?.click());
22+
expect(onModeChange).toHaveBeenCalledWith("terminal-2", "pin");
23+
24+
await screen.rerender(
25+
<TerminalCheckoutModeButton
26+
layout={layout}
27+
terminalId="terminal-2"
28+
mode="pin"
29+
onModeChange={onModeChange}
30+
/>,
31+
);
32+
const followButton = container.querySelector("button");
33+
expect(followButton?.getAttribute("aria-label")).toBe("Follow thread checkout");
34+
await act(() => followButton?.click());
35+
expect(onModeChange).toHaveBeenLastCalledWith("terminal-2", "follow");
36+
});
37+
38+
it("keeps the moving checkout lock visible and inert", async () => {
39+
const onModeChange = vi.fn();
40+
await using screen = await render(
41+
<TerminalCheckoutModeButton
42+
layout={layout}
43+
terminalId="terminal-2"
44+
mode="follow"
45+
disabled
46+
onModeChange={onModeChange}
47+
/>,
48+
);
49+
const { container } = screen;
50+
51+
const button = container.querySelector("button");
52+
// Upstream disables terminal actions by `aria-disabled`, so the tooltip still opens on hover.
53+
expect(button?.getAttribute("aria-disabled")).toBe("true");
54+
expect(button?.getAttribute("aria-label")).toBe(
55+
"Checkout mode is locked while the thread is moving",
56+
);
57+
await act(() => button?.click());
58+
expect(onModeChange).not.toHaveBeenCalled();
59+
});
60+
});

‎apps/web/src/components/ThreadTerminalDrawer.actions.fork.test.tsx‎

Lines changed: 0 additions & 81 deletions
This file was deleted.

‎apps/web/src/hooks/useThreadActionMenu.test.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,14 @@ describe("thread menu permissions", () => {
181181
},
182182
);
183183
});
184+
vi.mock("../state/threadFork.fork", () => ({
185+
// The real module loads the connection runtime, which reaches the draft store's UI.
186+
threadForkCommand: "thread-fork",
187+
buildLatestStableForkCommandFork: vi.fn(),
188+
forkInFlight: () => false,
189+
forkRefInFlightFork: () => false,
190+
setForkInFlight: vi.fn(),
191+
waitForChildShellFork: vi.fn(),
192+
readForkSourceTitleFork: () => null,
193+
readForkProviderFork: () => null,
194+
})); // fork-hook: thread-fork/header-test-fork-state

0 commit comments

Comments
 (0)