Repository navigation
[4.1] feat(presentation): insert pages into an existing presentation (from core and plugins) - #25380
imdt-claudiop wants to merge 86 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds stable opaque page IDs across presentation conversion, asset URLs, whiteboard events, recording, and playback. Adds native and plugin-driven page insertion with artifact splicing, progress messages, Akka state updates, failure cleanup, and presenter navigation. Updates page-aware GraphQL and message contracts, URL validation, tests, configuration, localization, and documentation. Estimated code review effort: 5 (Critical) | ~120 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 8
🧹 Nitpick comments (5)
bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/container.jsx (1)
155-160: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate
skipToSlidelookup logic.The
presentationPagesData?.pres_page.find(...)+setPresentationPage(page.pageId)pattern is duplicated verbatim inbigbluebutton-html5/imports/ui/components/whiteboard/container.jsx(lines 195-198). Consider extracting a shared helper (e.g. auseSkipToSlide(presentationId)hook alongsidePRESENTATION_PAGES_SUBSCRIPTION) to avoid drift between the two implementations.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/container.jsx` around lines 155 - 160, The `skipToSlide` lookup-and-select logic in `presentation-toolbar/container.jsx` is duplicated in `whiteboard/container.jsx`, so extract it into a shared helper or hook to keep both callers in sync. Move the `presentationPagesData?.pres_page.find(...)` plus `setPresentationPage(page.pageId)` behavior into a reusable `useSkipToSlide(presentationId)`-style helper near `PRESENTATION_PAGES_SUBSCRIPTION`, then update `skipToSlide` to use that shared implementation.akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala (1)
41-47: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueOptional: expose a companion helper to remove the repeated
(id, num)unwrap.
findPresentationPage(...).map { case (pres, page) => (pres.id, page.num) }.getOrElse(("", 0))is duplicated verbatim inSendCursorPositionPubMsgHdlr,SendWhiteboardAnnotationPubMsgHdlr,DeleteWhiteboardAnnotationsPubMsgHdlr, and mirrored inPolls. Consider a small helper so the empty-default contract lives in one place.♻️ Suggested helper
def findPresentationPage(state: MeetingState2x, pageId: String): Option[(PresentationInPod, PresentationPage)] = { (for { pod <- state.presentationPodManager.getAllPresentationPodsInMeeting() pres <- pod.presentations.values page <- pres.pages.get(pageId) } yield (pres, page)).headOption } + + def findPresentationPageIds(state: MeetingState2x, pageId: String): (String, Int) = + findPresentationPage(state, pageId).map { case (pres, page) => (pres.id, page.num) }.getOrElse(("", 0))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala` around lines 41 - 47, Add a small companion/helper around findPresentationPage in PresentationPodsApp so callers don’t repeat the same unwrap-and-default logic. The repeated pattern in SendCursorPositionPubMsgHdlr, SendWhiteboardAnnotationPubMsgHdlr, DeleteWhiteboardAnnotationsPubMsgHdlr, and the mirrored Polls code should call that helper instead of manually doing findPresentationPage(...).map { case (pres, page) => (pres.id, page.num) }.getOrElse(("", 0)). Keep the empty-default contract in one place and use the existing PresentationInPod and PresentationPage symbols to locate the refactor.akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/MakePresentationDownloadReqMsgHdlr.scala (1)
105-116: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winSilent page skip on
None— add logging for diagnosability.If
getPageByNumdoesn't resolve a page number in range (e.g., a race with the new insert-pages renumbering), the page is silently dropped from the export with no trace. SincepageCount/pagesRangeare computed earlier fromcurrentPres.get.pages.size, aNonehere is unexpected and worth logging.🔍 Suggested logging on the None branch
case None => + log.warn(s"Presentation page not found for export: presId=${presId}, pageNumber=${pageNumber}") getPresentationPagesForExport(pages, pageCount, presId, currentPres, liveMeeting, storeAnnotationPages)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/MakePresentationDownloadReqMsgHdlr.scala` around lines 105 - 116, The None branch in getPresentationPagesForExport is silently skipping a page, so add a warning/error log when PresentationInPod.getPageByNum returns None to make the export failure diagnosable. Use the existing context in MakePresentationDownloadReqMsgHdlr, especially pageNumber, presId, pageCount, and currentPres.get.pages.size, and log before recursing so unexpected gaps from renumbering or races can be traced.akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala (1)
64-67: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winLinear scan per lookup; downstream export loop makes it O(n·m).
getPageByNumscans all pages linearly since pages are now keyed by opaque id rather than number.MakePresentationDownloadReqMsgHdlr.getPresentationPagesForExportcalls this once per requested page number recursively, so exporting a large page range does an O(n·m) scan instead of O(n). Consider building aMap[Int, PresentationPage]once (e.g., in the caller) when multiple lookups by number are needed in a loop.♻️ Example: precompute an index for repeated lookups
+ def buildNumIndex(pres: PresentationInPod): Map[Int, PresentationPage] = + pres.pages.values.map(p => p.num -> p).toMap + def getPageByNum(pres: PresentationInPod, num: Int): Option[PresentationPage] = { pres.pages.values find (p => p.num == num) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala` around lines 64 - 67, getPageByNum in PresentationPods is doing a linear scan over pres.pages for every lookup, which becomes expensive when MakePresentationDownloadReqMsgHdlr.getPresentationPagesForExport calls it repeatedly. Update the export path to precompute a Map[Int, PresentationPage] indexed by page number once, then reuse that map for repeated lookups instead of calling getPageByNum in a loop. Keep getPageByNum only for occasional single lookups, and move the repeated-number access in getPresentationPagesForExport to the cached index.bigbluebutton-html5/imports/ui/components/plugins-engine/server-commands/presentation/insert-pages/manager.tsx (1)
15-19: 📐 Maintainability & Code Quality | 🔵 TrivialSDK dependency remains pinned to an unreleased commit archive. Switch it back to the published package once the
insertPagesrelease is available.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@bigbluebutton-html5/imports/ui/components/plugins-engine/server-commands/presentation/insert-pages/manager.tsx` around lines 15 - 19, The SDK dependency for the insert-pages server command is still pinned to an unreleased archive, so update the package reference back to the published plugin SDK version once the paired insertPages change is released. Make the change in the dependency/config that the insert-pages manager relies on, and keep the identifiers in sync with the sibling upload/manager.tsx and the insertPages command types so the branch-only codeload reference is removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPagesInsertedSysMsgHdlr.scala`:
- Around line 56-63: The merge/delete flow in
PresentationPagesInsertedSysMsgHdlr is split across separate DAO calls, so a
failure after PresPresentationDAO.updatePages(newTargetPres) can leave the
transient presentation row behind. Update the merge logic to perform both the
page reassignment and the delete in one transactional DBIO or a single DAO
helper, and use the existing PresentationPagesInsertedSysMsgHdlr path plus
PresPresentationDAO to make the operation all-or-nothing.
- Around line 31-35: The splice flow in PresentationPagesInsertedSysMsgHdlr is
currently split across separate queued DB actions, so updatePages and delete can
be interrupted independently. Refactor the handler around the existing newState
logic so the merge and cleanup happen inside one transactional DB action, using
the same PresentationPodsApp and presentation update/delete path, and ensure the
target presentation update and transient insert presentation removal are
committed together.
In
`@bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/InsertPagesSplicer.java`:
- Around line 40-81: The splice flow can leave the presentation partially moved
because renameAcrossArtifacts() only logs File.renameTo() failures and splice()
keeps continuing. Update InsertPagesSplicer.splice() and/or
renameAcrossArtifacts() so any failed move aborts immediately with an
IOException, or implement a full preflight/rollback strategy; use the existing
splice(), renameAcrossArtifacts(), and ARTIFACTS logic to locate the change.
In
`@bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SlidesGenerationProgressNotifier.java`:
- Around line 175-200: sendPagesInsertedMessage currently swallows
InsertPagesSplicer.splice failures by only logging and returning, so the
client/plugin never gets a failure signal. Update this path to behave like the
other failure handlers in SlidesGenerationProgressNotifier by creating and
sending an appropriate error/progress message through messagingService when
splice throws, using the existing sendPagesInsertedMessage flow and the relevant
UploadedPresentation details to identify the presentation and meeting.
In
`@bigbluebutton-html5/imports/ui/components/plugins-engine/server-commands/presentation/insert-pages/manager.tsx`:
- Around line 86-90: The isValidInsertEvent check in manager.tsx only verifies
typeof event.detail.position === 'number', which still allows NaN, Infinity, and
non-integer values to reach insertPages. Tighten the validation in
isValidInsertEvent so position is a finite positive integer (1-based) before
dispatching the command, ensuring only valid positions are forwarded to
insertPages.
In
`@bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/container.jsx`:
- Around line 114-121: Guard slide navigation in presentation-toolbar and
whiteboard until presentationPagesData is loaded, since skipToSlide can ignore
prev/next or picker input while pres_page is still empty during mount or
presenter changes. Update the controls in presentation-toolbar container and the
navigation handling in whiteboard container so they are disabled or blocked
while the subscription is unresolved, and only invoke skipToSlide once the page
list is available or a valid fallback page can be resolved.
In `@bigbluebutton-html5/package.json`:
- Line 82: The dependency entry for bigbluebutton-html-plugin-sdk is still
pointing at a forked GitHub tarball, while the lockfile resolves the npm
release, so installs are inconsistent. Update the package.json dependency to use
the official SDK release/tag instead of the imdt-claudiop fork, then refresh
package-lock.json so it matches the same official version. Use the
bigbluebutton-html-plugin-sdk package reference in package.json and the
generated lockfile entry to keep both sources aligned.
In
`@bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy`:
- Around line 274-288: Reject path separators in targetPresentationId before
using it in the insert flow. In PresentationController’s insert handling, add
the same strict [A-Za-z0-9-]+ validation used elsewhere for presentation IDs
instead of only checking non-empty, and do not set uploadedPres when the ID
fails validation. This prevents
SlidesGenerationProgressNotifier.sendPagesInsertedMessage from receiving a value
that could make new File(insertDir.getParentFile(),
pres.getTargetPresentationId()) escape the meeting presentation root.
---
Nitpick comments:
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/MakePresentationDownloadReqMsgHdlr.scala`:
- Around line 105-116: The None branch in getPresentationPagesForExport is
silently skipping a page, so add a warning/error log when
PresentationInPod.getPageByNum returns None to make the export failure
diagnosable. Use the existing context in MakePresentationDownloadReqMsgHdlr,
especially pageNumber, presId, pageCount, and currentPres.get.pages.size, and
log before recursing so unexpected gaps from renumbering or races can be traced.
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala`:
- Around line 41-47: Add a small companion/helper around findPresentationPage in
PresentationPodsApp so callers don’t repeat the same unwrap-and-default logic.
The repeated pattern in SendCursorPositionPubMsgHdlr,
SendWhiteboardAnnotationPubMsgHdlr, DeleteWhiteboardAnnotationsPubMsgHdlr, and
the mirrored Polls code should call that helper instead of manually doing
findPresentationPage(...).map { case (pres, page) => (pres.id, page.num)
}.getOrElse(("", 0)). Keep the empty-default contract in one place and use the
existing PresentationInPod and PresentationPage symbols to locate the refactor.
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala`:
- Around line 64-67: getPageByNum in PresentationPods is doing a linear scan
over pres.pages for every lookup, which becomes expensive when
MakePresentationDownloadReqMsgHdlr.getPresentationPagesForExport calls it
repeatedly. Update the export path to precompute a Map[Int, PresentationPage]
indexed by page number once, then reuse that map for repeated lookups instead of
calling getPageByNum in a loop. Keep getPageByNum only for occasional single
lookups, and move the repeated-number access in getPresentationPagesForExport to
the cached index.
In
`@bigbluebutton-html5/imports/ui/components/plugins-engine/server-commands/presentation/insert-pages/manager.tsx`:
- Around line 15-19: The SDK dependency for the insert-pages server command is
still pinned to an unreleased archive, so update the package reference back to
the published plugin SDK version once the paired insertPages change is released.
Make the change in the dependency/config that the insert-pages manager relies
on, and keep the identifiers in sync with the sibling upload/manager.tsx and the
insertPages command types so the branch-only codeload reference is removed.
In
`@bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/container.jsx`:
- Around line 155-160: The `skipToSlide` lookup-and-select logic in
`presentation-toolbar/container.jsx` is duplicated in
`whiteboard/container.jsx`, so extract it into a shared helper or hook to keep
both callers in sync. Move the `presentationPagesData?.pres_page.find(...)` plus
`setPresentationPage(page.pageId)` behavior into a reusable
`useSkipToSlide(presentationId)`-style helper near
`PRESENTATION_PAGES_SUBSCRIPTION`, then update `skipToSlide` to use that shared
implementation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 913a04c7-b1f0-4163-84a2-2cab7220d42a
📒 Files selected for processing (32)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/MakePresentationDownloadReqMsgHdlr.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPagesInsertMath.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPagesInsertedSysMsgHdlr.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPagePubMsgHdlr.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/DeleteWhiteboardAnnotationsPubMsgHdlr.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/SendCursorPositionPubMsgHdlr.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/whiteboard/SendWhiteboardAnnotationPubMsgHdlr.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Polls.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scalaakka-bbb-apps/src/test/scala/org/bigbluebutton/core/apps/PresentationPagesInsertMathSpec.scalabbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scalabbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/WhiteboardMsgs.scalabbb-common-web/src/main/java/org/bigbluebutton/presentation/UploadedPresentation.javabbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/InsertPagesSplicer.javabbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SlidesGenerationProgressNotifier.javabbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/DocPagesInsertedProgress.javabbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scalabbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scalabbb-common-web/src/test/scala/org/bigbluebutton/presentation/imp/InsertPagesSplicerSpec.scalabigbluebutton-html5/imports/ui/components/plugins-engine/server-commands/handler.tsxbigbluebutton-html5/imports/ui/components/plugins-engine/server-commands/presentation/insert-pages/manager.tsxbigbluebutton-html5/imports/ui/components/plugins-engine/server-commands/presentation/insert-pages/service.tsbigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/container.jsxbigbluebutton-html5/imports/ui/components/whiteboard/container.jsxbigbluebutton-html5/imports/ui/components/whiteboard/queries.tsbigbluebutton-html5/package.jsonbigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy
|
hello @imdt-claudiop Make the following end-to-end test:
This must be in your PR evidences video as well |
Standalone Node/Playwright script that reproduces the reviewer-requested scenario in PR bigbluebutton#25380: create annotations on slides 1 and 2, insert a blank page between them, then verify the original annotations survive the shift while the inserted blank accepts a new annotation. The script is the verbatim reproduction used to capture the PR evidence (not a fixture-based .spec.ts yet) so the bug it exposes - an annotation created before an insert is lost when its slide is renumbered - can be reproduced deterministically against any from-source BBB 4.0 server running this feature branch. Step 9 of the scenario currently fails; see the README and the PR discussion for the bug report and tracking.
E2E test result (annotation preservation scenario)I ran the end-to-end test you requested. Steps 7 and 8 pass, step 9 fails, exposing a bug that I believe is in the prerequisite PR #25378's scope rather than this one. What I did (verbatim scenario)
EvidenceThe standalone reproduction script and a README are committed in this PR at
Diagnosis (why I think this is #25378's scope, not this PR's)This PR's splicer shifts So the fix lives in the pageId-opaque-UUID work (#25378): the whiteboard needs to reconcile annotations against the stable pageId through a @TiagoJacobs - per our chat, handing the fix over to the session driving #25378. Link: #25378 |
|
@imdt-claudiop - can you double check if you are using the latest code of #25378 ? |
|
Good catch - I was not. My PR is based on the first commit of #25378 (610c7f5, "refactor: make pageId an opaque UUID"). Since then #25378 has added 8 more commits, several of which directly address the annotation-loss bug I reported here - notably 5bf9eb8 ("key the tldraw store by pageId instead of page number") and 67f47d9 ("fix: pass the real pageId to the whiteboard container"). That is almost certainly the fix for step 9 of the scenario. I will rebase this PR onto the current #25378 head (72ae3e1), re-run the E2E scenario, and report back. |
Standalone Node/Playwright script that reproduces the reviewer-requested scenario in PR bigbluebutton#25380: create annotations on slides 1 and 2, insert a blank page between them, then verify the original annotations survive the shift while the inserted blank accepts a new annotation. The script is the verbatim reproduction used to capture the PR evidence (not a fixture-based .spec.ts yet) so the bug it exposes - an annotation created before an insert is lost when its slide is renumbered - can be reproduced deterministically against any from-source BBB 4.0 server running this feature branch. Step 9 of the scenario currently fails; see the README and the PR discussion for the bug report and tracking.
5efc963 to
cef250f
Compare
Standalone Node/Playwright script that reproduces the reviewer-requested scenario in PR bigbluebutton#25380: create annotations on slides 1 and 2, insert a blank page between them, then verify the original annotations survive the shift while the inserted blank accepts a new annotation. The script is the verbatim reproduction used to capture the PR evidence (not a fixture-based .spec.ts yet) so the bug it exposes - an annotation created before an insert is lost when its slide is renumbered - can be reproduced deterministically against any from-source BBB 4.0 server running this feature branch. Step 9 of the scenario currently fails; see the README and the PR discussion for the bug report and tracking.
80dd855 to
bf126b8
Compare
|
|
This pull request has conflicts ☹ |
The usage counter that tracks how many plugins are listening to a given subscription can reach negative values, which is invalid and likely indicates a bug in the unsubscribe logic. Extract the hook usage update logic into a dedicated function that guards against negative values and logs a warning when such an update is attempted.
|
Pushed commit addressing the code review findings:
Validated: clean compile of Not exercised: functional end-to-end insert flow and media (WebRTC). Known limitation: the insert transaction is isolated with |
98932d2 to
16e740e
Compare
Standalone Node/Playwright script that reproduces the reviewer-requested scenario in PR bigbluebutton#25380: create annotations on slides 1 and 2, insert a blank page between them, then verify the original annotations survive the shift while the inserted blank accepts a new annotation. The script is the verbatim reproduction used to capture the PR evidence (not a fixture-based .spec.ts yet) so the bug it exposes - an annotation created before an insert is lost when its slide is renumbered - can be reproduced deterministically against any from-source BBB 4.0 server running this feature branch. Step 9 of the scenario currently fails; see the README and the PR discussion for the bug report and tracking.
|
Pushed commit addressing the re-review findings:
Validated: single-SVG/single-PNG/multi-SVG exports produce PDFs; akka 32 tests; splicer 11 tests; TS/ESLint/Ruby syntax passed; forced splice failure re-enables toolbar with one toast; plugin rejects invalid positions and disabled setting; 1-page insert reads "1 slide". Media paths were not exercised. Known limitations: plugin guard does not span full async splice; akka state vs DB divergence on commit failure (existing BBB pattern); partial-move disk leak (very low); recording page-id cache assumes stable slide numbers; missing-target notification validated by compile + forced event, not live scenario. Branch was rebased onto |
16e740e to
b168532
Compare
Standalone Node/Playwright script that reproduces the reviewer-requested scenario in PR bigbluebutton#25380: create annotations on slides 1 and 2, insert a blank page between them, then verify the original annotations survive the shift while the inserted blank accepts a new annotation. The script is the verbatim reproduction used to capture the PR evidence (not a fixture-based .spec.ts yet) so the bug it exposes - an annotation created before an insert is lost when its slide is renumbered - can be reproduced deterministically against any from-source BBB 4.0 server running this feature branch. Step 9 of the scenario currently fails; see the README and the PR discussion for the bug report and tracking.
|
Thanks for the thorough review, Tainan. All actionable findings are addressed in the latest push ( Fixes implemented[Medium] insertPagesEnabled doc/code contradiction + [Low] server enforcement (findings 1, 4)
[Low] Count-based completion mis-attribution (finding 2)
[Low] Unscoped failure reconciliation (finding 3)
[Housekeeping] Transient insert dir cleanup on success (finding 5)
[Nit] Leftover comment phrase
Declared limitations (findings 6, 7)
Known caveats (from the implementer's validation)
Non-code merge blockers (unchanged, external)
|
Poll result shapes are built server-side with an empty meta map. The whiteboard client keeps a remote shape only when it can tie the shape to the presentation on screen: either meta.presentationId matches, or the shape's whiteboardId contains the presentation id. Poll shapes never set meta, so they relied entirely on the second branch, which held only because page ids used to embed the presentation id (presId/pageNum). The pageId-opaque-UUID refactor made page ids standalone UUIDs, so whiteboardId no longer contains the presentation id, the filter started rejecting poll shapes, and poll results stopped rendering on the whiteboard. Populate meta.presentationId in pollResultToWhiteboardShape, mirroring the convention client-drawn shapes already follow on persist, so the whiteboard filter matches poll shapes again. Deskshare polls keep an empty presentation id, like the recorder defaults in the same method.
f591784 to
4801d26
Compare
Match the SDK version in bbb-html5/package.json (bumped in ff03330) so the plugin-sdk-version-check CI guard passes.
…tact The file is CRLF in the repository. Rewriting it as LF turned a two-line change (dropping the now-unused slideNumber) into a 135-line whole-file diff, which hides the real change from review and would conflict with any other work on the file. Restore the original CRLF bytes and keep only the two lines that actually change.
bigbluebutton.properties carries an exact html5PluginSdkVersion (0.1.25) and plugin-sdk-version-check compares it against the version resolved in package-lock.json. A caret range lets a later npm install resolve a newer 0.1.x and silently break that match, so pin it exactly, which is also what the branch point already did (0.1.24).
urlsJson is the page's asset urls: bbb-html5 reads svg/thumb out of it and the plugin data-consumption layer hands the whole object to plugins. Adding insertRequestId to that map made a client correlation token look like one more asset url to every consumer that walks it. Give it its own nullable pres_page column instead, exposed through v_pres_page (presenter-scoped, like the rest of that view) and read by the toolbar as a real field. The value is written only for pages that an insert re-homed onto the target, and only by the DAO, so the in-memory PresentationPage.urls map is left alone.
The insert failure notification is built with buildNotifyAllInMeetingEvtMsg, so it reaches every client in the meeting. The toolbar resolved its pending insert on any notification with that messageId, which means a failed insert by one presenter silently cleared another presenter's in-flight insert: the spinner stopped, no error was shown for the insert that was still running, and its success toast never arrived. Carry the request's correlation id in the notification's messageValues (both emitters: the splice failure reported by bbb-web, and the target-presentation -disappeared case in akka-apps) and resolve the pending insert only when the id matches. bbb-web already knows the id as the upload's temporaryPresentationId.
The object doc said these functions do not clamp, right above clampedInsertPosition. akka-apps does clamp, and deliberately so: bbb-web clamped against the manifest on disk, akka-apps decides against its own view of the target, which can hold a different number of pages by then.
Three small things in and around applyInsertedPages: - give it an explicit Unit return type, so the signature says what callers get instead of leaving it to inference through DatabaseConnection.enqueue; - name the page-geometry literals (1440/1080 image bounds, unzoomed view box) once in PresPageDAO instead of repeating them at every row build, which is what the existing keep-in-sync comment was asking for; - stop writing num back for pages the insert cannot have moved. Only the inserted pages and the ones shifted above them change position, so pages numbered below the insert position were getting a no-op UPDATE each.
content-to-file and the insert-pages service each exported their functions twice, named and as a default object, so importers picked whichever style they felt like (the toolbar container went through the default, the plugin manager through the named exports). Settle on one per module, following what the repo's eslint config asks for: content-to-file has a single export, so it is the default; the service has three, so they stay named and the container imports them that way. Also drop the comment above the plugin insert-pages manager: half of it repeated the imports right below it, and the other half described the SDK still being an unpublished codeload dependency, which stopped being true when it was pinned to the published 0.1.25.
bbb-graphql-schema.md tracks the fields each role can select. The new pres_page column was exposed through v_pres_page and granted to bbb_client, so it belongs in that list too.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresPresentationDAO.scala (1)
263-277: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftDo not hide a failed persistence transaction.
asTryconverts a database failure intoUnit, andenqueuedoes not return the result toPresentationPagesInsertedSysMsgHdlr. That handler has already applied the inserted pages to actor state. A failed commit leaves the actor state, GraphQL state, and stored presentation files inconsistent. It also leaves the originating client request without a failure notification.Return the transaction result to the meeting actor. Apply the in-memory merge only after commit, or send a correlated failure event and reconcile actor state after failure.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresPresentationDAO.scala` around lines 263 - 277, The transaction in the presentation page persistence flow must not convert failures to Unit or discard its result. Update the code around transaction construction and DatabaseConnection.enqueue so PresentationPagesInsertedSysMsgHdlr receives the commit outcome, applies the in-memory page merge only after a successful commit, and sends the originating client a correlated failure notification or otherwise reconciles actor state when persistence fails.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresPresentationDAO.scala`:
- Around line 263-277: The transaction in the presentation page persistence flow
must not convert failures to Unit or discard its result. Update the code around
transaction construction and DatabaseConnection.enqueue so
PresentationPagesInsertedSysMsgHdlr receives the commit outcome, applies the
in-memory page merge only after a successful commit, and sends the originating
client a correlated failure notification or otherwise reconciles actor state
when persistence fails.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3b207a96-f7dc-4771-943d-5f96e10a942e
⛔ Files ignored due to path filters (1)
bigbluebutton-html5/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (19)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPagesInsertFailedSysMsgHdlr.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPagesInsertMath.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPagesInsertedSysMsgHdlr.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/ResizeAndMovePagePubMsgHdlr.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresPageDAO.scalaakka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresPresentationDAO.scalabbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scalabbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SlidesGenerationProgressNotifier.javabbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/DocPagesInsertFailed.javabbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scalabbb-graphql-server/bbb_schema.sqlbbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_pres_page.yamlbigbluebutton-html5/imports/ui/components/plugins-engine/server-commands/presentation/content-to-file.tsbigbluebutton-html5/imports/ui/components/plugins-engine/server-commands/presentation/insert-pages/manager.tsxbigbluebutton-html5/imports/ui/components/plugins-engine/server-commands/presentation/upload/manager.tsxbigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/insert-pages/container.tsxbigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/insert-pages/service.tsbigbluebutton-html5/imports/ui/components/whiteboard/queries.tsbigbluebutton-html5/package.json
💤 Files with no reviewable changes (1)
- bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/insert-pages/service.ts
🚧 Files skipped from review as they are similar to previous changes (13)
- bigbluebutton-html5/package.json
- akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/ResizeAndMovePagePubMsgHdlr.scala
- bbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/DocPagesInsertFailed.java
- bigbluebutton-html5/imports/ui/components/plugins-engine/server-commands/presentation/upload/manager.tsx
- akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPagesInsertFailedSysMsgHdlr.scala
- bigbluebutton-html5/imports/ui/components/plugins-engine/server-commands/presentation/insert-pages/manager.tsx
- akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPagesInsertedSysMsgHdlr.scala
- bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SlidesGenerationProgressNotifier.java
- bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/insert-pages/container.tsx
- akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPagesInsertMath.scala
- bbb-graphql-server/bbb_schema.sql
- bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala
- bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala
✅ Automated tests have passed! |
|
This pull request has conflicts ☹ |



What this does
Today a presenter who needs one more slide has to upload a whole new presentation and switch to it, losing the annotations and the flow of the deck that is already on screen. This PR lets the presenter add pages into the presentation that is already open, at a chosen position.
Two entry points:
presentation.insertPagesserver command, sibling of the existingpresentation.upload. A plugin passes the content (file, blob, dataURL or base64, or nothing at all for a blank page) and a 1-based position.Both paths go through the same route: the file is uploaded through the regular presentation upload endpoint with two extra fields (
insertAtPosition,targetPresentationId), converted by the normal conversion pipeline as a transient presentation, and then spliced into the target. Nothing bypasses conversion, so the inserted pages get the same svg/png/textfile/thumbnail artifacts as any other slide.Preserving existing annotations
Splicing pages into the middle of a deck used to be impossible without renumbering, and renumbering broke annotations, because a slide's identity was its page number: assets were served as
.../svg/3, the tldraw store was keyed by page number, and the whiteboard rows hung offpresentationId/num. Inserting a page at position 3 would have quietly moved slide 3's drawings onto the newly inserted page.So the first half of this PR is a refactor:
pageIdbecomes an opaque UUID minted once during conversion, and everything downstream is keyed by it instead of by position. Slide files are named by page id, the page token is signed over the page id, the tldraw store and the whiteboard queries use the page id, and recording playback reads page identity from the events with a fallback to the old numbering for recordings made before this change.numsurvives as what it should always have been: a mutable position attribute.With that in place, an insert is just "move the new pages' files into the target directory and renumber positions", and every annotation stays attached to the page it was drawn on.
How a splice happens
InsertPagesSplicer) moves the converted pages' artifacts into the target presentation's directory and re-keyspages.json, the num-to-pageId manifest, so positions at and after the insert shift up. Names are opaque ids, so nothing collides and no existing file is touched. Splices are serialized against each other.PresentationPagesInsertedSysMsgHdlr) re-homes the converted pages onto the target in meeting state, shifts the existing page numbers, and persists the whole thing as one transaction: the inserted rows are repointed, the shifted rows renumbered,totalPagesupdated and the transient insert presentation deleted. It has to be one transaction, becausepres_pagecascades on delete ofpres_presentationand a split would cascade away the pages that were just re-homed. The(presentationId, num)unique constraint isDEFERRABLE INITIALLY DEFERREDso in-place renumbering can transiently collide inside the transaction.Configuration
public.presentation.insertPagesEnabledinsettings.yml, defaulttrue.Set it to
falseto hide the native toolbar button and reject inserts requested through the plugin SDK. The flag is enforced on the server too:bigbluebutton-webanswers403 insert-pages-disabledto an insert upload when the meeting has it off, so a client that ignores the setting gets nowhere.How to test
Manual path, on a server built from this branch:
Blank slide inserted after slide 1.public.presentation.insertPagesEnabled: false, restart the html5 client, and confirm the + button is gone.Plugin path: dispatch the
presentation.insertPagesserver command from a plugin with a position and either a content payload or no content (blank page). Non-presenters, malformed positions and inserts while the feature is off are rejected and logged.Recording: record a meeting in which pages are inserted, then process and play it back. Slide navigation and annotations should follow the post-insert numbering.
Testing done
akka-bbb-apps: 32 tests pass, includingPresentationPagesInsertMathSpec.bbb-common-web:InsertPagesSplicerSpec(11) andUtilIdValidationSpec(3) pass.ClientSettingsValidatorTestaborts on a jackson-databind / jackson-module-scala version conflict in the resolved dependency tree; that abort reproduces unchanged at the branch point, so it is not from this work.bigbluebutton-html5:tsc --noEmitand ESLint clean.bbb-export-annotations: targeted ESLint passed; the export worker produced valid PDFs for single-SVG, single-PNG and multi-SVG inputs.bigbluebutton-tests/playwright/presentation/insert-pages-repro/, with its README describing how to run it.bbb-apps-akka,bbb-export-annotations,bbb-weband nginx were active. Media paths were not exercised.Known limitations