Skip to content

Conversation

@mtrezza
Copy link
Member

@mtrezza mtrezza commented Nov 17, 2025

Pull Request

Issue

Queries with authData.provider.id are incorrectly transformed to _auth_data_provider.id for all classes. This transformation should only occur for the _User class, where authData is a special field with internal MongoDB representation. For custom classes, authData should be treated as a regular field and remain untransformed.

Approach

Changes:

  • Add className check in transformQueryKeyValue to restrict authData transformation to _User class only
  • Add test case verifying authData queries work correctly for both _User and custom classes

All other MongoDB authData transformations are already class-specific:

  • DatabaseController.js:317 - Already checks className === '_User'
  • MongoTransform.js:1204 - Already checks className === '_User'

This fix at line was the only missing check.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed authData transformation logic to correctly restrict transformations to User records, preventing unintended behavior where other data types could be incorrectly transformed.
  • Tests

    • Added test coverage for authData transformation behavior across different record types.

@parse-github-assistant
Copy link

parse-github-assistant bot commented Nov 17, 2025

🚀 Thanks for opening this pull request!

@coderabbitai
Copy link

coderabbitai bot commented Nov 17, 2025

📝 Walkthrough

Walkthrough

A test has been added to verify authData transformation behavior in MongoDB queries. The implementation is updated to restrict authData field mapping to the _User class only, preventing unintended transformations in other classes.

Changes

Cohort / File(s) Summary
Test validation for authData transformation
spec/MongoTransform.spec.js
New test added to verify authData transformation behavior differs between _User and non-User classes
className check in query transformation
src/Adapters/Storage/Mongo/MongoTransform.js
Modified transformQueryKeyValue to only map authData fields to special _auth_data_<provider>.id keys when className is '_User'

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Focus on verifying the className equality check is placed correctly in the control flow
  • Confirm the test covers both the _User and non-User class branches
  • Verify no side effects to other authData handling logic outside this conditional

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: restricting authData transformation to the _User class and preventing incorrect transformation for custom classes.
Description check ✅ Passed The description covers the issue, approach, and implementation details. However, the 'Issue' section does not include a link to the GitHub issue as required by the template.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@parseplatformorg
Copy link
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@mtrezza mtrezza added state:breaking Breaking change requires major version increment and `BREAKING CHANGE` commit message and removed state:breaking Breaking change requires major version increment and `BREAKING CHANGE` commit message labels Nov 17, 2025
@mtrezza mtrezza changed the title fix: Queries with object field authData are transformed for custom classes fix: Queries with object field authData.provider.id are incorrectly transformed to _auth_data_provider.id for custom classes Nov 17, 2025
@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.07%. Comparing base (7d5e9fc) to head (29fcd6b).
⚠️ Report is 3 commits behind head on alpha.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha    #9932   +/-   ##
=======================================
  Coverage   93.07%   93.07%           
=======================================
  Files         187      187           
  Lines       15243    15243           
  Branches      177      177           
=======================================
  Hits        14187    14187           
  Misses       1044     1044           
  Partials       12       12           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mtrezza mtrezza merged commit 7b9fa18 into parse-community:alpha Nov 17, 2025
27 of 28 checks passed
@mtrezza mtrezza deleted the fix/auth-data-transform branch November 17, 2025 16:47
parseplatformorg pushed a commit that referenced this pull request Nov 17, 2025
# [8.5.0-alpha.10](8.5.0-alpha.9...8.5.0-alpha.10) (2025-11-17)

### Bug Fixes

* Queries with object field `authData.provider.id` are incorrectly transformed to `_auth_data_provider.id` for custom classes ([#9932](#9932)) ([7b9fa18](7b9fa18))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 8.5.0-alpha.10

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants