Skip to content

feat: Add PhantAuth authentication adapter#474

Open
DENGXUELIN wants to merge 2 commits into
parse-community:mainfrom
DENGXUELIN:add-phantauth-authentication
Open

feat: Add PhantAuth authentication adapter#474
DENGXUELIN wants to merge 2 commits into
parse-community:mainfrom
DENGXUELIN:add-phantauth-authentication

Conversation

@DENGXUELIN

@DENGXUELIN DENGXUELIN commented May 13, 2026

Copy link
Copy Markdown

Summary

  • Add a PhantAuth authentication adapter for ParseUser.
  • Add callback, async/await, and Combine helpers.
  • Add tests for authData creation, login, link, unlink, invalid authData, and anonymous replacement flows.

Related issue

Addresses the PhantAuth adapter portion of #55.

Testing

  • git diff --check
  • Not run: swift test, because Swift is not installed in this local Windows environment.

Bounty

If this contribution qualifies for bounty payment, preferred payout address is BSC / BEP20: 0xEF8139503b8416FB0eded1d33F7eBcCA3C32A83E

Summary by CodeRabbit

  • New Features

    • PhantAuth authentication added: login, link, and unlink flows for users.
    • Async/await API added for PhantAuth operations.
    • Combine publisher support added for reactive PhantAuth flows.
  • Tests

    • Comprehensive tests added covering PhantAuth login, link, unlink across callback, async/await, and Combine APIs, including anonymous-user conversion and validation scenarios.

Review Change Stack

@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 13, 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: 971e4073-1de5-4cfa-9b96-d51c760eecd1

📥 Commits

Reviewing files that changed from the base of the PR and between 51102a0 and 004acae.

📒 Files selected for processing (1)
  • Sources/ParseSwift/Authentication/3rd Party/ParsePhantAuth/ParsePhantAuth.swift
🚧 Files skipped from review as they are similar to previous changes (1)
  • Sources/ParseSwift/Authentication/3rd Party/ParsePhantAuth/ParsePhantAuth.swift

📝 Walkthrough

Walkthrough

This PR adds PhantAuth support: a new ParsePhantAuth type with callback-based login/link, async/await wrappers, Combine publisher wrappers, and comprehensive tests covering login, link, replace-anonymous, and unlink scenarios.

Changes

PhantAuth Authentication Feature

Layer / File(s) Summary
Core PhantAuth authentication logic and callback tests
Sources/ParseSwift/Authentication/3rd Party/ParsePhantAuth/ParsePhantAuth.swift, Tests/ParseSwiftTests/ParsePhantAuthTests.swift
ParsePhantAuth implements login/link (id/accessToken and authData overloads), validates mandatory keys, delegates to AuthenticatedUser, and adds ParseUser.phantauth accessors. Callback tests cover key creation/validation, login/link/unlink flows, anonymous replacement, and error cases.
Async/await concurrency API and async tests
Sources/ParseSwift/Authentication/3rd Party/ParsePhantAuth/ParsePhantAuth+async.swift, Tests/ParseSwiftTests/ParsePhantAuthAsyncTests.swift
Adds async login/link overloads using withCheckedThrowingContinuation that bridge callback APIs; async tests exercise login, link, and unlink with both id/accessToken and authData inputs.
Combine publisher API and Combine tests
Sources/ParseSwift/Authentication/3rd Party/ParsePhantAuth/ParsePhantAuth+combine.swift, Tests/ParseSwiftTests/ParsePhantAuthCombineTests.swift
Adds loginPublisher/linkPublisher returning Future<AuthenticatedUser, ParseError> that bridge callback APIs; Combine tests validate publisher flows for login, link, and unlink.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is missing several required template sections including the 'New Pull Request Checklist', explicit 'Closes:' statement, and incomplete TODOs section for changelog and documentation. Complete the PR description using the template: add the checklist, reference the issue with 'Closes:', and mark applicable TODOs (add changelog entry and update documentation).
Docstring Coverage ⚠️ Warning Docstring coverage is 26.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'feat: Add PhantAuth authentication adapter' follows the required 'feat:' prefix and clearly summarizes the main change of adding PhantAuth authentication support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed No security vulnerabilities found. Credentials handled safely, authData validated, no hardcoded secrets, no injection vectors, consistent with existing auth adapters.
Engage In Review Feedback ✅ Passed No review feedback comments from human reviewers found. Only an automated bot reply exists, which is not review feedback requiring engagement.

✏️ 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.19][ERROR]: Error: exception Unix_error: No such file or directory stat Sources/ParseSwift/Authentication/3rd Party/ParsePhantAuth/ParsePhantAuth.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/commo

🔧 SwiftLint (0.63.2)
Sources/ParseSwift/Authentication/3rd Party/ParsePhantAuth/ParsePhantAuth.swift

Error: No lintable files found at paths: 'Sources/ParseSwift/Authentication/3rd Party/ParsePhantAuth/ParsePhantAuth.swift'


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.

@DENGXUELIN

Copy link
Copy Markdown
Author

Ready for review. I ran git diff --check locally. I could not run swift test because Swift is not installed in this Windows environment, so I expect the project CI to be the source of truth for the full test suite.

@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 `@Sources/ParseSwift/Authentication/3rd`
Party/ParsePhantAuth/ParsePhantAuth.swift:
- Around line 86-90: The error messages in ParsePhantAuth.swift incorrectly
reference "accessToken" instead of the expected "access_token", which misleads
clients; update the failure messages emitted where
AuthenticationKeys.id.verifyMandatoryKeys(authData:) is used (and the second
instance around lines 130–134) to list the required keys as "id" and
"access_token" (e.g., change the string "Should have authData consisting of keys
\"id\" and \"accessToken\"." to "Should have authData consisting of keys \"id\"
and \"access_token\".") so both occurrences in the ParsePhantAuth class use the
correct key name.
🪄 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

Run ID: 9caafaf3-79d8-4429-a4ac-7ef55449d00a

📥 Commits

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

📒 Files selected for processing (6)
  • Sources/ParseSwift/Authentication/3rd Party/ParsePhantAuth/ParsePhantAuth+async.swift
  • Sources/ParseSwift/Authentication/3rd Party/ParsePhantAuth/ParsePhantAuth+combine.swift
  • Sources/ParseSwift/Authentication/3rd Party/ParsePhantAuth/ParsePhantAuth.swift
  • Tests/ParseSwiftTests/ParsePhantAuthAsyncTests.swift
  • Tests/ParseSwiftTests/ParsePhantAuthCombineTests.swift
  • Tests/ParseSwiftTests/ParsePhantAuthTests.swift

@DENGXUELIN

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

1 participant