mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Register the `settleGate` preview feature (preview-features.json → Settings →
Experiments) and read it in MessageTimeline via `useFeatureEnabled`, passing
`settleGate: { enabled }` to `useAnchoredScroll`. Default-off: the flag-off
runtime path is unchanged from main — the mid-history prepend re-anchor runs
immediately on the prepend commit, exactly as it always has.
Gate-on, the re-anchor is now routed on live-motion at re-anchor time rather
than deferred unconditionally:
- At rest (no scroll event within SETTLE_MOTION_WINDOW_MS): `applyReanchor()`
runs synchronously in the layout effect, main-identical — no frame ever
paints at the displaced position.
- Under a live fling: defer behind `observeScrollSettle` (k consecutive still
frames), re-measuring drift at settle time.
The still-vs-moving decision reads `lastScrollTsRef`, stamped synchronously in
`onScroll`, so it costs zero deferred frames — a rAF probe would leak one
painted frame at full prepend height at rest. SETTLE_MOTION_WINDOW_MS (~6
frames) sits above WebKit's ~2-frame coalesced freeze, consistent with the k>=3
clamp, so a coalesced gap can't misread a live fling as still. A newer prepend,
channel switch, or unmount cancels any pending correction.
This clears the gate-on behavior-contract tier symmetrically: the earlier
defer-always version red-lined timeline-no-shift.spec.ts:429 at maxDrift 3400px
(one painted frame at rest); the synchronous at-rest path takes it to 18px with
no test change. Full timeline-no-shift contract file 5/5 green with the flag
forced on by the e2e bridge. Unit tier green (7 observeScrollSettle cases incl.
freeze-survival and k-clamp); tsc + biome clean.
Ruling: Dawn on :429 (at rest, "never paints a displaced frame" is the
behavior; synchronous-commit is main's means, not the assertion); ratified by
Eva. The momentum-only deferral is real behavior but unexercised by any current
top-tier test — a future mid-fling contract test gets the settle-sampled shape
from birth rather than rewriting :429.
Co-authored-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.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