Repository navigation
perf(session): reuse cached history during hydration - #4681
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
Contributor
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (f1be459ffd161c1774c725b31ae006b88f7659a4). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
Contributor
|
Passed · 1/1 tests · 2/2 assertions · 0 images Commit |
3 tasks
This branch was successfully deployed
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.
Summary
Avoid rebuilding unchanged thread history when cached snapshots are reapplied. Rendering previously cached its own UI projection, while hydration reconstructed every message separately. Snapshot-envelope updates also discarded rendering's projection cache, repeating conversion and reconciliation work.
This is a performance follow-up to #4676, not a rollback of the hydration freshness fixes.
Changes
Cache lifetimes, revert behavior, and freshness rules remain unchanged.
Focused measurement
After warm-up, 20 reapplications of a 140-message cached history performed 5,600 source-text projection reads before the change and zero after. The fixture also checks that changed tail content arrives and historical message references remain stable.
This is a deterministic operation count, not a measured frame-time or thread-switch latency improvement.
Verification
Verdict: Incomplete — focused checks passed; runtime journey proof is not yet available.
Checked commit:
f1be459ffd161c1774c725b31ae006b88f7659a4, based on9b5a5913cf22f20f2200f8c536c6abd81ef5667c.pnpm --filter @openwork/app exec bun test --isolate ./tests/session-render-state.test.ts ./tests/session-sync-permissions.test.tspnpm --filter @openwork/app typecheckgit diff --check origin/dev...HEADThe focused regression reproduced redundant history conversion before repair. No full app journey, live frame-time profile, or end-to-end evidence publication was run in this pass. Unit results do not establish runtime proof or that every reported hesitation is resolved.
Remaining runtime verification
Run the existing thread-switch continuity journey on this exact head:
Verify warm and cold history, held refetches, split-session isolation, and ongoing streaming. Measure long-thread switching separately before making an app-level latency claim.