Skip to content

fix: Resolve flaky rest query internal field test by running queries …#10239

Open
AbdullahZulfiqar2005 wants to merge 1 commit intoparse-community:alphafrom
AbdullahZulfiqar2005:fix-flaky-test-9273
Open

fix: Resolve flaky rest query internal field test by running queries …#10239
AbdullahZulfiqar2005 wants to merge 1 commit intoparse-community:alphafrom
AbdullahZulfiqar2005:fix-flaky-test-9273

Conversation

@AbdullahZulfiqar2005
Copy link

@AbdullahZulfiqar2005 AbdullahZulfiqar2005 commented Mar 18, 2026

Pull Request

Issue

Closes #9273

Approach

The rest query query internal field test was marked as flaky due to an Unhandled promise rejection error during CI runs. This was caused by using Promise.all combined with .map to fire 16 database queries simultaneously, which occasionally overwhelmed the test database connection pool.

Fix: Replaced the parallel Promise.all execution with a sequential for...of loop. This ensures each query is safely awaited before moving to the next, entirely eliminating the race conditions and connection exhaustion that were causing the unhandled rejections.

Tasks

(No tasks apply as this is a fix to an existing test case).

Summary by CodeRabbit

  • Tests
    • Refactored internal user field validation tests to use sequential execution instead of parallel processing, improving test clarity and maintainability while preserving existing validation coverage.

Copilot AI review requested due to automatic review settings March 18, 2026 18:37
@parse-github-assistant
Copy link

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

@parse-github-assistant parse-github-assistant bot changed the title fix: resolve flaky rest query internal field test by running queries … fix: Resolve flaky rest query internal field test by running queries … Mar 18, 2026
@parse-github-assistant
Copy link

🚀 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.

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9081c994-26d8-4c69-9eab-b98a03b77988

📥 Commits

Reviewing files that changed from the base of the PR and between c77c884 and d33de89.

📒 Files selected for processing (1)
  • spec/RestQuery.spec.js

📝 Walkthrough

Walkthrough

The test logic for validating internal user field queries was refactored from parallel Promise.all execution to sequential for-of loop iteration. Test semantics remain unchanged—each internal field is checked for an INVALID_KEY_NAME rejection when queried as a normal user and then queried with useMasterKey—but control flow transitions from concurrent to sequential execution to address test flakiness.

Changes

Cohort / File(s) Summary
Test Control Flow Refactoring
spec/RestQuery.spec.js
Changed internal field validation from parallelized Promise.all to sequential for-of loop to resolve flaky test behavior. Each field now awaits INVALID_KEY_NAME rejection and useMasterKey query operations sequentially rather than concurrently.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested reviewers

  • mtrezza
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing a flaky test by converting parallel query execution to sequential execution.
Description check ✅ Passed The description follows the template structure and provides clear issue reference, approach explanation, and notes that no additional tasks apply.
Linked Issues check ✅ Passed The PR successfully addresses issue #9273 by replacing parallel Promise.all execution with sequential for...of loops to eliminate flaky test behavior.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the flaky test in spec/RestQuery.spec.js as required by issue #9273; no out-of-scope modifications present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can disable sequence diagrams in the walkthrough.

Disable the reviews.sequence_diagrams setting to disable sequence diagrams in the walkthrough.

@parseplatformorg
Copy link
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses CI flakiness in the rest query query internal field test by preventing connection pool exhaustion from running many queries in parallel, aligning with the goal of stabilizing the test suite (closes #9273).

Changes:

  • Replaced parallel Promise.all([...map]) execution with a sequential for...of loop that awaits each query.
  • Ensured the rejection assertion and the master-key query run deterministically per internal field.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Fix flaky test rest query query internal field

3 participants