Skip to content

Can we remove workflow code from PowerShell Core? #9570

Closed

Description

@KirkMunro

ActionPreference.Suspend is not supported in PowerShell Core (it's only used for workflows, which are not in PowerShell Core). Today it just adds confusion to the code with checks to ensure that value isn't used where there doesn't need to be any. The checks should also be performed by a PSSA rule rather than in source code (similar to ActionPreference.Ignore, as was decided in #4348). Do we need to keep ActionPreference.Suspend checks around at this point or can we just remove the half-dozen checks related to it from the source code?

Further, if we remove these checks (for the same reason we removed the checks for ActionPreference.Ignore), do we need the ActionPreference.Suspend enumeration value kept around at all?

Steve Lee (@SteveL-MSFT): For committee review.

[Update]
As per the committee review, all workflow code should be removed. Here is the list of items requiring removal:

  • workflow keyword
  • parallel keyword (used for parallel activities in workflow)
  • sequence keyword (used for sequential activities in workflow)
  • inlinescript activity block (used for activities outside of workflow)
  • -parallel parameter on foreach statement
  • Checkpoint-Workflow activity (command)
  • Suspend-Workflow activity (command)
  • ActionPreference.Suspend enumeration
  • plus all related classes/methods

Activity

  1. added
    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
    on May 9, 2019
  2. iSazonov commented on May 11, 2019

    @iSazonov
    Collaborator

    If this does not work in any case it can be removed.
    We could use our suggestion system to inform users.

  3. SteveL-MSFT commented on May 15, 2019

    @SteveL-MSFT
    Member

    @PowerShell/powershell-committee reviewed this and agree but should broaden this to reviewing all the code and remove all PSWorkflow code

  4. added
    Committee-ReviewedPS-Committee has reviewed this and made a decision
    and removed
    Review - CommitteeThe PR/Issue needs a review from the PowerShell Committee
    on May 15, 2019
  5. iSazonov commented on May 16, 2019

    @iSazonov
    Collaborator

    There is a lot of such code. Maybe step-by-step will be suitable.

    Should we be worried about remoting?

  6. KirkMunro commented on May 16, 2019

    @KirkMunro
    ContributorAuthor

    Is there really a lot? Here is the list of things that need to be removed that I am aware of:

    • workflow keyword
    • parallel keyword (used for parallel activities in workflow)
    • sequence keyword (used for sequential activities in workflow)
    • inlinescript activity block (used for activities outside of workflow)
    • -parallel parameter on foreach statement
    • Checkpoint-Workflow activity (command)
    • Suspend-Workflow activity (command)
    • ActionPreference.Suspend enumeration
    • plus all related classes/methods

    That's not that long of a list. In terms of doing it piecemeal or all at once, I removed all references to ActionPreference.Suspend as well as the enumeration value itself as part of PR #8205. It made great sense to do so, since a new ActionPreference enumeration value was being added in that PR (removing it now means the enumeration can be defined without specifically assigned values/gaps caused by removing it later); however, I don't feel removing the rest all at once is too daunting of a task.

  7. iSazonov commented on May 16, 2019

    @iSazonov
    Collaborator

    Kirk Munro (@KirkMunro) Thanks for the review! You could move your check list in the issue description and rename header.

    I expected that almost everything was already removed there since we had already cleaned the code several times. Therefore, I was a little surprised that there is still relatively a lot of unnecessary code.

    I believe we will make the cleanup step-by-step. Perhaps we will need some discussions because there is public APIs that I already catched in #9618.

  8. changed the title [-]Can we remove checks for `ActionPreference.Suspend` from PowerShell Core?[/-] [+]Can we remove workflow code from PowerShell Core?[/+] on May 16, 2019
  9. KirkMunro commented on May 16, 2019

    @KirkMunro
    ContributorAuthor

    Ilya (@iSazonov) Good idea, and done.

  10. lzybkr commented on May 16, 2019

    @lzybkr
    Contributor

    There are good arguments for not removing keywords:

    • You can provide better error messages (workflow not supported vs. command not found)
    • It wouldn't be a breaking change to use the keyword in the future.
  11. msftrncs commented on May 16, 2019

    @msftrncs
    Contributor

    I also do not think that the keywords or parameter names should be moved entirely, and they are all already flagged as errors which is the right thing to do, in my opinion. The only downside to this is that means the workflow keyword cannot be used for a function name without using & (call).

  12. SteveL-MSFT commented on May 18, 2019

    @SteveL-MSFT
    Member

    Part of the reasoning by @PowerShell/powershell-committee to remove is to have the errors at parse time/compile time (for C# code) vs at runtime. There is no plan to ever bring back workflow. Instead, Jeffrey has a proposal for workflow-like state management that I'll publish a RFC for eventually.

  13. KirkMunro commented on Jul 24, 2019

    @KirkMunro
    ContributorAuthor

    There is a public method on the Debugger class called GetWorkflowDebuggerFunctions that is not used internally and seems intended only for workflow. Given that is the case, can this (and the related const string function definitions) be removed?

  14. SteveL-MSFT commented on Jul 24, 2019

    @SteveL-MSFT
    Member

    Kirk Munro (@KirkMunro) we've removed other workflow specific code that impacts public API, so now would be the time to remove it

  15. KirkMunro commented on Jul 25, 2019

    @KirkMunro
    ContributorAuthor

    Steve Lee (@SteveL-MSFT) PowerShellGet internally uses the IsWorkflow property of FunctionDefinitionAst objects. How do you want that handled? I have that property removed from PR #10223 at the moment, which causes some Pester tests to fail because that property does not exist.

    Futher, since PowerShellGet is managed independently of PowerShell itself, why are there PowerShellGet tests that use whatever latest version a user has installed in the PowerShell test suite?

  16. iSazonov commented on Jul 25, 2019

    @iSazonov
    Collaborator

    It is not time critical to leave the property as dummy, then cleanup PowerShellGet, and then remove the property from ast.

  17. daxian-dbw commented on Jul 25, 2019

    @daxian-dbw
    Member

    I'm concerned about removing the workflow keyword. An error message like Workflow is not supported in PowerShell 6+ is better than The term 'workflow' is not recognized as the name of a cmdlet ....
    /cc Steve Lee (@SteveL-MSFT)

  18. iSazonov commented on Jul 26, 2019

    @iSazonov
    Collaborator

    I'm concerned about removing the workflow keyword.

    Dongbo Wang (@daxian-dbw) Please look discussion in #10223

  19. ghost closed this as completedon Jan 31, 2020
  20. mavaddat commented on Jun 1, 2023

    @mavaddat

    It would be cool if PowerShell Core provided modularity on the workflow engine choice so that endusers could opt to choose their workflow adapter assembly. I have floated this idea in the UiPath/CoreWF discussion.

    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Committee-ReviewedPS-Committee has reviewed this and made a decisionIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions