Skip to content

feat: channel history paging, MessageLiveObject, message search and hardening - #346

Merged
Makisuo merged 34 commits into
mainfrom
integration/post-cutover
Oct 28, 2026
Merged

Makisuo merged 34 commits into
mainfrom
integration/post-cutover

test(web): pins keep their messages loaded by id

6e5b661
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Oct 28, 2026 in 58s

Confidence 8/10 · No issues found

🟢 Confidence 8/10 · likely safe to merge
Re-review covered only the two files changed since 8c05906; pinnedLoadStream's wiring is still untested and the auth/tenancy hunks rest on the earlier review.
1 note · tests partial −1 · risk high −1

Cutover follow-up: paged channel history, per-org FTS search, a MessageLiveObject replacing RivetKit, and hardening across sync, Connect and chat-sync. The two files changed since the last review (pin and reply-target loading plus their new tests) hold up; no new defects.

  • keepMessagesLoaded holds and releases by-id demands as the pin set changes
  • replyTargetsStream now takes the channel id and loads reply targets past the window
  • New tests pin history retention, reply-target loads and pin-set deduping

Before merge

  • Infra · Check every environment has what this config now expects · alchemy.run.ts
  • Infra · Check every environment has what this config now expects · apps/web-foldkit/alchemy.run.ts
  • Manual · Upgrade maple-ai and maple-chat to bot SDK 0.2.0: their open McpQueryError stacks point at packages/actors/src/registry.ts, which this PR deletes, so they stop only once those services deploy agai…

Still open from earlier reviews

Production impact

Open errors in the changed files
Issue Service Occurrences File
@maple/mcp/errors/McpQueryError maple-ai 226 packages/actors/src/registry.ts
@maple/mcp/errors/McpQueryError maple-ai 63 packages/actors/src/registry.ts
@maple/mcp/errors/McpQueryError maple-chat 54 packages/actors/src/registry.ts
@maple/mcp/errors/McpQueryError maple-chat 45 packages/actors/src/registry.ts
@maple/mcp/errors/McpQueryError maple-ai 36 packages/actors/src/registry.ts
@maple/mcp/errors/McpQueryError maple-chat 24 packages/actors/src/registry.ts
@maple/mcp/errors/McpQueryError maple-ai 24 packages/actors/src/registry.ts
@maple/mcp/errors/McpQueryError maple-ai 20 packages/actors/src/registry.ts
@maple/mcp/errors/McpQueryError maple-chat 18 packages/actors/src/registry.ts
@maple/mcp/errors/McpQueryError maple-ai 18 packages/actors/src/registry.ts

After this merges, Maple checks whether they stop.

Production traffic of the changed files (last 7 days)
File Calls/day Busiest operations
apps/backend/src/rpc/per-request.ts 2.6k POST 1.3k/day, 3.9% err
POST 1.2k/day, 0.2% err
apps/backend/src/worker/live-route.ts 1.6k GET 998/day, 1.4% err
GET 635/day, 12.3% err
Telemetry this change adds and removes (30)
  • ➕ span name ApiV1.writeLiveState · apps/backend/src/routes/api-v1/messages.http.ts:208
  • ➕ attribute message.id · apps/backend/src/routes/api-v1/messages.http.ts:209
  • ➕ attribute live.action · apps/backend/src/routes/api-v1/messages.http.ts:209
  • ➕ span name ApiV1.getLiveState · apps/backend/src/routes/api-v1/messages.http.ts:225
  • ➕ span name OrgObject.publishChatSyncAccounts · apps/backend/src/services/chat-sync/chat-sync-org.ts:124
  • ➕ attribute chat_sync.provider · apps/backend/src/services/chat-sync/chat-sync-org.ts:143
  • ➕ attribute chat_sync.channels · apps/backend/src/services/chat-sync/chat-sync-org.ts:144
  • ➕ span name OrgObject.chatSyncLinkThread · apps/backend/src/services/chat-sync/chat-sync-org.ts:413
  • ➕ attribute chat_sync.outcome · apps/backend/src/services/chat-sync/chat-sync-org.ts:415
  • ➕ attribute chat_sync.link_id · apps/backend/src/services/chat-sync/chat-sync-org.ts:417
  • ➕ attribute channel.id · apps/backend/src/services/chat-sync/chat-sync-org.ts:418
  • ➕ span name LiveRoute.forward · apps/backend/src/worker/live-route.ts:109
  • ➕ span name LiveRoute.upgrade · apps/backend/src/worker/live-route.ts:120
  • ➕ span name MessageLive.send · apps/backend/src/worker/live/client.ts:26
  • ➕ span name MessageLive.readSend · apps/backend/src/worker/live/client.ts:41
  • ➕ span name MessageLive.access · apps/backend/src/worker/live/runtime.ts:234
  • ➕ attribute live.rechecked_users · apps/backend/src/worker/live/runtime.ts:302
  • ➕ attribute live.closed · apps/backend/src/worker/live/runtime.ts:302
  • ➕ span name MessageLive.recheckSockets · apps/backend/src/worker/live/runtime.ts:303
  • ➕ span name MessageLive.finalize · apps/backend/src/worker/live/runtime.ts:346
  • ➕ span name MessageLive.write · apps/backend/src/worker/live/runtime.ts:388
  • ➕ span name MessageLive.read · apps/backend/src/worker/live/runtime.ts:396
  • ➕ attribute live.socket · apps/backend/src/worker/live/runtime.ts:444
  • ➕ span name MessageLive.adopt · apps/backend/src/worker/live/runtime.ts:446
  • ➕ span name MessageLive.alarm · apps/backend/src/worker/live/runtime.ts:486
  • ➕ span name ChannelObject.liveAccess · apps/backend/src/worker/objects/channel/live-access.ts:17
  • ➕ span name ChannelObject.exportSearchMessages · apps/backend/src/worker/objects/channel/search-index.ts:39
  • ➕ attribute search.exported · apps/backend/src/worker/objects/channel/search-index.ts:87
  • ➕ attribute channel.viewers_stale · apps/backend/src/worker/objects/effects/channel-effects.ts:96
  • ➕ span name OrgObject.publishOrgChannelsRemoval · apps/backend/src/worker/objects/org/channel-access.ts:287
What was checked
  • pumpIds skips ids the mirror already holds or requested (history.ts:186), so the new load streams never re-ask for window rows
  • Stream.switchMap releases the previous by-id demand before the new one starts, asserted via the release spies in the new pin test
  • ~/db/collections resolves to src/core/db/collections.ts via tsconfig, so the test spies the same messageCollection instance lookup-data.ts uses

6e5b661 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.