feat(storage): search the backend when no loaded entries match#9835
Draft
Light2Dark wants to merge 3 commits into
Draft
feat(storage): search the backend when no loaded entries match#9835Light2Dark wants to merge 3 commits into
Light2Dark wants to merge 3 commits into
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>
…tton Thread page tokens through the storage backends, runtime command, and notification, and surface a "Load more" control (plus a "may have more" hint when a provider truncates a listing) in the storage inspector. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When a prefix query has no matches among the loaded entries, page through the backend (up to a cap, or on Enter) to surface remote results, and match entries by full path so partial path queries work across object-store prefix boundaries. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="frontend/src/components/storage/storage-inspector.tsx">
<violation number="1" location="frontend/src/components/storage/storage-inspector.tsx:693">
P2: The UI can offer "Search more entries" for slashless queries even though the action is hard-disabled, causing a misleading no-op button/Enter hint.</violation>
</file>
Architecture diagram
sequenceDiagram
participant UI as Storage Panel
participant Hooks as useStorage / useStoragePageFetcher
participant State as Storage State (Zustand)
participant Backend as Backend API (obstore)
Note over UI,Backend: Search Flow with Remote Fallback
UI->>UI: User types search query in filter input
UI->>UI: filterEntries() checks loaded entries by full path + basename
alt Has loaded matches
UI->>UI: Display matching local entries
else No loaded matches AND has directory prefix
UI->>UI: remoteSearchPrefix() extracts parent directory
UI->>Hooks: Trigger remote search via useStoragePageFetcher
Hooks->>State: Request page for directory prefix
State->>Backend: listObjects(prefix=directory)
Backend-->>State: Page of entries + nextPageToken
State-->>UI: Update entriesByPath with new entries
UI->>UI: filterEntries() client-side on fetched entries
alt Entries match query
UI->>UI: Display matching remote entries
UI->>UI: Set remoteSearch status to "found"
else No entries yet AND nextPageToken exists
UI->>UI: Show "Search more entries" button
alt User clicks "Search more" (up to MAX_REMOTE_SEARCH_PAGES=5)
UI->>Hooks: fetchNextPage()
Hooks->>State: Request next page with token
State->>Backend: listObjects(prefix, pageToken)
Backend-->>State: Next page of entries
State-->>UI: Update entriesByPath
UI->>UI: Re-filter and loop
else User presses Enter
UI->>Hooks: fetchNextPage() (repeat until matched or exhausted)
end
end
end
Note over UI,Backend: Status/Error Handling
alt Remote search exhausted
UI->>UI: Set remoteSearch status to "exhausted"
UI->>UI: Show "No results found" message
else Remote search capped at 5 pages
UI->>UI: Set remoteSearch status to "capped"
UI->>UI: Show "Searched more entries" with retry option
else Remote search error
UI->>UI: Set remoteSearch status to "error"
UI->>UI: Show error message with retry button
end
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| const hasSearch = !!searchValue.trim(); | ||
| const hasLoadedMatches = | ||
| filtered.length > 0 || filteredRemoteEntries.length > 0; | ||
| const canSearchMore = canSearchMoreRemoteEntries({ |
Contributor
There was a problem hiding this comment.
P2: The UI can offer "Search more entries" for slashless queries even though the action is hard-disabled, causing a misleading no-op button/Enter hint.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At frontend/src/components/storage/storage-inspector.tsx, line 693:
<comment>The UI can offer "Search more entries" for slashless queries even though the action is hard-disabled, causing a misleading no-op button/Enter hint.</comment>
<file context>
@@ -540,12 +666,108 @@ const StorageNamespaceSection: React.FC<{
+ const hasSearch = !!searchValue.trim();
+ const hasLoadedMatches =
+ filtered.length > 0 || filteredRemoteEntries.length > 0;
+ const canSearchMore = canSearchMoreRemoteEntries({
+ hasSearch,
+ hasLoadedMatches,
</file context>
Suggested change
| const canSearchMore = canSearchMoreRemoteEntries({ | |
| const canSearchMore = | |
| searchPrefix !== "" && | |
| canSearchMoreRemoteEntries({ | |
| hasSearch, | |
| hasLoadedMatches, | |
| isPending, | |
| remoteSearch, | |
| searchKey, | |
| entriesByPath, | |
| pageMetadataByPath, | |
| }); |
fe2773c to
e446002
Compare
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.
This pull request was authored by a coding agent.
Note
Stacked on #9834 (base branch
Light2Dark/feat-storage-pagination, which is itself stacked on the duplicate-path fix). Review/merge those first; this PR's diff is only the remote-search changes.📝 Summary
Split out from #9708. Part of the work for #9662.
When a prefix query produces no matches among the already-loaded entries, this pages through the backend to surface remote results:
folder/xresolvefolder/xsomething. Because object stores evaluate prefixes on a path-segment basis, the parent directory is listed and filtered client-side.📋 Pre-Review Checklist
✅ Merge Checklist