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

fix: Cloud Code Trigger afterSave executes even if not set #8520

Merged
merged 5 commits into from
May 12, 2023

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented Apr 28, 2023

Pull Request

Issue

AfterSave triggers will run when the triggers don't exist. This can cause major issues when trying to merge an afterSave result that is undefined with an object. This PR will also reduce overhead on afterSave calls

Closes: parse-community/parse-php-sdk#502

@parse-github-assistant
Copy link

Thanks for opening this pull request!

@codecov
Copy link

codecov bot commented Apr 28, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.35 🎉

Comparison is base (2caea31) 93.95% compared to head (df3dbef) 94.31%.

❗ Current head df3dbef differs from pull request most recent head 2c26e45. Consider uploading reports for the commit 2c26e45 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##            alpha    #8520      +/-   ##
==========================================
+ Coverage   93.95%   94.31%   +0.35%     
==========================================
  Files         183      183              
  Lines       14517    14520       +3     
==========================================
+ Hits        13640    13694      +54     
+ Misses        877      826      -51     
Impacted Files Coverage Δ
src/RestWrite.js 94.64% <100.00%> (+0.02%) ⬆️

... and 6 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dplewis dplewis requested a review from mtrezza April 28, 2023 05:50
mtrezza
mtrezza previously approved these changes Apr 28, 2023
Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

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

Looks good!

To be more specific with the PR title, does this describe what this PR fixes?

fix: Cloud Code Trigger afterSave executes even if not set

@dplewis dplewis changed the title fix: Properly handle afterSave triggers fix: Cloud Code Trigger afterSave executes even if not set Apr 28, 2023
@dplewis
Copy link
Member Author

dplewis commented Apr 28, 2023

@mtrezza Title has been changed, sorry I'm horrible at naming these

@dplewis dplewis requested a review from mtrezza April 28, 2023 17:58
@mtrezza
Copy link
Member

mtrezza commented Apr 29, 2023

All good, most important is the code fix after all. I'm just always double checking to hopefully create an understandable changelog entry for developers.

Let's merge #8519 before this so we can also see the new API docs generated.

@mtrezza mtrezza changed the title fix: Cloud Code Trigger afterSave executes even if not set fix: Cloud Code Trigger afterSave executes even if not set Apr 29, 2023
@dblythy
Copy link
Member

dblythy commented Apr 29, 2023

Could we possibly add a failing test here? I’ve found in the past afterSave response changes can result in certain JS SDK tests failing, I’m worried if that happens again the bug will be re-introduced

@dplewis dplewis requested a review from dblythy May 8, 2023 20:09
@dplewis
Copy link
Member Author

dplewis commented May 8, 2023

@dblythy @mtrezza I've added a failing test.

@mtrezza
Copy link
Member

mtrezza commented May 9, 2023

Thanks, I'm re-running the CI to get all tests passing; if @dblythy could review this again then I'll go ahead and merge.

@dplewis
Copy link
Member Author

dplewis commented May 11, 2023

@mtrezza Can we merge this?

@mtrezza mtrezza merged commit afd0515 into parse-community:alpha May 12, 2023
parseplatformorg pushed a commit that referenced this pull request May 12, 2023
# [6.1.0-alpha.10](6.1.0-alpha.9...6.1.0-alpha.10) (2023-05-12)

### Bug Fixes

* Cloud Code Trigger `afterSave` executes even if not set ([#8520](#8520)) ([afd0515](afd0515))
@parseplatformorg
Copy link
Contributor

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

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label May 12, 2023
parseplatformorg pushed a commit that referenced this pull request Jun 10, 2023
# [6.3.0-beta.1](6.2.0...6.3.0-beta.1) (2023-06-10)

### Bug Fixes

* Cloud Code Trigger `afterSave` executes even if not set ([#8520](#8520)) ([afd0515](afd0515))
* GridFS file storage doesn't work with certain `enableSchemaHooks` settings ([#8467](#8467)) ([d4cda4b](d4cda4b))
* Inaccurate table total row count for PostgreSQL ([#8511](#8511)) ([0823a02](0823a02))
* LiveQuery server is not shut down properly when `handleShutdown` is called ([#8491](#8491)) ([967700b](967700b))
* Rate limit feature is incompatible with Node 14 ([#8578](#8578)) ([f911f2c](f911f2c))
* Unnecessary log entries by `extendSessionOnUse` ([#8562](#8562)) ([fd6a007](fd6a007))

### Features

* `extendSessionOnUse` to automatically renew Parse Sessions ([#8505](#8505)) ([6f885d3](6f885d3))
* Add new Parse Server option `preventSignupWithUnverifiedEmail` to prevent returning a user without session token on sign-up with unverified email address ([#8451](#8451)) ([82da308](82da308))
* Add option to change the log level of logs emitted by Cloud Functions ([#8530](#8530)) ([2caea31](2caea31))
* Add support for `$eq` query constraint in LiveQuery ([#8614](#8614)) ([656d673](656d673))
* Add zones for rate limiting by `ip`, `user`, `session`, `global` ([#8508](#8508)) ([03fba97](03fba97))
* Allow `Parse.Object` pointers in Cloud Code arguments ([#8490](#8490)) ([28aeda3](28aeda3))

### Reverts

* fix: Inaccurate table total row count for PostgreSQL ([6722110](6722110))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.3.0-beta.1

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Jun 10, 2023
parseplatformorg pushed a commit that referenced this pull request Jun 18, 2023
# [6.3.0-alpha.1](6.2.0...6.3.0-alpha.1) (2023-06-18)

### Bug Fixes

* Cloud Code Trigger `afterSave` executes even if not set ([#8520](#8520)) ([afd0515](afd0515))
* GridFS file storage doesn't work with certain `enableSchemaHooks` settings ([#8467](#8467)) ([d4cda4b](d4cda4b))
* Inaccurate table total row count for PostgreSQL ([#8511](#8511)) ([0823a02](0823a02))
* LiveQuery server is not shut down properly when `handleShutdown` is called ([#8491](#8491)) ([967700b](967700b))
* Rate limit feature is incompatible with Node 14 ([#8578](#8578)) ([f911f2c](f911f2c))
* Unnecessary log entries by `extendSessionOnUse` ([#8562](#8562)) ([fd6a007](fd6a007))

### Features

* `extendSessionOnUse` to automatically renew Parse Sessions ([#8505](#8505)) ([6f885d3](6f885d3))
* Add new Parse Server option `preventSignupWithUnverifiedEmail` to prevent returning a user without session token on sign-up with unverified email address ([#8451](#8451)) ([82da308](82da308))
* Add option to change the log level of logs emitted by Cloud Functions ([#8530](#8530)) ([2caea31](2caea31))
* Add support for `$eq` query constraint in LiveQuery ([#8614](#8614)) ([656d673](656d673))
* Add zones for rate limiting by `ip`, `user`, `session`, `global` ([#8508](#8508)) ([03fba97](03fba97))
* Allow `Parse.Object` pointers in Cloud Code arguments ([#8490](#8490)) ([28aeda3](28aeda3))

### Reverts

* fix: Inaccurate table total row count for PostgreSQL ([6722110](6722110))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.3.0-alpha.1

parseplatformorg pushed a commit that referenced this pull request Sep 16, 2023
# [6.3.0](6.2.2...6.3.0) (2023-09-16)

### Bug Fixes

* Cloud Code Trigger `afterSave` executes even if not set ([#8520](#8520)) ([afd0515](afd0515))
* GridFS file storage doesn't work with certain `enableSchemaHooks` settings ([#8467](#8467)) ([d4cda4b](d4cda4b))
* Inaccurate table total row count for PostgreSQL ([#8511](#8511)) ([0823a02](0823a02))
* LiveQuery server is not shut down properly when `handleShutdown` is called ([#8491](#8491)) ([967700b](967700b))
* Rate limit feature is incompatible with Node 14 ([#8578](#8578)) ([f911f2c](f911f2c))
* Unnecessary log entries by `extendSessionOnUse` ([#8562](#8562)) ([fd6a007](fd6a007))

### Features

* `extendSessionOnUse` to automatically renew Parse Sessions ([#8505](#8505)) ([6f885d3](6f885d3))
* Add new Parse Server option `preventSignupWithUnverifiedEmail` to prevent returning a user without session token on sign-up with unverified email address ([#8451](#8451)) ([82da308](82da308))
* Add option to change the log level of logs emitted by Cloud Functions ([#8530](#8530)) ([2caea31](2caea31))
* Add support for `$eq` query constraint in LiveQuery ([#8614](#8614)) ([656d673](656d673))
* Add zones for rate limiting by `ip`, `user`, `session`, `global` ([#8508](#8508)) ([03fba97](03fba97))
* Allow `Parse.Object` pointers in Cloud Code arguments ([#8490](#8490)) ([28aeda3](28aeda3))

### Reverts

* fix: Inaccurate table total row count for PostgreSQL ([6722110](6722110))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 6.3.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Sep 16, 2023
@dplewis dplewis deleted the fix-aftersave-triggers branch September 27, 2023 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SaveAll on new objects does not return objectIds
4 participants