Skip to content

fix: Restore direct equalTo pointer queries#524

Open
gut-puncture wants to merge 1 commit intoparse-community:masterfrom
gut-puncture:equalto-pointer-array-query
Open

fix: Restore direct equalTo pointer queries#524
gut-puncture wants to merge 1 commit intoparse-community:masterfrom
gut-puncture:equalto-pointer-array-query

Conversation

@gut-puncture
Copy link
Copy Markdown

@gut-puncture gut-puncture commented May 10, 2026

Fixes #516.

This keeps the existing $eq behavior for scalar equality and combined same-key constraints, but restores direct pointer equality for equalTo() when the value is a ParseObject and it is the only constraint on that key. That matches the REST query shape needed for pointer-in-array and relation membership checks such as _Role.users.

I also added focused coverage for direct pointer encoding and for preserving other same-key constraints when a pointer equality already exists.

Verification:

  • git diff --check
  • PHPUnit not run locally because this environment does not have PHP/Composer available; CI should exercise the added tests.

Summary by CodeRabbit

  • Bug Fixes
    • Query engine improvements now correctly handle object references in equality operations, ensuring more accurate and reliable query results when referencing other objects.
    • Enhanced condition composition logic to properly combine and preserve multiple conditions when applied to the same query field, enabling support for more sophisticated filtering scenarios.

Review Change Stack

@parse-github-assistant
Copy link
Copy Markdown

parse-github-assistant Bot commented May 10, 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 10, 2026

📝 Walkthrough

Walkthrough

ParseQuery::equalTo() now encodes ParseObject values as direct pointers without wrapping in $eq when the field has no existing constraints, while addCondition() preserves multiple conditions by converting existing scalar values into $eq operator maps before adding new operators.

Changes

ParseObject Direct Encoding and Multi-Condition Support

Layer / File(s) Summary
equalTo() ParseObject Detection and Direct Encoding
src/Parse/ParseQuery.php
equalTo() now detects ParseObject values and encodes them directly into where[$key] when no prior constraint exists, enabling direct pointer queries as expected by Parse Server; otherwise falls back to addCondition().
Operator Map Detection Utility
src/Parse/ParseQuery.php
New private isConditionMap() helper identifies whether a where entry is an operator map by checking for keys starting with $.
addCondition() Constraint Preservation
src/Parse/ParseQuery.php
addCondition() now preserves existing scalar constraints by converting them into '$eq' => <value> operator maps before adding additional operators to the same key.
Test Cases for ParseObject Pointer Conditions
tests/Parse/ParseQueryTest.php
Two new tests validate that equalTo() with ParseObject produces direct pointer conditions without $eq wrapping, and that combining equalTo() and notEqualTo() on the same key preserves both $eq and $ne operators.

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Engage In Review Feedback ❓ Inconclusive Cannot verify engagement with review feedback. No reviewer comments visible in accessible PR data. Requires live GitHub API access to check for review threads. Access live GitHub PR to verify: (1) if review feedback exists, (2) if author engaged with comments, (3) if feedback was addressed via commits/discussion.
✅ Passed checks (6 passed)
Check name Status Explanation
Description check ✅ Passed The PR description references the linked issue (#516), explains the approach, provides verification steps, and indicates tests were added. However, the checklist section is missing.
Linked Issues check ✅ Passed The PR directly addresses issue #516 by restoring direct pointer encoding for equalTo() when a ParseObject is the sole constraint, matching the REST query shape required for array membership queries.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the issue: modifications to ParseQuery::equalTo() logic, addition of helper methods, and focused test coverage for pointer equality behavior.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Security Check ✅ Passed No security vulnerabilities detected. Code properly validates types, encodes all values, uses safe array access patterns, and avoids dangerous functions. Follows secure coding practices.
Title check ✅ Passed The title 'fix: restore direct equalTo pointer queries' uses the required 'fix:' prefix and clearly summarizes the main change in the pull request.

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

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

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@gut-puncture gut-puncture force-pushed the equalto-pointer-array-query branch from c053008 to b1b0b5c Compare May 10, 2026 23:19
@gut-puncture gut-puncture changed the title Fix equalTo pointer query encoding fix: restore direct equalTo pointer queries May 10, 2026
@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 fix: restore direct equalTo pointer queries fix: Restore direct equalTo pointer queries May 10, 2026
@gut-puncture
Copy link
Copy Markdown
Author

Ready for review. This PR is intentionally scoped to #516: it adds a regression test for the direct pointer query shape and keeps combined same-key constraints using operator maps.

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.

Queries on array values broken since 2.3.1

1 participant