Skip to content

fix: continue to de-duplicate incoming operations once operation is complete#3728

Merged
jarhodes314 merged 1 commit intothin-edge:mainfrom
jarhodes314:fix/duplicate-operations-after-quick-completion
Jul 11, 2025
Merged

fix: continue to de-duplicate incoming operations once operation is complete#3728
jarhodes314 merged 1 commit intothin-edge:mainfrom
jarhodes314:fix/duplicate-operations-after-quick-completion

Conversation

@jarhodes314
Copy link
Copy Markdown
Contributor

Proposed changes

Fix a flaky system test caused by duplicate operations being executed by the mapper.

The reason why the existing de-duplication didn't work is that the operation had been completed locally before the operation notification was received for a second time from Cumulocity. Since the command was no longer "active", the mapper totally ignored the fact the operation has already been executed.

This PR adds a new recently_completed_commands store to the mapper, which stores the completed command IDs for ~1 hour to cope with this race condition where the Cumulocity operation status takes some time to update.

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

…omplete

Signed-off-by: James Rhodes <jarhodes314@gmail.com>
@jarhodes314 jarhodes314 added the theme:c8y Theme: Cumulocity related topics label Jul 11, 2025
@jarhodes314 jarhodes314 temporarily deployed to Test Pull Request July 11, 2025 10:20 — with GitHub Actions Inactive
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 11, 2025

Codecov Report

Attention: Patch coverage is 83.72093% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/extensions/c8y_mapper_ext/src/converter.rs 83.72% 5 Missing and 2 partials ⚠️

📢 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.

@github-actions
Copy link
Copy Markdown
Contributor

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
654 0 3 654 100 1h46m24.294489999s

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. Thank you for fixing that race condition.

Having this very specific and local fix is okay for now.
However, I don't think this is the only place we have to sync local and remote states.

@jarhodes314 jarhodes314 added this pull request to the merge queue Jul 11, 2025
Merged via the queue into thin-edge:main with commit abc1c66 Jul 11, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:c8y Theme: Cumulocity related topics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants