Skip to content

feat(storage): search the backend when no loaded entries match#9835

Draft
Light2Dark wants to merge 3 commits into
Light2Dark/feat-storage-paginationfrom
Light2Dark/feat-storage-remote-search
Draft

feat(storage): search the backend when no loaded entries match#9835
Light2Dark wants to merge 3 commits into
Light2Dark/feat-storage-paginationfrom
Light2Dark/feat-storage-remote-search

Conversation

@Light2Dark

Copy link
Copy Markdown
Member

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:

  • Entries are now matched by full path (not just basename), so partial path queries like folder/x resolve folder/xsomething. Because object stores evaluate prefixes on a path-segment basis, the parent directory is listed and filtered client-side.
  • When there are no loaded matches, the panel offers to search more entries from the backend (up to a cap, or on Enter), with status rows reflecting the search state.

📋 Pre-Review Checklist

  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • Video or media evidence is provided for any visual changes (optional).

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Tests have been added for the changes made.

Light2Dark and others added 3 commits June 9, 2026 17:19
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>
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jun 9, 2026 9:35am

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

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({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
});

@Light2Dark Light2Dark force-pushed the Light2Dark/feat-storage-pagination branch from fe2773c to e446002 Compare June 9, 2026 17:35
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.

1 participant