Stop the AI chat from reaching into the inbox for menus and thread lookup

Merged
CH
2d ago
+52-53

Why

Third step toward a one-way rule: the inbox may use the AI chat, the AI chat never uses the inbox. After #30424 and #30428, 13 files in modules/ai still imported from modules/inbox. These are not misplaced names any more: they are places where AI chat code reaches into the inbox. This PR removes the ones that need no behaviour change, taking the count from 13 to 9.

What changes

Two menus move up to modules/inbox. Nothing in modules/ai uses them; their users are the inbox lists, the pages and the side panel.

Was in modules/aiNow in modules/inboxWhy it belongs there
AiChatThreadActionsDropdownInboxThreadActionsDropdownthe actions on a row of a thread list, with the triage buttons
AiChatThreadDetailsDropdown, AiChatThreadDetailsStatus, useAiChatThreadDetailsStatusInboxThreadDetailsDropdown, InboxThreadDetailsStatus, useInboxThreadDetailsStatusthe thread's filing: status as seen from the list on screen, and its channel

AiChatPageHeader takes its icon as a prop. It used to render the inbox's list toggle itself. The page that mounts it now passes <InboxNewThreadListToggle />.

useOpenAskAiThread looks the thread up by id. It used to search the threads of the inbox's selected list. It now reads the thread record directly and keeps ignoring deleted threads. One difference: a thread that is loaded but not part of the selected list is now found, where before the hook fell back to selecting it by id and opening the side panel. Both paths open the same thread.

Not in this PR

The 9 remaining imports need a design choice each, so they come next:

  • useAiChatSubscription reloads the recent list when the open chat is not found.
  • useApplyAiChatThreadUpdate prepends a thread to the recent list.
  • AiChatThreadParticipantOperationsEffect refreshes the inbox counts.
  • AiChatPageThreadUrlSyncEffect, currentAiChatThreadDataSelector, aiChatIsLoadingSelector and useShouldShowAiChatEmptyState read whether the recent list is loaded.
  • useSelectAiChatThread resets the inbox's closing thread.
  • One story helper in modules/ai/testing.

The lint guard on the import direction follows once the count is zero.

Screenshots

No UI change.