Skip to content

fix(platform): show a failed website search with Try again - #5077

Closed
tale-code-bot wants to merge 2 commits into
mainfrom
fix/website-search-failure-retry
Closed

tale-code-bot wants to merge 2 commits into
mainfrom
fix/website-search-failure-retry

Conversation

@tale-code-bot

@tale-code-bot tale-code-bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

When websites/actions:searchContent rejected, 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

  • The failure is kept, not shown as empty (website-view-dialog.tsx). The rejection branch only cleared isSearching and raised a toast. The render then read the kept activeQuery with searchResults = [] as an answer with no match. Now searchFailures counts the failed searches for the active query, in the same pattern as the pages read's readFailures. 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 shared CatalogLoadError (websites.pagesDialog.searchFailed and Try again), never the spinner or No results found. A search that answers with no hits still reads No results found.
  • Try again sends the same request. retrySearch first moves focus to the Website pages section through EntityViewSection's focusRef, as retryPages does. 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; onFocusLost then moves focus to the section.
  • Copy: websites.pagesDialog.searchFailed in EN/DE/FR, worded like its sibling pagesDialog.loadFailed. de-CH overrides only pagesDialog.errorKind.responseTooLarge in websites and inherits DE for the rest; the new German string has no ß.
  • Manual tests: KNOW-B28 in tests/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 in reference/automation/knowledge.md.

Choices for review

  1. The toast stays next to the inline failure. The triage allowed it ("may stay, but it is not the only signal"). The existing test reports a pending search rejection after the caller unmounts needs a failure reported after the dialog is gone. searchContent already 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.
  2. A failed re-run keeps its results. If you press Enter again on a query whose results are on screen and that re-run fails, the results stay below the alert. Rows already shown behave the same way under a failed later pages read.
  3. Try again moves focus first, as retryPages does, 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.
  • Translations: services/platform/messages/{en,de,fr}/websites.yml gain pagesDialog.searchFailed. No de-CH override is needed (see above).
  • Docs: N/A here. docs/*/platform/knowledge/crawling.md mentions 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.
  • README: N/A. No setup, flag or command changed.

Test plan

Everything below ran locally in services/platform (jsdom, Vitest 4.1.11). Base is main 9be5cadacb5f59cd6b2cc67c7840e3c0101bdde2. Head is 197cf18c400376c32943cf37b8e33a7ac697d6d9: the fix 5bb0e73c5 plus 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 under a search that failed:

    • a rejected search: the alert, the kept query, no No results found, no spinner, and one toast. Try again calls searchContent again 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;
    • a retry that fails again keeps the alert and the focus, and announces the failure again: a new message node in the same alert, next to the same Try again;
    • focus handoff when a search sent from the box clears the failure;
    • a failed re-run keeps its results;
    • a successful search with no hits still shows No results found, with no alert, no Try again and no toast;
    • a clear, an edit or a site change drops the failure;
    • axe passes while the failure shows;
    • EN/DE/FR copy.
  • The new tests fail on the unfixed code. With the component restored to 9be5cadac and 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:

    Mutant Tests red
    Try again without moving focus first 2
    No onFocusLost 1
    No results found ignores the failure 5
    No reset when a search answers 2
    No reset on a query edit or clear 2
    Spinner beside the busy retry 1
    No toast 4
    Try again not busy while retrying 1
    No failureKey (no re-announcement) 1
    No reset on open or site change 0, equivalent

    The last mutant has no visible effect. The open/site-change effect also clears activeQuery and the box, so the failure cannot render. Any new query then passes through handleSearchChange, 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/platform passed at 5bb0e73c5 (exit 0, 3m14s) and again at head (exit 0). bunx oxlint --type-aware over the whole workspace passed at 5bb0e73c5 (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.ts passed: 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 --check on the changed files (oxfmt ignores YAML and Markdown);
    • bun run lint:conflicts;
    • commitlint on the title and on both commits.

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-B28 keeps the real route-blocking check for a manual round.

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 tale-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:searchContent puts 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-B28 and 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's website-view-dialog.tsx: 11 of the 12 new tests fail (no alert). The zero-hit control passes. The tree was restored afterwards.
  • lint:manual ok, lint:conflicts exit 0, and check-guide.ts OK on knowledge.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) and docs/AGENTS.md ("Product evidence and review"), and crawling.md makes no claim about a failed search.
  • The automation row is in reference/automation/knowledge.md. That matches the KNOW-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.

@tale-review-bot
tale-review-bot added this pull request to the merge queue Oct 29, 2026
@yannickmonney
yannickmonney removed this pull request from the merge queue due to a manual request Oct 29, 2026
@yannickmonney yannickmonney reopened this Oct 29, 2026
@tale-review-bot

Copy link
Copy Markdown
Collaborator

Not landed yet: its CI must re-run under the new landing rule. (Reviewer tale-review-bot, run 1f1d8573, 20:27 UTC.)

  • What changed. main no longer lands through a merge queue: commit 0da08205, and since about 20:25 UTC the ruleset holds only the seven required CI ready (…) contexts. This PR left the queue without merging. It is not merged, and auto-merge is off.
  • The new rule. .agents/repo.md ("Each PR lands on its own") and .github/CI.md#landing-on-main say a PR's own CI runs every suite its paths owe, the heavy ones included, and the PR squash-merges once the seven contexts pass on its head.
  • Why I'm not landing it now. The seven green contexts on the approved head 197cf18c400376c32943cf37b8e33a7ac697d6d9 ran under the pre-0da08205 workflows. Those skipped Build, E2E, CLI, UI, Browser, Performance and backend integration on pull requests and left them to the queue, which never ran them for this PR. Enabling auto-merge now would merge it at once without those suites. A skipped check is not a pass, so I am not landing it on that evidence.
  • Next. Re-run this PR's CI on the same head; any new pull-request run uses the new workflows. Once all seven CI ready contexts pass on that run, the Reviewer lands it with gh pr merge 5077 --repo tale-project/tale --squash --auto --match-head-commit 197cf18c400376c32943cf37b8e33a7ac697d6d9. The approval stands while the head is unchanged.

@tale-review-bot

Copy link
Copy Markdown
Collaborator

Reviewer: the CI on this head since the 20:13 UTC reopen can't be used to land it (head 197cf18c400376c32943cf37b8e33a7ac697d6d9, still the approved head).

It ran the workflows from before 0da08205. Its checkout merged this head into the old base 9be5cadacb5f59cd6b2cc67c7840e3c0101bdde2 (job 123705358519: HEAD is now at 61b1061 Merge 197cf18c400376c32943cf37b8e33a7ac697d6d9 into 9be5cadac…). As a result:

  • E2E's PR scope logged e2e runs only in the merge queue; this pull request skips it (job 123705356956).
  • These runs skipped every heavy job:
    • Checks 40947136150: UI shards, UI, Browser, Build, Performance and Backend integration;
    • Build 40947136181: all 13 jobs;
    • CLI 40947137193: all 5 jobs;
    • E2E 40947136114: all of its Playwright and bundle jobs.

Without a merge queue, those suites never run before landing. So these runs' CI ready contexts don't show what the contract now requires: "A pull request runs every suite its paths owe, the heavy ones included" (.github/CI.md, Landing on main). I won't enable auto-merge on them, even once they are green. The SAST, Commitlint and Security workflows didn't change in 0da08205.

Next. This PR's merge ref is now based on 0da08205 (merge commit a203c2499866). A new pull_request run on the same head, for example closing and reopening the PR as at 20:13, would run the current workflows. Once that run's seven CI ready contexts pass on 197cf18c400376c32943cf37b8e33a7ac697d6d9, the Reviewer lands it with gh pr merge 5077 --repo tale-project/tale --squash --auto --match-head-commit 197cf18c400376c32943cf37b8e33a7ac697d6d9.

@tale-code-bot
tale-code-bot marked this pull request as draft October 29, 2026 22:35
@tale-code-bot
tale-code-bot marked this pull request as ready for review October 29, 2026 22:35
@yannickmonney

Copy link
Copy Markdown
Contributor

Landed on train as d99dae6: squashed at the approved head after the fast gate (formatting, typecheck, build). It reaches main with the merge train's pull request, so this pull request closes without merging.

yannickmonney pushed a commit that referenced this pull request Oct 30, 2026
Reviewed and approved in pull request #5077 at 197cf18.

Closes #3860
Task: TALE-37
@yannickmonney
yannickmonney deleted the fix/website-search-failure-retry branch October 30, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(platform): Website content-search failures are rendered as no results

3 participants