Skip to content

fix: GraphQL classes query passes a boolean instead of options to getAllClasses#10551

Open
dblythy wants to merge 1 commit into
parse-community:alphafrom
dblythy:fix/graphql-getallclasses-clearcache-arg
Open

fix: GraphQL classes query passes a boolean instead of options to getAllClasses#10551
dblythy wants to merge 1 commit into
parse-community:alphafrom
dblythy:fix/graphql-getallclasses-clearcache-arg

Conversation

@dblythy

@dblythy dblythy commented Jul 5, 2026

Copy link
Copy Markdown
Member

Closes #7677

The GraphQL classes query resolver called getAllClasses(true) - a bare boolean - but the method expects a { clearCache } options object, so true.clearCache is undefined (falsy) and the cache clear silently no-ops. The sibling REST path in SchemasRouter.getAllSchemas already does it right with { clearCache: true }, so this just matches it.

Heads up on the test: the line right above already calls loadSchema({ clearCache: true }), which refreshes the schema cache, so the query response is actually identical either way in the normal single-request path (the two only diverge under a concurrent in-flight schema load). A black-box assertion can't tell fixed from unfixed here, so the regression test asserts the resolver passes the correct argument type (not.toHaveBeenCalledWith(true)) - that's the reliable guard for a wrong-type bug. Verified it fails without the fix and passes with it, on both Mongo and Postgres.

Summary by CodeRabbit

  • Bug Fixes
    • Improved the GraphQL classes query’s cache-refresh handling.
    • Preserved master-key access controls and existing error handling while returning class names and schema fields.

@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 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The GraphQL classes resolver now calls getAllClasses with { clearCache: true } instead of a boolean. A master-key GraphQL test verifies the updated argument shape.

Changes

GraphQL class loading

Layer / File(s) Summary
Update class loading options and coverage
src/GraphQL/loaders/schemaQueries.js, spec/ParseGraphQLServer.spec.js
The resolver passes { clearCache: true } to getAllClasses, and the new test confirms it is not called with true.

Estimated code review effort: 2 (Simple) | ~5 minutes

Suggested reviewers: mtrezza


Caution

Pre-merge checks failed

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

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Engage In Review Feedback ❌ Error The review asked for toHaveBeenCalledWith({ clearCache: true }), but the PR kept not.toHaveBeenCalledWith(true) instead. Either change the test to assert the exact options object or document a discussion where the reviewer retracted that feedback.
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required fix: prefix and accurately summarizes the GraphQL resolver change.
Description check ✅ Passed It includes the issue reference, explains the approach, and notes test behavior, though the template sections are not fully formatted.
Linked Issues check ✅ Passed The GraphQL resolver now passes { clearCache: true } and the regression test covers the wrong-type call, matching the linked bug.
Out of Scope Changes check ✅ Passed The only code changes are the resolver fix and its test, both directly in scope for the linked issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Security Check ✅ Passed No security-relevant pattern changed; the diff only fixes an internal cache-flag call behind existing master-key enforcement.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.44.1)
spec/ParseGraphQLServer.spec.js

ast-grep timed out on this file


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 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.66%. Comparing base (cce91e5) to head (89ae1c5).
⚠️ Report is 52 commits behind head on alpha.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha   #10551   +/-   ##
=======================================
  Coverage   92.66%   92.66%           
=======================================
  Files         193      193           
  Lines       16981    16981           
  Branches      248      248           
=======================================
  Hits        15736    15736           
  Misses       1224     1224           
  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 26, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@spec/ParseGraphQLServer.spec.js`:
- Around line 3422-3423: Update the assertions around the spy in the relevant
test to verify it was called with the exact options object { clearCache: true },
replacing the weaker call-presence and not-called-with-true checks. Preserve the
existing test setup and assert the controller contract directly using the spy’s
toHaveBeenCalledWith matcher.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f4b72b01-43c3-45b8-a4cc-1c533fd07fca

📥 Commits

Reviewing files that changed from the base of the PR and between 7e9d53a and 89ae1c5.

📒 Files selected for processing (2)
  • spec/ParseGraphQLServer.spec.js
  • src/GraphQL/loaders/schemaQueries.js

Comment on lines +3422 to +3423
expect(spy).toHaveBeenCalled();
expect(spy).not.toHaveBeenCalledWith(true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the exact options object, not only the absence of true.

This test would pass for undefined, null, false, or any other invalid argument. Assert toHaveBeenCalledWith({ clearCache: true }) so the regression test enforces the controller contract directly.

Proposed test assertion
          expect(spy).toHaveBeenCalled();
-         expect(spy).not.toHaveBeenCalledWith(true);
+         expect(spy).toHaveBeenCalledWith({ clearCache: true });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
expect(spy).toHaveBeenCalled();
expect(spy).not.toHaveBeenCalledWith(true);
expect(spy).toHaveBeenCalled();
expect(spy).toHaveBeenCalledWith({ clearCache: true });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@spec/ParseGraphQLServer.spec.js` around lines 3422 - 3423, Update the
assertions around the spy in the relevant test to verify it was called with the
exact options object { clearCache: true }, replacing the weaker call-presence
and not-called-with-true checks. Preserve the existing test setup and assert the
controller contract directly using the spy’s toHaveBeenCalledWith matcher.

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.

SchemaController.getAllClasses accepts parameter with wrong type

1 participant