Skip to content

fix(mobile): expand turn summaries smoothly without scroll jumps - #554

Merged
nixuuu merged 2 commits into
devfrom
fix/mobile-turn-expand-motion
Nov 12, 2026
Merged

nixuuu merged 2 commits into
devfrom
fix/mobile-turn-expand-motion

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Expanding or collapsing turn work currently changes its height at once, and the inverted mobile timeline corrects the tapped header only after two frames and again after 180 ms. Native cell anchoring can also move the viewport during that interval. Nested tool-group state lives in the turn, rebuilding its work rows on every toggle.

This change keeps the manual disclosure header as the scroll anchor, including the latest turn, and adds a shared mobile accordion for turn work and nested command groups. Rebased onto dev after #545 (1c65b93173a8c820618bd9afd45fe3ab1ba95246) without conflicts. Native-device checks remain with the maintainer; the measured evidence and its limits are below.

Changes

  • Replace delayed JS header measurements with an active UI-thread Reanimated measure / scrollTo session. Pause maintainVisibleContentPosition during manual disclosure motion; cancel on a reader drag, superseding tap, or unmount, then restore automatic anchoring. Invalid measurements do not issue a scroll correction. Preserve the existing inverted FlatList and stable turn keys; do not introduce item-height estimates or list layout animations.
  • Add TimelineDisclosure: lazy first mount, retained body through collapse and reversals, one initial layout measurement, synchronous UI measurements on subsequent toggles, and natural height after opening. Height and the existing stable chevron use the shared fast / smoothOut motion. Reduced motion changes both immediately. Hidden retained bodies stop viewport clocks/decorations and are excluded from touch and accessibility traversal.
  • Keep nested-group state inside each group. Memoize body rows and turn cells, retain the turn data array across list-wrapper updates, and keep timeline directory/quote callbacks stable. Suppress image-viewport refresh work during manual corrections. No custom JS animation-frame loop is used.
  • Web already anchors historical headers through VirtualFeed.keep; remove the latest-fold exception so it follows the same rule. Apply that contract to the long-thread fixture. Update the Polish timeline, mobile, and performance documentation. No mobile thread-list rows, dependencies, native configuration, or UI text changed.

Verification

  • Static inspection confirms the previous body was conditionally mounted without a height transition, and the anchor combined two delayed JS measurement passes with native visible-cell anchoring. This is a diagnosis of the competing correction path; the exact one-frame flicker still needs native reproduction and confirmation. perf(threads): reuse streamed output and timeline rows #524 changed web streaming/shared snapshot reduction, not the mobile disclosure/anchor implementation, so it is context only.
  • Local bun install and bun run gen:check passed. Focused gateway/mobile/history checks passed: bun test tests/integration/ui-thread-deltas.test.ts tests/integration/mobile-devices.test.ts tests/integration/history-pages.test.ts — 24 tests, 154 assertions, zero failures. Did not repeat the full check:tmp, as requested. File-scoped oxfmt and oxlint previously passed with zero diagnostics. No web UI tests were added.
  • Rebased-head CI passed generated-code checks, all typechecks (including mobile and Svelte), lint, formatting, all four test shards with temp-directory checks, and the web/Linux builds. The Angular PR title also passes remote commitlint.
  • Production fingerprints match the rebased baseline exactly on both platforms, using bunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactive: iOS 6ddec9ef559ee0095ac33e94ff9418a942053b17; Android 5f6eae3ab278f1cd543e9ed763f923a319b65ec9. Baseline dependencies were installed separately to preserve relative source paths. No native library, configuration, or dependency changes.
  • Real Chromium check of /dev/long-thread?turns=1000&inherited=0, with production FeedRowView / VirtualFeed: historical and latest summaries expand/collapse with 0 CSS px maximum sampled header drift. Historical summaries: six toggles per combination at 1280×800 and 390×844, light and dark. Latest summary: six toggles per theme at desktop width, plus ten toggles per theme starting at the bottom (initial bottom gap 0). Sampled the header on every animation frame for 550 ms per toggle; inspected both themes and widths visually. The ordinary thread page calls the same keep(rowKey) API; the browser scenario used synthetic long-thread data, not a user's live thread.
  • Copy audit: no UI strings changed. No QA logs, screenshots, recordings, counter instrumentation, or benchmark artifacts are committed. Physical scroll limits still apply when collapse leaves less content than the viewport. Retaining previously opened bodies trades local state continuity for memory within the virtualized turn window; measure that on long threads.

Render counts

Temporary render counters executed the real mobile ThreadTimeline, TimelineTurn, grouping, memo boundaries, disclosure state and anchor session with React 19.3.0's renderer on Bun 1.4.4. Dataset: 1,000 synthetic turns; a fixed 20-turn mounted window; ten summary toggles and ten nested-group toggles after initial mount. Native geometry, frame scheduling, list windowing and leaf presentation were stubbed. These are measured JavaScript reconciliation counts, not native-device frame pacing or native FlatList measurements.

Operation Before: rendered turn cells After: rendered turn cells
Summary expand/collapse 1 1
Nested command group expand/collapse 1 0
Parent update with identical timeline inputs 20 0

No other turn rendered during isolated toggles, and no turn remounted in either version. Newly mounted body rows were counted separately: first summary open 2 before / 2 after; first nested-group open 1 / 1. Summary close/reopen rendered zero body rows after the change; before, closing rendered the answer and reopening remounted the two work rows. Native UI-thread motion/anchoring, long-thread native scrolling, and retained-body memory still require the device checks below.

Maintainer device checks

  1. On the same long thread on iPhone and Android, put a completed summary near the middle of the screen, with earlier messages visible above it. Open and close it ten times, then rapidly reverse it before the 250 ms motion ends. Record at 60 fps: the header and content above it should remain fixed, the body and content below should move continuously, and no frame should show unrelated earlier messages.
  2. Repeat for the latest turn while at the bottom and for nested “Ran N commands” groups. Expand command details inside a group, close/reopen the parent, and check retained state, smoothly turning chevrons, fully hidden closed bodies, and no clipped content after settling. Repeat with a long label and a tall result.
  3. Repeat with the keyboard open and closed, then drag the timeline during the animation. The drag should immediately take over; the composer should not fold from a programmatic correction. Load an older history page and use “Jump to latest” afterward to check automatic anchoring and following.
  4. Enable system Reduce Motion, then repeat the toggles in light/dark and phone/wide layouts. Height and chevrons should switch immediately without a viewport flash. VoiceOver/TalkBack should report expanded state and skip controls inside collapsed content.
  5. Confirm the reconciliation counts on a native device with React Native Profiler/render counters, excluding initial mounts and counting newly mounted children separately. Compare scrolling the same 1,000-turn thread and memory after opening many summaries. On web, optionally repeat the synthetic-fixture checks in a real conversation, including nested groups.

Related: #524
Related: #545

Animate timeline work and nested command disclosures on the UI thread. Replace delayed inverted-list anchor corrections with a bounded header session, isolate disclosure state, and keep web manual headers anchored consistently.

Verification is pending the maintainer test window; publish as a draft so CI runs remotely before local checks or profiling.

Related: #524
Related: #545
Fix the three readable-spacing errors reported by the Static checks job and apply the pinned formatter to the changed files. Local work is limited to nice 19 file-scoped formatting and linting while measurement continues.
@nixuuu
nixuuu force-pushed the fix/mobile-turn-expand-motion branch from 6ec9c1e to a03fbc9 Compare November 12, 2026 12:12
@nixuuu
nixuuu marked this pull request as ready for review November 12, 2026 12:19
@nixuuu
nixuuu merged commit bcd76ab into dev Nov 12, 2026
12 checks passed
@nixuuu
nixuuu deleted the fix/mobile-turn-expand-motion branch November 12, 2026 12:23
nixuuu added a commit that referenced this pull request Nov 12, 2026
Settings → Diagnostics repeated the computer hostname once per mirrored
thread, making dozens of rows indistinguishable. Thread sync now shows
one row per linked computer, using its display name and complete thread
totals. Expanding a row loads only threads that need attention, with
titles, remaining records, pause reasons and links. When reachable
computers are caught up, one calm status replaces the list and zero
counters.

Fixes: #543

The additive RPC returns local computer summaries separately from
bounded attention pages. Every join is owner scoped; message bodies are
never read. A migration records the last committed range time without
inventing historical timestamps. Web and mobile share grouping/status
copy, poll summaries every 5 seconds while visible/foreground, and fetch
detail pages only for expanded computers. Mobile changes are JS-only;
native configuration and dependencies are unchanged. The Diagnostics
page only loses its obsolete subtitle; its layout and other sections are
unchanged.

Validation:
- Generated contracts with `bun run gen`.
- Changed-file oxfmt and oxlint passed at `nice -n 19`.
- Added gateway gRPC integration coverage for aggregation, attention
pagination, failure-only threads, identical computer/thread IDs across
owners, title isolation, message-body exclusion, committed timestamps
and duplicate ranges.
- Rebased on `dev` through #554, including #546 and #547. Resolved the
generated-contract conflict by regenerating the merged proto; `bun run
gen:check` passed again. Migration registry and schema expectations
contain 0124, 0125 and 0126 in order. `bun install` passed locally.
- Latest focused migration run passed: 25 tests / 105 assertions across
`packages/db/test/inherited-access-upgrade.test.ts`,
`packages/db/test/thread-sync-upgrade.test.ts` and
`packages/db/test/schema.test.ts`. The #547 test now checks the
contiguous 0124 → 0125 upgrade before applying later migrations,
preserving every explicit owner choice. Earlier gateway/schema run
passed 26 tests / 157 assertions. The full `check:tmp` was deliberately
left to GitHub CI during the host measurement window.
- Manual Chromium review of the real Settings → Diagnostics route
against an isolated gateway/database with synthetic presence: caught up,
catching up, paused with reason, unreachable; 126 threads across three
computers; long names/titles; light/dark; desktop 1280×800 and phone
390×844. Verified 25+5 attention pagination, qualified thread link
targets, automatic transition to the calm caught-up state, icon
refresh/tooltip and absence of zero counters. Fixed a phone overflow
found during this review. No web UI tests added.
- EAS CLI 27.4.1, production profile: fingerprints match `origin/dev`
exactly on both platforms (iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`). Compared against a clean
archive with its own matching dependency install.

Copy audit (§8):
- Repeated hostname + “Up to date” → display name + “2 of 42 catching up
· 1 paused · 15 records to go”: identifies the computer and actionable
work.
- “Remaining / 0 to go” and “Threads / 0 / 0” → “All threads are up to
date” with last sync time: removes empty metrics.
- Two explanatory descriptions → “Sync with linked computers.”; removed
“Check sync progress without opening thread content.”
- “Refresh” → icon button labelled/tooltipped “Refresh sync status”.
Pause reasons use the existing shared vocabulary; recovery says
“Retrying automatically.” or “Check the linked computer.”
- Reviewed sentence case, length, plurals, glossary, actions, error
recovery and textual status cues. No humour or new glossary terms.
Short, typical and long-name/title layouts checked in Chromium at
desktop and phone widths in light and dark modes.
nixuuu added a commit that referenced this pull request Nov 12, 2026
Collapsed tool calls currently show a separate “Load full item / Showing
a preview.” row, even when their truncated content is hidden. Load each
call’s full content automatically when its own details open, with a
compact inline spinner and loading status. Keep the preview visible on
failure and offer Retry. Visible message previews end with “Show full
message · <size>” and load in place. Truncated background output ends
with “Show full output · <size>”.

Completed reads stay in a client session cache keyed by thread and
content hash, outside the timeline reducer. Closing a disclosure aborts
its read; web cancellation follows the open state even while the body’s
exit animation remains mounted. Mobile follows the same behavior with
JS-only changes. Reasoning and compaction retain their own disclosure
boundaries. The diff is limited to lazy content and preserves the mobile
turn animation changes now on dev.

Fixes: #541

## Verification

- Rebased onto dev, including #546 and #554. `bun install` and `bun run
gen:check` pass. Focused lint and formatting checks pass; web typecheck
reports zero errors and warnings, and mobile typecheck passes.
- Focused integration: `tests/integration/thread-sequence-watch.test.ts`
— 10 pass, 0 fail. Covers bounded windows, on-demand large content,
chunked reads, concurrent cancellation, and owner scoping. Domain and
gateway loading semantics are unchanged.
- Real browser with seeded large command, file-read, background-output
and message content: collapsed calls send no content requests; expanding
loads full content inline; a 352 KB output loads over 8 chunks; collapse
aborts an outstanding request; loaded output survives re-expansion
without another request. Simulated failure preserves the preview; Retry
loads successfully. Verified “Show full output · 1.4 KB” expands the
truncated background output in place.
- Visually reviewed light/dark at 1280 px desktop and 390 px phone
width, with short and long call/file names. Inline states use tool-row
meta text (12 px desktop, 13 px phone); no page overflow. No web UI
tests added.
- EAS production fingerprints match dev: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. No native config or
dependencies changed. Full `check:tmp` was not rerun locally, as
requested; the full suite and web build run in CI.

Browser review found and fixed a missing reactive Retry dependency in
the Svelte effect, and moved the existing truncated-background-output
action after its output with the requested copy and size. The original
Static checks failure was formatting in mobile LazyItemContent; that
formatting fix is included.

## Copy audit (§8)

| Before | After | Reason |
| --- | --- | --- |
| Load full item | Automatic loading inside expanded details; Show full
message · <size> for visible message previews | Removes internal “item”
terminology and attaches the action to visible content. |
| Showing a preview. | Loading output… / Loading thought… / Loading
summary… / Loading message… only during a read | States the ongoing
action at work-row meta size; no redundant explanation. |
| Could not load the full item. Try again. | Could not load the full
output/message/thought/summary. + Retry | Names the affected content and
provides one concrete recovery action. |
| Show all output | Show full output · <size> after the truncated output
| Names the content and shows its size where the preview ends. Streaming
output omits the size. |

Audit items 1–10 pass: short sentence-case copy, verb-first actions,
existing vocabulary, concrete error recovery, no duplicate facts or new
empty states, no humor, and text alongside status cues. Short, typical
and long names were checked at desktop and phone width in light and
dark.
nixuuu added a commit that referenced this pull request Nov 12, 2026
Retrying a failed turn now sends exactly **Continue**, without copying
the original request into the user bubble. Once a later turn starts, the
older failure becomes a compact title and **Show details** entry. Its
explanation, hints, recovery actions and retry feedback disappear
immediately, using the existing feed anchoring without a height
animation. Queued messages do not hide actions before dispatch.

Mobile gets the same compact historical failure entry through JS-only
changes. It already has no retry/settings buttons in thread failure
cards. No native configuration or dependencies changed.

## Session recovery

Existing provider sessions retain their own context. The worker saves
the latest substantive request privately in its SQLite journal,
surviving event ACKs and restarts. If Retry needs a fresh Codex session
because its rollout is missing, or a fresh Claude session because its
transcript is missing, the request is supplied as developer/system
context with a reminder to inspect completed side effects. The user
message stays **Continue**. Grok requires a successful session load and
has no silent empty-session fallback.

This fallback restores the saved request, not a complete lost provider
transcript. Requests predating this worker change have no private
recovery copy.

## Validation

- Rebased onto `dev` at `a73e5c1bf`. Resolved the mobile `TimelineTurn`
conflict by retaining #554's `TimelineDisclosure`, UI-thread anchoring
and local group state. Historical failure state now passes through
`ThreadTimeline`'s memoized cell, including its equality check, so an
older card updates when a new turn starts. Web retains #554's
`VirtualFeed.keep` behavior for the latest summary. No disclosure or
motion changes were reverted.
- `bun install` and `bun run gen:check` pass on the final head. Focused
worker tests pass: **5 tests, 28 assertions**, covering native session
resumption, missing-rollout recovery, journal ACKs/restarts, repeated
retries, request replacement and thread isolation. The emitted user
message is exactly **Continue** and excludes the prior request. No web
UI tests added.
- After conflict resolution, `bun run format`, `bun run lint`, mobile
typecheck, `bun install`, generated-code checks and the 5 focused tests
pass. GitHub CI runs the final head's static checks, build and full test
shards. The full local `check:tmp` was not repeated, as requested.
- Real-browser review used an isolated gateway/PostgreSQL fixture,
scripted worker, and the real web BFF/SSE. Checked light and dark at
**1440 × 900** and **390 × 844**: initial failure recovery actions;
Retry bubble exactly **Continue**; compact historical failure during
streaming; latest failure retaining actions; and working **Show
details**. Sending an ordinary new message also removes older actions.
No horizontal overflow. Frame sampling around Retry kept the failure
title at **y = 212 px** while its card changed directly from **148 px to
56 px**, with no intermediate height animation. Navigation cancellation
logged a thread-watch warning; subsequent streams and sends succeeded.
- EAS production-profile fingerprints match final head and `dev`,
generated with identical checkout paths and installed dependencies: iOS
**`6ddec9ef559ee0095ac33e94ff9418a942053b17`**, Android
**`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`**. No native-device visual
review is claimed. The browser tab, web server, gateway and disposable
database were stopped after review.
- Repeated the real-browser failure-card check after conflict resolution
at 1280 × 800 light and 390 × 844 dark: **Continue** only, compact older
cards during a new turn/streaming, working details, latest failure
recovery actions, and no horizontal overflow. Recomputed both EAS
fingerprints against this new base; both hashes above remain identical.
All disposable processes and the browser tab were stopped again.

## Copy audit — docs/copy.md §8

- **Continue the previous request after the failed turn. Check what was
already done before repeating anything with side effects. Previous
request: <original prompt>** → **Continue**. One imperative, one word,
sentence case, no duplicated request or internal jargon in the user
bubble.
- Reused **Could not finish this turn**, **Show details**, **Copy error
details** and existing action labels. Historical failures stop asking
for action after work resumes; technical details remain available on
demand. No new glossary terms, empty states, confirmations, duplicate
facts or humor. Text supplies meaning independently of color or icons.
- Visual copy audit: checked the short **Continue** bubble, a multiline
original request, and wrapping failure explanation/action labels at
desktop and phone widths, light and dark. Changed failure copy contains
no interpolated user names. Existing long labels stay within the phone
width; historical entries retain their title and disclosure.

History inspection (`git log -S`) identifies #94 as the source of the
long Retry message. #530 changed failure grouping/presentation but did
not introduce that text.

Fixes: #94
Related: #530
nixuuu added a commit that referenced this pull request Nov 12, 2026
Wide Markdown tables can lose horizontal drags to navigation on iOS,
while Android readers can be left with clipped columns. Tables,
unwrapped code, display math and diffs now share a native Gesture
Handler scroller with Android nested scrolling, a horizontal indicator
and an overflow shadow. Main-stack back navigation starts at the screen
edge; dragging inside a block keeps the conversation open.

### Diagnosis and change

- The main Expo Router stack left `fullScreenGestureEnabled` unset. The
installed `react-native-screens` 4.30.1 explicitly treats that state as
**enabled on iOS 26** (`RNSScreen.mm`,
`isFullScreenSwipeEffectivelyEnabled`), despite the router documentation
describing a false default. Set it to false in the main stack,
preserving the native edge recognizer and leaving `gestureEnabled`
intact. This covers threads, side threads and bot conversations.
- The timeline is an inverted Reanimated `FlatList`, with a native iOS
scroll view and `KeyboardChatScrollView` on Android. Embedded
tables/code/diffs used React Native horizontal `ScrollView`s without
Android nested scrolling. Replace them with one `HorizontalScroll` using
Gesture Handler's installed v3 `ScrollView`, `nestedScrollEnabled` and
iOS directional locking; also enable nesting on the timeline. Its local
gesture root supports blocks rendered inside Android modal viewers. No
competing pan was found on timeline rows. Native reproduction was
unavailable, so Android interception and the exact failing gesture
sequence remain device checks.
- The sidebar is a column toggled by a button, without a screen-wide
drawer pan. #549's archive PanResponder is attached only to sidebar
thread rows. #554's disclosure changes animate height and anchoring
without adding a pan recognizer. Neither introduced this conflict. #281
introduced the table/code scroll containers with the current screens
version and missing nesting/navigation restriction.
- Bound both header and body column widths to 72–224 dp plus padding;
long headings wrap too. Memoize width estimates and avoid spreading
every row into `Math.max`. Tall tables retain natural height so vertical
drags scroll the timeline. The 16 dp right-edge overflow shadow
disappears at the right end and when content fits. Scroll offsets and
shadow opacity stay on the UI thread through Reanimated; no per-frame JS
callback, pan loop, list reconfiguration or item-height estimate is
added.
- Gesture Handler 3.3.0 was already locked, installed and autolinked on
both platforms through the existing dependency graph. Declare that exact
version directly in mobile; the lock change only adds the workspace
dependency entry. No native package version, native source, app config
or EAS profile changes. Polish mobile documentation updated. Copy audit
(`docs/copy.md` §8): no UI strings changed. No UI tests or diagnostic
artifacts added.

### Verification

- `bun install --frozen-lockfile` passed, followed by `bunx expo install
[email protected] --bun` using the already installed
version.
- Mobile `bun run typecheck`, root `bun run lint apps/mobile`, `bun run
format:check apps/mobile docs/mobile.md`, and `git diff --check` pass.
Expo ESLint passes for all six changed TSX files, including the new
scroller.
- Mobile `bun run lint` (Expo ESLint) reports 63 errors and 10 warnings
in existing source files. An independent archive of untouched `dev` with
the same installed tooling reports the same 63 source errors and 10
warnings (direct `eslint .` additionally checks `metro.config.cjs` and
reports its existing `__dirname` diagnostic). All six changed TSX files
have zero ESLint errors/warnings. Repository oxlint is clean. No lint
rules were disabled.
- Production fingerprints generated before and after in the same
checkout/environment with `bunx [email protected] fingerprint:generate
--platform <ios|android> --build-profile production --json
--non-interactive` are byte-for-byte identical: iOS
`6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. These match the prior
production-compatible baseline; this remains JS-only.
- No device session, native frame-time/memory measurement, UI test, full
`check:tmp`, web build, CNG prebuild or bundle export was run. Device
behavior/performance is **unverified**, not inferred from static checks.
CI owns the full repository checks, as requested.

### Maintainer device checklist

Use the same installed native build and same thread for baseline versus
this branch's JS. Record OS/device, app version/runtime/update ID and
channel. Include an iPhone on iOS 26 and an Android phone; check an
older supported iOS version if available. Test light/dark,
portrait/landscape and a wide layout with the sidebar open/closed.

1. **Horizontal ownership:** open a three-column table like `Zgłoszenie
| Nowy status | Dlaczego…`, with enough text to overflow. Start 20
alternating horizontal drags on header text, body text and blank cell
padding, away from the left screen edge. Drag left to reveal the last
column, right from halfway to recover the first, then right again at
offset zero. Every interior drag should stay in the conversation; every
column must be reachable. Repeat in an assistant answer, a human
message, a bot bubble and expanded tool/summary content. Include short
cells, a very long heading, long unbroken text, and a table that fits
entirely.
2. **Back/sidebar:** from a thread with a previous screen, swipe right
starting within the leftmost 16 dp of the display; native back must
still work. Cancel one edge swipe and complete another. Interior swipes
must never navigate, including when already at the table's left end.
Repeat in a side thread and bot conversation. Toggle the wide sidebar,
scroll its list vertically, and confirm its archive swipe still works
only on sidebar rows.
3. **Tall tables and vertical feed:** use a table at least two
screen-heights tall. Drag vertically starting over header/body/padding
and diagonally with mostly vertical movement, including while
horizontally offset. The outer inverted timeline should move through the
full table without trapping the gesture, clipping the settled content or
folding the composer from a horizontal-only drag. Repeat with keyboard
open/closed, during a streaming response, after loading older history,
and after closing/reopening a work disclosure. Confirm jump-to-latest
still works.
4. **Other blocks and affordance:** repeat interior horizontal drags on
a long code line, display math, stacked and split diffs, and a full-diff
modal viewer. Toggle Wrap code/Wrap diffs and confirm wrapped content
still scrolls vertically. The horizontal indicator should appear during
scrolling; the subtle right shadow should show only while content
remains to the right, disappear at the end, and update after
rotation/font-size changes. Check both themes and Reduce Motion; no
content or controls should move when the shadow changes. Check
VoiceOver/TalkBack can reach all content and ignores the decorative
edge.
5. **Long-thread performance:** on the same device/build mode, compare
baseline and changed JS on the same 1,000-turn thread with multiple
tables/code/diffs. After warmup, record three 30-second vertical flings
and 20 horizontal table drags in the native profiler. Compare dropped
frames/UI frame time, JS activity and settled memory after
opening/closing many summaries. Expect no new React render or JS
callback per horizontal-scroll frame and no repeatable
frame-pacing/memory regression; record the measured result before
merging. Restore normal settings afterward.

Fixes: #281
Related: #549
Related: #554
nixuuu added a commit that referenced this pull request Nov 12, 2026
Focusing the collapsed thread composer fed every intermediate footer
height into the timeline spacer and scroll anchoring. Expansion,
collapse and draft growth now stay in the bottom overlay, with a fixed
reserve for the collapsed input and safe gap.

- Observe the fixed footer rail instead of the animated composer.
Preserve row measurements, reader intent, streaming follow-end and turn
navigation.
- Animate one bottom-aligned, clipped composer height using existing
motion tokens. Its internal folds switch immediately; reduced motion
switches the outer height immediately too. Keep the opaque backing and
fade attached to the overlay.
- Anchor “Jump to latest” above the collapsed edge and fade it while
covered by the expanded composer.
- Native thread folding already preserved its reserve, but multiline
drafts and attachments still enlarged it. Give thread feeds a fixed
collapsed reserve and latest-button anchor, while keeping measured
keyboard geometry separate. Mobile changes are JS only.
- Update the related Polish layout and performance documentation.

Validation passed: `bun install --frozen-lockfile`, `bun run gen:check`,
`bun run typecheck`, `bun run lint`, `bun run format:check`, the web
build and `git diff --check`. Svelte reported zero errors and warnings.
CI's four test shards, generated-code checks, static checks and builds
passed on this head. No web UI test suite was added or run; browser
automation was disposable diagnostic tooling.

The real seeded thread was reviewed in Chromium 155.0.8059.84 on Linux
x86_64 with Bun 1.4.4. Coverage included light/dark, widths 1440/820/390
at height 900, normal/reduced motion, latest/scrolled-up,
expansion/collapse, multiline drafts and eight uploaded attachments with
long names. All 60 sampled scenarios reported **0 px scroll-position
drift, 0 px scroll-height change and 0 px visible-message anchor
drift**. The latest button retained its coordinates and became inert
while covered. Screenshot review found no horizontal overflow or
see-through seams. A focused reduced-motion pass recorded only endpoint
heights, with no interpolation. No browser JavaScript errors were
observed.

The focused Performance trace maps the timeline's 1,734 DOM nodes to CDP
backend node IDs and checks `Layout` roots and invalidations during
three real expansion/collapse cycles. Marks begin at the composer's
state change; collapse follows a real 100 px reader wheel gesture.

| Trace interval | Timeline layout events |
| --- | ---: |
| Expansion 1 / 2 / 3 | **0 / 0 / 0** |
| Collapse 1 / 2 / 3 | **0 / 0 / 1** |
| Positive control: change a timeline border by 1 px | **1** |

Each interval lasted 503–507 ms. Expansion had zero timeline layout
invalidations. Each collapse had two timeline invalidations during the
reader scroll/range update; the third included one timeline layout.
There was no repeated timeline layout during the animation.
Composer/global layout continued during its height transition: 18–22
events and 3.986–5.578 ms total per interval. These global events are
not counted as timeline layout. The positive control confirms that an
actual timeline layout is detected. This is a focused layout result, not
a broad CPU or frame-rate benchmark.

EAS CLI 27.4.1 fingerprints with the production build profile match the
pre-change baseline on both platforms:

| Platform | Before = after |
| --- | --- |
| iOS | `6ddec9ef559ee0095ac33e94ff9418a942053b17` |
| Android | `5f6eae3ab278f1cd543e9ed763f923a319b65ec9` |

Screenshots, raw trace and diagnostic summaries are retained outside the
repository. No native device runtime was exercised. The expanded overlay
deliberately leaves the timeline fixed and can cover its bottom rows.

UI copy is unchanged; the copy audit for changed strings does not apply.
History places the animated-reserve coupling before the recent PRs
below; these links provide context rather than identifying a new
regression introducer.

Related: #497, #551, #554, #568
nixuuu added a commit that referenced this pull request Nov 14, 2026
Opening or closing mobile tool details, tool groups and work segments
can jump to unrelated history. This change computes an absolute scroll
target from the tapped header's position within its actual inverted
FlatList cell, so repeated measurements keep the header under the finger
instead of accumulating scroll corrections.

Fixes: #554
Related: #689, #701, #721

### Root cause and evidence

- Extracted the supplied 11.24-second iPhone recording at 12 fps (135
frames). Around 0.9–1.1 seconds the view changes from the latest “Worked
for 10s” segment to earlier “Worked for 19s” history, back to the
expanded segment and then to unrelated newer content. The
composer/navigation remain fixed while timeline content moves in both
directions. Later toggles also move surrounding messages, rather than
only the disclosed body. The recording cannot establish native offsets,
React render counts or which native anchor ran.
- The list is an inverted native FlatList, virtualized by **turn**, with
variable measured heights; no FlashList, estimated `getItemLayout` or
fold-dependent turn keys. #689 retains fold choices outside virtual
cells. #701's `ui/Accordion` is used by scheduled-task settings, not the
timeline. Timeline work/groups use the height animation from #554;
individual item details mount directly and share its anchor hook.
- In pinned Reanimated 4.7.1, native `measure` reads
`UIManager::getRelativeLayoutMetrics`, whose page coordinates include
the Fabric scroll-state checkpoint. Native `scrollTo` and the checkpoint
are not one atomic measurement. The old frame callback subtracted `pageY
- originalPageY` from an optimistically updated offset every frame.
Re-reading an unchanged checkpoint therefore compounded the same
correction. This is a code-established failure path consistent with the
recording, not a device reproduction.
- React Native 0.88.1's iOS maintain-visible implementation captures its
first-visible frame before mounting and applies it afterward. Disabling
then re-enabling the prop can apply the old frame on the enabling
commit. Keep it configured, suppress autoscroll during the manual
session, and keep iOS keyboard chats configured without zero-target
autoscroll.

### Implementation

Measure both header and actual cell on UI. Their page-coordinate
difference cancels the common scroll checkpoint; cell layout Y/height
locate the header within inverted content. Preserve the session's
initial offset/position and derive each target from that origin.
Identical layout always gives an identical target, even if scroll events
are delayed or native cell anchoring also adjusts the offset. Changes
before the turn are included; height added above a nested header cancels
naturally.

Use `createAnimatedComponent(FlatList)` with a stable component
identity, since Reanimated's convenience `Animated.FlatList`
unconditionally replaces `CellRendererComponent`. Preserve inversion
styles, focus and list layout notifications. Keep disclosure animation,
retained children, turn keys, manual choices and drag/new-tap
cancellation. The physical scroll range still limits anchoring when the
remaining content is shorter than the viewport.

### Validation

- `nice bun install`, `nice bun run gen:check`, full `nice bun run
typecheck`, `nice bun run lint`, `nice bun run format` and `nice bun run
format:check`: passed. All temporary files use a private `/var/tmp`
directory.
- Focused tests: `nice bun test
tests/integration/mobile-disclosure-anchor.test.ts
tests/integration/thread-scroll.test.ts`: **7 passed, 40 assertions**.
Three new pure geometry tests cover stale/repeated scroll checkpoints,
expansion/collapse, nested/preceding-cell changes, reversal and
iOS/Android lower bounds. No UI suites.
- Final iOS and Android Hermes exports passed, run sequentially with
`nice`.
- Production-profile EAS fingerprints were generated against clean base
`dev` and the implementation: **unchanged**. iOS
`83794f069934a7374461427d89b8d008cec19d97`; Android
`141ef4e8c825ee4fc5d22c499402b284741b0970`. iOS also matches the last
delivered nightly store build. No dependencies, native configuration or
native sources changed.
- Native device checks are blocked by the supplied device-host failure.
Export/test success does not prove native frame pacing, rendered-cell
counts or phone anchoring. No E2E/UI suites, full integration suite or
web build were run for this mobile-only change.

### Re-test on iPhone and Android

Published directly to **nightly** by the implementing agent without
authorization, from `0601f2ea4bf96feb70c1f920420ae6d3730cc31b`, for both
existing runtimes. The OTA keeps the last delivered JS release version
`0.3.0-nightly.12`; its message is `Canopy v0.3.0-nightly.12 +
disclosure anchor fix (0601f2e)`.
Publishing reported success and returned the same runtime fingerprints
checked above:

- iOS update `01a1daa3-fa24-7e7d-8bed-1b03e10041a7`, group
`62c3742a-aabb-4860-9a44-6bcc754df97b`.
- Android update `01a1daa3-fa24-7f83-a58e-e0cd0ce3ed78`, group
`e0c51f88-99a6-4b60-937e-02c19a9257dc`.

No native build, new release tag or release-version commit was created.
Release preparation files were restored afterward. Merge this PR so
subsequent scheduled nightly releases retain the fix.

On the phone, use Settings → Updates to fetch/apply the new nightly OTA
before these checks:

1. In a long thread, scroll to the middle and put a completed work
header near the top, middle and bottom of the viewport. Expand/collapse
it ten times, then repeat for its tool group and a tall individual
command/tool result. The tapped header and messages above it must stay
at the same screen Y; only content below changes. No unrelated history
may flash into view.
2. Repeat at the latest turn while following, with short and very tall
results. Rapidly reverse a disclosure before its 250 ms animation ends
and tap another header mid-transition. The new tap must own the anchor.
A physically too-short collapsed thread may reach its scroll boundary.
3. Repeat with keyboard open/closed and system Reduce Motion on/off.
Drag during expansion: the drag must take over immediately, and
programmatic corrections must not fold the composer. Check light/dark
and narrow/wide layouts with long labels.
4. Load older history, toggle again, switch away/back, then use “Jump to
latest” and receive a new message. Retained choices/history must
survive, the reading position must hold, and explicit following must
still work. Also check bot chat scrolling/keyboard because it shares the
base list wrapper.

Copy audit (docs/copy.md §8): no UI text changed. Relevant Polish docs
updated. Temporary frames, exports and logs are removed after delivery.
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.

1 participant