Track live open canvas snapshots#1447
Open
jmoseley wants to merge 1 commit into
Open
Conversation
Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Rust SDK session event loop to keep Session::open_canvases() synchronized with live session.canvas.opened notifications, while preserving snapshot ordering when the same canvas instance is re-opened. It also adds Rust test coverage to validate malformed-payload tolerance, live additions, and live upserts.
Changes:
- Share an
open_canvasessnapshot store with the session event loop and update it onsession.canvas.openednotifications via an upsert helper. - Populate
open_canvasesfromsession.resumeresponses while keeping theSessionAPI unchanged. - Add a new Rust test covering live updates and upsert behavior for repeated
instanceIds.
Show a summary per file
| File | Description |
|---|---|
| rust/src/session.rs | Tracks and upserts open canvas snapshots on session.canvas.opened events; wires shared state into the event loop and resume path. |
| rust/tests/session_test.rs | Adds a new test validating malformed event tolerance plus live add/upsert snapshot behavior. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 2
Comment on lines
+1074
to
1075
| *open_canvases.write() = resume_result.open_canvases.unwrap_or_default(); | ||
|
|
Comment on lines
+1319
to
+1323
| if event_type == SessionEventType::SessionCanvasOpened { | ||
| match serde_json::from_value::<OpenCanvasInstance>(notification.event.data.clone()) { | ||
| Ok(open_canvas) => { | ||
| upsert_open_canvas_snapshot(&mut open_canvases.write(), open_canvas); | ||
| } |
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
Validation
Paired github-app branch pins this SDK WIP via .sdk-upstream-sha until the normal sync lands.