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(DataStore): Fixing a crash when attempting to create a model with a predicate #3600

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

ruisebas
Copy link
Member

@ruisebas ruisebas commented Apr 8, 2024

Issue #

Description

Setting a predicate on a save operation with a model that does not exist is not supported. The StorageEngine performs this validation and reports a failure to the completion handler if attempted. However, the execution is not interrupted and then StorageAdapter is still invoked, which also fails and also reports a failure.

This results in the plugin's continuation being resumed twice, which results in a crash with SWIFT TASK CONTINUATION MISUSE.

The fix is simple, we're just missing a return statement in the initial validation after we invoke the completion callback.

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ruisebas ruisebas requested a review from a team as a code owner April 8, 2024 15:59
@ruisebas ruisebas merged commit 235b49f into main Apr 8, 2024
99 checks passed
@ruisebas ruisebas deleted the ruisebas/fix-datastore-crash branch April 8, 2024 16:08
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