Repository navigation
Closed
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/web
Steps to reproduce
- Open a thread in one browser tab.
- In another tab connected to the same environment, start cloning a repository whose remote takes a while to respond before returning an error.
- Return to the first tab while the clone is still running.
- Dismiss the clone progress notification.
- Wait for the clone to fail.
Expected behavior
A failure notification appears with Retry and Remove project.
Actual behavior
The thread stays open with no notification that the clone failed.
Impact
Minor bug or occasional failure. This affects anyone who dismisses a progress notification in another thread before the clone fails.
Version or commit
main at 9de4ec1bfa. The cause is at apps/web/src/components/ProjectCloneToastCoordinator.tsx:203.
Environment
Linux x64 boat.dev default machine, a fresh checkout.
Logs or stack traces
Failed to clone pending-cloneAutomated repro
Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.
diff --git a/scripts/scenarios/clone-failure-after-dismissing-progress.e2e.ts b/scripts/scenarios/clone-failure-after-dismissing-progress.e2e.ts
new file mode 100644
index 0000000000..fa1ac6f2e5
--- /dev/null
+++ b/scripts/scenarios/clone-failure-after-dismissing-progress.e2e.ts
@@ -0,0 +1,93 @@
+// @effect-diagnostics-next-line nodeBuiltinImport:off -- The fixture holds Git's HTTP request open.
+import * as NodeHttp from "node:http";
+import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
+import { ProjectId } from "@t3tools/contracts";
+import { expect } from "e2e";
+import * as DateTime from "effect/DateTime";
+import * as Effect from "effect/Effect";
+import * as SecureRandom from "effect/crypto/SecureRandom";
+import * as Stream from "effect/Stream";
+
+import { T3_HOME } from "../e2e.config.ts";
+import { rpcClient, runPromise, test, WEB } from "./t3.ts";
+
+test(
+ "Dismissing clone progress leaves the later failure notification visible",
+ WEB,
+ async ({ t3, app, screen, browser }) => {
+ const project = await t3.project("demo");
+ const thread = await t3.thread({ project, title: "Other work", messages: ["Start"] });
+ const gitRequest = Promise.withResolvers<NodeHttp.ServerResponse>();
+ const remote = NodeHttp.createServer((_request, response) => {
+ gitRequest.resolve(response);
+ });
+
+ try {
+ await new Promise<void>((resolve) => remote.listen(0, "127.0.0.1", resolve));
+ const address = remote.address();
+ if (!address || typeof address === "string") throw new Error("No Git fixture port");
+ const projectId = ProjectId.make(
+ await runPromise(
+ SecureRandom.SecureRandom.pipe(
+ Effect.flatMap((random) => random.uuidV4()),
+ Effect.provide(NodeCrypto.layer),
+ ),
+ ),
+ );
+ const name = "pending-clone";
+ const origin = app.baseUrl ?? "";
+ await t3.open(thread);
+ await screen.getByText("Start", { exact: true }).waitFor();
+
+ await runPromise(
+ Effect.gen(function* () {
+ const client = yield* rpcClient(T3_HOME, origin);
+ const createdAt = DateTime.formatIso(yield* DateTime.now);
+ yield* client["projectClone.start"]({
+ projectId,
+ title: name,
+ createdAt,
+ remoteUrl: `http://127.0.0.1:${address.port}/${name}.git`,
+ destinationPath: `${project}/../${name}`,
+ });
+ }).pipe(Effect.scoped),
+ );
+ const response = await gitRequest.promise;
+
+ const progress = browser.locator(`[data-slot="toast-title"]:text-is("Cloning ${name}")`);
+ await progress.waitFor();
+ await browser
+ .locator(
+ `[data-position]:has(> div > [data-slot="toast-close"]):has([data-slot="toast-title"]:text-is("Cloning ${name}"))`,
+ )
+ .getByRole("button", "Dismiss notification", { exact: true })
+ .tap();
+ await progress.waitFor({ state: "detached" });
+
+ response.writeHead(404).end();
+ await runPromise(
+ Effect.gen(function* () {
+ const client = yield* rpcClient(T3_HOME, origin);
+ yield* client.subscribeProjectClones({}).pipe(
+ Stream.filter((clones) =>
+ clones.some((clone) => clone.projectId === projectId && clone.phase === "failed"),
+ ),
+ Stream.runHead,
+ );
+ }).pipe(Effect.scoped, Effect.timeout("10 seconds")),
+ );
+
+ try {
+ const failure = browser.locator(
+ `[data-slot="toast-title"]:text-is("Failed to clone ${name}")`,
+ );
+ await expect(failure).toBeVisible();
+ } finally {
+ await app.screenshot("after-background-clone-fails");
+ }
+ } finally {
+ remote.close();
+ remote.closeAllConnections();
+ }
+ },
+);pnpm scenarios:prove scripts/scenarios/clone-failure-after-dismissing-progress.e2e.ts --base mainWorkaround
No response
Metadata
Metadata
Assignees
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.


Activity