Skip to content

Conversation

didier-wenzek
Copy link
Contributor

@didier-wenzek didier-wenzek commented Aug 14, 2024

Proposed changes

Inject workflow default values while parsing the workflow definition and not during execution.
When a workflow is used to execute an operation, all the transitions must have been resolved.

  • Provide sensible defaults for the DefaultHandlers of a workflow
  • Impl TryFrom<(TomlExitHandlers, DefaultHandlers)> for Handlers
  • Deprecate the with_default methods from Handlers
  • Remove Option types from handlers mandatory fields
  • Remove on_success from the DefaultHandlers.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue


Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 86.30137% with 30 lines in your changes missing coverage. Please review.

Files Patch % Lines
crates/core/tedge_api/src/workflow/toml_config.rs 58.62% 23 Missing and 1 partial ⚠️
.../core/tedge_agent/src/operation_workflows/actor.rs 0.00% 3 Missing ⚠️
crates/core/tedge_api/src/workflow/script.rs 97.91% 3 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

Copy link
Contributor

github-actions bot commented Aug 14, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
495 0 2 495 100 1h38m13.618884s

Copy link
Contributor

@albinsuresh albinsuresh left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
With the previous impl TryFrom<TomlExitHandlers> for Handlers many
definition consistency and completness checks were not feasible,
the default values being injected only once the struct fully built.

This commit is a preparation step.
The next step is to deprecate the `with_default` method,
moving its effects into to the TryFrom implementations.

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
The aim is to resolve all the workflow transitions when the workflow
definition is parsed and not during its execution.

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
The idea is to force the users to be explicit on which state is to be
used on a successful action. Using the terminal successful test being
likely an error on most cases.

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
Copy link
Contributor

@albinsuresh albinsuresh left a comment

Choose a reason for hiding this comment

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

LGTM

@didier-wenzek didier-wenzek added this pull request to the merge queue Aug 21, 2024
Merged via the queue into thin-edge:main with commit 162f9a8 Aug 21, 2024
33 checks passed
@reubenmiller reubenmiller added the theme:workflows Theme: Workflow engine topics label Aug 27, 2024
@didier-wenzek didier-wenzek deleted the refactor/workflow-default-values branch September 4, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:workflows Theme: Workflow engine topics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants