Skip to content

Track live open canvas snapshots#1447

Open
jmoseley wants to merge 1 commit into
mainfrom
jmoseley/track-open-canvases
Open

Track live open canvas snapshots#1447
jmoseley wants to merge 1 commit into
mainfrom
jmoseley/track-open-canvases

Conversation

@jmoseley
Copy link
Copy Markdown
Contributor

Summary

  • update the Rust session event loop to keep Session::open_canvases() current from live session.canvas.opened events
  • upsert repeated canvas instance IDs while preserving snapshot order
  • add coverage for malformed payload tolerance, live add, and live upsert behavior

Validation

  • cargo test --features test-support session_canvas_opened_updates_open_canvas_snapshots
  • cargo test --features test-support resume_session_sends_canvas_fields_and_captures_open_canvases
  • cargo +nightly-2026-04-14 fmt --check

Paired github-app branch pins this SDK WIP via .sdk-upstream-sha until the normal sync lands.

Copilot AI review requested due to automatic review settings May 27, 2026 03:44
@jmoseley jmoseley requested a review from a team as a code owner May 27, 2026 03:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_canvases snapshot store with the session event loop and update it on session.canvas.opened notifications via an upsert helper.
  • Populate open_canvases from session.resume responses while keeping the Session API 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 thread rust/src/session.rs
Comment on lines +1074 to 1075
*open_canvases.write() = resume_result.open_canvases.unwrap_or_default();

Comment thread rust/src/session.rs
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);
}
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