Skip to content

Switch on the pending update kind in the worker - #68

Open
reeceyang wants to merge 1 commit into
mainfrom
reece/worker-switch
Open

reeceyang wants to merge 1 commit into
mainfrom
reece/worker-switch

Conversation

@reeceyang

@reeceyang reeceyang commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

refactor processBatch to switch on the update.kind

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: get-convex/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 35e7cdb4-157c-4ed9-9615-869bfb3615a6

📥 Commits

Reviewing files that changed from the base of the PR and between 320098a and 4465944.

📒 Files selected for processing (1)
  • src/component/worker.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

processBatch now uses a switch to handle pending update kinds. The reset case clears state.next. The consume case calculates and stores the clamped rate limit. The default case performs an exhaustiveness check and throws an Unhandled pending update error.

Priority: ⬇️ Low

Change: Refactor

Merge Risk: ⚪ Minimal · up to 14131

The refactor preserves pending-update behavior and adds exhaustive handling, with no unresolved merge-blocking risk identified.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the main change: switching on the pending update kind in the worker.
Description check ✅ Passed The description directly matches the changeset by describing the refactor of processBatch to switch on update.kind.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch reece/worker-switch

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.

@pkg-pr-new

pkg-pr-new Bot commented Sep 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@convex-dev/rate-limiter@68

commit: 1413140

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@reeceyang
reeceyang force-pushed the reece/worker-switch branch 2 times, most recently from f01b4e2 to 4465944 Compare September 15, 2026 00:41
Replaces the early-return chain in `processBatch` with a switch over the
update kind, so a new kind has an obvious place to go and a `never`
default makes the compiler point at this switch when one is added.

The clamp that keeps an update from moving time backwards moves into
`updateTime`, since a reset has no timestamp of its own and so can't
share a `now` computed ahead of the switch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant