Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass deeply nested keys correctly to afterSave triggers #7385

Draft
wants to merge 9 commits into
base: alpha
Choose a base branch
from

Conversation

mstniy
Copy link
Contributor

@mstniy mstniy commented May 12, 2021

New Pull Request Checklist

Issue Description

Related issue: #7384

Approach

RestWrite.buildUpdatedObject now functions correctly even for deeply nested keys.

TODOs before merging

  • Add test cases
  • Add entry to changelog
  • Add changes to documentation (guides, repository pages, in-code descriptions)
  • Add security check
  • Add new Parse Error codes to Parse JS SDK
  • ...

@codecov
Copy link

codecov bot commented May 12, 2021

Codecov Report

Merging #7385 (85a9a94) into master (bdf73a0) will decrease coverage by 9.29%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7385      +/-   ##
==========================================
- Coverage   93.92%   84.62%   -9.30%     
==========================================
  Files         181      181              
  Lines       13209    13201       -8     
==========================================
- Hits        12406    11172    -1234     
- Misses        803     2029    +1226     
Impacted Files Coverage Δ
src/RestWrite.js 93.85% <100.00%> (-0.08%) ⬇️
...dapters/Storage/Postgres/PostgresStorageAdapter.js 2.47% <0.00%> (-92.90%) ⬇️
src/Adapters/Storage/Postgres/PostgresClient.js 5.00% <0.00%> (-65.00%) ⬇️
src/Controllers/UserController.js 95.34% <0.00%> (-2.33%) ⬇️
src/Controllers/FilesController.js 92.00% <0.00%> (-2.00%) ⬇️
src/Controllers/index.js 96.66% <0.00%> (-1.12%) ⬇️
src/Adapters/Storage/Mongo/MongoStorageAdapter.js 92.59% <0.00%> (-0.66%) ⬇️
src/Routers/UsersRouter.js 93.16% <0.00%> (-0.63%) ⬇️
src/middlewares.js 96.71% <0.00%> (-0.47%) ⬇️
src/Controllers/SchemaController.js 97.16% <0.00%> (-0.19%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bdf73a0...85a9a94. Read the comment docs.

dplewis
dplewis previously approved these changes May 12, 2021
Copy link
Member

@dplewis dplewis left a comment

Choose a reason for hiding this comment

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

Nice cleanup and test!

@dplewis
Copy link
Member

dplewis commented May 12, 2021

@mstniy Can you add this fix to the ChangeLog?

@mtrezza
Copy link
Member

mtrezza commented May 12, 2021

This looks suspicious.

This PR removes lot of code from RestWrite and replaces it with a line that was already within the removed code.

Did you research why the logic around the line that you intend to keep was there previously? Is it possible that the logic was there to accommodate certain use cases?

@mstniy
Copy link
Contributor Author

mstniy commented May 12, 2021

@mtrezza ParseObject.set is capable of handling nested keys, no matter the depth. The regression tests actually makes use of this capability. I am not sure why the previous snippet did the split manually. Perhaps it was written before ParseObject.set gained that ability, or the contributor wasn't aware it could do that? But that's pure speculation.

Thus, the else branch also becomes a simple call to ParseObject.set, so I have removed the branch entirely. I am not sure why the code checks for a dot, so I have left that part intact.

@mstniy
Copy link
Contributor Author

mstniy commented May 12, 2021

@mstniy Can you add this fix to the ChangeLog?

Done

@dplewis
Copy link
Member

dplewis commented May 12, 2021

@mstniy @mtrezza Support for nested objects was recently improved in the SDK
https://github.com/parse-community/Parse-SDK-JS/releases/tag/3.1.0

That’s the reason why this cleanup works so well.

@mtrezza
Copy link
Member

mtrezza commented May 12, 2021

Aha, that may explain it indeed, thanks.

@mstniy mstniy marked this pull request as draft May 13, 2021 11:26
mstniy added 4 commits May 13, 2021 19:48
  Solves problems with nested keys
Expanded the regression test
  ParseUser.get('password') used to be undefined.
  Now, password is not an attribute
@mstniy
Copy link
Contributor Author

mstniy commented May 13, 2021

Blocked on parse-community/Parse-SDK-JS#1364

@mtrezza
Copy link
Member

mtrezza commented Sep 3, 2021

⚠️ Important change for merging PRs from Parse Server 5.0 onwards!

We are planning to release the first beta version of Parse Server 5.0 in October 2021.

If a PR contains a breaking change and is not merged before the beta release of Parse Server 5.0, it cannot be merged until the end of 2022. Instead it has to follow the Deprecation Policy and phase-in breaking changes to be merged during the course of 2022.

One of the most voiced community feedbacks was the demand for predictability in breaking changes to make it easy to upgrade Parse Server. We have made a first step towards this by introducing the Deprecation Policy in February 2021 that assists to phase-in breaking changes, giving developers time to adapt. We will follow-up with the introduction of Release Automation and a branch model that will allow breaking changes only with a new major release, scheduled for the beginning of each calendar year.

We understand that some PRs are a long time in the making and we very much appreciate your contribution. We want to make it easy for PRs that contain a breaking change and were created before the introduction of the Deprecation Policy. These PRs can be merged with a breaking change without being phased-in before the beta release of Parse Server 5.0. We are making this exception because we appreciate that this is a time of transition that requires additional effort from contributors to adapt. We encourage everyone to prepare their PRs until the end of September and account for review time and possible adaptions.

If a PR contains a breaking change and should be merged before the beta release, please mention @parse-community/server-maintenance and we will coordinate with you to merge the PR.

Thanks for your contribution and support during this transition to Parse Server release automation!

hariprasadiit added a commit to vizmo-vms/vizmo-parse-server that referenced this pull request Mar 7, 2022
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.

3 participants