Skip to content

perf(relay): verify cached history in the native host - #3426

Merged
jmecom merged 3 commits into
mainfrom
jm/native-cached-verification
Nov 13, 2026
Merged

jmecom merged 3 commits into
mainfrom
jm/native-cached-verification

Conversation

@jmecom

@jmecom jmecom commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Cached channel discovery, message history, and embedded profiles were reverified in JavaScript during desktop restoration. Route them through the existing verifyStored capability and native libsecp256k1 worker. This is an independent change based on main; it introduces no batch cryptography, Rust changes, or dependencies.

Preserve event-shape/content-hash validation, JavaScript fallback for unavailable or rejecting hosts, and the guards that prevent late results from surviving disposal, cache clear, or access revocation. Browser behavior and relay-read counts are unchanged.

A local native WKWebView fixture on base 63a0c1bd plus this unchanged store implementation, with 64 saved histories (1,344 signed events plus 128 discovery records) measured median selected-history visibility of 271 → 165 ms, and complete restoration of 1,136 → 246 ms. Three runs per version in alternating order, Apple M4 Max, Rust 1.98.1, optimized development native build and Vite frontend. All runs made zero relay reads. These timings exclude process launch, community handshake, signing and storage seeding; they are not production telemetry. No benchmark artifacts are checked in.

The three focused Vitest files pass all 124 tests. Added host-routing cases fail on the baseline; removing the new post-await guards makes both native revoke/regrant cases fail by admitting a stale profile. Source was restored and affected tests passed again. Existing tests were extended; no browser journeys or test infrastructure were added. Independent review found no blockers. The push hook also exposed an existing dialog test race on main; a four-line frame wait preserves its focus and exact cooldown assertions, and all 12 dialog tests pass.

After rebasing onto 6223ae59, the restored head batch also carries the cached membership notices that #3461 added, so the host verifies them with the head's events. TypeScript passes, and the focused files plus the adjacent verified-profile, native and store tests pass (323 tests in seven files). A one-off host-path run of #3461's notice-restore test also passed. The native timing fixture was not rerun on this base. Normal live-relay and human acceptance remain outstanding.

After reviewing #3487, which routes the same head and discovery restores through verifyStored, this branch adds its two startup-service cases adapted to the embedded-profile path: a cached history message or embedded profile whose signature only the host accepts is restored from the host's answer alone (fails on main), and a rejecting host drops the head and its profiles through the JavaScript fallback. The relay suite passes (3,653 tests in 144 files) and pnpm check is clean.

jmecom and others added 2 commits November 13, 2026 10:02
@jmecom
jmecom force-pushed the jm/native-cached-verification branch from ce22144 to 51ab4ba Compare November 13, 2026 18:05
@jmecom
jmecom marked this pull request as ready for review November 13, 2026 18:18
@jmecom
jmecom requested a review from a team as a code owner November 13, 2026 18:18

@kalvinnchau kalvinnchau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Reviewed at 51ab4ba. Routing cached head events, embedded head profiles and discovery through verifyStored keeps the per-input ordering, all-or-nothing rejection and JS fallback of parseEvents/native.settle. The post-await guards match the existing loop fences. Empty or already-proven batches skip the host. CI is green. No findings.

Add startup-service cases where a cached history message or embedded
profile carries a signature only the host accepts. With an accepting
host they are restored from its answer alone, which fails on main; with
a rejecting host the JavaScript fallback drops the head and its
profiles.

Co-authored-by: jm-opus <c10eccc76a9e867c86efb341b91c7a0f401dd4da6b36cae0a2d87708d7fb06d8@buzz.block.builderlab.xyz>
Signed-off-by: Jordan Mecom <[email protected]>
@jmecom
jmecom merged commit 111207e into main Nov 13, 2026
70 checks passed
@jmecom
jmecom deleted the jm/native-cached-verification branch November 13, 2026 18:32
joshfriend added a commit that referenced this pull request Nov 13, 2026
* origin/main: (153 commits)
  feat(agents): preview where interrupted agents were working before resume (#3494)
  perf(messages): close the editor and delete dialog on submit (#3493)
  feat(messages): quote selected message text into the composer (#2392)
  perf(toast): scope docked clearance to the toast host (#3489)
  fix(unread): undo exact captured ordinary reads conditionally (#3473)
  fix(solo): keep navigation responsive during chat deletion (#3488)
  fix(channels): keep custom thread tab names until the tab closes (#3458)
  perf(relay): verify cached history in the native host (#3426)
  fix(settings): refine claude and typesafe key setup dialogs (#3391)
  Update bundled help for Bestie and agent settings (#3194)
  feat(profiles): share and show a local time zone (#3332)
  Revert "feat(link-previews): unfurl web links below messages by default" (#3480)
  Show disabled plugin chats in Solo (#3456)
  perf(messages): host one context menu per message list (#3465)
  test(claude): keep the quit-release test copy above the minimum version (#3477)
  fix(profiles): restore verified names from the device cache (#3382)
  fix(mentions): show addressed agents first in Solo audience picker (#2856)
  perf: count member access once and scope find highlights to painting (#3464)
  perf(messages): prepare a message once for its renderer and link previews (#3466)
  fix(composer): speed up long pastes and paste office text as text (#3441)
  ...

# Conflicts:
#	docs/plugin-authoring-guide.md
joshfriend added a commit that referenced this pull request Nov 13, 2026
…when-ready

* origin/main: (21 commits)
  fix(agents): report a conversation wake that fails before its turn starts (#2192)
  fix(usage): read Claude transcripts over 50 MB a page at a time (#3498)
  feat(agents): preview where interrupted agents were working before resume (#3494)
  perf(messages): close the editor and delete dialog on submit (#3493)
  feat(messages): quote selected message text into the composer (#2392)
  perf(toast): scope docked clearance to the toast host (#3489)
  fix(unread): undo exact captured ordinary reads conditionally (#3473)
  fix(solo): keep navigation responsive during chat deletion (#3488)
  fix(channels): keep custom thread tab names until the tab closes (#3458)
  perf(relay): verify cached history in the native host (#3426)
  fix(settings): refine claude and typesafe key setup dialogs (#3391)
  Update bundled help for Bestie and agent settings (#3194)
  feat(profiles): share and show a local time zone (#3332)
  Revert "feat(link-previews): unfurl web links below messages by default" (#3480)
  Show disabled plugin chats in Solo (#3456)
  perf(messages): host one context menu per message list (#3465)
  test(claude): keep the quit-release test copy above the minimum version (#3477)
  fix(profiles): restore verified names from the device cache (#3382)
  fix(mentions): show addressed agents first in Solo audience picker (#2856)
  perf: count member access once and scope find highlights to painting (#3464)
  ...
joshfriend added a commit that referenced this pull request Nov 13, 2026
…n-on-github

* origin/main: (21 commits)
  fix(agents): report a conversation wake that fails before its turn starts (#2192)
  fix(usage): read Claude transcripts over 50 MB a page at a time (#3498)
  feat(agents): preview where interrupted agents were working before resume (#3494)
  perf(messages): close the editor and delete dialog on submit (#3493)
  feat(messages): quote selected message text into the composer (#2392)
  perf(toast): scope docked clearance to the toast host (#3489)
  fix(unread): undo exact captured ordinary reads conditionally (#3473)
  fix(solo): keep navigation responsive during chat deletion (#3488)
  fix(channels): keep custom thread tab names until the tab closes (#3458)
  perf(relay): verify cached history in the native host (#3426)
  fix(settings): refine claude and typesafe key setup dialogs (#3391)
  Update bundled help for Bestie and agent settings (#3194)
  feat(profiles): share and show a local time zone (#3332)
  Revert "feat(link-previews): unfurl web links below messages by default" (#3480)
  Show disabled plugin chats in Solo (#3456)
  perf(messages): host one context menu per message list (#3465)
  test(claude): keep the quit-release test copy above the minimum version (#3477)
  fix(profiles): restore verified names from the device cache (#3382)
  fix(mentions): show addressed agents first in Solo audience picker (#2856)
  perf: count member access once and scope find highlights to painting (#3464)
  ...
joshfriend added a commit that referenced this pull request Nov 13, 2026
* origin/main: (31 commits)
  Let plugin panels name their tab with panels.useTabTitle (#3251)
  fix(agents): report a conversation wake that fails before its turn starts (#2192)
  fix(usage): read Claude transcripts over 50 MB a page at a time (#3498)
  feat(agents): preview where interrupted agents were working before resume (#3494)
  perf(messages): close the editor and delete dialog on submit (#3493)
  feat(messages): quote selected message text into the composer (#2392)
  perf(toast): scope docked clearance to the toast host (#3489)
  fix(unread): undo exact captured ordinary reads conditionally (#3473)
  fix(solo): keep navigation responsive during chat deletion (#3488)
  fix(channels): keep custom thread tab names until the tab closes (#3458)
  perf(relay): verify cached history in the native host (#3426)
  fix(settings): refine claude and typesafe key setup dialogs (#3391)
  Update bundled help for Bestie and agent settings (#3194)
  feat(profiles): share and show a local time zone (#3332)
  Revert "feat(link-previews): unfurl web links below messages by default" (#3480)
  Show disabled plugin chats in Solo (#3456)
  perf(messages): host one context menu per message list (#3465)
  test(claude): keep the quit-release test copy above the minimum version (#3477)
  fix(profiles): restore verified names from the device cache (#3382)
  fix(mentions): show addressed agents first in Solo audience picker (#2856)
  ...
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.

2 participants