fix: GraphQL classes query passes a boolean instead of options to getAllClasses#10551
fix: GraphQL classes query passes a boolean instead of options to getAllClasses#10551dblythy wants to merge 1 commit into
Conversation
|
🚀 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
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. |
📝 WalkthroughWalkthroughThe GraphQL ChangesGraphQL class loading
Estimated code review effort: 2 (Simple) | ~5 minutes Suggested reviewers: Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (6 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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.jsast-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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
spec/ParseGraphQLServer.spec.jssrc/GraphQL/loaders/schemaQueries.js
| expect(spy).toHaveBeenCalled(); | ||
| expect(spy).not.toHaveBeenCalledWith(true); |
There was a problem hiding this comment.
🎯 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.
| 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.
Closes #7677
The GraphQL
classesquery resolver calledgetAllClasses(true)- a bare boolean - but the method expects a{ clearCache }options object, sotrue.clearCacheisundefined(falsy) and the cache clear silently no-ops. The sibling REST path inSchemasRouter.getAllSchemasalready 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
classesquery’s cache-refresh handling.