mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
The two archive-paging-reset tests in ingestArchivedObserverEvents.test.mjs were tautological: they reassigned local let variables and asserted on those same reassignments, not on any production behavior. The tests passed even if the useEffect([channelId]) reset in useLoadArchivedObserverEvents was deleted. Fix: extract the paging state machine into archivePagingState.ts with two pure functions (createArchivePagingState, applyChannelReset). The hook imports and calls these; tests import the same functions directly. Replace the tautological tests with: 1. Three unit tests in ingestArchivedObserverEvents.test.mjs that call createArchivePagingState() and applyChannelReset() — the real production functions, not local copies. These catch behavioral regressions in the state machine itself. 2. Two hook-lifecycle tests in archivePagingReset.test.mjs that mount a React component (via the same DOM shim used in MessageComposerDraftImagePersist.test.mjs), drive channel A to exhaustion, re-render with channel B, and assert B starts fresh via the hook's own reactive state. These tests fail when the useEffect([channelId]) body is deleted — verified before commit: removing applyChannelReset(ps) from the effect causes cursor/hasOlderArchived to remain stale after the channel switch (AssertionError: cursor must reset to null after channel switch (A->B)). The hook's useEffect([channelId]) body is unchanged in behavior: it calls applyChannelReset(ps) which sets cursor=null, isFetching=false, hasOlderArchived=true — identical to the prior inline mutations of cursorRef.current/isFetchingRef.current. Backfill state is not touched by applyChannelReset, preserving the identity-level semantics Paul and Thufir confirmed. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Buzz
Desktop chat shell with:
- Tauri + React + TypeScript + Vite
- Tailwind CSS
- shadcn/ui-ready shared components
- Biome (lint/format/check)
- Feature-driven frontend structure
Scripts
pnpm dev- run the web frontendpnpm tauri dev- run the desktop apppnpm build- typecheck and build frontendpnpm typecheck- TypeScript checkspnpm lint- Biome lintpnpm format- Biome format (write)pnpm check- Biome check
Structure
src/shared- reusable app-wide code (ui,lib,styles)src/features- feature modules (vertical slices)src/app- top-level app composition