Repository navigation
perf(mobile): cache immutable images and load them on demand - #419
Merged
Merged
Conversation
This was referenced Nov 9, 2026
nixuuu
force-pushed
the
perf/client-6
branch
2 times, most recently
from
November 9, 2026 16:50
bbd29c6 to
e87e583
Compare
nixuuu
marked this pull request as ready for review
November 9, 2026 16:54
nixuuu
added a commit
that referenced
this pull request
Nov 9, 2026
### Rebase verification — 2026-11-09 The five-layer stack is rebased onto `dev` at `2580ed75cdfc162e98e125b7c4d0b24eb81901b7`, including #418 and #421–#426. All PRs remain ready for review. The measurements below describe the original baseline; this section records the current integration verification. The attachment route now passes `If-None-Match` through #421's shared response helper. Gateway authorization/read succeeds before a 304 is possible; qualified IDs, thumbnail fallback, bounded preview/truncation, sanitized public failures and `no-store` errors are retained. Mobile image caching retains public error messages and reconnect retries. Session startup, replacement pairing, unpair and revocation retain all four caches: transcript, bot, archived sidebar and images. The branch/worktree panel, channel identity and sheet gesture changes remain intact. Passed on the rebased top branch: `bun install`, `bun run gen:check`, full `bun run typecheck`, root `bun run lint`, `bun run format:check` and the production web build. Final focused `check:tmp`: **27 passed, 0 failed, 334 assertions across 7 files**, no temp leftovers (images, immutable HTTP, transcript/archive/bot caches, two-gateway linked previews and composer choices). Coverage includes a matching old ETag returning 404 after ownership changes and 409 while the home is unavailable, with `no-store` and no ETag; image/archive caches are wiped together and late callbacks cannot restore them. EAS CLI **27.4.1**, production profile, before/after the image-cache and preparation layers and on the final top branch: **unchanged relative to the latest dev baseline**: - iOS: `bf3156a1bd878e10c0b0be25d4c194a837fb1b7e` - Android: `d638e5f7b7fa87f54ccc0715c5fe150b8c0ad3ae` These differ from the original measurement hashes below because #424 already changed native branding/configuration on dev. This stack adds no native dependency/configuration change. Final production Hermes exports passed sequentially with one Metro worker: iOS **9,971,620 B**, Android **9,961,323 B**. These include the newly merged client features; the earlier performance comparisons below retain their original baseline. Expo Doctor: **20/20**. An additional Expo ESLint check of the conflict files reports the same pre-existing `react-hooks/set-state-in-effect` finding in `useImage.ts` on both this head and unmodified `origin/dev`; session cleanup has no Expo ESLint findings. The required root oxlint check passes. No full local test run was started, as requested for the overloaded shared machine. The earlier full-run timeout below is historical; **GitHub CI is the current full-suite merge gate**. No native builds, EAS builds, OTA publication or UI test suites were added. Previous on-device profiling gaps remain. --- Reuses prepared timeline entries for unchanged turns, makes sibling item grouping linear, and avoids encoding/writing an identical immutable snapshot repeatedly. New snapshot revisions still serialize and persist; failed writes remain retryable, eviction allows a later resave, and unpair/close fences remain intact. | Metric | Before | After | Method / environment | |---|---:|---:|---| | Prepare 5,000 sibling items, median / p95 | 39.198 / 43.052 ms | 1.954 / 3.728 ms | Bun 1.4.4, 10 samples after 5 warmups | | Save the same immutable 14,085,915-byte snapshot, median | 30.218 ms | <0.001 ms | Warm duplicates; in-memory storage adapter, no disk | | Save a new immutable snapshot, median | 28.767 ms | 28.841 ms | Same adapter; serialization still required | | Cold cache load/decode, median | 21.348 ms | 20.932 ms | New cache per sample, same encoded bytes; no disk | | iOS Hermes bundle | 9,900,217 B | 9,901,992 B | Sequential `expo export --platform ios` | | Android Hermes bundle | 9,889,662 B | 9,891,426 B | Sequential `expo export --platform android` | CPU harness: deterministic 1,000-turn / 7,099-item snapshot on Linux x86_64, Ryzen 5 5600X, shared 15.5 GiB machine. The before and after control runs were consecutive while repository checks ran; this is not an exclusive-CPU lab result. The grouping instrumentation retains 999/1,000 group arrays after one item changes. That is reference retention, not a measured React render count. Native fingerprints, EAS CLI 27.4.1, production profile, before = after: - iOS: `2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3` - Android: `c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d` Only JS/TS changes; no native build, dependency, EAS build or OTA publication. The exports establish bundle sizes, not runtime FPS. Validation: durable bounded mobile cache integration cases passed (4 tests, 34 assertions), including retry, concurrent duplicate saves, disk eviction/resave and close fencing. Whole-stack checks are recorded on the top PR. No UI tests or changed UI copy. Additional Expo ESLint check: 18 errors and 1 warning on both the frozen baseline and this branch, all in unchanged files (effects/ref rules and Expo Updates namespace imports). The required root oxlint check is clean. These existing Expo lint findings were not suppressed or folded into this performance change. The table records the isolated preparation change measured before the image-cache layer was added. Original cumulative final Hermes sizes, including that layer: iOS 9,927,705 B and Android 9,917,398 B; both native fingerprints were identical to that baseline. The image-cache measurements and limitations are in #419. Original full-suite status is recorded on #416: one unchanged composer-shell timeout remained unresolved at that handoff. On-device work remains: React Native commit/render counts, Hermes JS/UI frame times, real filesystem read/write latency, variable-height FlatList window tuning, and native bitmap/process memory after repeated image-viewer visits. `docs/client-performance.md` gives the workload and profiling procedure. This layer leaves FlatList settings and image viewer behavior unchanged relative to #419.
nixuuu
added a commit
that referenced
this pull request
Nov 9, 2026
### Rebase verification — 2026-11-09 The five-layer stack is rebased onto `dev` at `2580ed75cdfc162e98e125b7c4d0b24eb81901b7`, including #418 and #421–#426. All PRs remain ready for review. The measurements below describe the original baseline; this section records the current integration verification. The attachment route now passes `If-None-Match` through #421's shared response helper. Gateway authorization/read succeeds before a 304 is possible; qualified IDs, thumbnail fallback, bounded preview/truncation, sanitized public failures and `no-store` errors are retained. Mobile image caching retains public error messages and reconnect retries. Session startup, replacement pairing, unpair and revocation retain all four caches: transcript, bot, archived sidebar and images. The branch/worktree panel, channel identity and sheet gesture changes remain intact. Passed on the rebased top branch: `bun install`, `bun run gen:check`, full `bun run typecheck`, root `bun run lint`, `bun run format:check` and the production web build. Final focused `check:tmp`: **27 passed, 0 failed, 334 assertions across 7 files**, no temp leftovers (images, immutable HTTP, transcript/archive/bot caches, two-gateway linked previews and composer choices). Coverage includes a matching old ETag returning 404 after ownership changes and 409 while the home is unavailable, with `no-store` and no ETag; image/archive caches are wiped together and late callbacks cannot restore them. EAS CLI **27.4.1**, production profile, before/after the image-cache and preparation layers and on the final top branch: **unchanged relative to the latest dev baseline**: - iOS: `bf3156a1bd878e10c0b0be25d4c194a837fb1b7e` - Android: `d638e5f7b7fa87f54ccc0715c5fe150b8c0ad3ae` These differ from the original measurement hashes below because #424 already changed native branding/configuration on dev. This stack adds no native dependency/configuration change. Final production Hermes exports passed sequentially with one Metro worker: iOS **9,971,620 B**, Android **9,961,323 B**. These include the newly merged client features; the earlier performance comparisons below retain their original baseline. Expo Doctor: **20/20**. An additional Expo ESLint check of the conflict files reports the same pre-existing `react-hooks/set-state-in-effect` finding in `useImage.ts` on both this head and unmodified `origin/dev`; session cleanup has no Expo ESLint findings. The required root oxlint check passes. No full local test run was started, as requested for the overloaded shared machine. The earlier full-run timeout below is historical; **GitHub CI is the current full-suite merge gate**. No native builds, EAS builds, OTA publication or UI test suites were added. Previous on-device profiling gaps remain. --- Reduces allocations while retaining unchanged feed rows and loads the bot settings editor only when it is first opened. Provider discovery and the dynamic import run concurrently; the existing loading/error dialog, generation fence and close animation remain in place. Web and the Electron renderer share this build. | Metric | Before | After | Method / environment | |---|---:|---:|---| | FeedBuilder unchanged 1,000-turn history, median / p95 | 25.829 / 37.331 ms | 16.725 / 31.636 ms | 30 Bun samples after 5 warmups; shared machine with checks running | | Initial shell JS, raw / gzip | 1,049,359 / 376,536 B | 978,327 / 348,632 B | Production static import closure | | Thread route JS, raw / gzip | 1,602,296 / 565,283 B | 1,567,887 / 552,802 B | `/threads/[threadId]`, shell + layouts + page, deduplicated | | General settings JS, raw / gzip | 1,078,406 / 389,672 B | 1,007,374 / 361,768 B | `/settings/general`, same accounting | | Bot conversation JS, raw / gzip | 1,230,361 / 443,477 B | 1,201,264 / 433,818 B | `/bots/[botId]`, same accounting | | Initial shell CSS, raw / gzip | 241,576 / 39,106 B | 240,383 / 38,685 B | Production static import closure | | Renderer remount, two-frame proxy | 20.3 ms | 17.8 ms | One warmed run per revision, isolated 1,000-turn fixture | | Streaming update + render/layout, mean / p95 | 18.58 / 24.6 ms | 12.89 / 17.3 ms | Same fixture and deterministic 200 updates; not network latency | | Scroll frame mean / max | 16.67 / 16.8 ms | 16.66 / 16.8 ms | 80 scroll steps; zero frames over threshold in either run | | Production cold first paint / FCP | 128 / 300 ms | 128 / 264 ms | Single sample per origin, cold HTTP cache, 500-thread sidebar | | Production first feed + focus-ready observation | 1,044.9 ms | 668 ms | Tool-attachment upper bound, single sample; not precise TTI | | Real SSE delta handler, median / p95 | 0.2 / 0.3 ms | 0.3 / 0.4 ms | One ~8.2-second turn, 200 producer deltas at 25/s, JSON.parse + decode + reducer only | Environment: Bun 1.4.4, Linux x86_64, Ryzen 5 5600X, shared 15.5 GiB memory, Chromium 156 at 1280×800. JS data: 1,000 turns, 7,099 items, 14,085,915 protobuf bytes. CPU comparisons use identical deterministic input; no exclusive-CPU claim. Dynamic imports and highlighter grammars are excluded from initial static closure totals. The browser samples are descriptive measurements on a shared machine, not statistically significant navigation or SSE speedup claims. BFF coalescing delivered 49 delta messages before and 36 after in the sampled network turns. The SSE reducer was not optimized here. Initial real snapshots were 24-turn pages, not all 1,000 turns; their sampled payloads differ after synthetic turns, so no snapshot speedup is claimed. Visual verification: real seeded thread with a 64× long answer, desktop 1280×800 and phone 390×844, light and dark, streaming, anchored composer, lazy bot editor initial open/close/reopen and error display. No horizontal document overflow observed. A visible completed answer retained exactly the same viewport y coordinate (-465.664 px) throughout a subsequent 8.2-second streamed turn while reading history. The fixture stayed at zero bottom gap after streaming. Motion code and tokens are unchanged; reduced-motion emulation was not available through the shared browser tool and was not runtime-verified. The existing timeline virtualizer limits mounted articles, but a single huge answer still creates all its Markdown DOM and the 500-row sidebar eventually mounts in full (26,215 total elements in the settled seeded production page). The isolated fixture's mounted element count was 164 before / 114 after at sampled positions; variable visible rows make this unsuitable as a DOM-reduction claim. These are remaining candidates, not fixed problems in this PR. Original validation: `bun install`, `gen:check`, full `typecheck`, root `lint`, `format:check`, production web build and both Expo exports passed. The original final full `check:tmp` finished with 1,919 pass / 161 skip / 1 fail, 22,240 assertions, 1,050.58 seconds, no temp leftovers. The unchanged composer-shell test “Stop during a shell steer kills its group and persists the failed delivery” hit a 10-second RPC cancellation in both original final full runs; its focused retry passed. At that handoff, the full gate was unresolved and the stack was draft. No timeout, assertion or backend changes were made to obtain a pass. No UI test suite was added. | Actual 30-minute session | Before | After | Method / limitation | |---|---:|---:|---| | Duration | 1,801.418 s | 1,801.638 s | Same 1,000-turn fixture, 25 producer updates/s within each visit | | Completed cycles / updates | 204 / 40,800 | 187 / 37,400 | Shared host; the full test suite ran during the after-session | | Handler median / p95 | 1.3 / 2.6 ms | 2.1 / 3.7 ms | Protobuf JSON-object decode + reducer; excludes network/render | | Long tasks / total duration | 1,444 / 131.895 s | 3,894 / 305.815 s | Includes reset, stream and scroll; unequal concurrent load | | Chromium heap counter, first → last | 109 → 364 MB | 342 → 462 MB | Coarse/cached counter; no forced GC, different starting heaps | | DOM first / last / range | 688 / 563 / 533–752 | 554 / 686 / 516–725 | Entire isolated fixture page | The long run was worse under its recorded conditions; it is not evidence of a performance win. The concurrent suite took 1,580 seconds versus 1,029 seconds in the earlier successful run, confirming substantially different observed runtime conditions without proving the cause of either result. Heap counter growth cannot establish retained memory or the absence of leaks; a DevTools memory profile with controlled GC remains necessary. No memory improvement is claimed. A subsequent short control without the full suite, using the same 1,000-turn fixture (after first, then before), recorded: | Short session metric | Before | After | Method / limitation | |---|---:|---:|---| | Duration / cycles / updates | 126.187 s / 13 / 2,600 | 124.428 s / 14 / 2,800 | One ~2-minute sample each; no own test suite, shared host | | Long tasks / total duration | 174 / 16.882 s | 32 / 6.642 s | About 13.4 vs 2.3 long tasks/cycle; no exclusive-CPU claim | | Handler median / p95 | 0.7 / 1.5 ms | 2.1 / 3.4 ms | Reducer timing remains worse in this sample; no handler win claimed | The short control did not reproduce the long-task regression and does not establish long-session memory stability. A controlled CPU/memory profile remains open before claiming an overall long-session improvement. The paired Bun harness and bundle accounting are the primary evidence for this change. Failure follow-up: unchanged ask-user, composer-shell and thread-mirror-deltas files passed together (42 tests, 226 assertions, 0 failures, clean temp directory, 38.70 seconds). The subsequent full run passed ask-user and mirror cases but repeated the composer-shell timeout. This does not establish the cause or make the full gate green. The final stack includes the focused image-cache layer #419. Browser validation on that final stack: 20 real thumbnails, 803,816 body bytes on first pass, zero additional network requests/body bytes on a second pass or reopening the thread. Existing web immutable caching already provided repeat reuse; no additional web transfer improvement is claimed. ETag/304, distinct variants and no-store 404 were observed. Mobile final Hermes bundles are iOS 9,927,705 B / Android 9,917,398 B, with unchanged production fingerprints. Final route bundle accounting is identical to the table above. The five focused cache and immutable HTTP checks passed (39 assertions), including in the final full run. Expo Doctor passed 20/20 checks. All owned benchmark servers and browser tabs were closed before the final full checks. Copy audit: no changed application UI text. No UI test suite was added. Polish documentation records row equality, lazy loading and the measurement method. This does not change FlatList tuning, markdown parsing, native image memory, Electron main-process caches or synchronization semantics.
nixuuu
added a commit
that referenced
this pull request
Nov 10, 2026
Busy threads used to repaint shimmering labels and synchronously measure the virtual feed while streaming. Running-work decorations now use compositor transforms/opacity, visible elapsed labels share one clock, and unchanged history/indexes stay out of the streaming update path. The soft highlight, spinners, durations, disclosure motion and reduced-motion behavior are preserved. ### Changes - Replace background-position shimmer with a static text raster, a translating soft mask and counter-translating highlight. Chromium identifies both layers as active accelerated transform animations; no blanket `will-change`. - Share elapsed/relative clocks; second ticks update only a text component. One IntersectionObserver pauses clocks/decorations outside the viewport and document visibility stops hidden-page work. Mobile uses foreground/viewport guards, one elapsed clock and non-interactive native animation loops. - Cache independent completed feed prefixes with conservative invalidation for edits, late results/notices, fold preferences, nesting and cross-turn background work. Retain structural row metadata so text deltas do not rebuild size indexes/entrances. - Batch clipped-text reads, retain motion tokens until root appearance changes, and let ResizeObserver handle content growth instead of forcing scrollHeight reads on every delta. Contain layout/style in virtual rows and layout/paint in capped code surfaces. - Add Polish rules to `docs/client-performance.md` and pure data/index regression coverage. No UI test suite or diagnostic artifacts are committed. ### Maintainer trace Read-only analysis of the supplied 20.254 s trace (120 Hz recording): | Event | Count | Main-thread time | | --- | ---: | ---: | | Style recalculation | 2,271 | 4,528.43 ms | | Layout | 273 | 142.18 ms | | Paint | 2,108 | 404.09 ms | | Pre-paint | 2,397 | 999.48 ms | | Layerize | 1,874 | 1,077.97 ms | | Commit | 1,875 | 168.06 ms | 1. Renderer main was busy **49.94%** of the recording. There were **27 long tasks** (79.98/min), maximum **213.57 ms**, and **557/2,431 dropped-frame deadline markers (22.91%)**. The recording is 120 Hz; these are not 60 Hz rAF estimates. 2. Long-task self samples point to `VirtualFeed.svelte/settle` (`Me`, `n4KsTDu5.js:42:17016`, approximately **931 ms**), native `getPropertyValue` under `motion.ts/rootToken` (**650 ms**), `AgentMessageBubble.svelte`'s resize measurement (`n4KsTDu5.js:3:1049`, **224 ms**), native `offsetWidth` (**165 ms**) and `clipped.ts/measure` (`B-CkncHS.js:1:286`, **127 ms**). Embedded compiled source was read to map these sites. Sample weights are estimates, not additive inclusive timings. **206 invalidation-followed-by-script layouts** cost **122.08 ms**; **36 tasks** contained multiple layouts. 3. The original CSS shimmer animates background-position and needs main-thread paint. Repeated animation observations include **916 transform-acceleration failure flags** (763 × 1024 and 153 × 132096), **38 moving-pixel filter flags** (4096), and **15 observations with the unsupported-CSS-property bit** (8192). These are state observations, not distinct animations. A partial start record identifies an `ARTICLE.t-unfold`; without a complete DOM/CSS snapshot and starts for pre-existing animations, the full target inventory and `will-change` count cannot be recovered. The live baseline inventory below supplies steady counts. Spins/pings use CSS transforms/opacity; there is no JS spinner rAF loop in the inspected components. Flag meanings follow Chromium's `CompositorAnimations::FailureReason` enum; unidentified/one-shot effects are not assumed to be the shimmer. 4. **11 newly installed one-second repeating fold timers**, **30 token-cache rAF requests**, and **225 rAF callbacks / 460.64 ms** occur in the trace. Some persistent timers were installed before recording. Code inspection confirms per-fold/per-background-task one-second clocks and a shared slower relative clock. The synthetic trace additionally exposes whole-history rebuilding per delta: long-task self samples include **887 ms** of feed shallow comparison, **597 ms** of row reconstruction and **505 ms** in `buildTimeline`, besides **1,219 ms** in `settle`. 5. GC is secondary in the maintainer recording: **19 top-level pauses / 56.82 ms**, largest **10.53 ms**. Used JS heap grows **53.62 → 66.13 MB** (peak **78.61 MB**); DOM counters include detached nodes and do not prove a leak. The supplied recording has frame markers and renderer Layerize/Commit, but no timed compositor/Viz draw stages recognized by the analyser; GPU/compositor totals are unavailable, not zero. The local trace separately records compositor prepare/draw and Viz draw time, which must not be added to nested main-thread stages. ### Reproducible comparison Linux / AMD Ryzen 5 5600X / Chromium 155 / Bun 1.4.4; 1512 × 949, dark theme, warm Vite fixture. Baseline is `8b6492d84a0c38e4df08f0d6b2e344e99cc4439c`. Both runs load all 1,000 turns, four expanded running subagents and their tray, six running sidebar rows alongside the seeded 500-thread sidebar, four elapsed headers, and four expanded commands. A 40 ms interval applies an agent text delta plus a round-robin tool-output delta through the real ThreadState and production components. Requested load is identical; an overloaded baseline delivers fewer ticks. No builds/checks ran alongside these two-minute recordings. | Metric | Before | After | | --- | ---: | ---: | | Recorded window | 120.035 s | 120.022 s | | Main-thread busy | 97.26% | **54.17%** | | Long tasks/min (> 50 ms) | 77.48 (155 total) | **2.00 (4 total)** | | Dropped-frame deadlines | 39.91% (2,874/7,202) | **4.86% (350/7,202)** | | Average rAF frame gap | 27.85 ms | **16.72 ms** | | p95 rAF frame gap | 50.10 ms | **16.70 ms** | | Style + layout / second | 113.44 ms | 115.33 ms | | Delivered streaming ticks (target 25/s) | 2,546 (21.21/s) | **2,998 (24.98/s)** | | Style + layout / delivered tick | 5.35 ms | **4.62 ms** | | Script-forced layouts | 2,586 / 8,971 ms | **35 / 32.39 ms** | | Paint time | 20,880 ms | **16,426 ms** | | GC pauses | 655 / 1,911 ms | **121 / 255 ms** | | Trace used heap, first → last | 113.49 → 340.67 MB | **129.27 → 134.03 MB** | | Trace peak used heap | 482.86 MB | **201.96 MB** | | Follow-end gap after two minutes | 0 px | **0 px** | The after run processes **17.8% more streaming ticks**. Absolute style/layout per second is essentially unchanged; cost per delivered update is lower. **The stressed developer build is still 54% busy and misses about 5% of compositor deadlines, so this does not demonstrate fully idle main-thread usage or flawless 60 fps.** It removes sustained rAF jank and most long tasks while preserving follow-end. The remaining cost includes growing output layout/paint, the real sidebar feed and tracing/dev instrumentation. Busy % is the union of renderer-main RunTask wall intervals inside explicit measurement marks. Long tasks are RunTask > 50 ms; dropped % counts trace BeginFrame/DroppedFrame deadlines. Average frame gap comes from rAF, not compositor presentation. Heap is used heap, not retained heap after GC; it includes a growing transcript and dev tooling, so these readings do not establish a leak. This synthetic Linux developer build is not a repeat of the maintainer's macOS desktop workload. The steady live baseline has **23 CSS animations** (5 background-position shimmers, 14 spins, 4 pings), versus **28** after (the 5 shimmers each use two transforms, plus the same spins/pings). There are **0 transitions and 0 `will-change` elements** in both steady inventories. The inspected after shimmer/spinner layers report **“Has an active accelerated transform animation or transition.”** Paused offscreen nodes remain mounted and can retain a layer, but their animations stop advancing. An isolated five-second decoration/clock recording paints only **0.51 ms total**, with no dropped deadlines; it includes the still-connected dev application and is not a clean CPU-idle benchmark. The after browser run checks that it starts at the end, then records **0 px end gap** and **0 px reader-anchor drift** during a subsequent three-second stream after a real wheel gesture. Light/dark, 1512 px desktop and 390 px phone screenshots, long-label truncation, offscreen pause and reduced motion were inspected. Headless Chromium kept both tabs visible: hidden-page lifecycle was verified with a simulated `document.hidden`/visibility event, and the clock did not advance until resume. Native mobile visuals/runtime profiling and the macOS Electron renderer were not run. ### Validation - `bun install`; `bun run typecheck`; `bun run lint`; `bun run format:check`; `bun run --filter @canopy/web build` — passed. - `bun test apps/web/test/feed-prefix.test.ts apps/web/test/feed-rows.test.ts apps/web/test/work-fold-state.test.ts` — **12 passed, 82 assertions**. These exercise pure feed/index state, not UI components. No UI/E2E suite or full integration/temp suite was run. - iOS and Android JS/Hermes exports — passed. Native project generation/build/publication was not performed. - `bunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactive` — before/after identical: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`; Android `5f6eae3ab278f1cd543e9ed763f923a319b65ec9`. Copy audit (§8): visible copy is unchanged (`Working`, `Working for …`, `Thinking`, durations and unavailable-time placeholders). Existing duration accessibility labels and truncation are retained. Checked short/typical/long labels at desktop and phone widths in light/dark. No new glossary terms, controls, errors or empty states. Artifacts are outside the repository in `/var/tmp/canopy-anim-perf/`: `analyse.py`, `measure.mjs`, `qa.mjs`, `fixture.patch`, `maintainer-report.json`, `before-final-{trace,report,metrics,inventory,layers}.json`, `verified-final-{trace,report,metrics,inventory,layers,anchor}.json`, `isolated-animations-{trace,report}.json`, `qa.json`, screenshots and check logs. Earlier exploratory traces are retained separately; the table uses only `before-final` and `verified-final`. The scratch runner temporarily exposes the fixture ThreadState using `fixture.patch`; that exposure is removed from the submitted code. The analyser reconstructs X/B/E spans, merges nested timing intervals, samples ProfileChunks, correlates invalidations/script layouts, inventories timer/rAF callers and extracts embedded source text without executing it. Related: #413, #414, #415, #416, #417, #418, #419
This was referenced Nov 13, 2026
nixuuu
added a commit
that referenced
this pull request
Nov 14, 2026
Android thread cards can lose their Run choice when virtualized, discard loaded thumbnail URIs when leaving the viewport, and move the feed as the composer folds. Thread details also share entrance progress with drag position and have no intermediate resting position. This change keeps HTML consent and measured heights per visual/version for the pairing session, uses a compact 112 dp gate, preserves thumbnail Image instances and synchronously restores cached file URIs on remount, retains the composer scroll reserve, and separates sheet entrance from drag offset. Thread details snap fully open or 40% down; dragging beyond 65% closes them. The scroll viewport remains usable at both positions. Visual resize updates use the existing feed anchor, and Android clipping no longer detaches native WebViews inside retained inverted cells. Distant turns remain virtualized. Web behavior is unchanged. Fixes: #719 The linked regression is specifically the per-mount HTML Run state introduced in #719; the other behavior is pre-existing. Related: #758, #419, #425. Rebased onto #758 and retained its notice removal and `Custom HTML from the agent.` gate label. ### Original recording Reviewed at 12 fps; timestamps are seconds from the start, with approximately 0.08 s precision. | Problem | Evidence | Change | | --- | --- | --- | | Tall blank HTML card; Run does not reveal content | 00.00–12.50 and 21.00–24.67; taps around 09.50/10.17 | Compact gate; session consent across row/slot/fullscreen remounts; explicit non-flex WebView sizing; token-validated height updates and anchored resize. Failure/watchdog revokes consent, so failed code does not automatically run again. | | Composer flips between compact/full | 01.00–01.50, 06.17–06.50, 10.75–11.17, 22.75–23.17 | Folding no longer releases the native list reserve; only active finger travel can change fold state, and expansion requires deliberate travel toward the end. Momentum interrupted by a tap cannot inherit drag intent. | | Details sheet jumps/rebounds; content also shifts | Opening 12.83–13.33; dragging 13.75–20.75; inner content 18.25–18.83 | Explicit surface height and seeded modal safe areas; separate entrance/drag values; two resting positions; bottom-only scroll viewport resize and no native scroll bounce. Re-grabbing an opening/settling sheet retains its position. | | Thumbnail disappears and reloads | 22.00–24.17 | Visibility cancels unfinished work without clearing a loaded URI. Cache peek restores the same immutable local URI before the first remount frame, allowing native decoded bitmap reuse. Existing memory/disk LRU budgets and pairing cleanup remain in force. | | Feed displacement during interactions/card changes | 06.17–06.50, 10.75–11.17 | Stable composer reserve; no Android autoscroll-to-zero threshold; existing disclosure anchor also wraps Run and visible WebView height changes. The recording alone cannot separate every gesture movement from layout correction. | ### Validation - Passed with `nice`: `bun install`, `bun run gen:check`, workspace `bun run typecheck`, mobile typecheck, repository `bun run lint`, `bun run format`, `bun run format:check`, and integration-test workspace typecheck. - Passed 10 unit tests: existing private image cache and pure sheet gesture tests, plus session consent isolation/revocation coverage. These are local unit tests under the existing tests directory; no UI suite or E2E tests were added or run. - Additional Expo lint remains failing on existing repository findings: clean dev has **116 errors / 25 warnings**, this change has **112 errors / 25 warnings**. Changed image/watchdog code removes some existing findings; the remaining Expo failures are not claimed as passed. - Native fingerprints match clean dev before/after, including explicit `CANOPY_CHANNEL=nightly`, using `bunx expo-updates fingerprint:generate --platform ...`. Nightly Android: `141ef4e8c825ee4fc5d22c499402b284741b0970`; Nightly iOS: `83794f069934a7374461427d89b8d008cec19d97`. Default-channel Android: `906dc944f94eb8333fa384ed9f198834fdd30d13`; iOS: `138e0c6b171c82b4933e86808cdfef56da73b8c6`. No dependencies, native modules, plugins, or native config changed. - **Device acceptance is unverified.** T3 device discovery found no local Android SDK. MacStudio device hub timed out twice (no device returned). EAS `device_open` failed: “frameAncestors and corsOrigins are supported on Production and Enterprise plans,” while this account has Starter. No emulator or physical device could be opened, so first-tap rendering, Android WebView height/gesture handling, decoded bitmap retention, snap motion, keyboard transitions, light/dark, and TalkBack still need device review. No after-shots are claimed. Draft PR preserves this outstanding gate. No web files changed; web build was not run. Full `check:tmp`/integration runs, native prebuilds/exports, EAS builds/updates, tags, and releases were not run. Original frame strips are retained outside the repository; raw extracted frames were removed. No servers, device processes, or reserved ports were used. ### Copy audit (§8) No new UI wording. `Run`, `Retry`, and `Custom HTML from the agent.` remain unchanged from #758; no secrets notice was reintroduced. Changes are session behavior, geometry, cache lifetime, and motion. Device layout/accessibility checks remain unverified.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebase verification — 2026-11-09
The five-layer stack is rebased onto
devat2580ed75cdfc162e98e125b7c4d0b24eb81901b7, including #418 and #421–#426. All PRs remain ready for review. The measurements below describe the original baseline; this section records the current integration verification.The attachment route now passes
If-None-Matchthrough #421's shared response helper. Gateway authorization/read succeeds before a 304 is possible; qualified IDs, thumbnail fallback, bounded preview/truncation, sanitized public failures andno-storeerrors are retained. Mobile image caching retains public error messages and reconnect retries. Session startup, replacement pairing, unpair and revocation retain all four caches: transcript, bot, archived sidebar and images. The branch/worktree panel, channel identity and sheet gesture changes remain intact.Passed on the rebased top branch:
bun install,bun run gen:check, fullbun run typecheck, rootbun run lint,bun run format:checkand the production web build. Final focusedcheck:tmp: 27 passed, 0 failed, 334 assertions across 7 files, no temp leftovers (images, immutable HTTP, transcript/archive/bot caches, two-gateway linked previews and composer choices). Coverage includes a matching old ETag returning 404 after ownership changes and 409 while the home is unavailable, withno-storeand no ETag; image/archive caches are wiped together and late callbacks cannot restore them.EAS CLI 27.4.1, production profile, before/after the image-cache and preparation layers and on the final top branch: unchanged relative to the latest dev baseline:
bf3156a1bd878e10c0b0be25d4c194a837fb1b7ed638e5f7b7fa87f54ccc0715c5fe150b8c0ad3aeThese differ from the original measurement hashes below because #424 already changed native branding/configuration on dev. This stack adds no native dependency/configuration change. Final production Hermes exports passed sequentially with one Metro worker: iOS 9,971,620 B, Android 9,961,323 B. These include the newly merged client features; the earlier performance comparisons below retain their original baseline. Expo Doctor: 20/20. An additional Expo ESLint check of the conflict files reports the same pre-existing
react-hooks/set-state-in-effectfinding inuseImage.tson both this head and unmodifiedorigin/dev; session cleanup has no Expo ESLint findings. The required root oxlint check passes.No full local test run was started, as requested for the overloaded shared machine. The earlier full-run timeout below is historical; GitHub CI is the current full-suite merge gate. No native builds, EAS builds, OTA publication or UI test suites were added. Previous on-device profiling gaps remain.
Obrazy mobilne są pobierane dopiero po wejściu do widocznego okna osi czasu. Powrót do historii lub otwarcie viewerów korzysta z prywatnych, niezmiennych plików zamiast ponownego RPC i base64.
Cache rozdziela parowania (owner-bound device id + pin), pełne kwalifikowane identyfikatory komputerów i rzeczywiste warianty thumbnail/full. Blob lub załącznik bez miniatury dzieli pełny wariant pomiędzy listą i viewerem, bez powtórnego odczytu. Pliki i katalogi mają nazwy SHA256; limit dysku to 200 MiB / 2048 wpisów, indeks URI w pamięci ma budżet 24 MiB ważony bajtami obrazu. To nie ogranicza natywnych bitmap. Wspólne żądania są anulowane po odejściu ostatniego odbiorcy. Forget, revocation i ponowne parowanie zamykają cache i usuwają pliki; spóźniona odpowiedź nie odtwarza danych. Brak nowych modułów natywnych lub uprawnień galerii.
Załączniki w listach i wysłane chipy używają miniatur; viewer pełnego wariantu. GetThreadBlob nie udostępnia miniatur: jego podglądy nadal używają obrazu źródłowego. BFF zachowuje private/immutable, dodaje ETag SHA256 reprezentacji i 304 po autoryzacji; błędy API mają no-store. Istniejące loading="lazy" i odrębne URL ?thumbnail/?preview pozostają zachowane. Zmiana nie ingeruje w routing linked previews 409.
Rzeczywista przeglądarka Chromium 156, produkcyjny BFF + gateway, prywatny seed 1000 tur / 500 wątków, 1280×800: 20 PNG 256×256 w dwóch wiadomościach. Pierwsze przejście pobrało 20 miniatur / 803 816 B treści (809 816 B Resource Timing transferSize). Drugie przejście: 0 żądań sieciowych / 0 B; ponowne otwarcie: 0 / 0 B, 20 wpisów z cache. Web już miał private/immutable, więc nie przypisujemy tej zmianie oszczędności ponownego transferu w web. To pomiar po zmianie; historycznego before w browserze dla obrazów nie zarejestrowano. Seed tego przebiegu miał ręcznie uzupełniony katalog załączników workera; narzędzie w #415 teraz zgłasza go przy hello.
Browser potwierdził: loading="lazy", ?thumbnail, różne ETag dla thumbnail/full/preview, 304 z poprawnym If-None-Match i 404 z no-store bez ETag. Sprawdzono telefon 390×844 w dark i desktop 1280×800 w light; bez poziomego overflow, obrazy poprawnie zdekodowane. Serwery i browser zamknięte przed pełnymi testami.
Weryfikacja: install, gen:check, pełny typecheck, root lint, format:check, web build i eksporty Expo obu platform przeszły. Expo Doctor: 20/20 kontroli. Końcowe 5 testów cache/HTTP (39 asercji) obejmuje izolację, restart, LRU, brak pliku po usunięciu przez OS, retry, współbieżność, ponowne użycie pełnego wariantu i wipe przy późnej odpowiedzi; przeszły również w pełnym przebiegu. Dodatkowy Expo ESLint dla zmienionych plików wskazuje istniejące już set-state-in-effect w useImage; nowe wskazania refs zostały poprawione i sprawdzone ponownie.
Pierwotny końcowy pełny check:tmp zakończył się 1919 pass / 161 skip / 1 fail, 22 240 asercji, 1050.58 s, bez pozostałości temp. Pozostał niezmieniany test composer-shell „Stop during a shell steer kills its group and persists the failed delivery” — anulowanie RPC po 10 s. Wcześniejszy przebieg miał też błędy ask-user i thread-mirror-deltas; wszystkie trzy pliki przeszły następnie osobno razem (42 pass / 0 fail, 226 asercji, 38.70 s). Nie zmieniano timeoutów ani asercji. W pierwotnym przekazaniu pełna bramka pozostawała nierozstrzygnięta, a stos był draftem.
Harness nie mierzy renderera React Native ani RPC. Na urządzeniu pozostają: widoczność wewnątrz wysokiej tury, szybki scroll/anulowanie, bitmapy i filesystem Expo, viewer/restart/unpair/revocation; instrukcje w docs/client-performance.md. Brak buildów natywnych, EAS i publikacji OTA. Copy audit: bez nowych tekstów UI.