Skip to content

fix: wrong message being shown on system.toml parse error#3668

Merged
Bravo555 merged 1 commit intothin-edge:mainfrom
Bravo555:fix/system-manager-command-fix
Jun 10, 2025
Merged

fix: wrong message being shown on system.toml parse error#3668
Bravo555 merged 1 commit intothin-edge:mainfrom
Bravo555:fix/system-manager-command-fix

Conversation

@Bravo555
Copy link
Copy Markdown
Member

@Bravo555 Bravo555 commented Jun 4, 2025

Proposed changes

A wrong variant of ServiceCommand was used which caused an error message to wrongly report that ServiceCommand::Enable instead of ServiceCommand::Start failed when start command in system.toml did not contain a placeholder for an argument.

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. You can activate automatic signing by running just prepare-dev once)
  • I ran just format as mentioned in CODING_GUIDELINES
  • I used just check 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

Some of the service manager code could be further improved:

  1. Many arguments are passed down unnecessarily just for sake of error reporting, we could instead not pass them down and instead attach the context up the call stack.
  2. Could use docs comments describing why we use system.toml file and why handling it takes quite a bit of code

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 4, 2025

Codecov Report

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

Files with missing lines Patch % Lines
...ge/src/system_services/managers/general_manager.rs 0.00% 16 Missing ⚠️

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@reubenmiller reubenmiller changed the title Fix wrong message being shown on system.toml parse error fix: wrong message being shown on system.toml parse error Jun 5, 2025
@reubenmiller reubenmiller added the theme:cli Theme: cli related topics label Jun 5, 2025
Self::Start(service) => ExecCommand::try_new_with_placeholder(
service_manager.init_config.start.clone(),
ServiceCommand::Enable(service),
ServiceCommand::Start(service),
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.

I believe the following should work since ServiceCommand: Copy. Assuming it does, that will do a better job of preventing these errors.

Suggested change
ServiceCommand::Start(service),
self,

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.

It works. Indeed less error prone.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Went a step further and shortened the whole thing in 23bc247.

@Bravo555 Bravo555 had a problem deploying to Test Pull Request June 9, 2025 08:25 — with GitHub Actions Failure
@Bravo555 Bravo555 force-pushed the fix/system-manager-command-fix branch from b67edf8 to 23bc247 Compare June 9, 2025 08:26
@Bravo555 Bravo555 temporarily deployed to Test Pull Request June 9, 2025 08:26 — with GitHub Actions Inactive
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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 10, 2025

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
641 0 3 641 100 1h49m26.554582999s

A wrong variant of ServiceCommand was used which caused an error message
to wrongly report that `ServiceCommand::Enable` instead of
`ServiceCommand::Start` failed when `start` command in `system.toml` did
not contain a placeholder for an argument.

Signed-off-by: Marcel Guzik <marcel.guzik@cumulocity.com>
@Bravo555 Bravo555 force-pushed the fix/system-manager-command-fix branch from 23bc247 to a5eac7b Compare June 10, 2025 08:54
@Bravo555 Bravo555 temporarily deployed to Test Pull Request June 10, 2025 08:54 — with GitHub Actions Inactive
@Bravo555 Bravo555 added this pull request to the merge queue Jun 10, 2025
Merged via the queue into thin-edge:main with commit e68f84c Jun 10, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:cli Theme: cli related topics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants