-
Notifications
You must be signed in to change notification settings - Fork 47
[task]: attempt to improve debugging info for AnyWorkflowAction #194
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
Conversation
fileID: StaticString = #fileID, | ||
line: UInt = #line | ||
) { | ||
let closureAction = ClosureAction<WorkflowType>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we expose a way for consumers who receive AnyWorkflowAction
to know if this is wrapping a closure vs. a real action? could maybe make ClosureAction
public to achieve that
let action: AnyWorkflowAction<SomeWorkflow> = ...
if action.base is ClosureAction<SomeWorkflow> {
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah we can do that. do you think full access to the underlying type is needed? or would a flag suffice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general my default is "provide more access" but I know as the SDK author its the opposite for you :p for now I suppose a flag would work
/// defined via a closure. | ||
struct ClosureAction<WorkflowType: Workflow>: WorkflowAction { | ||
private let _apply: (inout WorkflowType.State) -> WorkflowType.Output? | ||
let fileID: StaticString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice touch!
Description
this change adds introspection capabilities for what i believe is the final type-eraser that lacks them – AnyWorkflowAction. changes include:
base
property onAnyWorkflowAction
to expose the underlying action as anAny
valueClosureAction
, for closure-basedAnyWorkflowAction
s. the intent is to provide the possibility of improved telemetry information when logging such actions.isClosureBased
onAnyWorkflowAction
to differentiate instances that forward to an underlying wrapped action vs those whose implementations are defined by a closure.Checklist