Skip to content

fix: normalize paths in workspace collection storage to prevent ghost entries#17

Merged
naman-bruno merged 2 commits intousebruno:mainfrom
chirag-bruno:fix/collection-removal-persistence
Apr 20, 2026
Merged

fix: normalize paths in workspace collection storage to prevent ghost entries#17
naman-bruno merged 2 commits intousebruno:mainfrom
chirag-bruno:fix/collection-removal-persistence

Conversation

@chirag-bruno
Copy link
Copy Markdown
Collaborator

Collections reappeared after removal because of path format mismatches:

  • addCollectionToWorkspace stored absolute paths but normalizeCollectionEntry (which converts to relative + posixified) was never called
  • Duplicate entries were created when the exists-check compared a stored relative path against an incoming absolute path
  • Removal comparison used strict equality without path.normalize, failing on Windows where / and \ differ

Fix all three: call normalizeCollectionEntry on add, resolve paths before the exists-check, and use path.normalize in the removal filter.

Add e2e tests that create a collection, remove it, create another, and verify the removed one stays gone. Also fix the test fixture to dismiss the VS Code 1.116+ GitHub sign-in dialog on startup.

cchirag added 2 commits April 16, 2026 20:37
… entries

Collections reappeared after removal because of path format mismatches:
- addCollectionToWorkspace stored absolute paths but normalizeCollectionEntry
  (which converts to relative + posixified) was never called
- Duplicate entries were created when the exists-check compared a stored
  relative path against an incoming absolute path
- Removal comparison used strict equality without path.normalize, failing
  on Windows where / and \ differ

Fix all three: call normalizeCollectionEntry on add, resolve paths before
the exists-check, and use path.normalize in the removal filter.

Add e2e tests that create a collection, remove it, create another, and
verify the removed one stays gone. Also fix the test fixture to dismiss
the VS Code 1.116+ GitHub sign-in dialog on startup.
On Windows, the sidebar sends posixified collection paths (C:/Users/...)
but generateUidBasedOnHash was called on them directly, producing a
different UID than the native-path UID stored in Redux. This caused
unlinkDir events from folder/request deletion to be silently dropped
by the sidebar because collectionExists() couldn't match the UID.

Wrap all webview-sourced collection paths in path.resolve() before
hashing in renderer:delete-item, renderer:rename-item, and
renderer:get-collection-tree handlers.

Add e2e test for folder deletion visibility, plus createFolder and
deleteItem test helpers with IPC mocks for native dialogs.
@naman-bruno naman-bruno merged commit 5cd27f4 into usebruno:main Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants