Repository navigation
fix(project-group): keep a group editable after its folder is renamed externally - #1882
Merged
vastsa merged 4 commits intoOct 26, 2026
Merged
Conversation
… externally A project group whose folder was renamed (or its drive unmounted) outside the app could no longer be healed from the edit dialog (vastsa#1869): both the desktop update handler and the host rejected any submission that still contained the stale root ('project group folders must be directories' / 'project group root is not a directory'), so the only way out was to drop the stale root — and once the user had created a shadow group on the renamed folder, even that died with 'folder already belongs to a project group'. The host now exempts roots the edited group already owns from the on-disk directory check (folders new to the group must still exist), and the desktop update handler no longer pre-rejects missing folders so the host rule is the single gate. Keeping the stale root while adding and promoting its replacement, then dropping the stale root in a follow-up edit, both land; creation keeps validating every folder.
Owner
|
Merged as |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #1869.
Root cause
A project group whose folder was renamed (or its drive unmounted) outside the app could no longer be healed from the edit dialog, through two stacked locks:
apps/desktop/electron/main/ipc/workspace-ipc.ts):projectGroupUpdaterejected any submission that still contained the stale root withproject group folders must be directories— including submissions where the user kept the stale row while adding the renamed folder (the reporter's screenshot 1).is_dircheck (crates/host-core/src/db/project_groups.rs,update_project_group): the same per-folder directory check, so dropping the desktop pre-check alone would not help.Because every natural edit path was blocked, the reporter next created a project on the renamed folder. The create-side dedupe (
project-slice.ts) compares stored root spellings only, so it missed the renamed spelling and created a shadow group owning the new path. From then on the host's ownership guard rejected every heal of the original group withfolder already belongs to a project group(the reporter's screenshot 2) — the group kept a folder that no longer existed and could never be edited again.Fix
update_project_groupexempts roots the edited group already owns from the on-disk directory check: a root renamed/unmounted externally can be kept, reordered, or dropped by the edit that is supposed to fix it. Folders that are new to the group must still exist on disk, exactly as before.projectGroupUpdatehandler no longer pre-rejects missing folders, so the host rule is the single gate (and its error names the offending path).projectGroupCreatekeeps its pre-check because every submitted folder is new there.After the fix the reporter's flow lands: keep the stale root while adding and promoting its replacement (now allowed), then drop the stale root in a follow-up edit — it detaches and the sidebar stops showing the dead folder.
Tests
crates/host-core/src/db/tests.rs—project_group_update_allows_a_root_renamed_away_externally: keep-stale-plus-add-replacement succeeds, follow-up drop heals and detaches the stale root, and a folder that is new to the group is still refused when missing on disk. (Runs in CI; no cargo locally.)apps/desktop/test/project-edit.test.mjs— pins the new contract: only creation pre-checks folder existence in the desktop layer; 8/8 pass locally,workspace-roots.test.mjs7/7.The shadow-group ownership conflict itself is a separate product decision (transfer vs refuse) and is intentionally left as-is; this PR removes the path that leads users into it.