mirror of
https://github.com/block/buzz.git
synced 2026-11-02 23:41:08 +00:00
Round 7 fixes for PR #3966 (Thufir's BLOCKED verdict at 35873afea3):
1. Bounded drain-retry controller: scheduleAbortRetry() gives abort retries
their own escalating timer (1s→2s→4s…60s), coalesced per manager, cancelled
on destroy() and identity change. Abort paths call scheduleAbortRetry(); only
the success-path gen2 promotion uses scheduleDrain() (immediate). No microtask
spin loop under persistent storage failure.
2. Generation exhaustion without reuse: deleted nextGen=1 ceiling reset.
Hydration now compacts/rebases all pending intent gens and their matching
receipt gens into a fresh safe range [1..N] when maxObservedGen is at or
above MAX_SAFE_INTEGER; nextGen = N+1 after rebase. Both enqueue() and
promoteDeferred() guard the _nextGen++ with Number.isSafeInteger(gen).
3. Total transaction closure: onDrainOutcome wrapped in try/catch — thrown
callback triggers the same receipt-aware abortTransaction + scheduleAbortRetry
path as the storage-failure abort, not a silent latch-forever exit.
restoreFromStorage() clears all transaction-only maps (clearTransactionState)
so no lock/snapshot/deferred/promoted state survives an identity swap.
destroy() calls clearTransactionState() for the same reason.
4. Witnesses to contract (Tests 51/52/37):
- Tests 51/52: enqueue gen2 from onDrainOutcome (isLoadComplete toggle forces
deferred latch path); fail exactly one write; let real bounded scheduler fire
retry (no manual intercept); assert intermediate blob, recovered combined
gen1-cleanup+gen2-pi commit, restart parity.
- Test 37: Phase 5 sends TWO reconnects while gen-2 held; Phase 6 releases
secondBarrier, asserts gen advances to gen1+2, fetchCallCount=3 before
destroy. All assertions unconditional.
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