Repository navigation
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
I reproduced the bug with the new regression test, which uses the real Session.move service. On the base branch the global project's worktree is rewritten from the deleted source repo to the destination. With this change it stays put. The session-move and project suites pass, and so does the core typecheck.
The fix looks right to me. Every empty git repo resolves to global, so the clone/rename recovery in persist should not adopt whichever empty repo was resolved last as global's directory. Real project renames and clone recovery are unaffected.
This is a partial fix for #50979: empty repos still share global, as the description says. One small request on the test, inline.
| expect(yield* sessions.get(created.id)).toMatchObject({ | ||
| projectID: Project.ID.global, | ||
| location: { directory: destination }, | ||
| }) |
There was a problem hiding this comment.
Could this test be cut down to the fixed behaviour? The core case is: global points at a deleted empty repo, a session is moved into another empty repo, and global's worktree is unchanged. The source/destination list checks, the extra remaining/other sessions and the final sessions.remove check session isolation rather than this bug, which makes the test longer and harder to follow.
There was a problem hiding this comment.
Simplified in 7dcc68e: removed the extra sessions, list checks and deletion check. The test now only verifies that the actual move reaches the destination and that global retains the deleted source as its worktree. The focused regression still fails without the guard and passes with it (2 assertions); the normal pre-push check also passed.
Issue for this PR
Refs #50979 (partial: canonical rewrite when the previous source directory is gone).
Type of change
What does this PR do?
If
globalpoints to a directory that has disappeared, moving a session into an empty git repository currently replaces the global canonical with the destination. Exclude the catch-all project from checkout-rename recovery; real project renames still work.This does not change empty repositories’ shared project identity or the all-project session picker. The original two-existing-directory rewrite was not reproduced.
How did you verify your code works?
bun typecheckandgit diff --check: passed.bun run check(normal pre-push hook): all 36 tasks passed. Node 22.16 requiredNODE_OPTIONS=--experimental-strip-types; sandbox validation used isolated XDG paths,ASTRO_TELEMETRY_DISABLED=1andTURBO_ENV_MODE=loose. Installed dependencies from the unchanged lockfile after a stale workspace dependency caused an initial missing-module failure.Screenshots / recordings
No UI changes.
Checklist