Skip to content

fix: Dispatch save callbacks on callback queue#467

Open
newmattock wants to merge 1 commit into
parse-community:mainfrom
newmattock:codex/fix-save-callback-queue
Open

fix: Dispatch save callbacks on callback queue#467
newmattock wants to merge 1 commit into
parse-community:mainfrom
newmattock:codex/fix-save-callback-queue

Conversation

@newmattock

@newmattock newmattock commented May 12, 2026

Copy link
Copy Markdown

New Pull Request Checklist

Issue Description

Successful callback-style save completions for ParseObject, ParseUser, and ParseInstallation were called directly from the Swift concurrency task instead of being dispatched back to the requested callbackQueue. The failure path already used callbackQueue.async, so success and failure behaved inconsistently.

Closes: #431

Approach

  • Wrap successful save completions in callbackQueue.async for ParseObject, ParseUser, and ParseInstallation.
  • Add focused tests that save each object type with a custom dispatch queue and assert the success completion runs on that queue.
  • Keep the change scoped to the callback-style save APIs described in the issue.

TODOs before merging

None.

Verification

  • git diff --check

I attempted to run swift test --filter ParseObjectTests.testSaveAsyncUsesCallbackQueueOnSuccess, but local SwiftPM fails before building because this machine's selected Command Line Tools compiler and SDK are mismatched:

swiftlang-6.0.3.1.10 compiler vs swiftlang-6.0.3.1.5 SDK.

Summary by CodeRabbit

  • Bug Fixes

    • Save operation completion callbacks now properly execute on the specified callback queue, ensuring thread-safe behavior and consistent callback handling across Installation, Object, and User save methods.
  • Tests

    • Added tests to verify completion callbacks execute on the provided callback queue for save operations.

Review Change Stack

@parse-github-assistant

Copy link
Copy Markdown

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

@parse-github-assistant parse-github-assistant Bot changed the title fix: dispatch save callbacks on callback queue fix: Dispatch save callbacks on callback queue May 12, 2026
@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 May 12, 2026

Copy link
Copy Markdown

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: ce6ba3bf-3345-49e8-a55e-98fc1b5a8018

📥 Commits

Reviewing files that changed from the base of the PR and between 645180e and fec3390.

📒 Files selected for processing (6)
  • Sources/ParseSwift/Objects/ParseInstallation.swift
  • Sources/ParseSwift/Objects/ParseObject.swift
  • Sources/ParseSwift/Objects/ParseUser.swift
  • Tests/ParseSwiftTests/ParseInstallationTests.swift
  • Tests/ParseSwiftTests/ParseObjectTests.swift
  • Tests/ParseSwiftTests/ParseUserTests.swift

📝 Walkthrough

Walkthrough

Three Parse object types' async save implementations now dispatch success callbacks to the provided callbackQueue instead of invoking them directly within the Task. Corresponding tests validate that callbacks execute on the correct queue. This fixes a bug where only error callbacks were dispatched to the callback queue.

Changes

Async save callback queue dispatch

Layer / File(s) Summary
Core implementation: dispatch success callbacks to callbackQueue
Sources/ParseSwift/Objects/ParseInstallation.swift, Sources/ParseSwift/Objects/ParseObject.swift, Sources/ParseSwift/Objects/ParseUser.swift
ParseInstallation.save(), ParseObject.save(), and ParseUser.save() async code paths now dispatch the success completion onto callbackQueue via callbackQueue.async instead of calling completion directly within the Task.
Test coverage: callback queue dispatch validation
Tests/ParseSwiftTests/ParseInstallationTests.swift, Tests/ParseSwiftTests/ParseObjectTests.swift, Tests/ParseSwiftTests/ParseUserTests.swift
Three new tests (testSaveAsyncUsesCallbackQueueOnSuccess) for Installation, Object, and User verify that save completion handlers execute on the provided callbackQueue by checking DispatchQueue.getSpecific, and validate saved object state.

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Engage In Review Feedback ❓ Inconclusive Cannot verify review feedback engagement. This repository snapshot lacks PR review comment metadata needed to assess whether feedback was discussed or addressed. Review PR #467 on GitHub at parse-community/Parse-Swift to check if review feedback was addressed or discussed with reviewers.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PR title correctly uses the 'fix:' prefix and accurately describes the main change: dispatching save callbacks to the callback queue.
Description check ✅ Passed PR description follows the template structure with checklist items, issue description, approach, and verification details. All critical sections are complete and informative.
Linked Issues check ✅ Passed Code changes address the core requirement from issue #431: wrapping successful save completions in callbackQueue.async for ParseObject, ParseUser, and ParseInstallation to ensure consistent behavior with failure paths.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the callback-style save APIs for three object types and their corresponding tests; no unrelated modifications are present.
Security Check ✅ Passed No security vulnerabilities detected. Thread-safe fix that dispatches save() completions to callback queue consistently for both success and failure paths, improving thread safety.

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

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

🔧 OpenGrep (1.20.0)

OpenGrep fatal error (exit code 2): [00.16][ERROR]: Error: exception Unix_error: No such file or directory stat Sources/ParseSwift/Objects/ParseObject.swift
Raised by primitive operation at UTmp.replace_named_pipe_by_regular_file_if_needed in file "libs/commons/UTmp.ml", line 145, characters 8-27
Called from Scan_CLI.replace_target_roots_by_regular_files_where_needed.(fun) in file "src/osemgrep/cli_scan/Scan_CLI.ml", lines 1086-1087, characters 19-65
Called from List_.fast_map in file "libs/commons/List_.ml", line 81, characters 1

🔧 SwiftLint (0.63.2)
Sources/ParseSwift/Objects/ParseInstallation.swift

Error: No lintable files found at paths: 'Sources/ParseSwift/Objects/ParseInstallation.swift'

Sources/ParseSwift/Objects/ParseObject.swift

Error: No lintable files found at paths: 'Sources/ParseSwift/Objects/ParseObject.swift'

Sources/ParseSwift/Objects/ParseUser.swift

Error: No lintable files found at paths: 'Sources/ParseSwift/Objects/ParseUser.swift'

  • 3 others

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.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@newmattock

Copy link
Copy Markdown
Author

Ready for review. The PR is scoped to the save callback queue issue in #431, CodeRabbit approved with no actionable comments, and the current GitHub statuses are green. Local SwiftPM test execution on this machine is still blocked by the Command Line Tools compiler/SDK mismatch noted in the PR body, but the focused code/tests were checked for whitespace with git diff --check.

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.

Parse.User save not dispatching back to callback queue when result is success

1 participant