wwt / SwiftCurrent

A library for managing complex workflows in Swift
https://wwt.github.io/SwiftCurrent/
Apache License 2.0
307 stars 19 forks source link

Launching a Workflow using an AnyWorkflow #150

Closed morganzellers closed 2 years ago

morganzellers commented 2 years ago

Linked Issue:

Checklist:


If Applicable:


If Public API Has Changed:

codecov-commenter commented 2 years ago

Codecov Report

Merging #150 (1f62b9b) into data-driven (7ac2343) will decrease coverage by 1.56%. The diff coverage is 63.23%.

:exclamation: Current head 1f62b9b differs from pull request most recent head 9a283fd. Consider uploading reports for the commit 9a283fd to get more accurate results Impacted file tree graph

@@               Coverage Diff               @@
##           data-driven     #150      +/-   ##
===============================================
- Coverage        91.27%   89.70%   -1.57%     
===============================================
  Files               92       94       +2     
  Lines             2373     2497     +124     
===============================================
+ Hits              2166     2240      +74     
- Misses             207      257      +50     
Impacted Files Coverage Δ
...wiftCurrent/Models/FlowRepresentableMetadata.swift 100.00% <ø> (ø)
...urrent_SwiftUI/Extensions/WorkflowExtensions.swift 45.67% <44.30%> (-54.33%) :arrow_down:
Sources/SwiftCurrent/TypeErased/AnyWorkflow.swift 81.66% <66.66%> (-0.79%) :arrow_down:
...tUI/Models/ExtendedFlowRepresentableMetadata.swift 72.72% <72.72%> (ø)
...ftCurrent_SwiftUI/TypeErased/AnyWorkflowItem.swift 80.00% <80.00%> (ø)
.../SwiftCurrent_SwiftUI/Views/WorkflowLauncher.swift 98.96% <96.15%> (-1.04%) :arrow_down:
...rces/SwiftCurrent_SwiftUI/Views/WorkflowItem.swift 94.07% <100.00%> (ø)

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 7ac2343...9a283fd. Read the comment docs.

morganzellers commented 2 years ago

Added a test for fatalError when no items in a workflow earlier then spent most of the day deciphering some of the unit tests and working through adding needed thenProceed's.

morganzellers commented 2 years ago

EOD: Was able to drive out a few more thenProceed's today. Starting to understand them more, but am still fuzzy at times on which situation in a workflow a thenProceed signature translates to.

Also fuzzy on the difference between setting typealias WorkflowOutput = String vs typealias WorkflowOutput = AnyWorkflow.PassedArgs. I thought that setting the latter basically said "Whatever type I'm passed is what I'm passing on" but there were a few times today where I doubted my memory.

morganzellers commented 2 years ago

EOD: Added support for startingArgs - swapped to using the GenericConstraintsTests (copied and renamed for ExtendedFlowRepresentableMetadata) to drive out more functionality for persistence and launch style arguements.

Richard-Gist commented 2 years ago

I tried to work on this a bit today, but there's a LOT of work we'll need to do to convert all of the tests over to actually test things. I tried some different routes like maybe taking the generic constraint tests from SwiftCurrent core and seeing if those were easier to change over, but they weren't because of a difference in what you can use as starting arguments.

Maybe someone with a bit more regex prowess can make mass edits to convert the code, but for now, the only way forward I see is essentially translating all of the tests. I found I had to update how the workflow was created, how it was launched, and how it was asserted.

I did contemplate for a while if we even needed to do all of this, which is still a "maybe" to a somewhat of a "yeah". We might be able to prune it down some but a lot of these tests will remain valid if we ever get to a point of letting our users declare Workflows and feed them into SwiftUI this way (which is something that holds a lot of value for integrating into certain design patterns).

But overall I'm not sure we're actually going to use these thenProceeds to build out our workflows from data.