Skip to content

refactor: swap method.call/addUsersToRoom for per-type REST endpoints#40723

Draft
Copilot wants to merge 3 commits into
developfrom
copilot/ddp-removal-swap-api-methods
Draft

refactor: swap method.call/addUsersToRoom for per-type REST endpoints#40723
Copilot wants to merge 3 commits into
developfrom
copilot/ddp-removal-swap-api-methods

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

The addUserToRoom test helper used the legacy DDP method.call/addUsersToRoom endpoint. Federation tests asserted the DDP error shape (JSON.parse(body.message).error.error) instead of the REST envelope ({ success: false, errorType }).

Changes

  • apps/meteor/tests/data/rooms.helper.ts — Added required type: IRoom['t'] parameter routing to the appropriate endpoint:

    • 'c'POST /v1/channels.invite
    • 'p'POST /v1/groups.invite
    • 'd' → falls back to method.call (no REST equivalent for DM invites)
  • Federation test assertions (room.spec.ts, permissions.spec.ts) — Migrated from DDP error shape to REST envelope:

    - const messageData = JSON.parse(response.body.message);
    - expect(messageData.error).toHaveProperty('error', 'error-federated-users-in-non-federated-rooms');
    + expect(response.body).toHaveProperty('errorType', 'error-federated-users-in-non-federated-rooms');

    Success assertions updated from DDP result string (body.message matching {"msg":"result",...}) to REST shape (body.group).

  • DM tests (dms.spec.ts) — Pass type: 'd'; assertions unchanged since DDP fallback is preserved.

  • Other callers (chat.ts, uploads.helper.ts) — Pass explicit room type.

Task: FGA-67

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented May 28, 2026

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

  • This PR is missing the 'stat: QA assured' label

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 May 28, 2026

⚠️ No Changeset found

Latest commit: 8dce3ac

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Replace the DDP method.call/addUsersToRoom helper with per-type REST
endpoints:
- type 'c' → POST /v1/channels.invite
- type 'p' → POST /v1/groups.invite
- type 'd' → fallback to method.call (no REST equivalent for DM invites)

Update federation test assertions from DDP error shape
(JSON.parse(body.message).error.error) to REST envelope
(body.errorType), and success assertions from DDP result string to
REST response shape (body.group).
Copilot AI changed the title [WIP] Swap legacy DDP method for REST endpoints refactor: swap method.call/addUsersToRoom for per-type REST endpoints May 28, 2026
Copilot finished work on behalf of ggazzo May 28, 2026 17:42
Copilot AI requested a review from ggazzo May 28, 2026 17:42
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.73%. Comparing base (1a4d0f3) to head (8dce3ac).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #40723      +/-   ##
===========================================
+ Coverage    69.72%   69.73%   +0.01%     
===========================================
  Files         3326     3326              
  Lines       123056   123090      +34     
  Branches     21976    21948      -28     
===========================================
+ Hits         85797    85835      +38     
  Misses       33905    33905              
+ Partials      3354     3350       -4     
Flag Coverage Δ
unit 70.47% <ø> (+<0.01%) ⬆️

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.

@ggazzo
Copy link
Copy Markdown
Member

ggazzo commented May 28, 2026

@copilot check lint task

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 28, 2026

@copilot check lint task

The lint failure was two prettier errors in rooms.helper.ts — the chained .post().set() calls needed to be on a single line instead of split across multiple lines. Fixed in 3rd commit.

Copilot finished work on behalf of ggazzo May 28, 2026 19:28
@ggazzo ggazzo added this to the 8.6.0 milestone May 28, 2026
@ggazzo
Copy link
Copy Markdown
Member

ggazzo commented May 28, 2026

/jira FGA

@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot Bot commented May 28, 2026

⚠️ Dionisio (Jira)

The milestone "8.6.0" does not exist on the Jira board; the task was created without Fix version.

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.

(ddp-removal): swap /api/v1/method.call/addUsersToRoom for the per-type

2 participants