Skip to content

[4.0 port] fix(whiteboard): add trailing to throttling for cursor updates #25693 - #25951

Merged
ramonlsouza merged 4 commits into
bigbluebutton:v4.0.x-developfrom
antobinary:port-25693-cursor-throttle-trailing-40
Oct 6, 2026
Merged

ramonlsouza merged 4 commits into
bigbluebutton:v4.0.x-developfrom
antobinary:port-25693-cursor-throttle-trailing-40

Conversation

@antobinary

@antobinary antobinary commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Ports #25693 (merged into v3.0.x-develop) to v4.0.x-develop.

The four commits are cherry-picked unchanged (git cherry-pick -x, original author kept). They applied without conflicts; no 4.0-specific adaptation was needed.

The whiteboard cursor publisher used Radash's throttle, which is leading-edge only: moves that land inside the throttle window are dropped, so when the presenter stops moving, the last position sent is not the position the pointer rests on. This PR wraps the throttle in a throttleWithTrailing helper that keeps the latest position and publishes it when the interval expires. The pending update is cancelled on unmount and when the page changes.

Only bigbluebutton-html5/imports/ui/components/whiteboard/container.jsx changes.

Closes Issue(s)

Related to #25690 (cursor position half; the pan half is #25691, still open on 3.0)

Motivation

Viewers on 4.0 see the presenter's cursor resting at a stale position, same as on 3.0 before #25693.

How to test

  1. Join as presenter and as a viewer in a second browser.
  2. As presenter, move the pointer quickly across the slide and stop.
  3. Compare where the cursor rests on the viewer's side with the presenter's pointer.

Before: the viewer's cursor often stops short of the real position.
After: the viewer's cursor ends on the real position.

Results on a local 4.0 server (cursorInterval: 100), client built from v4.0.x-develop at 420e8ca with and without this branch. A script moved the presenter's pointer in 20 bursts and compared the last PresentationPublishCursor sent, and the last pres_page_cursor_stream row a viewer received, with the true resting position:

Client Stale at viewer Smallest gap between publishes
v4.0.x-develop 17 of 20 115.4 ms
this branch 0 of 20 99.3 ms

Also checked:

  • throttleWithTrailing exercised against Radash 12.1.1: publishes the final position, keeps the rate bounded by the interval, sends a single move once, and cancel() drops the pending publish. PASS (7 of 7 checks).
  • Playwright whiteboard/ specs on this branch: 27 of 30 passed. Pan and Shape Options Duplicate fail on the unpatched client as well (screenshot diffs). Redo drawing failed once in the full run and then passed 16 of 16 on this branch and 2 of 2 on the unpatched client.
  • Not covered by a live test: the cancel on page change/unmount (covered by the helper check only).

More

Original PR: #25693 by @hiroshisuga. The follow-up about moving the throttle helper to a shared utility is tracked in #25824.

Remove curPageId dependency from useEffect hook.

(cherry picked from commit 7465afe)
Include curPageId in the dependencies for throttledPublishCursorUpdate effect.

(cherry picked from commit b527317)
@antobinary antobinary added this to the Release 4.0 milestone Oct 2, 2026
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ae74cd3a-ef78-43a4-b9f3-7e7c6937969d

📥 Commits

Reviewing files that changed from the base of the PR and between caac45a and 5cf5568.

📒 Files selected for processing (1)
  • bigbluebutton-html5/imports/ui/components/whiteboard/container.jsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

Cursor publishing now uses a trailing throttle. While throttled, it retains the latest cursor update and retries after the remaining interval. The wrapper is recreated when the publishing callback, configured interval, or current page changes. Cleanup cancels pending work.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 5cf55

The cursor update change is ready to merge after normal checks; no actionable issue remains.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 5cf55

The change preserves the existing cursor permission check and does not demonstrate broader access or authority. The remaining risk is limited to cursor lifecycle containment: cleanup clears queued work but does not prevent a later call from restarting an obsolete publisher.

Retained concerns

  • Low · reliability · inferred: Cancellation clears existing pending arguments and the trailing timer but leaves the wrapper callable. The cursor hook separately flushes pending coordinates during cleanup, so an obsolete wrapper can accept new work after cancellation if cleanup ordering permits. Unlike the previous leading-only throttle, that call can retain a trailing publication. This is a bounded cursor ownership and cleanup-containment concern, not a demonstrated security bypass.
Security review details

Security Blast Radius

  • inferred — The demonstrated changed path concerns a browser's whiteboard cursor publications, including delayed coordinates and cleanup behavior. The inspected evidence establishes no additional privilege or cross-tenant reachability; backend enforcement and broader exposure remain unverified.

Trust Boundaries and Controls

  • observed — Immediate and trailing wrapper execution both call the same existing permission-gated publication callback. The exact diff leaves that callback and its mutation variables unchanged. This preserves the inspected client-side control but does not establish server-side authorization.

Resilience and Maintainability Implications

  • inferred — Latest-value storage bounds pending cursor data, and cancellation contains already queued wrapper work. End-to-end cleanup containment remains incomplete because the independent producer can call the wrapper again; the supported consequence is stale or late cursor publication rather than a verified authorization failure.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description clearly explains the port to v4.0.x-develop, the trailing throttling change, its motivation, affected file, and test results.
Title check ✅ Passed The title clearly identifies the whiteboard cursor update change and the addition of trailing throttling. The port prefix and issue reference provide useful context.
✨ Finishing Touches 💡 1
🧪 Generate unit tests (beta)
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ramonlsouza
ramonlsouza self-requested a review October 6, 2026 12:15
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

⏳ Automated tests are running...

@ramonlsouza
ramonlsouza merged commit f8d9ebb into bigbluebutton:v4.0.x-develop Oct 6, 2026
58 of 62 checks passed
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.

3 participants