Skip to content

refactor: clean up meteor-run-as-user package#38373

Merged
ggazzo merged 3 commits into
developfrom
chore/run-as-user
Jan 28, 2026
Merged

refactor: clean up meteor-run-as-user package#38373
ggazzo merged 3 commits into
developfrom
chore/run-as-user

Conversation

@ggazzo

@ggazzo ggazzo commented Jan 27, 2026

Copy link
Copy Markdown
Member

extracted from #38354

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Breaking Changes

    • Removed public APIs: Meteor.isRestricted(), Meteor.runRestricted(), Meteor.runUnrestricted(), Meteor.runAsRestrictedUser(), Meteor.isAdmin(), Meteor.runAsAdmin(), and Meteor.runOutsideInvocation().
  • Refactor

    • Streamlined internal collection handling logic.
  • Chores

    • Dropped support for older Meteor versions.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot

changeset-bot Bot commented Jan 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3ef5377

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

@coderabbitai

coderabbitai Bot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR removes deprecated public APIs from the meteor-run-as-user package (Meteor.isRestricted, Meteor.runRestricted, Meteor.isAdmin, etc.) and eliminates a Meteor version compatibility polyfill. It refactors collection operation handling to use LocalCollection iteration helpers instead of Mongo.Collection monkey-patching.

Changes

Cohort / File(s) Summary
API and Infrastructure Removal
lib/common.js
Removed 7 public APIs: isRestricted, runRestricted, runUnrestricted, runAsRestrictedUser, isAdmin, runAsAdmin, and runOutsideInvocation. Eliminated associated adminMode and restrictedMode environment variables. Kept only Meteor.runAsUser with minor formatting updates.
Collection Override Refactoring
lib/collection.overwrites.js
Replaced Mongo.Collection prototype overrides for insert/update/remove with two targeted LocalCollection iteration helpers: _eachPossiblyMatchingDocAsync and _eachPossiblyMatchingDocSync. Updated break conditions to explicitly check for false returns instead of negated conditions.
Version Compatibility Polyfill Deletion
lib/pre.1.0.3.js
Removed entire polyfill file containing DDPCommon.MethodInvocation constructor and prototype methods (unblock, setUserId) for backward compatibility with older Meteor versions.
Package Configuration Update
package.js
Removed lib/pre.1.0.3.js from the file inclusion list, reducing package files from 3 to 2.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

stat: QA assured

Poem

🐰 Old APIs fade like winter snow,
Polyfills packed away to go,
Collection helpers now take flight,
Leaner code shining bright!
RunAsUser remains on stage,
Turning a cleaner, fresher page. 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the changeset—removing deprecated APIs, unused files, and simplifying the meteor-run-as-user package structure through refactoring.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/run-as-user

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 and usage tips.

@dionisio-bot

dionisio-bot Bot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

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

  • This PR is targeting the wrong base branch. It should target 8.2.0, but it targets 8.1.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@codecov

codecov Bot commented Jan 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.78%. Comparing base (31d0c01) to head (3ef5377).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #38373   +/-   ##
========================================
  Coverage    70.78%   70.78%           
========================================
  Files         3159     3159           
  Lines       109397   109396    -1     
  Branches     19669    19666    -3     
========================================
  Hits         77437    77437           
+ Misses       29933    29930    -3     
- Partials      2027     2029    +2     
Flag Coverage Δ
unit 71.97% <ø> (-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.

@github-actions

github-actions Bot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

📦 Docker Image Size Report

➡️ Changes

Service Current Baseline Change Percent
sum of all images 0B 0B 0B
account-service 0B 0B 0B
authorization-service 0B 0B 0B
ddp-streamer-service 0B 0B 0B
omnichannel-transcript-service 0B 0B 0B
presence-service 0B 0B 0B
queue-worker-service 0B 0B 0B
rocketchat 0B 0B 0B

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/18 22:53", "11/19 23:02", "11/21 16:49", "11/24 17:34", "11/27 22:32", "11/28 19:05", "12/01 23:01", "12/02 21:57", "12/03 21:00", "12/04 18:17", "12/05 21:56", "12/08 20:15", "12/09 22:17", "12/10 23:26", "12/11 21:56", "12/12 22:45", "12/13 01:34", "12/15 22:31", "12/16 22:18", "12/17 21:04", "12/18 23:12", "12/19 23:27", "12/20 21:03", "12/22 18:54", "12/23 16:16", "12/24 19:38", "12/25 17:51", "12/26 13:18", "12/29 19:01", "12/30 20:52", "01/27 22:29 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.00]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "queue-worker-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "rocketchat" [0.35, 0.35, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.00]
Loading

Statistics (last 30 days):

  • 📊 Average: 1.5GiB
  • ⬇️ Minimum: 1.4GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 0B
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-38373
  • Baseline: develop
  • Timestamp: 2026-01-27 22:29:38 UTC
  • Historical data points: 30

Updated: Tue, 27 Jan 2026 22:29:39 GMT

@ggazzo ggazzo added this to the 8.2.0 milestone Jan 27, 2026
@ggazzo ggazzo marked this pull request as ready for review January 27, 2026 18:48

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/meteor/packages/meteor-run-as-user/package.js (1)

1-7: Update package summary to reflect removed API.

The summary still references Meteor.isRestricted() which has been removed in this refactor. Consider updating it to accurately describe the current API surface.

Suggested diff
 Package.describe({
 	name: 'dispatch:run-as-user',
 	version: '1.1.1',
-	summary: 'Adds Meteor.runAsUser(user, f) and Meteor.isRestricted()',
+	summary: 'Adds Meteor.runAsUser(user, f)',
 	git: 'https://github.com/DispatchMe/Meteor-run-as-user.git',
 	documentation: 'README.md',
 });
🧹 Nitpick comments (2)
apps/meteor/packages/meteor-run-as-user/lib/collection.overwrites.js (2)

11-13: Consider removing inline comments.

Per coding guidelines, implementation code should avoid comments. The change from !fn(doc,id) to === false is self-explanatory for the explicit boolean check pattern.

Suggested diff
-			if (doc && (await fn(doc, id)) === false) {
-				// Changed from `!fn(doc,id)`
+			if (doc && (await fn(doc, id)) === false) {
 				break;
 			}

28-30: Same comment applies here.

The inline comment on line 29 can be removed for consistency with the async version and to follow the coding guidelines.

Suggested diff
-			if (doc && fn(doc, id) === false) {
-				// Changed from `!fn(doc,id)`
+			if (doc && fn(doc, id) === false) {
 				break;
 			}

@sampaiodiego sampaiodiego added the stat: QA assured Means it has been tested and approved by a company insider label Jan 27, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jan 27, 2026
@ggazzo ggazzo merged commit 35ea71a into develop Jan 28, 2026
42 of 44 checks passed
@ggazzo ggazzo deleted the chore/run-as-user branch January 28, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants