Repository navigation
fix(platform): show a failed website search with Try again - #5077
tale-code-bot wants to merge 2 commits into
Conversation
A rejected websites/actions:searchContent only toasted, so the website details dialog read the empty results under the kept query as a search that matched nothing and offered no way to run it again. Count the failed searches for the active query and show them as a catalog load error with Try again, which runs the same search again with focus on the Website pages section; a search that answers, a cleared or edited query or another site drops the failure. A search that finds nothing still reads No results found. Adds websites.pagesDialog.searchFailed in en, de and fr, the KNOW-B28 manual box and its automation row. Refs #3860
Two behaviours the failed-search state relies on had no test, and a mutant that dropped either kept the dialog suite green: while the same search runs again, the busy Try again is the only progress shown (no spinner beside it), and a retry that fails again writes the message afresh inside the same alert, beside the same Try again, so it is announced again. Refs #3860
tale-review-bot
left a comment
There was a problem hiding this comment.
Approved at head 197cf18c400376c32943cf37b8e33a7ac697d6d9 (base main 9be5cadacb5f59cd6b2cc67c7840e3c0101bdde2).
Scope. The PR does what TALE-37's triage and plan asked, and nothing else:
- A rejected
websites/actions:searchContentputs Website details into a failed-search state: "Couldn't search the website's content." with Try again, the query kept, and never "No results found". - Try again moves focus to Website pages and sends the same
{ websiteId, query, limit: 20 }through the request-id guard. - A search with no hits still reads "No results found". Clearing, editing or switching sites drops the failure.
- The EN/DE/FR string,
KNOW-B28and its automation row are swept in.
What I ran at this head (credentials removed; logs attached to the Reviewer task):
vitest.ui.config.ts app/features/websites/: 9 files, 163/163.- The dialog tests against
main'swebsite-view-dialog.tsx: 11 of the 12 new tests fail (noalert). The zero-hit control passes. The tree was restored afterwards. lint:manualok,lint:conflictsexit 0, andcheck-guide.tsOK onknowledge.md.
Checks. All seven CI ready checks passed on this head: Checks 40916293733, SAST 40916293689, Commitlint 40916293701, Build 40916293704, CLI 40916293758, E2E 40916293684 and Security 40916293755. There are no review threads.
The PR's three open choices, all acceptable:
- The toast stays beside the inline alert. The triage allowed it ("may stay, but it is not the only signal"), and "one failure, one toast" counts toasts, of which there is still one.
- The docs are unchanged. That matches the #4301 precedent (
d08251809) anddocs/AGENTS.md("Product evidence and review"), andcrawling.mdmakes no claim about a failed search. - The automation row is in
reference/automation/knowledge.md. That matches theKNOW-B26/KNOW-A9"half" row already there.
Not run: a real browser (KNOW-B28 covers it) and the queue-only tier, which the merge queue runs.
|
Not landed yet: its CI must re-run under the new landing rule. (Reviewer
|
|
Reviewer: the CI on this head since the 20:13 UTC reopen can't be used to land it (head It ran the workflows from before
Without a merge queue, those suites never run before landing. So these runs' Next. This PR's merge ref is now based on |
|
Landed on |
Summary
When
websites/actions:searchContentrejected, Website details (WebsiteViewDialog) showed No results found. The query stayed in the box and the only other signal was a toast. Users could not tell a failed search from a site with no match, and the only way to search again was to submit the query anew. A failed search now reads "Couldn't search the website's content." with Try again, and Try again sends the same search again.Closes #3860 · Task TALE-37 (Development board)
What changed
website-view-dialog.tsx). The rejection branch only clearedisSearchingand raised a toast. The render then read the keptactiveQuerywithsearchResults = []as an answer with no match. NowsearchFailurescounts the failed searches for the active query, in the same pattern as the pages read'sreadFailures. It resets when a search answers, when the query is edited or cleared, and when the dialog opens or the site changes. While it is set, the search area shows the sharedCatalogLoadError(websites.pagesDialog.searchFailedand Try again), never the spinner or No results found. A search that answers with no hits still reads No results found.retrySearchfirst moves focus to the Website pages section throughEntityViewSection'sfocusRef, asretryPagesdoes. It then sends{ websiteId, query: activeQuery, limit: 20 }through the same request-id guard (searchFor, which Enter now uses too), so a stale answer is still ignored. The alert stays up while the search runs again, and Try again is busy but keeps focus (isRetrying). Each new failure is announced again (failureKey). A search sent from the box can clear the failure while Try again holds focus;onFocusLostthen moves focus to the section.websites.pagesDialog.searchFailedin EN/DE/FR, worded like its siblingpagesDialog.loadFailed.de-CHoverrides onlypagesDialog.errorKind.responseTooLargeinwebsitesand inherits DE for the rest; the new German string has noß.KNOW-B28intests/manual/suites/knowledge.md. The header's cost goes from a stale 76 to the real count, 78 (the suite held 77 boxes before this change). The component half is a row inreference/automation/knowledge.md.Choices for review
reports a pending search rejection after the caller unmountsneeds a failure reported after the dialog is gone.searchContentalready opts out of the hook's default toast (errorToast: false), so there is still one toast per failure. The alternative is fix(platform): show a failed website pages read with Try again #4301's rule: no toast when the dialog shows the failure itself. That would need a mounted/open check on the rejection path, and I did not take it.retryPagesdoes, because the control it replaces goes away when the results arrive.Out of scope and untouched: the out-of-order success race, the first pages-read failure, and the shared engagement-list error wiring.
Checklist
bun run check: not run as a whole in this worker. The test plan lists the parts that ran: workspace type-aware lint and typecheck for@tale/platform, the websites UI tests, the i18n and guard suites, and format and conflict checks. CI's fast tier runs format, lint, types, knip, unit, commitlint and SAST on this head. The UI tier runs only in the merge queue.bun run lint:sast: not run locally. The Opengrep binary is not cached here, and fetching it would install a tool from outside the lock files. CI's SAST job runs it.services/platform/messages/{en,de,fr}/websites.ymlgainpagesDialog.searchFailed. Node-CHoverride is needed (see above).docs/*/platform/knowledge/crawling.mdmentions the page view's search in one sentence and documents none of its states, empty or failed. fix(platform): show a failed website pages read with Try again #4301, which fixed the failed pages read in the same dialog, did not change the docs either. The docs contract asks for docs claims to be observed in the running platform, which this worker could not run. If wanted, a follow-up can add one sentence on both failures (pages read and search) in EN/DE/FR.Test plan
Everything below ran locally in
services/platform(jsdom, Vitest 4.1.11). Base ismain9be5cadacb5f59cd6b2cc67c7840e3c0101bdde2. Head is197cf18c400376c32943cf37b8e33a7ac697d6d9: the fix5bb0e73c5plus a test-only commit that pins two behaviours the mutation check found unguarded.bunx vitest --run --config vitest.ui.config.ts app/features/websites/at head passed: 9 files, 163/163. The dialog file alone passes 68/68, with 12 new tests undera search that failed:searchContentagain with{ websiteId: 'w-1', query: 'broken', limit: 20 }, focus moves to the region, the busy Try again is the only progress, and the results replace the alert;The new tests fail on the unfixed code. With the component restored to
9be5cadacand the new tests run at head (-t 'a search that failed'), 11 failed and 1 passed. The one that passes is the zero-hit control, which asserts unchanged behaviour.Mutants of the fix, each applied alone to the component and checked against the dialog file at head:
onFocusLostfailureKey(no re-announcement)The last mutant has no visible effect. The open/site-change effect also clears
activeQueryand the box, so the failure cannot render. Any new query then passes throughhandleSearchChange, which resets the count. The reset stays because it keeps the effect's list of search-state resets complete.bunx tsc --noEmit(6 GiB heap, as in CI) for@tale/platformpassed at5bb0e73c5(exit 0, 3m14s) and again at head (exit 0).bunx oxlint --type-awareover the whole workspace passed at5bb0e73c5(exit 0, no diagnostics), and on both changed files at head (exit 0).bunx vitest --run --project server lib/i18n/messages.test.ts lib/i18n/topic-references.test.ts lib/i18n/swiss-loading.test.ts tests/guards/single-failure-toast.guard.test.ts tests/guards/error-message-description.guard.test.tspassed: 5 files, 112/112. That covers catalog key and ICU parity, the one-toast guard and the error-message guard.Also clean:
bun run lint:manual(1849 boxes);bun services/platform/tests/manual/scripts/check-guide.ts services/platform/tests/manual/suites/knowledge.md;bunx oxfmt --checkon the changed files (oxfmt ignores YAML and Markdown);bun run lint:conflicts;Not run here: Opengrep (see above), knip, the full platform unit and UI suites, Browser and E2E. I did not watch the change in a real browser because no stack runs in this worker;
KNOW-B28keeps the real route-blocking check for a manual round.