feat: replace meteor/check with a zod based validator - #1803
Conversation
|
Warning Review limit reached
Next review available in: 12 minutes Limit details: You’ve used all 2 included reviews currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (66)
💤 Files with no reviewable changes (6)
🚧 Files skipped from review as they are similar to previous changes (45)
Included review availability: Your plan includes up to 2 reviews per rolling hour; 0 remain after this review. WalkthroughThis change replaces Meteor ChangesZod validation foundation
Server API and REST migration
Publication registration
Supporting setup
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to This validation replacement is merge-ready after normal checks and review; no actionable merge-blocking risk remains. 🚥 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.
🧹 Nitpick comments (1)
meteor/server/api/system.ts (1)
391-394: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
cleanupIndexesreturn type left asanyunlike its siblings.The other three methods added in this same pass (
cleanupOldData,runCronjob,doSystemBenchmark) got precise return types, butcleanupIndexesis typedPromise<any>even though the underlying function returnsPromise<Array<IndexSpecification>>. This forfeits the type-safety this change was meant to add for this one method.♻️ Proposed fix
- async cleanupIndexes(actuallyRemoveOldIndexes: boolean): Promise<any> { + async cleanupIndexes(actuallyRemoveOldIndexes: boolean): Promise<Array<IndexSpecification>> { return cleanupIndexes(this, actuallyRemoveOldIndexes) }🤖 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 `@meteor/server/api/system.ts` around lines 391 - 394, Update SystemAPIClass.cleanupIndexes to return Promise<Array<IndexSpecification>> instead of Promise<any>, matching the return type of the delegated cleanupIndexes function and the precise typing used by its sibling methods.
🤖 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.
Nitpick comments:
In `@meteor/server/api/system.ts`:
- Around line 391-394: Update SystemAPIClass.cleanupIndexes to return
Promise<Array<IndexSpecification>> instead of Promise<any>, matching the return
type of the delegated cleanupIndexes function and the precise typing used by its
sibling methods.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c00f215a-a9d3-47a1-8b60-68f8d233f6af
⛔ Files ignored due to path filters (3)
meteor/server/__tests__/__snapshots__/methodRegistry.test.ts.snapis excluded by!**/*.snapmeteor/server/__tests__/__snapshots__/publicationRegistry.test.ts.snapis excluded by!**/*.snapmeteor/yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (99)
meteor/.meteor/versionsmeteor/__mocks__/_setupMocks.tsmeteor/__mocks__/check/READMEmeteor/__mocks__/check/index.tsmeteor/__mocks__/check/isPlainObject.jsmeteor/__mocks__/check/match.jsmeteor/__mocks__/helpers/methods.tsmeteor/__mocks__/helpers/publications.tsmeteor/package.jsonmeteor/server/__tests__/cronjobs.test.tsmeteor/server/__tests__/methodRegistry.test.tsmeteor/server/__tests__/publicationRegistry.test.tsmeteor/server/api/ExternalMessageQueue.tsmeteor/server/api/__tests__/client.test.tsmeteor/server/api/__tests__/externalMessageQueue.test.tsmeteor/server/api/__tests__/peripheralDevice.test.tsmeteor/server/api/__tests__/rundownLayouts.test.tsmeteor/server/api/__tests__/userActions/general.test.tsmeteor/server/api/__tests__/userActions/system.test.tsmeteor/server/api/blueprints/__tests__/api.test.tsmeteor/server/api/blueprints/api.tsmeteor/server/api/blueprints/http.tsmeteor/server/api/client.tsmeteor/server/api/deviceTriggers/observer.tsmeteor/server/api/ingest/debug.tsmeteor/server/api/ingest/http.tsmeteor/server/api/ingest/rundownInput.tsmeteor/server/api/integration/expectedPackages.tsmeteor/server/api/mongo.tsmeteor/server/api/peripheralDevice.tsmeteor/server/api/playout/api.tsmeteor/server/api/playout/debug.tsmeteor/server/api/rest/api.tsmeteor/server/api/rest/v0/__tests__/rest.test.tsmeteor/server/api/rest/v0/index.tsmeteor/server/api/rest/v1/blueprints.tsmeteor/server/api/rest/v1/buckets.tsmeteor/server/api/rest/v1/devices.tsmeteor/server/api/rest/v1/ingest.tsmeteor/server/api/rest/v1/playlists.tsmeteor/server/api/rest/v1/showstyles.tsmeteor/server/api/rest/v1/snapshots.tsmeteor/server/api/rest/v1/studios.tsmeteor/server/api/rest/v1/system.tsmeteor/server/api/rundown.tsmeteor/server/api/rundownLayouts.tsmeteor/server/api/showStyles.tsmeteor/server/api/snapshot.tsmeteor/server/api/studio/api.tsmeteor/server/api/system.tsmeteor/server/api/triggeredActions.tsmeteor/server/api/user.tsmeteor/server/api/userActions.tsmeteor/server/lib/__tests__/check.test.tsmeteor/server/lib/check.tsmeteor/server/lib/customPublication/index.tsmeteor/server/lib/customPublication/publish.tsmeteor/server/main.tsmeteor/server/methodRegistrations.tsmeteor/server/methodRegistry.tsmeteor/server/methods.tsmeteor/server/migration/__tests__/migrations.test.tsmeteor/server/migration/api.tsmeteor/server/publicationRegistrations.tsmeteor/server/publicationRegistry.tsmeteor/server/publications/_publications.tsmeteor/server/publications/blueprintUpgradeStatus/publication.tsmeteor/server/publications/buckets.tsmeteor/server/publications/deviceTriggersPreview.tsmeteor/server/publications/externalEventSubscriptions.tsmeteor/server/publications/ingestStatus/publication.tsmeteor/server/publications/lib/lib.tsmeteor/server/publications/mountedTriggers.tsmeteor/server/publications/organization.tsmeteor/server/publications/packageManager/expectedPackages/publication.tsmeteor/server/publications/packageManager/packageContainers.tsmeteor/server/publications/packageManager/playoutContext.tsmeteor/server/publications/partInstancesUI/publication.tsmeteor/server/publications/partsUI/publication.tsmeteor/server/publications/peripheralDevice.tsmeteor/server/publications/peripheralDeviceForDevice.tsmeteor/server/publications/pieceContentStatusUI/bucket/publication.tsmeteor/server/publications/pieceContentStatusUI/rundown/publication.tsmeteor/server/publications/rundown.tsmeteor/server/publications/rundownPlaylist.tsmeteor/server/publications/segmentPartNotesUI/publication.tsmeteor/server/publications/showStyle.tsmeteor/server/publications/showStyleUI.tsmeteor/server/publications/studio.tsmeteor/server/publications/studioUI.tsmeteor/server/publications/system.tsmeteor/server/publications/timeline.tsmeteor/server/publications/translationsBundles.tsmeteor/server/publications/triggeredActionsUI.tsmeteor/server/security/check.tsmeteor/server/security/securityVerify.tsmeteor/server/systemStatus/__tests__/api.test.tsmeteor/server/systemStatus/__tests__/systemStatus.test.tsmeteor/server/systemStatus/api.ts
💤 Files with no reviewable changes (7)
- meteor/mocks/check/index.ts
- meteor/mocks/check/README
- meteor/mocks/check/isPlainObject.js
- meteor/mocks/_setupMocks.ts
- meteor/mocks/check/match.js
- meteor/server/publications/_publications.ts
- meteor/.meteor/versions
322cf80 to
1b42ccf
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
1b42ccf to
a27190d
Compare
About the Contributor
Type of Contribution
This is a: Feature / Code improvement
This is part of a series of PRs aiming to replace meteor.
This builds upon #1785, as it conflicts heavily with the refactoring there
Current Behavior
For ddp methods, we are using 'meteor/check' to validate method arguments. As part of removing our usage of meteor, this will need to be replaced.
New Behavior
Instead of porting the meteor code, or building something new, I decided to try out zod for this. The usage and DX could be better, but I see that as a follow up.
For now this is a fairly minimal port of existing semantics, but using zod for the validation.
In the future, I would like to see us rework the method definition process to include providing a zod schema so that we can be sure the validation is performed correctly, and matches the types (as the types will be inferred from the schema)
Testing
Affected areas
Time Frame
Other Information
Status