Skip to content

Track live open canvas snapshots#1447

Merged
jmoseley merged 5 commits into
mainfrom
jmoseley/track-open-canvases
May 28, 2026
Merged

Track live open canvas snapshots#1447
jmoseley merged 5 commits 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.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 Outdated
Comment thread rust/src/session.rs
@SteveSandersonMS
Copy link
Copy Markdown
Contributor

@jmoseley Looks good. I'm guessing a similar fix is also needed for the other languages. Is that correct?

@jmoseley
Copy link
Copy Markdown
Contributor Author

Yes, will work on that.

Comment thread dotnet/test/Unit/CanvasTests.cs Fixed
Comment thread dotnet/test/Unit/CanvasTests.cs Fixed
@github-actions

This comment has been minimized.

- rust: upsert resume snapshots instead of wholesale replace, so live
  session.canvas.opened notifications received during session.resume are
  preserved.
- rust: update capabilities and open canvas snapshots BEFORE broadcasting
  the event, so subscribers observe current state when handling the event.
- dotnet: dispose MemoryStreams on construction failure in test helper.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR implements live session.canvas.opened tracking consistently across all five SDK implementations: Node.js/TypeScript, Python, Go, .NET, and Rust.

SDK Event handler Upsert logic Malformed payload warning Tests
Node.js upsertOpenCanvasFromEvent console.warn
Python _upsert_open_canvas logger.warning
Go updateOpenCanvasesFromEvent fmt.Printf
.NET UpdateOpenCanvasesFromEvent LogWarning
Rust upsert_open_canvas_snapshot warn!

Behavioral parity confirmed:

  • All SDKs validate required fields (instanceId, canvasId, extensionId, availability) and log a warning on malformed payloads
  • All SDKs upsert by instanceId (in-place replace preserving order, or append if new)
  • All SDKs update the snapshot cache before broadcasting the event to subscribers
  • The Rust implementation additionally handles the race between session.resume and live events with upsert semantics — a nice correctness improvement
  • Updated docstrings/comments in all SDKs consistently describe the new behavior

No consistency gaps found. 🎉

Generated by SDK Consistency Review Agent for issue #1447 · ● 3.7M ·

@jmoseley jmoseley enabled auto-merge May 28, 2026 20:50
@jmoseley jmoseley added this pull request to the merge queue May 28, 2026
Merged via the queue into main with commit 7b5565d May 28, 2026
42 checks passed
@jmoseley jmoseley deleted the jmoseley/track-open-canvases branch May 28, 2026 22:17
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.

4 participants