Repository navigation
fix(atlas-search): reject whitespace-only query on GET /v1/cache/inspect (#6937) - #6938
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
Fixes #6937.
GET /v1/cache/inspectguarded only the rawqueryparameter (if (!q)), then normalized and never re-checked — a whitespace-only query normalized to"", was keyed, and its Durable Object was queried, returning 200.POST /v1/searchalready rejects the same input with 400 "query must not be empty".Change (
pkgs/atlas-search/worker/src/index.ts, +4 lines): afternormalizeQuery, return the search route's 400 when the normalized query is empty, before keying or any Durable Object call.Test (
test/worker.test.ts, +17 lines): one regression test pinning both routes — whitespace-only search → 400, whitespace-only inspect → 400 with message "query must not be empty", and the service embed/search counters unmoved.Verification (laptop, this branch):
npm testin pkgs/atlas-search/worker: 13/13 passed (3 files, incl. the new test).npm run typecheck(tsc --noEmit): clean.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit