Repository navigation
fix: refuse to run invalid search queries instead of matching everything - #87
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ytkimirti
marked this pull request as ready for review
October 22, 2026 11:33
# Conflicts: # src/lib/utils.test.ts
# Conflicts: # src/lib/utils.test.ts
alitariksahin
approved these changes
Nov 11, 2026
This branch was successfully deployed
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.
Bug: When the search query can't be parsed (e.g. a missing closing brace while typing), the browser silently searches with
{}and lists every document, and Export exports the whole index. Both call sites usedparseJSObjectLiteral(query) ?? {}.Fix: Parse the query with a new
parseSearchQuerythat returns undefined for invalid input, and refuse to search or export in that case with an "Invalid query syntax" error.Why each change
lib/utils.ts:parseSearchQuerykeeps an empty query as{}(match everything, the existing behavior), but returns undefined for invalid syntax and for non-object values like[1], which are not valid filters either.lib/utils.ts:INVALID_QUERY_MESSAGEis shared so the search and export show the same error.components/databrowser/hooks/use-keys.tsx: throws instead of searching, so the error goes through the existing query error display in the query builder panel.components/databrowser/components/search/export-results-button.tsx: the filter is computed once per render; the estimate is skipped and the dialog shows the error, and the export button is disabled, so an export can never run against{}.lib/utils.test.ts: locks in that an empty query matches everything and invalid or non-object queries are undefined.Repro: Pick a search index, type
{ title: "x"(no closing brace) in the Code Editor: every document is listed; open Export and it estimates and exports the whole index.Part of DX-3147