Repository navigation
fix(chat): judge follow re-engage on the reader's own travel during an iOS toolbar collapse - #13359
Conversation
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
3 similar comments
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
|
👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review. When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically. |
UX Review (Fable 5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Verify on a real iPhone that a deliberate drag to the bottom mid-stream still re-engages follow; the simulated-gesture tests can't stand in for Safari's actual toolbar timing. [UX-REVIEWED] 5e12ee7 Description read[DESCRIPTION-READ] b2673890e230b841d8e5c4f113bc4e08ebb873b974d5dc315f60bb3884d4bff7 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Fable 5, fork) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The gesture-total accounting rests on unverified iOS Safari claims — multi-frame collapse, ~50px growth, touch jitter samples — that only a real device can confirm. Not justified as shipped
What this change shipsInventory (9 items) — 8 justifiedIntent: FIX — stop iOS Safari's collapsing toolbar from snapping a scrolled-up reader back to the live end during a small downward drag.
[FIRST-PRINCIPLES-REVIEWED] 5e12ee7 Description read[DESCRIPTION-READ] 7e458272b332257cc0d8f2e3302392d95e1f0d8e74e34cabbf7eb419d881b8c9 That sha256 names the PR description this verdict read. Recompute it with |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Every iOS timing assumption here (observer-before-clamp order, touch sampling, settle windows) is encoded from simulation; no real-device run of this revision is evidenced. Watch
Suggestions
[DESIGN-REVIEWED] 5e12ee7 Description read[DESCRIPTION-READ] ba13508e066a27d9484f96eff2db5da425aea3e45a1d5d0ecf2e7e080e5183cc That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed |
537d8a5 to
5531a85
Compare
5531a85 to
3907bb2
Compare
5e897c2 to
22bb210
Compare
22bb210 to
47d858d
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
Requesting changes: two Opus findings on head 25f0194 are unaddressed and one can leave follow stuck off.
-
followPolicy.ts (travelDelta hunk, @@ -627): travel is measured from the clamped scrollTop, so a reader less than 2x growth above the bottom (under ~100px for Safari's 50px collapse) can never satisfy travel >= growth; a deliberate long drag to the end counts like a 12px nudge, and at flush a further drag fires no scroll event, so follow stays off until the reader jumps to latest or scrolls up and back down. Suggested fix: measure travel from the unclamped intent (pre-clamp delta or pointer/wheel delta), or treat reaching the bottom edge as satisfying the re-engage.
-
followPolicy.ts:~784: lastReaderScrollAtRef is stamped on !layoutClamp, and layoutClamp requires stick, so a released reader's own engine clamp opens a gesture and charges its growth to their next flick back down, contradicting the comment above it. Gate the stamp on the reader's own input, not on stick.
Also still open from Design: keyboard-sized growth (~300px) closing during a drag to the bottom now refuses a re-engage that main allowed; no table row or test covers it. Please add tests for D0 < 2G with a deliberate drag, a released reader's clamp followed by a flick down, and growth concurrent with the keyboard.
|
Thanks, both findings were real, and they are fixed on 1. Travel measured from the clamped scrollTop. The intent listeners ( 2. Gesture clock stamped on Tests ( |
|
Re the GPT finding on The downward-intent total ( Pinned in |
|
Re the First Principles item on The inline predicate is deleted. Same pins: the wall-drag hook test goes red with the resolver's answer discarded; tsc clean, 568/568, eslint clean. Body sentence updated. |
|
Re the Opus findings on
Pins, each red with only its own term reverted: two resolver tests (gap-at-bottom; content shrink under a drag, with the keyboard counter-case) and three hook tests driven by real Separately, |
|
Round 5 ( Finding: Fix: the fresh-gesture branch now zeroes both accumulators alongside the gap, the same reset the scroll handler applies on lapse. The live wall-drag re-engage is unchanged: it runs inside an open gesture (input clock fresh), so nothing is reset there. Pin: Gates: tsc clean, 1751/1751 across 143 virtualizer/scroll/follow/viewport/shell files, eslint clean. Rebased onto main while at it; this push also re-rolls the Windows(7) |
|
Opus round on Finding (correct): the intent-based Fix: the input may stand in for the position only with no upward evidence in the window: Pins: a resolver-level test (stick armed, growth 60, intent 1, upward stamp -> |
…n iOS toolbar collapse On iOS Safari the toolbar collapses under the very drag that scrolls toward the bottom, so the scroller grows during the reader's small downward move. resolveUserScrollStick rule 3 judged the re-engage band against the post-growth height, read that as the reader arriving, re-armed follow above the bottom, and the next automatic pin took them to the end. Rule 3 now keeps the live distance as the arrival test and credits the arrival to the reader only when their own downward travel across the gesture is at least the viewport growth across it; the hook accumulates both totals per gesture and re-baselines growth that lands while the reader rests. With no growth the rule is identical to main. Fixes kirodotdev#13356
iamwhatever
left a comment
There was a problem hiding this comment.
Re-reviewed the PR's own files at 5e12ee7 against 25f0194. All three points fixed: travel is now the reader's own input (pixel wheel delta or finger path) rather than the clamped scrollTop, and a drag continuing at the wall goes through the same resolver; a flush landing with no hard input no longer opens a gesture whatever stick says; the gap rule (travel >= starting gap above epsilon) restores the keyboard-close return main allowed. Each has a test (D0 < 2G, wall drag, released clamp then flick, 200px gap / 250px drag / 300px growth). Non-blocking: line-mode wheels (Firefox deltaMode=1) fall back to the position-only rule, and a pinch can add downward input via touches[0].
Problem / Motivation
Goal: A reader who has scrolled up on iOS keeps their place when the Safari toolbar collapses under a small downward drag, instead of being snapped to the live end.
On iOS Safari, a reader who has scrolled up in the chat transcript to read
earlier messages gets snapped back to the bottom while a turn is streaming.
It happens as they drag downward a little and the Safari toolbar collapses
under the drag; a moment later the transcript is at the live end.
Why it matters
On a phone the toolbar collapses and re-shows constantly as you scroll, so a
reader loses their place whenever they pause to read history mid-turn. It
looks random because it needs a small downward nudge and a live turn at the
same time.
Not a goal
atBottomUI band; both keep their existing behavior.What changed (motivation → approach → change)
Follow is re-armed by rule 3 of
resolveUserScrollStickinwebsite/src/hooks/virtualizer/FollowController.ts: a genuine downward movethat lands within
FOLLOW_REENGAGE_PXof the bottom means the reader cameback, so the transcript follows again. That band was judged against the
scroller's height after the frame's layout was applied.
On iOS the Safari toolbar collapses under the very drag that scrolls toward
the bottom, so the scroller grows during the reader's small downward move: the
bottom comes up to meet them, follow re-arms, and the next automatic pin
carries them to the end.
The fix splits the approach. With content unchanged, the distance the reader
closed is their own downward travel plus the box's growth. Rule 3 keeps the
live distance as the arrival test (
dist <= FOLLOW_REENGAGE_PX; the livebottom is the only one reachable) and credits the arrival to the reader only
when
travel >= growth: they moved at least as far as the growth carriedthem. Subtracting growth from the distance instead is unsatisfiable once the
collapse exceeds the band (growth lowers the maximum scrollTop by the same
amount), which would refuse "return to live" for the whole collapse.
website/src/hooks/virtualizer/useVirtualChat.tsowns the two gesture totalsthe resolver compares: the reader's downward travel (user scroll events only,
positive deltas) and the viewport growth (signed
clientHeightdeltas), bothaccumulated across scroll events that arrive within
SCROLL_SETTLE_MSof eachother and reset after a rest. Safari animates the collapse over several
frames, so per-event values would credit only the last frame. Growth that
lands while the reader rests (keyboard closes, window grows: no scroll event)
is re-baselined out at the ResizeObserver so it is never charged to the next
drag. With no growth the rule is identical to main.
Two follow-ups from review. First, the same split guards BOTH arrival
branches of
resolveUserScrollStick, not only rule 3's band: a viewportgrowth lowers the maximum scrollTop, so a reader parked 60 px up is only
10 px from the new maximum after a 50 px collapse, and any nudge of 10 px or
more is clamped flush (distance 0) rather than landing inside the band. The
bottom-epsilon branch decided that case on direction alone and re-armed follow
for a reader who never reached the bottom. Its released row now requires
travel >= growthas rule 3 does; its follower row and non-downward landingsare unchanged, and the redundant
clampedByViewportterm is folded into thedocumented decision table. Second, "a gesture in flight" now means the
reader's hand: both totals lapse, and the ResizeObserver re-baselines the
scroll-event height, on a clock stamped only by user scrolls that are not
layout clamps and by the grab that interrupts a smooth glide. A streaming
turn's own pin writes previously kept the window open for the whole turn, so a
mid-turn growth (the keyboard closing) stayed in the total and the rest
re-baseline never ran; a reader who flicked up and came straight back was
refused their own arrival while the output streamed past them. Self-scroll
events neither extend the gesture nor contribute growth.
A third round found two holes in that accounting, both in
website/src/hooks/virtualizer/followPolicy.ts. First, the reader's travelwas measured from the CLAMPED
scrollTop: a growth G lowers the maximum byG, so a reader parked D0 above the bottom is answered with at most D0 - G
however far they drag, and
travel >= growthis unsatisfiable for anyoneunder 2G away (100 px at Safari's collapse) -- a deliberate drag to the end
counted like a 12 px nudge, and once flush a further drag raised no scroll
event, so follow stayed off until they jumped to latest. The intent listeners
in
website/src/utils/searchScroll.tsnow report the input's own size withits direction (a pixel wheel delta, a finger's path), the hook sums the
downward input per gesture (
readerIntentAccumRef), and the resolver judgestravel as the larger of answered and asked (
readerIntent). An input in thegesture also counts as the hand on the scroller for a flush landing whose
position fell (the growth outran the finger within the frame). A second term
covers growth larger than the drag: a drag that covers the WHOLE gap the
gesture began with (
gestureStartGap) is the reader's return whatever the boxdid, which is how the keyboard closing (~300 px) under a 250 px drag from
200 px up re-engages as it did on main. And because a drag at the wall raises
no scroll event,
noteHardInputasksresolveUserScrollStickwith the sameaccumulators (neutral position, live intent as the move) when a released
reader at the bottom keeps dragging down -- the arrival rule has one spelling. Second, the gesture clock was
stamped on
!layoutClamp, andlayoutClamprequires follow to be armed, soa RELEASED reader's own engine clamp opened a gesture and charged its growth
to their next flick down. The clock is now gated on the reader's input: a
flush landing with no hardware input in the settle window is the engine's
whatever
sticksays.lastUserScrollAtRef(the pin-hold gate) keeps itsexisting rule.
The intent total also resets on an UPWARD input. A phone reports the finger's
direction per frame, so an upward flick often opens with one downward jitter
frame; that frame's few px used to stand for the whole settle window, and the
resolver reads a live downward intent as "moved down", which disables the
upward clamp-release guard -- a flick up that coincided with a mid-stream
content shrink kept follow armed and the next pin snapped the reader back.
A reversal is no longer a return, so the total goes to zero.
Both substitutions are gated on what makes them honest. The gap term needs a
REAL gap: a gesture that opens at the bottom (a released reader the engine
clamped flush, now at rest) seeds a gap of ~0, and
travel >= 0would havelet a 1 px nudge re-arm follow. And the input stands in for the position only
while a viewport growth is in flight, because that is the one thing that can
make a downward drag read as a fall; with no growth a falling
scrollTopatthe bottom is a CONTENT shrink clamping the reader flush, and the position is
the honest read (arriving is not asking), as on main. The observer's at-rest
re-baseline in
measurement.tsnow judges "in flight" on both reader clocks,the way
noteHardInputopens a gesture: the input that starts a drag landsbefore its first scroll event, so keyed on the scroll clock alone the first
frame's growth was folded away before the nudge's scroll event could see it.
A gesture that
noteHardInputopens also starts its growth and travelaccumulators from zero. The scroll handler's lapse reset never runs for a
gesture that raises no scroll event (an input at the wall), so a wheel notch
after a rest was judged against the LAST gesture's growth and re-armed follow
with no growth in flight -- the case the no-growth rule refuses.
And the input stands in for the position only with no UPWARD input in the
settle window: touch samples outrun frames, so a 1 px reversal sample can
land after an upward flick's sample and re-bank a positive intent beside the
upward stamp, and letting the input answer "moved down" there skipped the
very release the stamp arms -- a follower who flicked up as the keyboard
closed stayed armed and the next pin yanked them back. The keyboard-close
returns the substitute exists for carry no upward input.
Legend: 🟩 added · 🟨 changed · 🟦 unchanged.
Backwards compatibility
Compatible: only the two arrival tests change, and only when a viewport
growth lands within the reader's gesture. With no growth both branches are
identical to main. Desktop resizes under a downward wheel now behave the same
way, which is the intended reading in both cases.
Tests
src/test/FollowController.test.ts: a 50 px collapse under a 148 px drag to2 px from the end re-engages (red on the code before this rule); a 3 px nudge
that lands inside the band only because of the growth stays released; a
neutral event during growth stays released; a shrink never widens the band;
both totals are gesture totals, not one frame's; omitted
readerTraveliscredited as 0; a nudge the growth clamps FLUSH stays released (red before the
bottom-epsilon guard); a reader who drags to flush while the box grows
re-engages; a follower clamped flush by the growth keeps following.
src/test/useVirtualChat.viewportResize.test.tsxunder "iOS toolbar collapse under a downward drag": the 50 px drag-to-bottom
re-engages and stays pinned through the re-show (red before); a nudge during
the collapse does not re-arm, so the re-show does not pin (red on main); a
collapse animated over frames 38/8/1 is judged on gesture totals; growth the
reader sat through is not credited to a later nudge; growth that landed at
rest with no scroll event is not charged to the next drag; a released reader
clamped flush stays released; a nudge the collapse clamps flush does not
re-arm (red before); growth under our own pins mid-turn is not charged to the
reader's later gesture, growth across one of our scroll events inside their
gesture is dropped, and growth right after the turn's last pin is re-baselined
at rest (each red before, and each pinned so that removing only one half of
the gesture-clock change fails it).
Third round:
FollowController.test.tspins that travel is judged on theasked-for input when the clamp answered with less (red without
readerIntent), and that a drag covering the whole starting gap re-engagesunder larger growth while a fall with no input stays the engine's (red without
gestureStartGap).useVirtualChat.viewportResize.test.tsxadds the fourrows above, driven by real
touchmoveevents through the intent listener: theshort-gap deliberate drag (red without the intent term), the drag that goes on
at the wall with no scroll event (red without the
noteHardInputre-engage),the released reader's clamp followed by a flick down (red with the clock back
on
stick), and the keyboard closing under a drag to the end (red without thegap term).
searchScroll.test.tsasserts the reported magnitudes.The jitter-then-flick-up row is pinned the same way (red with the upward
reset removed).
The three rows after it are pinned as hook tests plus resolver-level pins,
each red with only its own term reverted: the gap guard, the growth gate on
the input term, and the input clock in the observer's at-rest test.
Manual verification
N/A — unit coverage is the verification. The trigger needs a downward drag,
the toolbar collapse and a live turn in one gesture, so a manual pass/fail on a
device is not evidence either way. What a device would have to confirm is
that the toolbar collapse changes the scroller's
clientHeightduring thedrag; that follows from the shell being
h-dvh(the dynamic viewport tracksthe toolbar by specification) and is the same growth path rule 1 already
handles for keyboard close. The tests reproduce the frame sequence against a
controllable scroller and fail on the unpatched code.
Screenshots / video
Why no screenshot: the fix is that nothing moves; the correct after-state
is identical to where the reader already was.
Related Issues
Pattern harvest
Rule candidate: review-prompt -- any 'did the reader arrive here' test in the follow resolver must be judged against pre-layout geometry (credit viewportGrowth), not the height the frame just applied.
Generalizable, one sibling: rule 1 of the same resolver already credited
viewportGrowthfor the at-bottom clamp; rule 3 read the same event withoutit. Any rule that judges "did the reader arrive here" against post-layout
geometry needs the same credit. No further rule in the resolver reads the
band, so nothing else needs the change now.
Fixes #13356