Skip to content

fix: EqualTo array membership queries#525

Open
usmcff1985 wants to merge 1 commit intoparse-community:masterfrom
usmcff1985:codex/fix-equalto-array-query
Open

fix: EqualTo array membership queries#525
usmcff1985 wants to merge 1 commit intoparse-community:masterfrom
usmcff1985:codex/fix-equalto-array-query

Conversation

@usmcff1985
Copy link
Copy Markdown

@usmcff1985 usmcff1985 commented May 11, 2026

Closes #516.

Summary

  • Restores direct equality output for equalTo() when it is the only condition on a key.
  • Preserves the condition-map behavior when equalTo() is combined with another condition on the same key.
  • Adds regression tests for pointer equality used by array/relation membership queries.
  • Updates existing query option expectations for direct equalTo() values.

Validation

  • Not run locally: PHP and Composer are not available in this environment.
  • Reviewed the generated query options in the added PHPUnit assertions.

Summary by CodeRabbit

  • Bug Fixes

    • Improved equality constraint handling to efficiently represent single equality conditions as direct values, while properly converting to condition-map format when multiple constraints target the same key.
  • Tests

    • Added test coverage for equality conditions in array membership queries to validate correct query representation and proper constraint merging behavior.

Review Change Stack

@parse-github-assistant
Copy link
Copy Markdown

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

📝 Walkthrough

Walkthrough

The PR fixes ParseQuery::equalTo() to use direct equality encoding instead of unconditional $eq condition-map wrapping. Values are now merged in-place, wrapping existing constraints in a condition-map only when necessary. Test expectations are updated for single constraints, and new tests validate array membership query behavior where direct pointer equality is preserved.

Changes

equalTo Direct Equality Behavior Fix

Layer / File(s) Summary
Core Implementation
src/Parse/ParseQuery.php
equalTo() now directly encodes the value and conditionally merges it into $this->where[$key]: wraps existing constraints in a condition-map only if not already one, then updates the '$eq' entry with the encoded value, preserving prior state.
Existing Test Expectations
tests/Parse/ParseQueryTest.php
testGetAndSetConditions() and testCountDoesNotOverrideConditions() expectations updated: single equalTo constraints now expect direct equality values ('key' => 'value') instead of wrapped '$eq' condition-maps.
New Array Membership Tests
tests/Parse/ParseQueryTest.php
Added testEqualToObjectUsesDirectEqualityForArrayMembershipQueries() validating single equalTo on pointer objects uses direct equality; added testEqualToWithRepeatedSameKeyConvertsDirectEqualityToConditionMap() validating repeated equalTo on the same key converts to '$eq' condition-map.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Engage In Review Feedback ❓ Inconclusive Custom check cannot be verified: PR review comments exist on GitHub but are not accessible in the cloned repository. Would need direct GitHub API access to assess engagement with review feedback. Review PR #525 on GitHub directly at #525 to check for review comments and assess author engagement.
✅ Passed checks (6 passed)
Check name Status Explanation
Description check ✅ Passed The description includes the issue reference (Closes #516), a clear summary of changes, and explains both the main fix and regression tests, but lacks the full template structure with explicit TODOs checkboxes.
Linked Issues check ✅ Passed The PR fully addresses issue #516 by restoring direct equality output for equalTo() on single conditions [#516], preserving condition-map behavior for multiple conditions [#516], and adding regression test coverage [#516].
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the equalTo() behavior for array membership queries and updating corresponding test expectations; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Security Check ✅ Passed No security vulnerabilities detected. Changes maintain proper value encoding via ParseClient::_encode(), input validation, and safe serialization through JSON encoding before transmission.
Title check ✅ Passed The PR title 'fix: EqualTo array membership queries' directly matches the main change: fixing equalTo() behavior for array membership queries by restoring direct equality output.

✏️ 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.

@usmcff1985
Copy link
Copy Markdown
Author

Ready for review. This PR was prepared with Codex under human-supervised workflow.

Note: I could not run PHPUnit locally because this environment does not have PHP/Composer available, so I kept the change small and focused on query option regression coverage.

@usmcff1985
Copy link
Copy Markdown
Author

Additional validation update: I installed a portable PHP 8.3 runtime and ran a focused smoke test against the changed query behavior:

  • direct pointer equality: passed
  • combined $ne + equalTo() condition-map behavior: passed

Full PHPUnit still was not run because Composer dependency installation did not complete in this environment due local SSL/download issues, but the changed behavior has now been executed directly.

@usmcff1985 usmcff1985 changed the title Fix equalTo array membership queries fix: equalTo array membership queries May 11, 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: equalTo array membership queries fix: EqualTo array membership queries May 11, 2026
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