Skip to content

improvement(search): search every folder, and document real API error bodies - #6861

Merged
waleedlatif1 merged 2 commits into
stagingfrom
worktree-files-search-ux
Aug 19, 2026
Merged

improvement(search): search every folder, and document real API error bodies#6861
waleedlatif1 merged 2 commits into
stagingfrom
worktree-files-search-ux

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Search on Files, Tables, and Knowledge was ANDed with the open folder, so a query only ever matched that folder's direct children — you could not find a nested file from the root. A non-empty query now searches the whole workspace, at any depth.
  • The query was not cleared when you entered a folder, so the folder you just opened stayed filtered to the previous search. Opening a folder now ends the search (Back restores the results).
  • A Location column names each result's folder while searching, and is absent otherwise.
  • A search or filter that matched nothing rendered a blank table with no explanation. There is now a real no-results state naming the query.
  • GET /api/v2/files gains a recursive flag — defaults to true alongside a search, false otherwise, so listing a folder shows that folder while searching one looks through it. Surfaces as --recursive on sim files list.
  • Every non-200 tab in the API reference showed the same BAD_REQUEST / "The request is invalid." body, because one shared example hung off the error schema. Each status now documents a real code and message, with details where the description promises it.

Type of Change

  • Bug fix

Testing

Tested manually. bun run check:audits (29/29), bun run type-check, and bun run lint all pass. 61 new tests across the search scope, drag-move pruning, recursive folder scoping, recursive query parsing, error-code mapping, and the OpenAPI generator; each verified to fail against the pre-fix behavior. OpenAPI and CLI artifacts regenerated.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

… bodies

Search on Files, Tables, and Knowledge was ANDed with the open folder, so a
query only ever matched that folder's direct children — and the query was not
cleared when you entered a folder, filtering the folder you just opened down to
the same matches. A non-empty query now searches the whole workspace, a
Location column names each result's folder, and opening a folder ends the
search.

Also gives GET /api/v2/files a `recursive` flag, and replaces the single shared
OpenAPI error example — which showed `BAD_REQUEST` under every status tab — with
one real body per status.
@vercel

vercel Bot commented Aug 19, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 19, 2026 8:38pm

Request Review

@cursor

cursor Bot commented Aug 19, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches list filtering, navigation, and drag-drop across three workspace surfaces plus v2 files listing and published API docs; behavior changes are user-visible but bounded to foldered lists and files list contract.

Overview
Workspace folder lists (Files, Tables, Knowledge) no longer treat search as “only the open folder.” A non-empty query searches the whole workspace; opening a folder clears search (via openFolder / navigateToFolder) so you see that folder’s contents instead of a stale filter. While searching, a Location column shows where each row lives; drag-and-drop ignores body drops during search and prunes rows already carried by dragged folders.

Empty vs no-results: resourceListState distinguishes a truly empty workspace from search/filter with zero matches; ResourceNoResults replaces a blank table. useSearchFilterValue clears the filter term immediately on clear (fixes stale results after folder navigation). Upload/create-folder paths clear search so new items appear in the open folder.

API: GET /api/v2/files adds recursive (string enum, not z.coerce.boolean); listsSubfolders defaults recursive to true when search is set. Cursor pagination keys on resolved recursive. V2 error-codes are centralized; OpenAPI error responses carry per-status examples via withErrorExamples, and generated JSON docs/CLI reference updated.

Reviewed by Cursor Bugbot for commit 16dd34b. Configure here.

Comment thread apps/sim/hooks/use-search-filter-value.ts
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR makes resource searches workspace-wide while preserving direct-child folder browsing, adds recursive file-listing support, and generates status-specific API error examples.

  • Adds shared folder-search scoping, location labels, no-results states, and navigation/search coordination across Files, Knowledge, and Tables.
  • Adds recursive folder filtering to the v2 Files API, cursor scope, generated CLI, and documentation.
  • Centralizes v2 status/code mappings and emits response-specific OpenAPI error examples.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/components/folders/folder-search-scope.ts Centralizes direct-child browsing, workspace-wide search matching, and folder-location derivation.
apps/sim/app/workspace/[workspaceId]/components/folders/use-folder-navigation.ts Coordinates folder URL transitions with search clearing and browser-history behavior.
apps/sim/app/workspace/[workspaceId]/components/folders/use-folder-row-drag-drop.ts Prunes resources carried by selected folders and prevents invalid subtree moves.
apps/sim/lib/workspace-files/application/list-workspace-files.ts Resolves direct or recursive folder scopes before querying paginated workspace files.
apps/sim/app/api/v2/files/route.ts Parses recursive listing behavior and includes its effective value in cursor scope.
apps/sim/lib/api/contracts/v2/openapi/shared.ts Defines status-specific reusable v2 error examples for generated API documents.
scripts/openapi/generator.ts Generates response-level error examples and retains referenced reusable response components.
apps/sim/hooks/use-search-filter-value.ts Keeps displayed filtering synchronized with debounced query changes and immediate clearing.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Q[Resource query] --> S{Query non-empty?}
  S -->|No| F[Show direct children of open folder]
  S -->|Yes| W[Search entire workspace]
  W --> L[Show result location]
  W --> N{Any matches?}
  N -->|No| E[Show named no-results state]
  N -->|Yes| R[Render matching resources]
  R --> O[Open folder or resource]
  O --> C[Clear active search]
  C --> F
Loading

Reviews (2): Last reviewed commit: "fix(search): discard the search term on ..." | Re-trigger Greptile

`useSearchFilterValue` returned the debounced term whenever the input was
non-empty, so clearing only hid the settled needle. The mask lifted on the next
keystroke while the debounce still held the pre-clear term — opening a folder
and typing within the window searched the whole workspace for the query the
user had just abandoned.

A clear now resets the settled term rather than hiding it, adjusted during
render so the reset is visible to the render that follows the clear. The
initial state is seeded from the first value so a deep-linked `?search=` still
filters on the first render.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 16dd34b. Configure here.

@waleedlatif1
waleedlatif1 merged commit 4f9d5f3 into staging Aug 19, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the worktree-files-search-ux branch August 19, 2026 20:55
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