Skip to content

feat(chat-ui)!: feed reads from @corbits/mailbox threads; pins and reactions removed (CL-8174) - #789

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-8174-feed-mailbox
Sep 17, 2026
Merged

TheGreatAxios merged 2 commits into
mainfrom
cl-8174-feed-mailbox

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

  • use-workbench-feed now loads a room's messages and reply-thread rows by listing and reading @corbits/mailbox threads instead of @corbits/chat's message/thread routes, and its live-update subscription follows the mailbox's own SSE stream (/me/inbox/events) instead of folding chat.message stream events straight into the cache.
  • Pins and reactions are removed from chat-ui entirely (client-only; no server-side change) — the feed they hung off no longer exists in this shape.
  • Every mailbox read stays behind one adapter, packages/chat-ui/src/mailbox-timeline.ts: it makes its own fetch() calls and validates responses with local arktype schemas rather than importing @corbits/inbox/client, whose value-level re-exports pull @corbits/mailbox's server-only migrations.ts (a node:crypto user) into the browser bundle and break the Vite build. Per the owner's ruling that @corbits/mailbox is a temporary, shrinking surface over Interchange's native mailbox, no other file in this package touches the mailbox response shape, so swapping to the native thread shape later is a one-file change.
  • Deletes the now-uncalled @corbits/chat thread-messages read route (GET /workbenches/:id/threads/:threadId/messages) and the chat-ui pinned-strip/reaction-chip UI and wire types it fed.

Known regressions, follow-up needed

  • Forking is disconnected: forking a message into a depth-2 sub-thread still targets the old @corbits/chat thread store, whose ids have no relationship to the new mailbox-derived thread ids. The fork/sub-thread affordance needs to be ported to mailbox threads before it works again.
  • Block-kind message parts don't round-trip: approve/poll/form/connect-github/connect-service cards can't survive a reload — a mail body is plain text, so threadMessagesToTimeline only ever produces text parts. A reloaded page loses any persisted block content.
  • Live updates are coarse: the mailbox SSE payload carries only a message id/op, not a thread root, so the subscription refreshes the whole feed on any event rather than re-reading just the affected thread.

Deleted tests

  • packages/chat-ui/src/pins-status.test.ts
  • packages/chat-ui/test/reactions-and-pins.test.tsx
  • packages/chat-ui/test/connect-card-settings-stream.test.tsx — block-kind message parts can't round-trip through a mail body; no replacement mechanism exists yet (see regression above)
  • packages/chat-ui/test/stream-apply.test.ts — applyStreamMessage/applyStreamReaction/applyStreamPin describe blocks (kept ensureReplyThreadRow)
  • packages/chat/test/routes.test.ts — "threads — root feed vs reply membership (4a)" (exercised the now-deleted thread-messages route)
  • packages/chat-ui/test/chat-workspace.test.tsx:
    • "a stale thread reference self-heals instead of dead-ending" — the GET .../threads/:id/messages 404-recovery path it tested never existed in the real feed even before this change
    • "forking a message inside a thread opens a sub-thread..." and "the threads menu indents sub-threads..." — see the forking regression above
  • packages/chat-ui/test/zero-refetch-on-stream-event.test.tsx — "a streamed chat.message renders with no fetch call beyond mount-hydration" (the zero-refetch guarantee no longer holds once reads come from the mailbox)
  • packages/chat-ui/test/message-hover-toolbar.test.tsx — reaction-picker and pin-menu-entry tests

Test plan

  • bun run typecheck
  • bun run lint
  • bun run check:structural
  • bun --cwd packages/chat-ui test (852 pass)
  • bun --cwd apps/web test (799 pass, includes a real vite build)
  • bun --cwd packages/chat test (808 pass, 66 skip — DB-gated)

@linear-code

linear-code Bot commented Sep 17, 2026

Copy link
Copy Markdown

CL-8174

Move the feed's read-path tests off @corbits/chat's message/thread
routes and onto mailbox stubs, delete the pins/reactions suites the
feature removal leaves pointless, and drop the fork/sub-thread and
stale-thread-reference tests that encoded mechanisms the mailbox-backed
feed no longer has.

Deleted tests:
- packages/chat-ui/src/pins-status.test.ts
- packages/chat-ui/test/reactions-and-pins.test.tsx
- packages/chat-ui/test/connect-card-settings-stream.test.tsx (block-kind
  message parts, e.g. connect cards, cannot round-trip through a mail
  body; no replacement mechanism exists yet)
- packages/chat-ui/test/stream-apply.test.ts: applyStreamMessage/
  applyStreamReaction/applyStreamPin describe blocks (kept
  ensureReplyThreadRow)
- packages/chat/test/routes.test.ts: "threads — root feed vs reply
  membership (4a)" (exercised the now-deleted thread-messages route)
- packages/chat-ui/test/chat-workspace.test.tsx: "a stale thread
  reference self-heals instead of dead-ending" (the GET
  .../threads/:id/messages 404-recovery path it tested never existed in
  the real feed); "forking a message inside a thread opens a sub-thread
  ..." and "the threads menu indents sub-threads ..." (forking still
  targets the old @corbits/chat thread store, disconnected from
  mailbox-derived thread ids)
- packages/chat-ui/test/zero-refetch-on-stream-event.test.tsx: "a
  streamed chat.message renders with no fetch call beyond
  mount-hydration" (applyStreamMessage's zero-refetch guarantee no
  longer applies once reads come from the mailbox)
- packages/chat-ui/test/message-hover-toolbar.test.tsx: reaction-picker
  and pin-menu-entry tests
…actions removed (CL-8174)

use-workbench-feed now loads a room's messages and reply-thread rows by
listing and reading @corbits/mailbox threads instead of @corbits/chat's
message/thread routes, and its live-update subscription follows the
mailbox's own SSE stream. Pins and reactions are removed from chat-ui
entirely (no server-side change) since the feed they hung off no longer
exists in this shape.

Every mailbox read stays behind the single adapter in
packages/chat-ui/src/mailbox-timeline.ts: it makes its own fetch() calls
and validates responses with local arktype schemas rather than
importing @corbits/inbox/client, whose value-level re-exports pull
@corbits/mailbox's server-only migrations.ts (a node:crypto user) into
the browser bundle and break the Vite build. Per the owner's ruling that
@corbits/mailbox is a temporary, shrinking surface over Interchange's
native mailbox, no other file in this package touches the mailbox
response shape, so a later swap to the native thread shape is a
one-file change.

Deletes the now-uncalled @corbits/chat thread-messages read route
(GET /workbenches/:id/threads/:threadId/messages) and its chat-ui
pinned-strip/reaction-chip UI and wire types.

Known regressions, follow-up needed:
- Forking a message into a depth-2 sub-thread still targets the old
  @corbits/chat thread store, whose ids have no relationship to the new
  mailbox-derived thread ids; the fork/sub-thread affordance is
  disconnected until it's ported to mailbox threads too.
- Block-kind message parts (approve/poll/form/connect-github/
  connect-service cards) cannot round-trip through the mailbox: a mail
  body is plain text, so a reloaded page loses any persisted block
  content.
- The mailbox live-update subscription refreshes the whole feed on any
  event rather than re-reading only the affected thread, since the SSE
  payload carries just a message id/op, not a thread root.
@TheGreatAxios
TheGreatAxios merged commit f4a4b21 into main Sep 17, 2026
5 of 9 checks passed
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.

1 participant