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: resolve strict concurrency errors #3731

Merged
merged 19 commits into from
Jun 7, 2024
Merged

Conversation

phantumcode
Copy link
Member

@phantumcode phantumcode commented May 31, 2024

Issue #

Description

Resolving errors in various categories when strict concurrency and Swift 6 experimental settings are enabled

Change details:

Amplify Core

  • Updated usage and references to UIDevice in DeviceInfo from an main-actor isolated context
  • Updated code in DevMenu resolve issues with referencing main-actor isolated context from a synchronus nonisolated context

AmplifyPlugins/Core

  • Updated AWSServiceConfiguration to calculate the user agent value in an main-actor isolated context as a result of changes to Amplify Core

AmplifyPlugins Auth

  • Changes from AmplifyCore required cascading changes to AmplifyPlugins Auth due to ASFDeviceInfo referencing DeviceInfo
  • Updated calling hierarchy to reference ASFDeviceInfo in an async isolated context

AmplifyPlugins InternalAWSPinpoint

  • Changes from AmplifyCore required cascading changes to EndpointInformation
  • Updated EndpointInformation to be a struct and introduced EndpointInformationProvider interface and implementation so that calling hierarchy can execute and get EndpointInformation in an async isolated context

AmplifyPlugins Logging

  • The CloudWatchLoggingStreamNameFormatter needs to calculate the device identifier to calculate the log stream name in an async isolated context. Updated and refactor logging logic to calculate the log stream name at the time of usage so that it can be called in an async isolated context while limiting cascading changes.

AmplifyPlugins Storage

  • The Storage plugin references AWSServiceConfiguration in AmplifyPluginsCore which requires main-actor isolated context execution. Updating the StorageServiceProxy to provide userAgent computed property in an async context. Implementation and references to StorageServiceProxy to get the userAgent property is also updated to execute in an async context.

Testing details:

  • verified all unit tests passed when running with Xcode 15.0.1 and Xcode 15.4
  • verified all integration tests passed when running with Xcode 15.0.1 and Xcode 15.4

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.

@phantumcode phantumcode requested a review from a team as a code owner May 31, 2024 16:51
Copy link

codecov bot commented Jun 5, 2024

Codecov Report

Attention: Patch coverage is 77.51938% with 29 lines in your changes missing coverage. Please review.

Project coverage is 68.59%. Comparing base (4d16007) to head (9c31f85).
Report is 3 commits behind head on main.

Files Patch % Lines
Amplify/DevMenu/View/IssueReporter.swift 0.00% 25 Missing ⚠️
...Storage/AWSS3StorageService+DownloadBehavior.swift 0.00% 3 Missing ⚠️
...AuthPlugin/Support/Utils/SignUpInput+Amplify.swift 97.05% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3731      +/-   ##
==========================================
+ Coverage   68.41%   68.59%   +0.17%     
==========================================
  Files        1079     1079              
  Lines       37563    37569       +6     
==========================================
+ Hits        25699    25769      +70     
+ Misses      11864    11800      -64     
Flag Coverage Δ
API_plugin_unit_test 68.83% <ø> (ø)
AWSPluginsCore 68.56% <ø> (ø)
Amplify 47.59% <0.00%> (-0.07%) ⬇️
Analytics_plugin_unit_test 84.52% <ø> (ø)
Auth_plugin_unit_test 79.37% <98.63%> (+0.07%) ⬆️
DataStore_plugin_unit_test 82.17% <ø> (+0.88%) ⬆️
Geo_plugin_unit_test 72.00% <ø> (ø)
Logging_plugin_unit_test 62.95% <100.00%> (+0.07%) ⬆️
Predictions_plugin_unit_test 37.32% <ø> (ø)
PushNotifications_plugin_unit_test 86.21% <ø> (ø)
Storage_plugin_unit_test 76.75% <72.72%> (+<0.01%) ⬆️
unit_tests 68.59% <77.51%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

thisisabhash
thisisabhash previously approved these changes Jun 5, 2024
Copy link
Member

@lawmicha lawmicha left a comment

Choose a reason for hiding this comment

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

A reminder to merge this in as a fix or feat since chore commits do not show up in the changelog, and they usually non-production related code changes https://devops.stackexchange.com/a/19067

@phantumcode phantumcode changed the title chore: resolve strict concurrency errors fix: resolve strict concurrency errors Jun 7, 2024
@phantumcode phantumcode merged commit 53d0fff into main Jun 7, 2024
100 of 101 checks passed
@phantumcode phantumcode deleted the enhancement/swift6_update branch June 7, 2024 22:11
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.

None yet

5 participants