Repository navigation
Search overview: a search needs at least three words - #729
Merged
Merged
Conversation
…any model call query_word_count counts whitespace tokens holding a letter or digit; MIN_QUERY_WORDS = 3. Tests move to three-word queries and cover the count, the 422 and its reason. Tested: tests/test_api and tests/test_metrics (2112 passed).
…rule, not a model limit; api-structure.md and the worker routing test follow it Tested: overview tests (166 passed); bun workers/osa-worker/test-routing.js passes.
Member
Author
Review round 1 (Sonnet code reviewer): outcomesNo critical findings, 2 important, 1 minor; all fixed in the round 1 commit. The reviewer checked the Python word count against the website's TypeScript count with both runtimes. They agree on letters, digits, marks, underscores, symbols, CJK without spaces (one word each) and the common whitespace. They differ only on U+001C to U+001F, U+0085 and U+FEFF, which a real search does not contain. Either way the result is a refusal, not a wrong overview.
|
Contributor
|
Worker changes detected. After merging to Manual deployment (if needed): cd workers/osa-worker
wrangler deploy --env dev # for develop branch
wrangler deploy # for main branch |
Member
Author
Review round 2 (Sonnet code reviewer): outcomesNo findings: all 3 round 1 findings are resolved, and the fixes introduced nothing new. This was the last round. |
This was referenced Nov 11, 2026
Merged
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.
Summary
The maintainer's rule (2026-11-11): an AI overview needs a search of at least three words.
A one-word search such as "EEG" came back from the dev overview as a 502 every time (#728), and nemar.org's Discover panel showed its error state.
src/api/overview.py:MIN_QUERY_WORDS = 3andquery_word_count(query), which counts whitespace-separated tokens that hold at least one letter or digit. It is Unicode-aware, so "P300", "naïve" and "α-band" are words and a lone "-" is not.OverviewRequest's query validator refuses a shorter query, so the route answers 422 with "an overview needs a search of at least 3 words" before any model call or cache lookup.staging. A 422 from here shows the same note, so the two sides cannot disagree visibly.docs/search-overview.mdgives the rule in the field table and the 422 row. CHANGELOG entry added.Refs #728. It closes after a check on develop: "EEG" answers 422, and a three-word search answers 200 with a cited overview.
What this does not settle: why a short query produced no citation, and whether the plain-text
error code: 502body came from Cloudflare replacing OSA's JSON 502. Both need the dev server logs. With the three-word rule the case no longer reaches the model, so I am noting them on #728 rather than chasing them here.Tests
tests/test_api/test_overview_unit.py: the word count on seven cases, and the minimum (3 words pass, 2 are refused)tests/test_api/test_search_overview.py: one and two words are 422 with no model call; "EEG" is a 422 whose body says "at least 3 words"pytest tests/test_api tests/test_metrics -m 'not network and not llm'(Python 3.12): 2112 passedruff checkandruff format: clean