fix: Dispatch save success callbacks on callbackQueue#473
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. |
📝 WalkthroughWalkthroughThree core Parse model classes now consistently dispatch async CRUD operation success completions to the provided ChangesAsync CRUD Callback Queue Dispatch Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Tests/ParseSwiftTests/ParseUserTests.swift (1)
1010-1054: ⚡ Quick winOptional: Consider adding error path test for completeness.
The test validates that success callbacks execute on the provided
callbackQueue. While issue#431reported that error callbacks were already correctly dispatched, adding a test for the error path would prevent future regressions and provide complete coverage of queue dispatch behavior.Example pattern:
// Mock an error response and verify error callback runs on callbackQueue MockURLProtocol.mockRequests { _ in let parseError = ParseError(code: .objectNotFound, message: "Not found") let encoded = try! ParseCoding.jsonEncoder().encode(parseError) return MockURLResponse(data: encoded, statusCode: 404, delay: 0.0) } user.save(options: [], callbackQueue: callbackQueue) { result in XCTAssertEqual(DispatchQueue.getSpecific(key: callbackKey), callbackValue) // validate error... }🤖 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 `@Tests/ParseSwiftTests/ParseUserTests.swift` around lines 1010 - 1054, Add a companion test to testSaveAsyncCallbackQueueOnSuccess that verifies the error callback is dispatched to the provided callbackQueue: mock an error response via MockURLProtocol.mockRequests (returning a ParseError payload and 404 status), call user.save(options:[], callbackQueue: callbackQueue) and inside the completion assert DispatchQueue.getSpecific(key: callbackKey) == callbackValue and that the result is a failure with the expected ParseError; mirror the existing test's setup (callbackKey, callbackValue, callbackQueue, expectation) and fulfill/wait the expectation just like in testSaveAsyncCallbackQueueOnSuccess.
🤖 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.
Nitpick comments:
In `@Tests/ParseSwiftTests/ParseUserTests.swift`:
- Around line 1010-1054: Add a companion test to
testSaveAsyncCallbackQueueOnSuccess that verifies the error callback is
dispatched to the provided callbackQueue: mock an error response via
MockURLProtocol.mockRequests (returning a ParseError payload and 404 status),
call user.save(options:[], callbackQueue: callbackQueue) and inside the
completion assert DispatchQueue.getSpecific(key: callbackKey) == callbackValue
and that the result is a failure with the expected ParseError; mirror the
existing test's setup (callbackKey, callbackValue, callbackQueue, expectation)
and fulfill/wait the expectation just like in
testSaveAsyncCallbackQueueOnSuccess.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 14a308a1-1088-44c0-8e1e-e3adb0545d6c
📒 Files selected for processing (5)
Sources/ParseSwift/Objects/ParseInstallation.swiftSources/ParseSwift/Objects/ParseObject.swiftSources/ParseSwift/Objects/ParseUser.swiftTests/ParseSwiftTests/ParseObjectTests.swiftTests/ParseSwiftTests/ParseUserTests.swift
|
I will reformat the title to use the proper commit message syntax. |
Fixes #431
Summary:
Validation:
Summary by CodeRabbit
Bug Fixes
Tests