Skip to content

fix: Parse.Query.explain runs afterFind trigger on query plan results - #10536

Merged
mtrezza merged 2 commits into
parse-community:alphafrom
dblythy:fix/afterfind-explain
Jul 26, 2026
Merged

fix: Parse.Query.explain runs afterFind trigger on query plan results#10536
mtrezza merged 2 commits into
parse-community:alphafrom
dblythy:fix/afterfind-explain

Conversation

@dblythy

@dblythy dblythy commented Jul 4, 2026

Copy link
Copy Markdown
Member

Closes #10007

Summary by CodeRabbit

  • Bug Fixes
    • Explain queries now correctly skip afterFind triggers while still returning query execution details.
    • Added coverage to ensure explain responses continue to include execution statistics and do not invoke the trigger.

@parse-github-assistant

Copy link
Copy Markdown

🚀 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

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The runAfterFindTrigger skip condition in RestQuery.js now also excludes explain queries, preventing afterFind from running on explain results. A new mongo-only test verifies explain queries return executionStats while skipping the afterFind trigger.

Changes

Explain Query afterFind Fix

Layer / File(s) Summary
Skip afterFind trigger for explain queries
src/RestQuery.js, spec/ParseQuery.spec.js
The runAfterFindTrigger early-return condition now also skips afterFind for explain queries (in addition to pipeline and distinct), and a new test confirms explain results include executionStats while the afterFind trigger does not run.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested reviewers: Moumouls


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 1 inconclusive)

Check name Status Explanation Resolution
Description check ❌ Error The description is largely incomplete and only links the issue, missing the required Issue, Approach, and Tasks sections. Expand the PR description to match the template by adding Issue, Approach, and Tasks sections and checking completed items.
Engage In Review Feedback ❓ Inconclusive No review-comment/discussion artifacts are present in the repo; only code changes are visible, so engagement with feedback can’t be verified. Provide PR review comments or discussion metadata showing feedback was addressed or retracted before this check can be judged.
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The code skips afterFind for explain queries and adds a test, satisfying issue #10007.
Out of Scope Changes check ✅ Passed The changes are focused on the explain/afterFind bug and its test coverage, with no obvious unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Security Check ✅ Passed Explain is still master-key gated; the patch only skips afterFind for explain results, with no new auth-bypass or injection pattern.
Title check ✅ Passed The title is directly related to the PR and clearly describes the explain/afterFind behavior change.
✨ 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.

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.78%. Comparing base (9e4e5db) to head (4ef89b3).

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha   #10536   +/-   ##
=======================================
  Coverage   93.78%   93.78%           
=======================================
  Files         192      192           
  Lines       16832    16832           
  Branches      248      248           
=======================================
  Hits        15786    15786           
  Misses       1025     1025           
  Partials       21       21           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dblythy

dblythy commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@dblythy

dblythy commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@dblythy

dblythy commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@mtrezza mtrezza changed the title fix: Parse.Query explain runs afterFind on query plan results fix: Parse.Query.explain runs afterFind on query plan results Jul 25, 2026
@mtrezza mtrezza changed the title fix: Parse.Query.explain runs afterFind on query plan results fix: Parse.Query.explain runs afterFind trigger on query plan results Jul 25, 2026
@mtrezza
mtrezza merged commit 64d58ff into parse-community:alpha Jul 26, 2026
24 of 25 checks passed
parseplatformorg pushed a commit that referenced this pull request Jul 26, 2026
## [9.10.1-alpha.6](9.10.1-alpha.5...9.10.1-alpha.6) (2026-07-26)

### Bug Fixes

* `Parse.Query.explain` runs afterFind trigger on query plan results ([#10536](#10536)) ([64d58ff](64d58ff))
@parseplatformorg

Copy link
Copy Markdown
Contributor

🎉 This change has been released in version 9.10.1-alpha.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parse.Query.explain breaks Parse.Cloud.afterFind

3 participants