Skip to content

perf(chat): move history projection to worker#406

Open
beruro wants to merge 1 commit into
developfrom
perf/chat-history-worker
Open

perf(chat): move history projection to worker#406
beruro wants to merge 1 commit into
developfrom
perf/chat-history-worker

Conversation

@beruro

@beruro beruro commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • move large ChatHistory pipeline and group projection work into a module Web Worker
  • share one pure projection core between Worker execution and main-thread fallback
  • add versioned snapshot/delta protocol with stale-response, resync, timeout, and multi-consumer protection
  • keep small histories on the main thread and preserve/loading-state existing projections while Worker updates are pending
  • replace render-time full-array virtual-list keys with deterministic layout digests
  • document EventStore, Worker projection, and React ownership boundaries

Verification

  • pnpm exec vitest run src/engines/ChatPanel/ChatHistory/projection/__tests__ src/engines/ChatPanel/ChatHistory/chatItemPipeline/__tests__ src/engines/ChatPanel/ChatHistory/hooks/__tests__/useChatGroups.test.ts src/engines/ChatPanel/ChatHistory/hooks/__tests__/useChatTurnPagination.test.ts — 11 files, 235 tests passed
  • scoped ESLint with --max-warnings=0 — passed
  • pnpm exec tsc --noEmit --pretty false — passed
  • pnpm exec webpack --mode production --no-cache — passed
  • git diff origin/develop...HEAD --check — passed

Performance validation note

The implementation includes deterministic 10,000-event coverage and a 50,000-event pressure fixture. Real Tauri runtime measurements for INP, main-thread P95, structured-clone cost, and steady-state memory remain follow-up acceptance work with production session data.

@beruro
beruro marked this pull request as draft July 17, 2026 06:37
@beruro
beruro marked this pull request as ready for review July 17, 2026 08:00
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