Skip to content

Conversation

@Nicolapps
Copy link
Member

@Nicolapps Nicolapps commented Dec 17, 2025


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Summary by CodeRabbit

  • Refactor

    • Database operations now require an explicit table/collection name as the first argument across the codebase, affecting get/patch/replace/delete calls and tests.
  • Chores

    • Updated devDependency "@convex-dev/eslint-plugin" to allow newer minor/patch releases.

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

@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This PR systematically updates database operation calls across the codebase to pass explicit table/collection names as the first argument to get, patch, replace, and delete (including system DB calls).

Changes

Cohort / File(s) Change Summary
Convex examples
convex/counter.ts, convex/migrationsExample.ts, convex/presence.ts, convex/relationshipsExample.ts, convex/rlsExample.ts, convex/sessionsExample.ts, convex/triggersExample.ts, convex/testingFunctions.ts
All DB operations updated to include explicit table/collection names as the first argument (get("table", id), patch("table", id, ...), replace("table", id, ...), delete("table", id)).
Helper implementation files
packages/convex-helpers/server/migrations.ts, packages/convex-helpers/server/rateLimit.ts, packages/convex-helpers/server/retries.ts
System and regular DB calls now include explicit collection names (e.g., ctx.db.system.get("_scheduled_functions", id); patch("rateLimits", id, ...); delete("rateLimits", id)).
Helper tests
packages/convex-helpers/server/filter.test.ts, packages/convex-helpers/server/pagination.test.ts, packages/convex-helpers/server/rowLevelSecurity.test.ts, packages/convex-helpers/server/table.test.ts, packages/convex-helpers/server/triggers.test.ts, packages/convex-helpers/server/validators.test.ts, packages/convex-helpers/server/zod3.test.ts, packages/convex-helpers/server/zod4.zod3.test.ts
Tests updated to call DB methods with explicit table names; some eslint-disable comments added/adjusted around legacy/implicit API usage.
Package metadata
package.json
Bumped devDependency @convex-dev/eslint-plugin from 1.0.0 to ^1.1.0.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Focus review on consistent application of the pattern across files.
  • Verify each explicit table name is correct for its context (e.g., "_scheduled_functions" for system lookups, "users", "presence", "rateLimits", etc.).
  • Check tests and triggers for any missed implicit calls or eslint comment placement.

Possibly related PRs

Suggested reviewers

  • ianmacartney

Poem

🐰 I hopped through code with tiny paws,

I named each table without a pause.
No more guessing, no more plight —
Every call now names its right.
Hooray for clarity, what a sight! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title focuses only on the eslint-plugin dependency update, but the changeset includes extensive database API migration across 15+ files requiring explicit table name arguments. Revise the title to reflect the primary change: 'Migrate database operations to require explicit table names' or similar, as this architectural change is far more significant than the minor dependency update.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 17, 2025

Open in StackBlitz

npm i https://pkg.pr.new/get-convex/convex-helpers@883

commit: 0abef26

"devDependencies": {
"@arethetypeswrong/cli": "0.18.2",
"@convex-dev/eslint-plugin": "1.0.0",
"@convex-dev/eslint-plugin": "^1.1.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

generally we pin dev dependencies and have it auto-update them via renovate

Copy link
Collaborator

@ianmacartney ianmacartney left a comment

Choose a reason for hiding this comment

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

lgtm - just a few instances in the migrations helper to go. aside: we should probably deprecate the migrations helper in favor of the component

try {
const next = await migrateOne(ctx, doc);
if (next && Object.keys(next).length > 0) {
await ctx.db.patch(doc._id as GenericId<TableName>, next);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
await ctx.db.patch(table, doc._id as GenericId<TableName>, next);

@Nicolapps Nicolapps marked this pull request as draft December 18, 2025 22:34
@Nicolapps
Copy link
Member Author

Thanks @ianmacartney! I’m moving this back to draft, as I realized that there are some other helpers that would benefit from supporting the new APIs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants