fix(storage): disambiguate storage entries with duplicate paths#9832
Merged
Conversation
Prefer the backend's stable id (e.g. Google Drive) when keying entry rows, and surface that id through the fsspec backend so duplicate paths no longer collide in the storage inspector. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Disambiguates remote storage entries that can legitimately share the same path (e.g. Google Drive) by surfacing a stable backend id to the frontend and using it for row identity in the storage inspector.
Changes:
- Propagate backend-provided
idintoStorageEntry.metadatafor fsspec-based storage entries. - Update the storage inspector to key/render rows using
metadata.idwhen present, falling back to a derived key when absent. - Add backend + frontend tests to cover the new
idplumbing and keying behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/_data/_external_storage/test_storage_models.py | Adds coverage to ensure backend id is preserved in StorageEntry.metadata. |
| marimo/_data/_external_storage/storage.py | Includes id in the fsspec entry metadata created from ls(..., detail=True) results. |
| frontend/src/components/storage/storage-inspector.tsx | Uses a stable row key based on backend id (with fallback) and threads it into row rendering. |
| frontend/src/components/storage/tests/storage-inspector.test.ts | Adds unit tests for storageEntryKey behavior with/without backend ids. |
Contributor
There was a problem hiding this comment.
Review completed
Architecture diagram
sequenceDiagram
participant UI as Storage Inspector UI
participant Backend as Backend API (fsspec)
participant DB as Google Drive / Backend
participant State as React Component State
Note over UI,State: Entry listing from backend
UI->>Backend: listFiles(namespace, path)
Backend->>DB: Fetch file metadata
DB-->>Backend: File list (name, id, ...)
Backend-->>UI: StorageEntry[] (metadata.id populated)
Note over UI,State: Render each entry with a stable key
UI->>UI: For each entry + index → storageEntryKey()
alt metadata.id is a non-empty string (e.g. Google Drive)
UI->>UI: Use id as key (no index needed)
else metadata.id missing / empty / non-string
UI->>UI: Fallback to path::index
end
UI->>State: set entries with unique keys
State-->>UI: Re-render rows
Note over UI,State: Row selection / navigation
UI->>UI: User clicks or selects row
UI->>UI: Build value = namespace:rowKey
UI->>UI: Handle click (expand dirs, open files)
alt Directory click
UI->>Backend: Recurse into directory (re-requests children)
Backend-->>UI: New StorageEntry[] for sub-path
else File click
UI->>UI: onOpenFile(rowKey)
end
Use each entry's position in the full list (not the filtered list) for the fallback row key, so filtering no longer shifts keys and remounts rows that lack a stable backend id. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
kirangadhave
approved these changes
Jun 9, 2026
| ); | ||
| }; | ||
|
|
||
| export const exportedForTesting = { |
Member
There was a problem hiding this comment.
why not just export it normally?
or add barrel exports from an index.ts where we skip storageEntryKey, then the tests can export directly from the file.
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.
📝 Summary
Split out from #9708.
Some backends (e.g. Google Drive) allow multiple files to share the same path, which made entry rows collide when keyed by path alone. This surfaces the backend's stable
idthrough the fsspec backend and prefers it when keying entry rows in the storage inspector, falling back topath + indexwhen no id is available.📋 Pre-Review Checklist
✅ Merge Checklist