improvement(search): search every folder, and document real API error bodies - #6861
Conversation
… 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.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Empty vs no-results: API: Reviewed by Cursor Bugbot for commit 16dd34b. Configure here. |
Greptile SummaryThe PR makes resource searches workspace-wide while preserving direct-child folder browsing, adds recursive file-listing support, and generates status-specific API error examples.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains. No blocking failure remains.
|
| 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
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.
|
@cursor review |
There was a problem hiding this comment.
✅ 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.
Summary
Locationcolumn names each result's folder while searching, and is absent otherwise.GET /api/v2/filesgains arecursiveflag — defaults to true alongside a search, false otherwise, so listing a folder shows that folder while searching one looks through it. Surfaces as--recursiveonsim files list.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, withdetailswhere the description promises it.Type of Change
Testing
Tested manually.
bun run check:audits(29/29),bun run type-check, andbun run lintall pass. 61 new tests across the search scope, drag-move pruning, recursive folder scoping,recursivequery parsing, error-code mapping, and the OpenAPI generator; each verified to fail against the pre-fix behavior. OpenAPI and CLI artifacts regenerated.Checklist