Skip to content

feat: Add WeChat authentication helpers#468

Open
kaziiza wants to merge 1 commit into
parse-community:mainfrom
kaziiza:codex/parse-wechat-auth
Open

feat: Add WeChat authentication helpers#468
kaziiza wants to merge 1 commit into
parse-community:mainfrom
kaziiza:codex/parse-wechat-auth

Conversation

@kaziiza

@kaziiza kaziiza commented May 12, 2026

Copy link
Copy Markdown

New Pull Request Checklist

Issue Description

Refs: #55

Adds the missing WeChat third-party authentication helper surface so WeChat auth can use the same provider/data pattern as the existing ParseSwift auth integrations.

Approach

  • add ParseWeChat auth data/provider types
  • add async/await and Combine convenience helpers matching the existing third-party auth style
  • register the new source files in the Xcode project
  • add unit coverage for auth data encoding, login/link flows, async helpers, and Combine helpers
  • keep the PR scoped to source, tests, and project registration; no changelog file is changed

Testing

  • git diff --check
  • Verified CHANGELOG.md matches upstream main and is not part of the current PR diff.
  • swift build
  • swift test --enable-code-coverage --filter ParseWeChat passed: 19 tests, 0 failures.

@parse-github-assistant

parse-github-assistant Bot commented May 12, 2026

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

Warning

Rate limit exceeded

@kaziiza has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 53 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fcd4ce9b-c97b-4feb-800e-394caaf72155

📥 Commits

Reviewing files that changed from the base of the PR and between 6356b8b and c1723fb.

📒 Files selected for processing (6)
  • ParseSwift.xcodeproj/project.pbxproj
  • Sources/ParseSwift/Authentication/3rd Party/ParseWeChat/ParseWeChat+async.swift
  • Sources/ParseSwift/Authentication/3rd Party/ParseWeChat/ParseWeChat+combine.swift
  • Sources/ParseSwift/Authentication/3rd Party/ParseWeChat/ParseWeChat.swift
  • Tests/ParseSwiftTests/ParseWeChatCombineTests.swift
  • Tests/ParseSwiftTests/ParseWeChatTests.swift
📝 Walkthrough

Walkthrough

This PR adds complete WeChat authentication integration to Parse-Swift, including callback-based core APIs, async/await and Combine compatibility layers, comprehensive test coverage across all three paradigms, and Xcode project configuration updates.

Changes

ParseWeChat Authentication Integration

Layer / File(s) Summary
ParseWeChat core type and callback-based APIs
Sources/ParseSwift/Authentication/3rd Party/ParseWeChat/ParseWeChat.swift
ParseWeChat<AuthenticatedUser> generic type implements ParseAuthentication with nested AuthenticationKeys for building and validating authData. Provides callback-based login and link methods with three overloads each (code, deprecated id+accessToken, and raw authData). Adds ParseUser.wechat static and instance accessors.
Async/await compatibility layer
Sources/ParseSwift/Authentication/3rd Party/ParseWeChat/ParseWeChat+async.swift
Bridges six callback-based methods to async/await using withCheckedThrowingContinuation: three login overloads and three link overloads matching the core type's callback signatures, gated by Swift concurrency availability.
Combine publisher compatibility layer
Sources/ParseSwift/Authentication/3rd Party/ParseWeChat/ParseWeChat+combine.swift
Wraps callback methods with Future publishers for six publisher methods: three loginPublisher overloads and three linkPublisher overloads, gated by Combine framework availability.
Synchronous and asynchronous test coverage
Tests/ParseSwiftTests/ParseWeChatTests.swift, Tests/ParseSwiftTests/ParseWeChatCombineTests.swift
ParseWeChatTests validates callback login/link, authentication key validation, and async/await flows with error handling and user replacement scenarios. ParseWeChatCombineTests validates Combine publishers for login, link, and unlink with mocked network responses and assertion of user equality and linkage state.
Project configuration and build wiring
ParseSwift.xcodeproj/project.pbxproj
Adds PBXBuildFile, PBXFileReference, and PBXGroup entries for all WeChat sources and tests, and includes them in PBXSourcesBuildPhase for iOS, macOS, tvOS, and watchOS targets.
Changelog documentation
CHANGELOG.md
Documents "Add ParseWeChat authentication" under the main/New features section.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Engage In Review Feedback ⚠️ Warning Review feedback requested removal of manual CHANGELOG.md lines 7-9, but no follow-up commits or discussion addressed this. The manual entry remains unchanged in the PR. Remove the manual CHANGELOG.md entry per semantic-release workflow or engage in discussion with the reviewer to clarify the approach.
✅ Passed checks (6 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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. Proper input validation, no credential exposure, no hardcoded secrets, safe error handling.
Title check ✅ Passed The title 'feat: Add WeChat authentication helpers' follows the required 'feat:' prefix and accurately describes the main change: adding WeChat authentication support with helper functions.
Description check ✅ Passed The PR description includes all required sections: vulnerability disclosure confirmation, issue reference (#55), clear issue description, detailed approach, and testing verification.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@kaziiza kaziiza force-pushed the codex/parse-wechat-auth branch from 6356b8b to e0ccbb2 Compare May 12, 2026 18:18

@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

🧹 Nitpick comments (3)
Sources/ParseSwift/Authentication/3rd Party/ParseWeChat/ParseWeChat+combine.swift (1)

36-38: ⚡ Quick win

Add deprecation annotations to legacy Combine publisher overloads.

Line 30 and Line 79 document deprecated behavior, but these APIs should also be declared with @available(*, deprecated, ...) so callers get warnings.

Also applies to: 86-88

🤖 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 `@Sources/ParseSwift/Authentication/3rd`
Party/ParseWeChat/ParseWeChat+combine.swift around lines 36 - 38, Add
`@available`(*, deprecated, "<brief reason>") annotations to the legacy Combine
publisher overloads so callers receive compile-time warnings: annotate the
loginPublisher(id:accessToken:options:) method and the other deprecated Combine
overloads in ParseWeChat+combine.swift (the methods documented as deprecated
around the earlier comment at line ~30 and the ones around lines ~79 and
~86-88). Use a short deprecation message matching the existing docs (e.g., "Use
async/await or new API") and place the annotation immediately above each
function declaration (e.g., above the loginPublisher signatures) to ensure
callers are warned.
Sources/ParseSwift/Authentication/3rd Party/ParseWeChat/ParseWeChat+async.swift (1)

38-40: ⚡ Quick win

Mark async legacy token-flow APIs as deprecated at declaration level.

Line 31 and Line 84 mark these as deprecated in comments, but missing @available(*, deprecated, ...) means no compile-time warning for async callers.

Also applies to: 91-93

🤖 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 `@Sources/ParseSwift/Authentication/3rd`
Party/ParseWeChat/ParseWeChat+async.swift around lines 38 - 40, The async legacy
token-flow APIs (e.g., the login(id:accessToken:options:) async function shown
and the other async legacy token-flow methods around lines 91–93) must be
annotated with a deprecation attribute at declaration level; add an
`@available`(*, deprecated, message: "Use the modern OAuth-compliant async APIs or
tokenless flows") (or a project-appropriate deprecation message) directly above
each async function signature (for example above func
login(id:accessToken:options:) and the other async legacy token-flow methods) so
callers receive compile-time deprecation warnings instead of only comment-based
notes.
Sources/ParseSwift/Authentication/3rd Party/ParseWeChat/ParseWeChat.swift (1)

98-103: ⚡ Quick win

Add real Swift deprecation attributes to legacy token-flow overloads.

Line 91 and Line 154 describe these APIs as deprecated, but the declarations aren’t annotated with @available(*, deprecated, ...), so consumers won’t get compiler warnings.

Suggested change
+    `@available`(*, deprecated, message: "Use login(code:) instead.")
     func login(id: String,
                accessToken: String,
                options: API.Options = [],
                callbackQueue: DispatchQueue = .main,
                completion: `@escaping` (Result<AuthenticatedUser, ParseError>) -> Void) {
@@
+    `@available`(*, deprecated, message: "Use link(code:) instead.")
     func link(id: String,
               accessToken: String,
               options: API.Options = [],
               callbackQueue: DispatchQueue = .main,
               completion: `@escaping` (Result<AuthenticatedUser, ParseError>) -> Void) {

Also applies to: 161-166

🤖 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 `@Sources/ParseSwift/Authentication/3rd` Party/ParseWeChat/ParseWeChat.swift
around lines 98 - 103, The legacy token-flow overloads of ParseWeChat's login
(including the signature login(id:accessToken:options:callbackQueue:completion:)
and the other id+accessToken overloads in the same file) should be annotated
with a Swift deprecation attribute; add `@available`(*, deprecated, message:
"Deprecated: use the newer authentication flow") (or a more specific replacement
message) immediately before each deprecated method declaration so callers
receive compiler warnings about the legacy token-flow APIs.
🤖 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 `@CHANGELOG.md`:
- Around line 7-9: Remove the manual changelog entry from CHANGELOG.md by
deleting the added lines "__New features__" and "- Add ParseWeChat
authentication." so the file remains managed by semantic-release; do not add any
manual changelog text in this PR and revert the file to its
previous/autogenerated state.

---

Nitpick comments:
In `@Sources/ParseSwift/Authentication/3rd` Party/ParseWeChat/ParseWeChat.swift:
- Around line 98-103: The legacy token-flow overloads of ParseWeChat's login
(including the signature login(id:accessToken:options:callbackQueue:completion:)
and the other id+accessToken overloads in the same file) should be annotated
with a Swift deprecation attribute; add `@available`(*, deprecated, message:
"Deprecated: use the newer authentication flow") (or a more specific replacement
message) immediately before each deprecated method declaration so callers
receive compiler warnings about the legacy token-flow APIs.

In `@Sources/ParseSwift/Authentication/3rd`
Party/ParseWeChat/ParseWeChat+async.swift:
- Around line 38-40: The async legacy token-flow APIs (e.g., the
login(id:accessToken:options:) async function shown and the other async legacy
token-flow methods around lines 91–93) must be annotated with a deprecation
attribute at declaration level; add an `@available`(*, deprecated, message: "Use
the modern OAuth-compliant async APIs or tokenless flows") (or a
project-appropriate deprecation message) directly above each async function
signature (for example above func login(id:accessToken:options:) and the other
async legacy token-flow methods) so callers receive compile-time deprecation
warnings instead of only comment-based notes.

In `@Sources/ParseSwift/Authentication/3rd`
Party/ParseWeChat/ParseWeChat+combine.swift:
- Around line 36-38: Add `@available`(*, deprecated, "<brief reason>") annotations
to the legacy Combine publisher overloads so callers receive compile-time
warnings: annotate the loginPublisher(id:accessToken:options:) method and the
other deprecated Combine overloads in ParseWeChat+combine.swift (the methods
documented as deprecated around the earlier comment at line ~30 and the ones
around lines ~79 and ~86-88). Use a short deprecation message matching the
existing docs (e.g., "Use async/await or new API") and place the annotation
immediately above each function declaration (e.g., above the loginPublisher
signatures) to ensure callers are warned.
🪄 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: 7c9b4e36-3d3e-4462-9656-63a0df513cd1

📥 Commits

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

📒 Files selected for processing (7)
  • CHANGELOG.md
  • ParseSwift.xcodeproj/project.pbxproj
  • Sources/ParseSwift/Authentication/3rd Party/ParseWeChat/ParseWeChat+async.swift
  • Sources/ParseSwift/Authentication/3rd Party/ParseWeChat/ParseWeChat+combine.swift
  • Sources/ParseSwift/Authentication/3rd Party/ParseWeChat/ParseWeChat.swift
  • Tests/ParseSwiftTests/ParseWeChatCombineTests.swift
  • Tests/ParseSwiftTests/ParseWeChatTests.swift

Comment thread CHANGELOG.md Outdated
Comment on lines +7 to +9
__New features__
- Add ParseWeChat authentication.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Remove manual changelog entry—changelog is auto-generated by semantic-release.

This manual addition to CHANGELOG.md violates the project's established workflow. Based on learnings, CHANGELOG.md entries should be automatically generated by semantic-release during the release process, not manually edited in pull requests. Manual edits can cause conflicts with automated generation and lead to release inconsistencies.

Please remove these lines. The changelog will be automatically updated when this PR is released.

🔧 Proposed fix
-__New features__
-- Add ParseWeChat authentication.
-

Based on learnings: "Never manually add or modify entries in CHANGELOG.md. These files should be generated automatically by semantic-release during the release process."

📝 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
__New features__
- Add ParseWeChat authentication.
🤖 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 `@CHANGELOG.md` around lines 7 - 9, Remove the manual changelog entry from
CHANGELOG.md by deleting the added lines "__New features__" and "- Add
ParseWeChat authentication." so the file remains managed by semantic-release; do
not add any manual changelog text in this PR and revert the file to its
previous/autogenerated state.

@kaziiza kaziiza changed the title Add WeChat authentication helpers feat: add WeChat authentication helpers May 12, 2026
@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 feat: add WeChat authentication helpers feat: Add WeChat authentication helpers May 12, 2026
@kaziiza kaziiza changed the title feat: Add WeChat authentication helpers feat: add WeChat authentication helpers May 12, 2026
@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 feat: add WeChat authentication helpers feat: Add WeChat authentication helpers May 12, 2026
@kaziiza kaziiza force-pushed the codex/parse-wechat-auth branch from e0ccbb2 to c1723fb Compare May 12, 2026 18:23
@kaziiza

kaziiza commented May 12, 2026

Copy link
Copy Markdown
Author

Addressed the CodeRabbit feedback in c1723fb5:

  • Removed the manual CHANGELOG.md entry so release notes stay managed by the repository workflow.
  • Added @available(*, deprecated, ...) annotations to the legacy WeChat id + accessToken overloads across callback, async/await, and Combine APIs.
  • Re-ran git diff --check successfully.

@kaziiza

kaziiza commented May 13, 2026

Copy link
Copy Markdown
Author

@coderabbitai review

Current head no longer changes CHANGELOG.md, and swift test --enable-code-coverage --filter ParseWeChat passed: 19 tests, 0 failures.

@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown

@kaziiza Thanks for the update! The addressed items look solid — removing the manual CHANGELOG.md entry and adding @available(*, deprecated, ...) annotations to the legacy id + accessToken overloads are the right moves. Triggering a review of the latest changes now.

✅ 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