fix(fs): keep list paths in requested space through symlinks

Closes openchamber/openchamber#2627

Listing a directory through a workspace symlink was returning realpath
entry paths. The file tree then rejected nested expand toggles because
those paths fall outside the workspace root.

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
This commit is contained in:
Serhii Dziupin
2026-08-05 17:40:01 +00:00
co-authored by Serhii Dziupin
parent 22766fe0ac
commit ee57088dfe
4 changed files with 109 additions and 9 deletions
@@ -29,6 +29,20 @@ describe('useFilesViewTabsStore', () => {
expect(useFilesViewTabsStore.getState().byRoot[root]?.expandedPaths).toEqual(['/repo/src']);
});
test('rejects realpath children of workspace symlinks (issue 2627)', () => {
const root = '/workspace';
const store = useFilesViewTabsStore.getState();
store.toggleExpandedPath(root, '/workspace/pkg');
store.toggleExpandedPath(root, '/real/pkg/src');
store.toggleExpandedPath(root, '/workspace/pkg/src');
expect(useFilesViewTabsStore.getState().byRoot[root]?.expandedPaths).toEqual([
'/workspace/pkg',
'/workspace/pkg/src',
]);
});
test('removes stale expanded paths by prefix without closing files', () => {
const root = '/repo';
const store = useFilesViewTabsStore.getState();