Skip to content

fix(desktop): restore fast middle-page scroll coverage setup (#155) - #166

Merged
oscarlehuu merged 1 commit into
mainfrom
fix/155-scroll-mounted-coverage
Aug 12, 2026
Merged

fix(desktop): restore fast middle-page scroll coverage setup (#155)#166
oscarlehuu merged 1 commit into
mainfrom
fix/155-scroll-mounted-coverage

Conversation

@oscarlehuu

Copy link
Copy Markdown

Problem

scroll-history.spec.tsfast middle-page scroll settles with continuous mounted coverage — failed on main with:

expect(received).toBeGreaterThan(expected)
Expected: > 5608
Received: 3608

Issue #155 framed two opposite product causes (page-fetch shortfall vs virtualizer coverage). Discriminating evidence shows neither: the suite never reached the middle-scroll coverage loop.

Evidence (before fix)

Recorded at the setup prepend step on main:

Probe Value
scrollHeight before live older emits 3608
mounted [data-message-id] rows 49 (initial ~50-event window)
older live emits 100
of those mounted immediately 0
scrollHeight 1s later 3608 (unchanged)
prepended settle text in DOM none

Product path that rejects the harness setup:

// desktop/src/features/messages/lib/channelWindowStore.ts
// mergeLiveChannelWindowEvent — events below an open oldest boundary wait for paging
if (
  oldest &&
  (event.created_at < oldest.created_at ||
    (oldestPage.hasMore && compareRelayOrder(event, oldest) >= 0))
) {
  return current;
}

Unit contract already locks this: live rows below an open oldest boundary wait for paging.

Cause kind: HARNESS (not product page-fetch shortfall, not virtualizer coverage bug).

Approach

Buzz seam: channel window store live-merge + older-page pagination (mergeLiveChannelWindowEvent / pageOlderMessagesUntilRowFloor / top-edge sentinel).

  • Seed older mock history with __BUZZ_E2E_PREPEND_MOCK_HISTORY__ before open.
  • After open, wheel up so the real older-page fetch lands a genuine Virtua shift prepend.
  • Keep the original middle-scroll continuous-coverage asserts (no weaken / skip / timeout raise).

Tests

Red → green (target):

# main
[smoke] fast middle-page scroll… FAIL  Expected: > 5608  Received: 3608
# this branch
[smoke] fast middle-page scroll… PASS  (3.1s)

Local collateral:

Docs

Risk

  • Low: harness-only setup change. Product retention / virtualizer / live-merge behavior unchanged.
  • If wheel-up fails to page on a slower runner, the existing scrollHeight poll still fails loudly rather than weakening coverage.

Exclusions

Fixes #155

The failing scroll-history middle-page coverage case never reached its
mounted-range asserts. Setup tried to force a Virtua shift prepend by
live-emitting 100 backdated messages after channel open; product
mergeLiveChannelWindowEvent correctly drops events below the open oldest
boundary (they wait for ordinary relay paging), so scrollHeight stayed
flat (3608→3608) and the >5608 poll timed out.

Evidence (before fix):
- mounted rows before emit: 49; after 100 older live emits: still 49
- prepended settle text mounted: 0
- no older-page request required for that path — pure live merge shortfall
  in the harness, not a virtualizer coverage or page-fetch shortfall

Fix (harness): seed older mock history before open, wheel up to land a
real older-page prepend (enables shift), then keep the original
middle-scroll continuous-coverage asserts unchanged.

Fixes #155
@oscarlehuu
oscarlehuu merged commit e80a041 into main Aug 12, 2026
9 of 12 checks passed
@oscarlehuu
oscarlehuu deleted the fix/155-scroll-mounted-coverage branch August 12, 2026 05:51
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.

scroll-history.spec.ts:1281 — fast middle-page scroll settles with ~half the required mounted coverage

1 participant