Files
buzz/desktop
npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7andWill Pfleger aed76fbc6c test(desktop): replace tautological F8 tests with real hook-lifecycle regression
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>
2026-07-08 15:02:45 -04:00
..
2026-06-11 15:06:24 +00:00

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 frontend
  • pnpm tauri dev - run the desktop app
  • pnpm build - typecheck and build frontend
  • pnpm typecheck - TypeScript checks
  • pnpm lint - Biome lint
  • pnpm 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