Repository navigation
perf(bots): add durable ui history checkpoints - #288
Merged
Merged
Conversation
nixuuu
marked this pull request as ready for review
November 6, 2026 19:11
nixuuu
force-pushed
the
perf/bot-cache-1
branch
from
November 6, 2026 19:14
8ffb08c to
b83e2c4
Compare
nixuuu
added a commit
that referenced
this pull request
Nov 6, 2026
Mobile conversations used a solid composer block that shortened the timeline. Composers now float above the feed and fold while reading history; the main screens also extend their backgrounds and scroll viewports behind the system bars while keeping controls inside safe areas. Rebased onto `dev` after the mobile UI kit landed (Related: #287). Its shared buttons, notices, search/form controls, confirmation host and sheet title/close controls are preserved. Connection banners now participate in the floating header measurement on threads, bot chats, sidebar and Settings. The extracted sidebar footer uses #287's interactive connection status with details and retry; Settings retains its density provider. Full sheets keep the kit's 20 dp content spacing inside the inset-aware modal frame. The final rebase also includes the bot-history changes that landed meanwhile (Related: #288, #289, #290). Bot chats retain the snapshot cache, incremental updates, cached bot names, loading header/avatar, syncing subtitle and live-only approval/send/stop guards beneath the floating layout. ## Composer behavior - Match web `ComposerCompaction`: fold after 96 dp of travel toward older messages, at least 192 dp from the end; expand within 8 dp of the end or on tap, focus, or typing. Only reader gestures fold it; streaming and layout changes do not. Synchronous questions keep it expanded. - Match `VirtualFeed.reservedFooter`: measure the full overlay, retain its largest reserve while reading history, and follow its height at the latest end. The changing spacer is excluded from the visible-message anchor. The latest-message action remains above the composer with an actual Android touch area. - Reuse the web surface, border, light-theme shadow and 32 dp canvas fade. Animate folding with shared 400/350 ms tokens and `smoothOut`; reduced motion uses zero duration. Inputs and folded controls stay mounted. - Mobile additionally keeps any draft, attachment or mention picker expanded, so compaction cannot hide unfinished input. Bot chats retain their native inline pill. This is a deliberate difference from web's ability to fold a draft to one line. ## Insets by screen | Screen | Layout and control insets | | --- | --- | | Thread and existing side thread | Full-window inverted feed under a translucent floating header and composer. Oldest end reserves the measured header plus top inset; latest end reserves the measured composer including bottom inset. Composer controls have side/bottom padding. | | Bot chat | Same overlay, compaction, reserve and safe-area rules as threads, with the inline bot composer. | | Sidebar and thread/bot lists | Full-height list under measured floating header/footer. Content padding makes first/last rows reachable. Footer controls sit above the home indicator. Only the outside edge of each split pane consumes a horizontal inset. | | New thread and side-thread creation | Expanded forms because there is no conversation history to compact. New thread scrolls under its floating header; side-thread creation uses the modal frame. Form content gets safe-area padding. | | Settings | Both columns scroll behind the floating header. Navigation consumes the left outside inset, details the right; a single column consumes both. Forms retain keyboard-overlap handling. | | Pairing and empty home pane | Full-window background and scroll viewport, with content padding protecting controls at both ends and sides. | | Full sheets and compact pickers | Full sheets measure their own modal safe area and scroll under the header. Bottom pickers extend their surface behind the home indicator and inset actions; centered landscape/Fold cards fit the safe rectangle. | `KeyboardArea` keeps its existing keyboard `screenY` calculation. Closed-keyboard safe-area padding now belongs to scroll content and composer controls instead of the viewport. Status-bar icons continue to follow the selected light/dark theme; translucent header surfaces maintain contrast above scrolling content. No new native dependency or native configuration change. ## Verification Reran after the final rebase onto `cf9f6be2`: `bun install`, `bun run gen:check`, `bun run typecheck`, `bun run lint`, `bun run format:check`, `bunx expo lint` from `apps/mobile`, and the web build. All passed. Expo refreshed the ignored generated route list for the newly merged exchange screen before the passing typecheck. Final `bun run check:tmp`: **1534 passed, 158 skipped, 0 failed**, 1692 tests across 274 files; no test temp directories left behind. The full test run uses a private `TMPDIR` inside the ignored worktree temp directory, with `GIT_CEILING_DIRECTORIES` set to that directory. This prevents deliberately non-Git fixture folders from discovering the checkout above them. Live/provider tests remain opt-in. Self-review and `git diff --check` are clean. Android Fold device observations before the final edge-to-edge expansion: light/dark surfaces, long history, content passing below the composer, folding on scroll, expanding on tap/focus and return to latest, functioning latest-message action, and a visible multiline draft. Screenshots are kept outside the checkout. The recording exporter failed after its documented debug retry. After the UI-kit rebase, the source launched in the free Android Fold emulator using the existing development client. Smoke-checked the edge-to-edge shell in light and dark, readable status icons, inset sidebar footer, the offline connection banner and its details/retry overlay, plus Settings search with the real keyboard open and closed. After the final bot-cache rebase, the bot-chat screen also rendered its loading header and floating composer. The old fixture gateway was offline, so live conversation behavior was not rechecked. Multiline entry could not be verified: Android's `system_server` aborted during the fill attempt, and the tool's debug retry could not find the field after the reset. No new native build or download was needed; the owned emulator and Metro session were shut down afterwards. Device QA remains incomplete: the earlier iOS development-client launch timed out twice, and its notch/Dynamic Island layouts remain unverified. Phone width, conversation keyboard handling, drafts with attachments and mention suggestions, bot/side-thread flows, reaching the bottom during streaming, reduced motion, landscape and Android three-button navigation still need device coverage. The rebase smoke check does not replace those checks. Copy audit (`docs/copy.md` §8): no new user-facing copy; existing English action labels and form text are preserved. No web UI tests or permanent verification artifacts were added. Shared mobile buttons, notices and form controls retain #287's implementation; only the shared sheet's layout delegates to the new modal frame.
This was referenced Nov 13, 2026
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.
Opening a long bot conversation currently transfers every message again. This adds durable, owner-scoped checkpoints for bot conversations and bot-to-bot exchanges, so clients can request only changed messages and current control state.
The bot tables have their own commit-ordered key journal, following the thread mirror epoch/cursor design. A checkpoint binds the owner, view and revision. Message edits, deletion and turn failures produce upserts/removals. A metadata digest confirms approvals, read state, pending cards, configuration, streaming text, routines and reminders; changed control state is replaced atomically. Missing/expired cursors, gaps, another epoch, rewritten exchange membership and moves fall back to a full projection.
Linked bot reads pass the cursor to the home through the existing route. Offline reads retain the existing mirror path and gateway action enforcement. Proto additions are opt-in: old clients get full snapshots, and a home ignoring the new fields returns full state that new clients can apply. No link protocol version change. Migration 0091 is the next free number on the rebased dev; schema expectations and generated contracts are included.
Measurements
Single-run development-server measurements with a real local gateway/Postgres and 3,000 stored messages, each containing about 2 KB of long output. Browser first content is measured from route switch to message DOM appearing. SSE bytes include the ready frame and initial state, excluding HTTP/TLS headers and unrelated sidebar polling. The after column uses the whole stack, including the opt-in web client in the next layer.
The baseline full protobuf was 6,772,217 B. Cold full history remains approximately 6.77 MB: this does not add server-side pagination. The cold browser sample includes development module loading; these are observations, not statistical latency bounds. Android timing and runtime visuals are unverified: the device tool's dev-client deep link failed with
COMMAND_FAILED: adb exited with code 1, including its advised debug retry. No SSH/ADB UI fallback was used.Verification
bun install,bun run gen:check,bun run typecheck,bun run lint,bun run format:checkpassed on this stage after rebasing.The bot mirror publisher still uses its existing full projection protocol; this stack changes UI reads, not partner journal publishing. Live control metadata is a complete replacement when changed, rather than a second journal for approvals and linked thread cards.
Related: #271, #272, #273.