Skip to content

fix(platform): recover failed knowledge, history and folder reads - #3814

Merged
yannickmonney merged 5 commits into
mainfrom
fix/knowledge-read-recovery
Sep 29, 2026
Merged

yannickmonney merged 5 commits into
mainfrom
fix/knowledge-read-recovery

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Failed reads in Knowledge and in a project's Files tab looked like missing data. A failed knowledge list said No knowledge entries yet. A failed version history disappeared, which looked the same as an entry that was never edited. A failed folder read hid every file inside a folder, even though the file read had succeeded. Each read now separates loading, a real empty answer, unavailable and recovery. Data already loaded stays on screen, and every failed read offers a keyboard-reachable Try again in EN/DE/FR.

Closes #3777
Closes #3736

What changed

Knowledge entries list (#3777)

  • The table now passes the paginated read's error and retry to useListPage, which it previously dropped. A failed first page shows the shared DataTable error state with Try again, never the empty state.
  • Rows a failed refresh or a failed later page leaves on screen stay. A notice above the table (CatalogLoadError) says the list may be incomplete or out of date and offers the same retry. The search and any selected rows survive the retry.
  • Extra defect found while reproducing: with 34 entries (20 + 14 across two pages), a search drains into page 2. When page 2 failed, useListPage re-requested it on every render in an endless loop: 14 → 30 requests within 2 s in the jsdom probe with no backoff, and four requests roughly every 7 s in the app. Meanwhile the table showed a skeleton that no request was filling.
    • The paginated hook now stops asking for a failed next page until Try again, which resumes from that page. fix(platform): make Inbox assignment, selection and activity reliable #3784 landed the same retry change meanwhile, and this branch builds on it.
    • useListPage and DataTable stop such a list where it stands: no skeleton, and the no-results and footer copy say that only the loaded rows were searched and that the rest could not be loaded.

Version history (#3777)

  • The Version history section is always shown. It reads "Loading version history…" while loading, and "No earlier versions yet — …" for an entry never edited.
  • If the read fails, the section says so with Try again, and the current entry stays readable. The disabled Retry indexing badge is not the history's retry.
  • A failed refresh keeps the versions already loaded, under a notice.

Project files (#3736)

  • The document and folder hooks now report how their read stands: never answered, stale, retrying, and failures so far.
  • The Files tab names a failed read above the tree with one Try again, which repeats only the read that failed.
  • Files whose folder did not load stay listed under Files inside folders, so the tree is never an empty bordered list.
  • A failed file read no longer passes silently either: the folders stay, and the notice says the files are missing.
  • The tree now waits for both reads before its first paint, so nested files no longer appear late.

Documents list: it is the only other paginated list that passes its error to useListPage, so the new stop would otherwise have left it without a retry. It gets the same notice.

Accessibility: each retry first moves focus onto a stable, named target: the Knowledge entries or Documents region, the Version history section, or the Files group. Focus never falls to the page body when the control that held it is replaced. A repeated failure re-creates only the message inside the same live region (failureKey), so it is announced again while Try again keeps its node and any focus on it. When a refresh that heals the read takes the alert away while it holds focus, the focus goes to that same target (onFocusLost). Focus the reader moved elsewhere stays where it is. A busy retry stays focusable and inert (aria-busy, aria-disabled); a native disabled would drop its focus.

Shared pieces reused and extended: DataTable's error state, CatalogLoadError (new optional isRetrying, failureKey and onFocusLost), EmptyState, EntityViewSection (new optional focusRef), the shared common.actions.tryAgain and common.errors.tryAgain keys, and useListPage. No toast is raised for any read failure.

Docs and manual tests

  • EN/DE/FR product docs: knowledge/knowledge-entries.md and projects/manage-files.md.
  • Design-system guides: data table, list page and dialog.
  • New manual boxes KNOW-B17, KNOW-B18, KNOW-A7, PROJ-B10 and PROJ-A8, plus an automation-map row.
  • The knowledge and projects suite Cost headers are updated. The platform readme totals are left for the maintainer's recount.

How I verified it

  • Reproduced on main (fac88dfc2) first, at component level. Real hooks, adapter rows, backendFetch and the four-attempt retry policy ran against a closed synthetic transport that failed only the read under test. Details are in the task deliverables.
    • A failed list showed the empty state with no retry.
    • A failed history showed no section and no alert.
    • A failed folder read left only the root file visible. With every file nested, the tree had zero rows.
    • A failed file read showed the folders with no alert.
    • A failed page 2 during a search was re-requested in a loop.
  • New regression suites use the same real read lane:
    • knowledge-entries-table.read-failure.test.tsx: 34 entries, a true empty state, cold and background failures, a failed page 2 during a search (one run of four requests, then exactly one more on retry), search and selection kept, EN/DE/FR.
    • knowledge-entry-view-dialog.read-failure.test.tsx: a two-version chain, never edited, loading, cold and background failures, focus on recovery, a retry answer kept to its own entry, EN/DE/FR.
    • project-files-tab.read-failure.test.tsx: a mixed tree with a deep link, a folder failure, all files nested, a true empty project, a file failure, a failed refresh, switching project while a retry is in flight, and recovery without re-reading documents, EN/DE/FR.
    • Plus unit tests for readStateOf, the paginated hook (no re-request until the retry), useListPage, DataTable, CatalogLoadError, EntityViewSection and the Documents notice.
  • Local results at the merged head 4afccb13b:
    • The related platform suites: 123/123.
    • The related @tale/ui unit suites: 120/120.
    • The platform and @tale/ui i18n suites pass.
    • Docs 200/200 and ui-docs 82/82.
    • lint:manual and check-guide pass on the two touched suites.
    • oxlint --type-aware --type-check is clean on every changed file.
  • Real-browser checks (keyboard, layout, screen-reader semantics, visual gate) are in the section below.

Real-browser checks

Headless Chromium drove the CI-built bundle, served locally, against a local backend with synthetic data only. Faults were injected per request as 503s on exactly the read under test. Background refreshes came from a second session's writes through the app's own endpoints. No screen reader was run; semantics were read from the accessibility tree.

  • Before, on the main bundle:
    • The failed list showed No knowledge entries yet with no retry.
    • A page 2 that failed during a search was re-requested 18 times in 40 s under a skeleton.
    • A failed history showed no section and no alert.
    • A failed folder read left only the root file visible.
  • Knowledge list, exact head 4afccb13b:
    • 34 seeded entries load (37 by then, after earlier runs added some).
    • A cold failure shows the error state after 4 attempts. Try again is reached by keyboard and moves focus to the Knowledge entries region, and the list recovers with no reload.
    • A truly empty library keeps its empty state.
    • A background failure keeps the rows, the search and the selection.
    • A failed page 2 makes one run of 4 requests and then shows the notice and No results among the loaded items, with no skeleton. A stream reconnect heals failed reads, so it can add one more run. The retry makes exactly one more request.
    • DE and FR copy is shown in both languages.
    • No toasts appear.
  • Version history: the loading, never-edited and two-version states. A cold failure recovers by keyboard with focus on the section. A background refresh that fails keeps the versions under a notice.
  • Project files: a folder failure keeps nested files under Files inside folders. The Tab retry re-reads only the folders, with focus on the Files group. Also checked: all files nested, a file failure, both reads failing, a truly empty project, a failed refresh, switching project while a retry runs, and DE/FR copy.
  • Visual gate (visual-aspect-analyzer, main against an earlier head of this branch):
    • The healthy list scored 75 on both.
    • The files tab went from 74 to 99, with fewer layout shifts.
    • The failed page-2 search scored 100 on main (a steady skeleton) and 71 here. The drop comes from the pre-existing navigation flicker plus the intended 0.05 layout shift when the notice is inserted.
    • Dialog scenarios cannot be measured: the analyzer hangs on them on main and on this branch.

Review round (r4134167039)

03f3a7b16 and 4afccb13b address the review. A background refresh that failed again re-created a focused Try again through the per-failure key. The four keyed notices now pass failureKey and onFocusLost instead.

Exact-head Chromium check on 4afccb13b, with Try again focused by Tab and not pressed:

  • History: another session's hub upload set off a refresh that failed 4 times. The same node kept focus throughout, busy while the refresh ran. A refresh that healed moved focus to the section.
  • List and Files notices: the same node was kept through the failure. When the read healed, focus moved to the region or the group.
  • Manual retry: still moves focus to the section.

Seven mutation checks each turned exactly one test red.

The sweep found one more path: when nothing had loaded, DataTable's error state lost a focused Try again when a background refresh ran. That fix is in #3937.

Not in this PR

Description updated after the merge. The first version said that each failure mounted a fresh alert and that the platform readme totals were recounted; neither is what merged. The review round and the browser results were added.

@yannickmonney yannickmonney left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

One actionable keyboard recovery issue found; inline reproduction attached. The scoped read/recovery checks passed. Existing draft-loss issue #3901 remains separate and is not introduced by this diff. No merge approval.

A paginated source whose next page failed kept being drained: the search
drain in useListPage re-issued the failed page on every render while the
table showed a skeleton no request was filling, over a footer promising
"scroll for more".

- useListPage marks a paginated source that failed with rows on screen
  (`infiniteScroll.loadFailed`), stops draining and scrolling it, and opens
  its window to every loaded row, kept open on recovery.
- DataTable shows no skeleton for such a list: a search that matched none
  of the loaded rows says it searched only those, and the count footer says
  the rest could not be loaded (EN/DE/FR).
- CatalogLoadError takes `isRetrying`: the retry reads busy and inert but
  stays focusable, since a native disable drops a focused control's focus.
- EntityViewSection takes `focusRef`, making the section a named focus
  target for a host whose retry replaces the control that held focus.
A knowledge list whose read failed said "No knowledge entries yet", and an
entry whose version history failed to load showed no history at all, the
same as an entry never edited (#3777).

- The knowledge list hands useListPage the paginated read's error and
  retry: a failed first page is the table's error state with Try again.
  Rows a failed refresh or page left on screen stay, under a notice with
  the same retry; the retry moves focus onto the list region first, and
  the search and selected rows survive it.
- The paginated hook no longer re-requests a failed next page from every
  render of a search drain or scroll (it looped, four requests per run);
  its retry resumes from that page, and it reports a retry in flight and
  how many failures settled, so each new failure is announced again.
- Version history is always shown: loading, "No earlier versions yet",
  a failed read with Try again (the current content stays), and a failed
  refresh over the versions already loaded. Focus moves to the section.
- The Documents list, the other paginated list that passes its error,
  gets the same notice, so a page that fails there is not a dead end.
- EN/DE/FR copy, docs and manual boxes KNOW-B17, KNOW-B18 and KNOW-A7.
A project whose folder read failed hid every file inside a folder, though
the file read had succeeded; with only nested files the tree was an empty
bordered list, with no error and no retry (#3736). A failed file read left
the folders alone, also without a word.

- The project's document and folder hooks report how their read stands
  (never answered, stale, retrying, failures so far) beside their rows.
- The Files tab names a failed read above the tree with one Try again
  that repeats only the read that failed, and moves focus onto the tree
  area first. Files whose folder did not load stay listed under "Files
  inside folders"; a failed refresh keeps the tree it showed.
- The tree waits for both reads before its first paint, so nested files no
  longer appear only once their folders catch up, and the empty state
  shows only when both reads answered with nothing.
- EN/DE/FR copy, docs, manual boxes PROJ-B10 and PROJ-A8, and the
  automation map row for the new component suites.
@yannickmonney

Copy link
Copy Markdown
Contributor Author

Rechecked revision 97756307fbc803550b56e7e8dab227f42e7ace59: the existing P2 in #3814 (comment) remains unresolved. The history dialog still keys the entire error alert by failureCount; a background read failure disconnects its focused Retry button and leaves Chromium focus on the outer dialog, outside Version history. Relevant implementation blobs are unchanged from the prior reviewed head.

Three focused Chromium cases passed as defect reproduction and controls: background-refailure focus loss; deliberate manual Retry returning focus to the stable history section; and an intentional move to Edit during the pending background request, which stays focused. Preserve that last behavior when repairing the stale focused button; do not unconditionally steal focus on every failure. Remove the remount or restore focus only when the removed control owned it.

The broad prior test count remains attributed to the earlier head; this revision check does not claim a full repository or native PostgreSQL rerun. Replay/source receipts: /Users/yannick/.codex/notes/tale-1000-additional/review-3814-revision/. This is the existing review finding, not a new audit issue or approval.

Review of #3814: a host re-keyed the whole CatalogLoadError for each new
failure, so the alert was announced again, but its Try again was re-created
too. A reader who had focused it (without pressing it) lost the focus when
a background refresh failed again; Chromium moved it to the dialog frame.

- `failureKey` re-creates only the message inside the same live region:
  the failure is announced again, and Try again keeps its node and focus.
- `onFocusLost` takes the focus the alert held when a refresh that worked
  takes it away, a frame after it leaves. Focus the reader moved elsewhere
  stays where it is, and a host re-rendering with a new callback is not
  mistaken for the alert leaving.
Review of #3814: the version history, the knowledge and documents lists and
a project's Files tab keyed their failure notice per failure, re-creating a
focused Try again when a background refresh failed again.

- Each notice passes `failureKey` instead of a key, so the failure is still
  announced again while Try again keeps its node and focus.
- Each passes `onFocusLost`: a refresh that heals the read while Try again
  holds focus hands it to the history section, the list region or the Files
  group. A manual retry still moves focus there first.
- Regression tests reproduce the review's case for each notice (a focused,
  unpressed Try again through a failed background refresh), the healing
  handoff, and focus the reader moved elsewhere during the read. Manual
  boxes KNOW-A7 and PROJ-A8 cover the same keyboard path.
@yannickmonney
yannickmonney force-pushed the fix/knowledge-read-recovery branch from 9775630 to 4afccb1 Compare September 29, 2026 15:12
@yannickmonney
yannickmonney merged commit 6f51793 into main Sep 29, 2026
50 checks passed
@yannickmonney
yannickmonney deleted the fix/knowledge-read-recovery branch September 29, 2026 16:03
yannickmonney added a commit that referenced this pull request Sep 29, 2026
Review of #3814, swept past the keyed alerts: with nothing loaded, a list's
failure is DataTable's error state, and a refresh the reader did not start
(the tab regaining focus, another session's change) swaps it for the loading
state. A Try again the reader had focused went with it, and the focus
dropped to the page (Chromium, the knowledge list at 4afccb1).

- `useFocusHandoff` is CatalogLoadError's handoff, now shared: a callback
  ref whose element, leaving with the focus inside, hands the focus to
  `onFocusLost` a frame later. Focus the reader moved elsewhere stays.
- ErrorDisplayCompact takes `onFocusLost`; DataTable passes its new
  `onErrorFocusLost` to its error state.
yannickmonney added a commit that referenced this pull request Sep 29, 2026
Review of #3814, swept past the keyed alerts: a knowledge list that never
loaded shows the table's error state, and a refresh the reader did not start
swapped it for the loading state, taking a focused Try again and dropping
the focus to the page — while the refresh ran, after it failed again, and
after it healed (Chromium at 4afccb1: another session's hub upload, and
the window regaining focus). The documents list shares the state.

- Both lists pass their region as the table's `onErrorFocusLost`, the
  target a manual retry already moves focus to. Focus the reader moved
  elsewhere stays.
- Regression tests: a focused, unpressed Try again in the error state
  through a background refresh that fails again and then heals, and focus
  moved elsewhere. Manual box KNOW-A7 adds the window-refocus path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant