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

Prepare 0.39.0 #58

Merged
merged 3 commits into from
Dec 21, 2022
Merged

Prepare 0.39.0 #58

merged 3 commits into from
Dec 21, 2022

Conversation

p4checo
Copy link
Collaborator

@p4checo p4checo commented Nov 8, 2022

Description

Cherry pick of upstream commits up to version 0.39.0 🏷️:

Discussion

Breaking changes due to Effect no longer typealiasing SignalProducer

This update will cause countless breaking changes in projects as Effect is now a struct that wraps a SignalProducer instead of being a typealias of it. This is not as big of a problem in upstream TCA because Effect is still a Publisher, so all Combine operators will keep working on Effect operation chains, whereas in RAS-TCA they will now break.

Possible approaches:

  1. Follow upstream approach
  • Pros:
    • People will be (forcibly 😅) steered away from SP-based effects in favor of the new async based ones quicker
  • Cons:
    • Harder migration path, especially in reducers that use RAS operators and dependencies that use Effect outputs
    • Difficult to provide deprecation warnings with Fix-Its
  1. Create RAS variants of SignalProducer's operators in Effect~
  • Pros:
    • Almost no breaking changes (if we cover most/all operators)
  • Cons
    • Increases API surface area
    • Increases stack sizes, as each operator would have to do a .producer.doOperation().eraseToEffect()
    • Projects will likely take longer to migrate away from using SPs as the building block of their Effects
  1. Add SignalProducerConvertible conformance to Effect
  • Pros:
    • Smoother transition, by providing a simple "fix" to make things build again (i.e. add a .producer in relevant chains)
  • Cons
    • Would still be breaking change, as people still need to use a .producer on the chain before using any RAS operators
    • Requires exposing the wrapped producer as public (requirement of SignalProducerConvertible), which is not ideal
    • Projects will likely take longer to migrate away from using SPs as the building block of their Effects
  1. other?

TestScheduler

Pointing to ReactiveSwift 7.1, which already includes async APIs in TestScheduler and DateScheduler.

Upstream TCA relies on `CombineScheduler`'s `[TestScheduler](https://github.com/pointfreeco/combine-schedulers#testscheduler)` to control scheduling in unit tests, and they have added `async` variants of the `advance(by:)`, `advance(to:)` and `run()` as well as helper `sleep` and `timer` async APIs.
  1. For now I've left all await mainQueue.advance() and await mainQueue.run()calls in place. It triggers a warning but most tests pass, except those where the reducer uses the new sleep or timer async APIs on effects, which fail. .
  2. I've implemented the sleep and timer async APIs in SchedulerExtensions for now.

I opened ReactiveCocoa/ReactiveSwift#857 to add these new async APIs which are required to properly test new async effects that wait on time, as well as help make the transition to Clock APIs smoother as well.

New SignalProducerConvertible.values Async(Throwing)Stream APIs

In order to use SignalProducers in the async "world", while replicating the existing APIs in Combine, two new
values computed properties in SignalProducerConvertible were added:

  • values: AsyncStream<Value> when Error == Never
  • values: AsyncThrowingStream<Value, Swift.Error> otherwise

Implementation was heavily inspired by ReactiveCocoa/ReactiveSwift#847, the main difference is that these extensions were added to SignalProducerConvertible instead of SignalProducer. This allows having defining both properties with the same name while providing symmetry with Combine.

Thoughts? 🙏🏼

@p4checo p4checo marked this pull request as draft November 8, 2022 01:09
@p4checo p4checo changed the title Draft: Prepare 0.39.0 Prepare 0.39.0 Nov 8, 2022
@p4checo p4checo marked this pull request as ready for review December 12, 2022 22:17
mbrandonw and others added 2 commits December 12, 2022 22:25
* more main actor audit

* wip

* wip

* fix

* better task result ==

* task result tests

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* fix merge conflicts

* wip

* wip

* lots of doc fixes and modernizations

* lots more docs and better hashable conformance for TaskResult

* more docs

* clean up

* more tests and docs

* clean up

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* small clean up

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* explicit

* wip

* fix bug in TestStore.receive

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* fixes

* wip

* tools for non-deterministic TestStore.receive

* fix

* wip

* wip

* remove inAnyOrder stuff

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* convert download case study to use async/await

* animations

* fix tests

* remove executor experiment

* wip

* wip

* wip

* wip

* wip

* speech simplification

* wip

* wip

* wip

* wip

* wip

* wip

* add a few todos

* wrote some tests

* simplify speech recognizer

* fix tests

* update some docs about error throwing behavior

* wip

* wip

* fix

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Swift 5.5.2 fixes

* wip

* Bump timeout

* wip

* wip

* Finesse

* proper way to detect main queue

* extra guard

* revert main queue check

* move stuff around

* docs

* fixed a bunch of warnings

* Fix references

* clean up

* clean up

* fix a bunch of warnings

* clean up

* un-soft deprecate concatenate

* async teststore.send

* fix uikit tests

* drop sendable

* wip

* wip

* wip

* wip

* wip

* clean up

* clean up

* reorganize, remove extra task cancellation handler

* wip

* wip

* wip

* wip

* wip

* wip

* Make TestStore.send async (#1190)

* async teststore.send

* fix uikit tests

* Converted all tests to async

* clean up

* added docs

* Update Sources/ComposableArchitecture/TestStore.swift

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* Update Sources/ComposableArchitecture/TestStore.swift

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* docs and readme update

* Update README.md

* Update Tests/ComposableArchitectureTests/StoreTests.swift

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* fix

* Update Sources/ComposableArchitecture/TestStore.swift

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* Update Sources/ComposableArchitecture/TestStore.swift

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* Update Sources/ComposableArchitecture/TestStore.swift

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* clean up

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* wip

* wip

* wip

* make fetchNumber throwing and fix tests

* effect basics clean up

* use local state for isLoading in refreshable case study

* clean up

* fix test

* wip

* wip

* wip

* wip

* wip

* wip

* fixes

* clean up

* clean up

* Simplify

* wip

* clean up

* wip

* AsyncStream.finished()

* give Send a public initializer

* make send public

* temporarily make box public

* remove concurrency flag

* wip

* wip

* wip

* wip

* wip

* docs

* speech

* simplify

* clean up;

* unchecked sendable

* clean up

* clean up

* wip

* docs

* docs

* more docs

* lots of docs

* wip

* wip

* wip

* more docs for streamWithContinuation

* wip

* wip

* wip

* Make internal, too

* wip

* Remove sendability detection

It breaks things, like:

    let request = UncheckedSendable(
      SKProductsRequest(productIdentifiers: []
    )
    // UncheckedSendable<NSObject> // *not* _<SKProductsRequest>

* wip

* doc clean up;

* fixed some todos

* docs

* wip

* remove thread safety FAQ from readme

* fix test

* wip

* docs clean up

* docs clean up

* added a testing article and fixed some docs

* rearrange

* docs clean up

* wip

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/Testing.md

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* Update Sources/ComposableArchitecture/Effects/ConcurrencySupport.swift

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* Update Sources/ComposableArchitecture/Effects/ConcurrencySupport.swift

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* Update Sources/ComposableArchitecture/Effects/ConcurrencySupport.swift

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* Update Sources/ComposableArchitecture/Effects/ConcurrencySupport.swift

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/Testing.md

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/Testing.md

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/Testing.md

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/Testing.md

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/Testing.md

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/Testing.md

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/Testing.md

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* wip

* wip

* wip

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>
(cherry picked from commit 108e3a536fcebb16c4f247ef92c2d7326baf9fe3)

# Conflicts:
#	Examples/CaseStudies/SwiftUICaseStudies/00-Core.swift
#	Examples/CaseStudies/SwiftUICaseStudies/01-GettingStarted-Animations.swift
#	Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Basics.swift
#	Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Cancellation.swift
#	Examples/CaseStudies/SwiftUICaseStudies/02-Effects-LongLiving.swift
#	Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Refreshable.swift
#	Examples/CaseStudies/SwiftUICaseStudies/02-Effects-SystemEnvironment.swift
#	Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Timers.swift
#	Examples/CaseStudies/SwiftUICaseStudies/02-Effects-WebSocket.swift
#	Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-Lists-LoadThenNavigate.swift
#	Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-Lists-NavigateAndLoad.swift
#	Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-LoadThenNavigate.swift
#	Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-NavigateAndLoad.swift
#	Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-Sheet-LoadThenPresent.swift
#	Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-Sheet-PresentAndLoad.swift
#	Examples/CaseStudies/SwiftUICaseStudies/04-HigherOrderReducers-ElmLikeSubscriptions.swift
#	Examples/CaseStudies/SwiftUICaseStudies/04-HigherOrderReducers-Lifecycle.swift
#	Examples/CaseStudies/SwiftUICaseStudies/04-HigherOrderReducers-ResuableOfflineDownloads/DownloadClient.swift
#	Examples/CaseStudies/SwiftUICaseStudies/04-HigherOrderReducers-ResuableOfflineDownloads/DownloadComponent.swift
#	Examples/CaseStudies/SwiftUICaseStudies/04-HigherOrderReducers-ReusableFavoriting.swift
#	Examples/CaseStudies/SwiftUICaseStudies/FactClient.swift
#	Examples/CaseStudies/SwiftUICaseStudies/Internal/ResignFirstResponder.swift
#	Examples/CaseStudies/SwiftUICaseStudiesTests/01-GettingStarted-AnimationsTests.swift
#	Examples/CaseStudies/SwiftUICaseStudiesTests/02-Effects-BasicsTests.swift
#	Examples/CaseStudies/SwiftUICaseStudiesTests/02-Effects-CancellationTests.swift
#	Examples/CaseStudies/SwiftUICaseStudiesTests/02-Effects-RefreshableTests.swift
#	Examples/CaseStudies/SwiftUICaseStudiesTests/02-Effects-TimersTests.swift
#	Examples/CaseStudies/SwiftUICaseStudiesTests/02-Effects-WebSocketTests.swift
#	Examples/CaseStudies/SwiftUICaseStudiesTests/04-HigherOrderReducers-LifecycleTests.swift
#	Examples/CaseStudies/SwiftUICaseStudiesTests/04-HigherOrderReducers-ReusableFavoritingTests.swift
#	Examples/CaseStudies/SwiftUICaseStudiesTests/04-HigherOrderReducers-ReusableOfflineDownloadsTests.swift
#	Examples/CaseStudies/UIKitCaseStudies/LoadThenNavigate.swift
#	Examples/CaseStudies/UIKitCaseStudies/NavigateAndLoad.swift
#	Examples/Search/Search/SearchView.swift
#	Examples/Search/Search/WeatherClient.swift
#	Examples/SpeechRecognition/SpeechRecognition/SpeechClient/Live.swift
#	Examples/SpeechRecognition/SpeechRecognition/SpeechRecognition.swift
#	Examples/SpeechRecognition/SpeechRecognition/SpeechRecognitionApp.swift
#	Examples/SpeechRecognition/SpeechRecognitionTests/SpeechRecognitionTests.swift
#	Examples/TicTacToe/App/RootView.swift
#	Examples/TicTacToe/tic-tac-toe/Sources/AppCore/AppCore.swift
#	Examples/TicTacToe/tic-tac-toe/Sources/AuthenticationClientLive/LiveAuthenticationClient.swift
#	Examples/TicTacToe/tic-tac-toe/Sources/LoginCore/LoginCore.swift
#	Examples/TicTacToe/tic-tac-toe/Sources/LoginSwiftUI/LoginView.swift
#	Examples/TicTacToe/tic-tac-toe/Sources/TwoFactorCore/TwoFactorCore.swift
#	Examples/TicTacToe/tic-tac-toe/Sources/TwoFactorSwiftUI/TwoFactorView.swift
#	Examples/TicTacToe/tic-tac-toe/Tests/AppCoreTests/AppCoreTests.swift
#	Examples/TicTacToe/tic-tac-toe/Tests/LoginCoreTests/LoginCoreTests.swift
#	Examples/TicTacToe/tic-tac-toe/Tests/LoginSwiftUITests/LoginSwiftUITests.swift
#	Examples/TicTacToe/tic-tac-toe/Tests/TwoFactorCoreTests/TwoFactorCoreTests.swift
#	Examples/TicTacToe/tic-tac-toe/Tests/TwoFactorSwiftUITests/TwoFactorSwiftUITests.swift
#	Examples/Todos/Todos/Todos.swift
#	Examples/Todos/Todos/TodosApp.swift
#	Examples/Todos/TodosTests/TodosTests.swift
#	Examples/VoiceMemos/VoiceMemos/AudioRecorderClient/LiveAudioRecorderClient.swift
#	Examples/VoiceMemos/VoiceMemos/VoiceMemo.swift
#	Examples/VoiceMemos/VoiceMemos/VoiceMemos.swift
#	Examples/VoiceMemos/VoiceMemos/VoiceMemosApp.swift
#	Examples/VoiceMemos/VoiceMemosTests/VoiceMemosTests.swift
#	Package.swift
#	README.md
#	Sources/ComposableArchitecture/Documentation.docc/Articles/GettingStarted.md
#	Sources/ComposableArchitecture/Effect.swift
#	Sources/ComposableArchitecture/Effects/Animation.swift
#	Sources/ComposableArchitecture/Effects/Cancellation.swift
#	Sources/ComposableArchitecture/Effects/Concurrency.swift
#	Sources/ComposableArchitecture/Effects/Timer.swift
#	Sources/ComposableArchitecture/Internal/Create.swift
#	Sources/ComposableArchitecture/Internal/Deprecations.swift
#	Sources/ComposableArchitecture/Internal/RuntimeWarnings.swift
#	Sources/ComposableArchitecture/Reducer.swift
#	Sources/ComposableArchitecture/Store.swift
#	Sources/ComposableArchitecture/SwiftUI/Alert.swift
#	Sources/ComposableArchitecture/SwiftUI/Binding.swift
#	Sources/ComposableArchitecture/SwiftUI/ConfirmationDialog.swift
#	Sources/ComposableArchitecture/SwiftUI/ForEachStore.swift
#	Sources/ComposableArchitecture/SwiftUI/SwitchStore.swift
#	Sources/ComposableArchitecture/TestSupport/TestStore.swift
#	Sources/ComposableArchitecture/ViewStore.swift
#	Tests/ComposableArchitectureTests/ComposableArchitectureTests.swift
#	Tests/ComposableArchitectureTests/EffectDebounceTests.swift
#	Tests/ComposableArchitectureTests/EffectTests.swift
#	Tests/ComposableArchitectureTests/ReducerTests.swift
#	Tests/ComposableArchitectureTests/RuntimeWarningTests.swift
#	Tests/ComposableArchitectureTests/StoreTests.swift
#	Tests/ComposableArchitectureTests/TestStoreFailureTests.swift
#	Tests/ComposableArchitectureTests/TestStoreTests.swift
#	Tests/ComposableArchitectureTests/TimerTests.swift
#	Tests/ComposableArchitectureTests/ViewStoreTests.swift
## Changes

- Require ReactiveSwift 7.1 which includes latest `async` APIs in
`TestScheduler` and `DateScheduler`.

- Remove local `async` `DateScheduler` extensions.

- Add missing `async` keywords in asynchronous tests.
## Changes

- Fix unit tests.

- Remove unnecessary Combine imports

- Fix imports on Linux.

- Fix unit tests on Linux
  + Add missing compile checks for `XCTExpectFailure` in Linux
  + Disable tests that use `@MainActor` on Linux because of an issue
  gathering tests:
  https://github.com/apple/swift-corelibs-xctest/issues/424

- Remove Swift installation from SwiftPM Linux job, as Swift is already
included in `ubuntu-latest` (`ubuntu-20.04`):
https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md#language-and-runtime
@mluisbrown mluisbrown merged commit 33ce925 into ReactiveCocoa:master Dec 21, 2022
@p4checo p4checo deleted the prepare-0.39.0 branch December 21, 2022 14:15
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

3 participants