Skip to content

refactor RunQueryCtx to QueryCtx using Pick#284

Merged
ianmacartney merged 2 commits into
mainfrom
ian/update-types
Jun 17, 2026
Merged

refactor RunQueryCtx to QueryCtx using Pick#284
ianmacartney merged 2 commits into
mainfrom
ian/update-types

Conversation

@ianmacartney

Copy link
Copy Markdown
Member

Renames the internal RunQueryCtx type to QueryCtx and updates its definition to use Pick instead of a manually declared interface, aligning it with idiomatic TypeScript patterns for extracting a subset of an existing type.

Replace RunQueryCtx/RunMutationCtx/RunActionCtx with Pick-based types that
express the full ctx compatibility: QueryCtx | MutationCtx | ActionCtx for
read operations, MutationCtx | ActionCtx for write operations, and ActionCtx
for action-only operations.
@ianmacartney ianmacartney requested a review from erquhart June 12, 2026 22:45
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review 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: Pro

Run ID: 460024c8-d8d6-45b6-b33f-6aca4064f1c7

📥 Commits

Reviewing files that changed from the base of the PR and between 9713c5c and 74b10d7.

📒 Files selected for processing (1)
  • src/client/definePlaygroundAPI.ts

📝 Walkthrough

Walkthrough

In definePlaygroundAPI.ts, the internal validateApiKey helper's parameter type is widened from a query-only context to a union of QueryCtx | MutationCtx | ActionCtx. To support this, the single RunQueryCtx local alias is replaced with three distinct aliases: QueryCtx (providing runQuery), MutationCtx (providing runQuery and runMutation), and ActionCtx (providing runQuery and runAction). The GenericMutationCtx type is added to the Convex server imports to enable the new MutationCtx alias. The runtime behavior of validateApiKey is unchanged.

Possibly related PRs

  • get-convex/agent#277: Also updates client/server context typing to handle QueryCtx, MutationCtx, and ActionCtx interchangeably, directly related to this PR's broadening of validateApiKey acceptance.

Suggested reviewers

  • robelest
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main refactoring work: renaming RunQueryCtx to QueryCtx and converting to Pick-based type definitions, which aligns with the code changes.
Description check ✅ Passed The description is directly related to the changeset, explaining the renaming of RunQueryCtx to QueryCtx and the switch to TypeScript's Pick utility type.
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.

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

✨ 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 ian/update-types

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.

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@pkg-pr-new

pkg-pr-new Bot commented Jun 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@convex-dev/agent@284

commit: 74b10d7

@ianmacartney ianmacartney merged commit 26ddfcc into main Jun 17, 2026
4 checks passed
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.

2 participants