qwen-code/packages/web-shell/client/hooks
易良 8a34d3eee1
test(web-shell): pin silent failure of background artifact refreshes (#7427) (#9227)
* test(web-shell): pin silent failure of background artifact refreshes (#7427)

The toast-spam behavior reported in #7427 no longer exists on main — loadArtifacts carries no notice dispatch and the hook swallows background-refresh failures, keeping the last-good artifacts. What was missing is a regression pin: add one that fails a background refresh and asserts last-good artifacts survive, loading clears, no error surfaces, and the next refresh recovers. Mutation-verified: clearing artifacts in the catch turns it red.

* test(web-shell): cover artifact refresh triggers

* test(web-shell): tighten artifact refresh assertions

* test(web-shell): settle artifact-refresh mocks via deferred awaits (#7427)

The two regression tests added here flushed their mocked refreshes with
a single microtask, so under full-suite parallel load the hook's refresh
continuation intermittently missed the React commit and the last-good
assertions saw artifacts === [] — a signature indistinguishable from a
real #7427 regression. Model every mocked load as a deferred and
resolve/reject + await it inside act, the shape the file's pre-existing
tests already use (review round, 7 fragile flush sites).

Also fold in two review pins while the tests are being rewritten:
- R2-2: the superseded-failure test now rejects the stale load while
  the superseding load is still in flight and asserts loading stays
  true — the requestId guard in the finally cleanup becomes
  load-bearing (mutation-verified: dropping the guard fails the test).
- add a waiting -> idle settling-trigger test so the prompt guard
  cannot be specialized to 'streaming' ('waiting' is a real prompt
  status).

* test(web-shell): pin the version bookkeeping and owner-guard halves (#7427)

- Non-monotonic artifactsVersion sequence (1->2->1 from a non-zero start)
  with exact loadArtifacts call counts: killing the previous-value
  bookkeeping silently skips the refresh that returns to a previously-seen
  version (stale artifacts panel, suite green) — measured mutant.
- Owner-flip supersede variant: the provider flips isCurrent() the instant
  the session switches, before a re-render; an in-flight load resolving in
  that window passes the requestId half and only the !owner.isCurrent()
  half of the guard stops it from painting the previous session's
  artifacts — deleting that half left all prior tests green (measured).

* test(web-shell): pin superseded artifact successes

---------

Co-authored-by: yiliang114 <yiliang114@users.noreply.github.com>
2026-08-16 15:29:58 +00:00
..
daemonSessionMappers.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
useAnimationFrameTranscriptBlocks.test.tsx fix(web-shell): reduce composer input latency (#8015) 2026-07-29 08:06:53 +00:00
useAnimationFrameTranscriptBlocks.ts fix(web-shell): reduce composer input latency (#8015) 2026-07-29 08:06:53 +00:00
useAnimationFrameValue.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
useAtMentionMenu.test.tsx feat(web-shell): support workspace file uploads (#8874) 2026-08-13 06:42:07 +00:00
useAtMentionMenu.ts feat(web-shell): support workspace file uploads (#8874) 2026-08-13 06:42:07 +00:00
useBackgroundTasks.test.tsx fix(webui): Make cross-session switching transactional (#8882) 2026-08-11 09:38:36 +00:00
useBackgroundTasks.ts fix(webui): Make cross-session switching transactional (#8882) 2026-08-11 09:38:36 +00:00
useComposerCore.dom.test.tsx feat(web-shell): support text file attachments in the composer (#9180) 2026-08-15 16:34:20 +00:00
useComposerCore.mobile.dom.test.tsx feat: support drag and drop img in web-shell (#8696) 2026-08-10 05:48:17 +00:00
useComposerCore.test.ts fix(web-shell): keep pasted text visible (#8230) 2026-07-31 15:39:10 +00:00
useComposerCore.ts feat(web-shell): support text file attachments in the composer (#9180) 2026-08-15 16:34:20 +00:00
useDelayedGlobalKeyDown.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
useExternalLinkOpener.test.ts fix(desktop): open remaining external links through the shell opener (#9111) 2026-08-14 02:14:01 +00:00
useExternalLinkOpener.ts fix(desktop): open remaining external links through the shell opener (#9111) 2026-08-14 02:14:01 +00:00
useFileUpload.test.tsx feat(web-shell): support workspace file uploads (#8874) 2026-08-13 06:42:07 +00:00
useFileUpload.ts feat(web-shell): support workspace file uploads (#8874) 2026-08-13 06:42:07 +00:00
useFilterInput.test.tsx feat(web-shell): overhaul list-dialog interaction, keyboard nav & a11y (#6128) 2026-07-02 12:19:17 +00:00
useFilterInput.ts feat(web-shell): overhaul list-dialog interaction, keyboard nav & a11y (#6128) 2026-07-02 12:19:17 +00:00
useInputHistory.ts fix(web-shell): isolate history and session drafts (#7810) 2026-07-28 01:45:52 +00:00
useIsLargeScreen.test.tsx feat(tui): Ctrl+O frozen transcript view and unified tool output rendering (#5666) 2026-07-09 23:40:29 +00:00
useIsLargeScreen.ts feat(tui): Ctrl+O frozen transcript view and unified tool output rendering (#5666) 2026-07-09 23:40:29 +00:00
useIsTouchComposer.test.tsx fix(web-shell): render a plain textarea composer on touch devices (#7587) 2026-07-23 13:14:25 +00:00
useIsTouchComposer.ts fix(web-shell): render a plain textarea composer on touch devices (#7587) 2026-07-23 13:14:25 +00:00
useListboxKeyboard.test.tsx feat(web-shell): overhaul list-dialog interaction, keyboard nav & a11y (#6128) 2026-07-02 12:19:17 +00:00
useListboxKeyboard.ts feat(web-shell): overhaul list-dialog interaction, keyboard nav & a11y (#6128) 2026-07-02 12:19:17 +00:00
useMessages.test.ts fix(web-shell): defer assistant footer during background agent work (#8787) 2026-08-14 06:16:46 +00:00
useMessages.ts fix(web-shell): defer assistant footer during background agent work (#8787) 2026-08-14 06:16:46 +00:00
useNewSessionSuggestion.test.tsx fix(web-shell): reduce composer input latency (#8015) 2026-07-29 08:06:53 +00:00
useNewSessionSuggestion.ts fix(web-shell): reduce composer input latency (#8015) 2026-07-29 08:06:53 +00:00
useOtherWorkspaceSessions.test.tsx feat(web-shell): Share session catalog scheduling (#8891) 2026-08-11 09:13:14 +00:00
useOtherWorkspaceSessions.ts feat(web-shell): Share session catalog scheduling (#8891) 2026-08-11 09:13:14 +00:00
usePrefersReducedMotion.test.tsx feat(web-shell): enhance composer and empty-session animations (#8098) 2026-07-31 02:20:27 +00:00
usePrefersReducedMotion.ts feat(web-shell): enhance composer and empty-session animations (#8098) 2026-07-31 02:20:27 +00:00
useQueuedPrompts.dom.test.tsx feat(web-shell): support text file attachments in the composer (#9180) 2026-08-15 16:34:20 +00:00
useQueuedPrompts.midTurnReconcile.test.tsx feat(web-shell): support text file attachments in the composer (#9180) 2026-08-15 16:34:20 +00:00
useQueuedPrompts.test.ts fix(web-shell): stop stacking duplicate copies when restoring prompt text (#7134) 2026-07-17 22:22:50 +00:00
useQueuedPrompts.ts feat(web-shell): support text file attachments in the composer (#9180) 2026-08-15 16:34:20 +00:00
useScopedSessions.test.tsx feat(web-shell): Share session catalog scheduling (#8891) 2026-08-11 09:13:14 +00:00
useScopedSessions.ts feat(web-shell): Share session catalog scheduling (#8891) 2026-08-11 09:13:14 +00:00
useSessionArtifacts.test.tsx test(web-shell): pin silent failure of background artifact refreshes (#7427) (#9227) 2026-08-16 15:29:58 +00:00
useSessionArtifacts.ts fix(webui): Make cross-session switching transactional (#8882) 2026-08-11 09:38:36 +00:00
useShallowMemo.ts feat(daemon): merge daemon-mode feature batch into main (#4490) 2026-06-12 00:34:49 +08:00
useSharedNow.ts refactor(web-shell): restructure chat UI (#5775) 2026-06-23 22:43:19 +08:00
useStreamingLoadingMetrics.ts fix(ui): display output tokens instead of cumulative API throughput for subagents (#5972) 2026-06-29 07:27:41 +00:00