Skip to content

feat(uikit): add room to some other interaction contexts#39719

Closed
Copilot wants to merge 15 commits intodevelopfrom
copilot/fix-uikit-interaction-room-data
Closed

feat(uikit): add room to some other interaction contexts#39719
Copilot wants to merge 15 commits intodevelopfrom
copilot/fix-uikit-interaction-room-data

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 18, 2026

  • Fix modal UIKit interactions to send rid to server (ActionManager approach)
  • Add UIKit room context test app
    • Test app with slash command supporting three surfaces: modal, ctx (contextual bar), and message
    • Implements executeBlockActionHandler, executeViewSubmitHandler, executeViewClosedHandler
    • Logs room, user, triggerId, actionId, and container type from each handler to enable verification
  • Add Playwright e2e tests for UIKit interaction data (uikit-interactions.spec.ts)
    • Add getAppLogs helper and update installLocalTestPackage to return app data in insert-apps.ts
    • Test executeBlockActionHandler from message, contextual bar, and modal surfaces
    • Test executeViewSubmitHandler from modal and contextual bar surfaces
    • Test executeViewClosedHandler from modal and contextual bar surfaces
    • Each test validates room, user, triggerId, actionId, and container data via app logs
  • Document uikit-room-test_0.0.1.zip in app-packages/README.md with full TypeScript source

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Mar 18, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 18, 2026

🦋 Changeset detected

Latest commit: 4c13525

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 42 packages
Name Type
@rocket.chat/ui-kit Minor
@rocket.chat/meteor Minor
@rocket.chat/core-services Patch
@rocket.chat/core-typings Minor
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/livechat Patch
@rocket.chat/rest-typings Minor
@rocket.chat/ui-voip Major
rocketchat-services Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/presence Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/gazzodown Major
@rocket.chat/http-router Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Major
@rocket.chat/ui-client Major
@rocket.chat/ui-contexts Major
@rocket.chat/web-ui-registration Major
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/models Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Major
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/server-fetch Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI changed the title [WIP] Fix missing room data in uikit interaction payload Fix UIKit interaction room data not being passed to apps Mar 18, 2026
Copilot AI requested a review from d-gubert March 18, 2026 18:47
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.60%. Comparing base (1dbfce4) to head (4c13525).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #39719      +/-   ##
===========================================
- Coverage    70.61%   70.60%   -0.02%     
===========================================
  Files         3256     3256              
  Lines       115778   115777       -1     
  Branches     21042    21059      +17     
===========================================
- Hits         81756    81743      -13     
- Misses       31965    31976      +11     
- Partials      2057     2058       +1     
Flag Coverage Δ
unit 71.12% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@d-gubert d-gubert force-pushed the copilot/fix-uikit-interaction-room-data branch from 3c70293 to 0e855fe Compare March 19, 2026 17:40
Copilot AI changed the title Fix UIKit interaction room data not being passed to apps Add room context to modal UIKit interactions Mar 19, 2026
@d-gubert
Copy link
Copy Markdown
Member

@copilot This solution doesn't work because the UiKitModal component is not rendered inside the component tree that provides the RoomContext; so it will always be undefined.

We need to find a way for the ActionManager to access the rid from a context, and pass it over on line 260

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 19, 2026

@copilot This solution doesn't work because the UiKitModal component is not rendered inside the component tree that provides the RoomContext; so it will always be undefined.

We need to find a way for...

You're right. I've fixed this by tracking rid in the ActionManager itself:

  1. Changed appIdByTriggerId to triggerIdInfo to store both appId and rid per trigger
  2. When emitInteraction is called with an interaction that has rid, it's stored with the trigger
  3. When the server responds with modal.open, the rid is passed to openModal and then to UiKitModal as a prop
  4. Added getRidByViewId method to support modal-to-modal rid inheritance

Commit: 23cdcc8

@d-gubert d-gubert force-pushed the copilot/fix-uikit-interaction-room-data branch from e575cf8 to a371882 Compare March 19, 2026 21:10
@d-gubert d-gubert changed the title Add room context to modal UIKit interactions feat(uikit): add room to some other interaction contexts Mar 19, 2026
@d-gubert d-gubert force-pushed the copilot/fix-uikit-interaction-room-data branch 2 times, most recently from e4ec352 to c25a09a Compare March 19, 2026 21:40
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 23, 2026

@copilot fix the issue on CI https://github.com/RocketChat/Rocket.Chat/actions/runs/23447872808/job/68219474625?pr=39719

Fixed in fbf30d1. The CI failure was a Prettier lint error in uikit-room-context.ts at line 44 — two &&-chained conditions were split across lines but Prettier required them on a single line.

Copilot AI and others added 11 commits March 23, 2026 19:54
Revert "Track rid in ActionManager and pass to modals via props"

This reverts commit 23cdcc8.

Revert "Add rid to modal UIKit interactions when room context is available"

This reverts commit c25436d.
@d-gubert d-gubert force-pushed the copilot/fix-uikit-interaction-room-data branch from fbf30d1 to 312e538 Compare March 24, 2026 00:34
@d-gubert
Copy link
Copy Markdown
Member

@copilot the test at apps/meteor/tests/end-to-end/apps/uikit-room-context.ts is not applicable - manually sending interactions defeats the purpose for the test. We'll actually need an e2e, playwright test.

I've included a helper function for installing apps in apps/meteor/tests/e2e/fixtures/insert-apps.ts, and created the scaffold for the playwright test here apps/meteor/tests/e2e/apps/uikit-interactions.spec.ts

You have to complete each test case with their appropriate validation. Include any extra test case if you deem necessary.

You may need to add helpers to apps/meteor/tests/e2e while working on the tests, for instance to fetch apps' logs. Follow patterns in apps/meteor/tests/e2e for that.

The app you've built does not provide all the functionality needed for all test cases. Review the app and add things accordingly. Refer back to my example app here for reference.

Copilot AI and others added 2 commits March 24, 2026 01:04
- Enhanced test app to support modal, contextual bar, and message surfaces
- Added getAppLogs helper to e2e fixtures for fetching app logs
- Updated installLocalTestPackage to return app data
- Completed all 7 Playwright test cases validating room, user, triggerId, actionId, and container
- Removed old non-applicable end-to-end test (uikit-room-context.ts)
- Updated README documentation for the enhanced test app

Co-authored-by: d-gubert <[email protected]>
Agent-Logs-Url: https://github.com/RocketChat/Rocket.Chat/sessions/ec71feb5-1416-4b80-8e2f-b03c571ccef4
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 24, 2026

@copilot the test at apps/meteor/tests/end-to-end/apps/uikit-room-context.ts is not applicable - manually sending interactions defeats the purpose for the test. We'll actually need an ...

Implemented in a9d6682 and b8fa0f8.

Changes made:

  • Enhanced test app (uikit-room-test_0.0.1.zip): Now supports all three surfaces via /open-uikit-room-test-modal <modal|ctx|message>, each handler logs room, user, triggerId, actionId, and container type
  • Added helpers in insert-apps.ts: installLocalTestPackage now returns { app: { id } }, added getAppLogs(appId) for fetching app logs
  • Completed all 7 Playwright tests validating correct data in executeBlockActionHandler (message, contextual bar, modal), executeViewSubmitHandler (modal, contextual bar), and executeViewClosedHandler (modal, contextual bar)
  • Removed old API-based uikit-room-context.ts test
  • Updated README with the new app source code

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/RocketChat/Rocket.Chat/issues/comments/4111646611
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@d-gubert
Copy link
Copy Markdown
Member

@copilot https://github.com/RocketChat/Rocket.Chat/actions/runs/23468073147/job/68285933076?pr=39719 CI issue involving your changes

This one is unrelated, don't worry about it

Opening a contextual bar via the Apps Engine triggers a client-side
URL navigation (to /channel/{room}/app/{viewId}). Calling waitFor on
a locator while this navigation is still in progress causes Playwright
to throw "Target page, context or browser has been closed".

Add page.waitForURL(/\/app\//) after dispatching the contextual bar
slash command in all three contextual bar tests to ensure the
navigation completes before any locator operations.

Co-authored-by: d-gubert <[email protected]>
Agent-Logs-Url: https://github.com/RocketChat/Rocket.Chat/sessions/1998ca62-abf1-478a-835c-d3ea1053d273
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 24, 2026

@copilot https://github.com/RocketChat/Rocket.Chat/actions/runs/23468073147/job/68285933076?pr=39719 CI issue involving your changes

[This one](https://github.com/RocketChat/Rocke...

Fixed in 56e9106.

The failure was caused by a race condition: when openSurfaceView(CONTEXTUAL_BAR) is called via the Apps Engine, Rocket.Chat performs a client-side URL navigation (to /channel/general/app/{viewId}). When locator.waitFor() was called while this navigation was still in progress, Playwright threw "Target page, context or browser has been closed".

The fix adds await page.waitForURL(/\/app\//) immediately after the slash command dispatch for all three contextual bar tests. This waits for the navigation to complete before any locator operations begin.

@d-gubert
Copy link
Copy Markdown
Member

closing in favor of #39858

@d-gubert d-gubert closed this Mar 25, 2026
@d-gubert d-gubert deleted the copilot/fix-uikit-interaction-room-data branch March 25, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants