Skip to content

feat: Add LiveQuery query operation#10470

Open
Corvus400 wants to merge 2 commits into
parse-community:alphafrom
Corvus400:todayama/live-query-query-9086
Open

feat: Add LiveQuery query operation#10470
Corvus400 wants to merge 2 commits into
parse-community:alphafrom
Corvus400:todayama/live-query-query-9086

Conversation

@Corvus400
Copy link
Copy Markdown

@Corvus400 Corvus400 commented May 20, 2026

Issue

Closes #9086 and resumes #9864.

Approach

This adds one socket request for saved live query rows.

The server uses saved auth and selected fields.

Missing client or query data returns a clear error.

Tasks

Schema, server path, result messages, and tests are done.

Checks

Specs, lint, and build passed.

/claim #9086

@parse-github-assistant
Copy link
Copy Markdown

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant Bot changed the title feat: add LiveQuery query operation feat: Add LiveQuery query operation May 20, 2026
@parse-github-assistant
Copy link
Copy Markdown

parse-github-assistant Bot commented May 20, 2026

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

Tip

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

Note

Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect.

Caution

Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

📝 Walkthrough

Walkthrough

This PR adds a websocket query operation: schema entry, server-side _handleQuery to execute stored subscriptions (with where and keys), client-side pushResult to emit op: 'result' messages, and tests covering success and error scenarios.

Changes

Live Query Query Operation

Layer / File(s) Summary
Query Operation Schema Definition
src/LiveQuery/RequestSchema.js
Request schema enum and operation definition updated to support op: 'query' with numeric requestId.
Client Result Publishing
src/LiveQuery/Client.js, spec/Client.spec.js
Client.pushResult/_pushQueryResult serializes results (applying per-subscription field filtering via _toJSONWithFields), sends op: 'result' messages, and handles missing results as empty arrays. Tests verify payload structure, field selection, and empty results.
Server Query Execution and Dispatch
src/LiveQuery/ParseLiveQueryServer.ts, spec/ParseLiveQueryQuery.spec.js
Server dispatch routes query to _handleQuery, which validates client/subscription, builds and runs a Parse.Query with stored class/where/keys and appropriate auth, then calls client.pushResult or Client.pushError; specs cover success, missing clientId, missing subscription, field filtering, and where-clause matching.

Sequence Diagram

sequenceDiagram
  participant Client as WebSocket Client
  participant Server as ParseLiveQueryServer
  participant DB as Parse.Query
  participant Response as Client.pushResult

  Client->>Server: {"op":"query","requestId":123}
  
  Server->>Server: Validate clientId exists
  Server->>Server: Lookup subscription by requestId
  
  Server->>DB: new Parse.Query(className)
  DB->>DB: Apply where clause
  DB->>DB: Apply field selection (keys)
  
  Server->>DB: find(sessionToken or useMasterKey)
  DB-->>Server: results array
  
  Server->>Response: pushResult(subscriptionId, results)
  Response->>Response: Map results via _toJSONWithFields
  Response-->>Client: {"op":"result","requestId":123,"results":[...]}
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Security Check ⚠️ Warning The _handleQuery method does not invoke beforeSubscribe/beforeQuery triggers that may implement security checks, unlike _handleSubscribe. Add beforeSubscribe trigger invocation to _handleQuery or create a beforeQuery trigger with equivalent security validation before query execution.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'feat: Add LiveQuery query operation' begins with the required 'feat:' prefix and clearly describes the main feature being added.
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.
Engage In Review Feedback ✅ Passed No review feedback comments are present on the PR. The PR status is "open" and ready for review; no reviewers have yet provided feedback requiring engagement or discussion.
Description check ✅ Passed The PR description provides a clear issue reference, approach overview, and confirms tasks completion, though it lacks detailed documentation changes and security check information.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 20, 2026
@Corvus400
Copy link
Copy Markdown
Author

This is ready for review.

This PR resumes #9864.

It keeps the server change focused.

The JS SDK side appears released in parse-community/Parse-SDK-JS#2114.

Local checks passed.

See the PR body for the commands.

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.

Allow to run queries through LiveQueryClient

1 participant