Skip to content

fix: process non-versioned in-progress commands on startup#3306

Merged
reubenmiller merged 2 commits intothin-edge:mainfrom
reubenmiller:fix-in-progress-workflows-ignored-after-self-update
Dec 17, 2024
Merged

fix: process non-versioned in-progress commands on startup#3306
reubenmiller merged 2 commits intothin-edge:mainfrom
reubenmiller:fix-in-progress-workflows-ignored-after-self-update

Conversation

@reubenmiller
Copy link
Copy Markdown
Contributor

Proposed changes

Fix handling of in-progress commands/workflows which originate from the tedge-agent prior to 1.4.0.

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

#3305

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 17, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
551 0 2 551 100 1h31m52.586193999s

@reubenmiller reubenmiller changed the title test: add system test to check handling of non-versioned in-progress workflows on startup fix: process non-versioned in-progress commands on startup Dec 17, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/core/tedge_api/src/workflow/supervisor.rs 0.00% 25 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

reubenmiller and others added 2 commits December 17, 2024 17:54
When the agent restarts after a self-update, the workflow versions might
not have been persisted for the pending commands (simply because the
feature was not enabled by the former version of the agent).
In such a case the current version of the workflow is assumed.

Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
@reubenmiller reubenmiller force-pushed the fix-in-progress-workflows-ignored-after-self-update branch from 2098c5e to f48eedd Compare December 17, 2024 16:54
Copy link
Copy Markdown
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

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

Approved

.and_then(|operation| self.workflows.get_mut(&operation.as_str().into()))
{
if let Some(current_version) = versions.use_current_version() {
*command = command.clone().set_workflow_version(current_version);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not so nice, but okayish as this happens only on very specific and rare cases (restart after a self update).

It would be nicer to change set_workflow_version signature:

Suggested change
*command = command.clone().set_workflow_version(current_version);
command.set_workflow_version(current_version);

@didier-wenzek didier-wenzek added this pull request to the merge queue Dec 17, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 17, 2024
@reubenmiller reubenmiller added this pull request to the merge queue Dec 17, 2024
Merged via the queue into thin-edge:main with commit d710940 Dec 17, 2024
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.

2 participants