Skip to content
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

Deprecate tedge topic parsing method #2818

Conversation

didier-wenzek
Copy link
Contributor

Proposed changes

Deprecate get_child_id_from_child_topic, a method parsing the now deprecated tedge command topic.

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 Apr 9, 2024

Codecov Report

Attention: Patch coverage is 37.50000% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 76.6%. Comparing base (2ada77d) to head (7478800).
Report is 3 commits behind head on main.

Additional details and impacted files
Files Coverage Δ
crates/core/tedge_api/src/lib.rs 100.0% <ø> (ø)
...rates/extensions/c8y_firmware_manager/src/actor.rs 67.5% <0.0%> (-0.5%) ⬇️
...tes/extensions/c8y_firmware_manager/src/message.rs 94.7% <50.0%> (-1.1%) ⬇️

... and 2 files with indirect coverage changes

Copy link
Contributor

github-actions bot commented Apr 9, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
428 0 3 428 100 0s

Comment on lines +100 to +110
let child_id = match topic.split('/').collect::<Vec<&str>>()[..] {
// This plugin is still listening to the deprecated `tedge` command topic
["tedge", child_id, "commands", "res", "firmware_update"] if !child_id.is_empty() => {
child_id.to_string()
}
_ => {
return Err(FirmwareManagementError::InvalidTopicFromChildOperation {
topic: topic.into(),
})
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

note: I think this not only removes the deprecated function, but also fixes the wrong behaviour

Previously get_child_id_from_child_topic just extracted child id, but the topic itself wasn't checked, so it could be anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, this also fixes the behavior and I failed to missed that trying at first to use one of the tedge_api::MqttSchema method!

@didier-wenzek didier-wenzek added this pull request to the merge queue Apr 9, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 9, 2024
@didier-wenzek didier-wenzek added this pull request to the merge queue Apr 9, 2024
Merged via the queue into thin-edge:main with commit bd9d671 Apr 9, 2024
32 checks passed
@didier-wenzek didier-wenzek deleted the refactor/deprecate-get_child_id_from_child_topic branch April 22, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants