fix(dashboard): search on Enter, not while typing; repoint three stale comments - #267
Merged
Merged
Conversation
…e comments TWO UNRELATED THINGS, BOTH SMALL, BOTH USER-VISIBLE OR READER-VISIBLE. SEARCH FIRED WHILE TYPING /search debounced the input into the URL after 250ms idle, and a change to the URL is what runs a search. That is the usual pattern and it is wrong here: a semantic search embeds the query through the configured provider, so every pause while typing spent a real API call and a full fan-out to answer a half-written question. "retry with exponential backoff" typed at a normal pace fires on "retry", "retry with", "retry with expo" — three searches nobody asked for and one they did. On a metered provider that is money; on a local sidecar it is a queue of pointless work in front of the query the user meant. Typing now changes local state and nothing else. The URL — and therefore the search — moves only on submit. SearchBar already had the onSubmit path; only the debounce had to go. The empty state says "press Enter to search" instead of implying results appear on their own. Verified through the real component in devmock, which boots the app with a mock fetch and no login: typing 31 characters one at a time issues ZERO search requests, and submitting issues exactly one, with no navigation. A note on how that was verified, because the first attempt was worthless: driving Enter through the browser-automation key API produced a page "reload" that looked like a regression. It was not — a keydown listener on the input recorded NOTHING, so those key events never reached the page and that test asserted nothing at all. The real check goes through form.requestSubmit(), which is the exact path a keypress takes. THREE STALE COMMENTS IN workspacesearch.go All three are from #265, all three describe code that commit changed: - projectHits' doc said the two sides "are fused inside the goroutine". They are not — fuseRRF runs in the serial loop after g.Wait(), and the comment above that loop says so in as many words. The struct doc contradicted a comment 650 lines below it. - the handler doc said "each project runs two queries in parallel: dense and sparse". There is one BM25 query for the whole workspace now, which is what #265 was. - BM25Signal's doc explained its normalization but never said it is computed on the RAW, unfused list while FusedChunks beside it is post-RRF. That asymmetry decides whether a panel reorder means what it appears to mean, and the one place a reader would look for it did not mention it. Same class as 7cc70a2 and as two commits in #266: the code moved and the comment above it did not. go test ./... green, go vet clean, gofmt clean on the touched files. Dashboard built with `npm run build` (tsc -b + vite); dashboard build is not on PR CI, so it was validated locally. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Two small, unrelated things, batched because both are one-line-class and the release is waiting.
1.
/searchfired while typingThe page debounced the input into the URL after 250 ms idle, and a URL change is what runs a search. Usual pattern, wrong here: a semantic search embeds the query through the configured provider, so every pause while typing spent a real API call and a full fan-out to answer a half-written question.
retry with exponential backofftyped at a normal pace fires onretry,retry with,retry with expo— three searches nobody asked for and one they did. On a metered provider that is money; on a local sidecar it is a queue of pointless work in front of the query the user meant.Typing now changes local state only. The URL, and therefore the search, moves on submit.
SearchBaralready had theonSubmitpath — only the debounce had to go. The empty state now says press Enter to search instead of implying results arrive on their own.Verified through the real component in
devmock(boots the app with a mock fetch, no login): typing 31 characters one at a time issues zero search requests; submitting issues exactly one; no navigation.Worth recording how that was verified, because the first attempt was worthless: driving Enter through the browser-automation key API produced a page "reload" that looked like a regression. It was not — a
keydownlistener on the input recorded nothing, so those key events never reached the page and the test asserted nothing at all. The real check goes throughform.requestSubmit(), the exact path a keypress takes.2. Three stale comments in
workspacesearch.goAll three are from #265 and all three describe code that commit changed:
projectHits' doc said the two sides "are fused inside the goroutine". They are not —fuseRRFruns in the serial loop afterg.Wait(), and the comment above that loop says so in as many words. The struct doc contradicted a comment 650 lines below it.BM25Signal's doc explained its normalization but never said it is computed on the raw, unfused list whileFusedChunksbeside it is post-RRF. That asymmetry decides whether a panel reorder means what it appears to mean.Same class as
7cc70a2and two commits in #266: the code moved, the comment above it did not.Checks
go test ./...green,go vetclean,gofmtclean on the touched files. Dashboard built withnpm run build(tsc -b+ vite) — the dashboard build is not on PR CI, so it was validated locally.