Repository navigation
fix(server): removing a failed clone no longer leaves a stuck banner #24915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dw3105
wants to merge
5
commits into
pingdotgg:main
Choose a base branch
from
dw3105:fix/project-delete-clone-cleanup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+164
−10
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ae4ba58
fix(server): removing a failed clone no longer leaves a stuck banner
chief-archivist 7e6d715
fix(server): deleting a project through MCP also clears its failed clone
chief-archivist e25558b
test(server): MCP test layers provide the clone tracker the project d…
chief-archivist 6aca3fa
chore: merge main into failed clone cleanup
maria-rcks bbaead8
test(server): preserve clones when project deletion is rejected
maria-rcks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import { describe, expect, it } from "@effect/vitest"; | ||
| import { CommandId, type Project, ProjectId } from "@t3tools/contracts"; | ||
| import * as Deferred from "effect/Deferred"; | ||
| import * as Effect from "effect/Effect"; | ||
| import * as Fiber from "effect/Fiber"; | ||
|
|
||
| import { ProjectNotEmptyError } from "./ProjectService.ts"; | ||
| import { mutateProjectWithClone } from "./ProjectMutation.ts"; | ||
|
|
||
| const projectId = ProjectId.make("project-1"); | ||
| const deletedProject: Project = { | ||
| id: projectId, | ||
| title: "kh-frontend", | ||
| workspaceRoot: "/workspace/kh-frontend", | ||
| repositoryIdentity: null, | ||
| faviconPath: null, | ||
| defaultModelSelection: null, | ||
| defaultThreadEnvMode: null, | ||
| autoPull: false, | ||
| projectIcon: null, | ||
| scripts: [], | ||
| createdAt: "2026-01-01T00:00:00.000Z", | ||
| updatedAt: "2026-01-01T00:00:00.000Z", | ||
| deletedAt: "2026-01-01T00:00:00.000Z", | ||
| }; | ||
|
|
||
| describe("mutateProjectWithClone", () => { | ||
| it.effect("keeps the clone when deletion is rejected", () => | ||
| Effect.gen(function* () { | ||
| const rejected = new ProjectNotEmptyError({ projectId }); | ||
| const result = yield* mutateProjectWithClone( | ||
| { | ||
| create: () => Effect.die("unused"), | ||
| update: () => Effect.die("unused"), | ||
| delete: () => Effect.fail(rejected), | ||
| }, | ||
| { discard: () => Effect.die("must not discard a project that still exists") }, | ||
| { type: "project.delete", commandId: CommandId.make("rejected-delete"), projectId }, | ||
| ).pipe(Effect.flip); | ||
|
|
||
| expect(result).toBe(rejected); | ||
| }), | ||
| ); | ||
|
|
||
| it.effect("discards the clone record even when the caller disconnects mid-delete", () => | ||
| Effect.gen(function* () { | ||
| const committed = yield* Deferred.make<void>(); | ||
| const finishDelete = yield* Deferred.make<void>(); | ||
| const discarded: Array<ProjectId> = []; | ||
| const projects = { | ||
| create: () => Effect.die("unused"), | ||
| update: () => Effect.die("unused"), | ||
| // The delete event is already durable while its post-commit cleanup runs. | ||
| delete: () => | ||
| Deferred.succeed(committed, undefined).pipe( | ||
| Effect.andThen(Deferred.await(finishDelete)), | ||
| Effect.as(deletedProject), | ||
| ), | ||
| }; | ||
| const clones = { | ||
| discard: (id: ProjectId) => Effect.sync(() => void discarded.push(id)), | ||
| }; | ||
|
|
||
| const request = yield* mutateProjectWithClone(projects, clones, { | ||
| type: "project.delete", | ||
| commandId: CommandId.make("command-1"), | ||
| projectId, | ||
| }).pipe(Effect.forkChild); | ||
| yield* Deferred.await(committed); | ||
| // Delivered synchronously so it lands before the delete can finish. | ||
| request.interruptUnsafe(); | ||
| yield* Deferred.succeed(finishDelete, undefined); | ||
| yield* Fiber.await(request); | ||
|
|
||
| expect(discarded).toEqual([projectId]); | ||
| }), | ||
| ); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.