Skip to content

Conversation

@jarhodes314
Copy link
Contributor

@jarhodes314 jarhodes314 commented Dec 18, 2025

Proposed changes

Add a migration tool for converting tedge.toml based configs to separate mapper configs.

To use the tool, run tedge-mapper migrate-config c8y (or with the cloud of your choosing).
To use the tool, run tedge config upgrade.

TODO:

  • System tests for the separate mapper config functionality
  • Add line to tedge connect summary showing where the mapper is configured
  • Ensure there is a mechanism for changing the default mapper config location for new users
  • Include the directory cleanup logic in the system tests
  • Test that config can be read from tedge.toml if mapper has flows directory but not migrated config
  • Ensure we are happy with tedge connect config summary showing the feature/temporarily hide it if not

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

@codecov
Copy link

codecov bot commented Dec 18, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Dec 18, 2025

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
795 0 4 795 100 2h27m13.415149999s

Copy link
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.

tedge-mapper migrate-config is nicely working, including for cloud profile.

It could be improved a bit to be more explicit when no config is to be migrated (because not set or already migrated).

Comment on lines 122 to 125
#[clap(hide = true)]
MigrateConfig {
cloud_name: CloudType,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use a hidden command for this migration tool?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At the moment, I didn't want to expose the details for undocumented features, particularly one where the user has nothing obvious to gain by using the feature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Particularly with @albinsuresh's point about unifying directory structure between this and the mapper flow definitions in #3892 (comment), there's a chance we may need to slightly revise the structure, which is a good reason for people not to adopt this feature until we are happy it's stable.

@jarhodes314 jarhodes314 requested a review from a team as a code owner December 19, 2025 15:07
Copy link
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.

The code is clear and the tests comprehensive. There are still some open UX questions, though.

I don't think we need to "Ensure there is a mechanism for changing the default mapper config location for new users" in this PR. We can make the new mapper schema the default, when the feature and the documentation will be complete.

I like that tedge connect displays the path to the mapper configuration file. This is not a problem to have a constant path when the config has not been migrated. This will even be handy to support users during the transition phase.

I noticed that now tedge config set remove unknown properties, while this was not the case before #3889. I'm okay with that, as I don't think it was a documented behavior, but it would be good to consider restoring the former behavior.

@jarhodes314
Copy link
Contributor Author

I noticed that now tedge config set remove unknown properties, while this was not the case before #3889. I'm okay with that, as I don't think it was a documented behavior, but it would be good to consider restoring the former behavior.

I believe this is the existing behaviour for tedge.toml even though it is new for the mapper toml files. Since pretty much no users edit these files directly, I don't think this matters.

@jarhodes314 jarhodes314 force-pushed the feat/mapper-config-migration-tool branch from f324ec4 to ac295bd Compare January 5, 2026 12:22
@jarhodes314 jarhodes314 temporarily deployed to Test Pull Request January 5, 2026 12:22 — with GitHub Actions Inactive
Copy link
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.

From my point of view, this PR is ready to be merged, with one point still to be discussed as highlighted here #3902 (comment): do we have to revise the mapper config directory structure so we can add later other mapper related configs (flows, bridged topics)?

@albinsuresh
Copy link
Contributor

Just some remarks on the UX.

  1. Why not restart the corresponding service after the config file migration? If we have intentionally left it to the user, thenit'd be good to give a hit about that to the user in the output. I prefer implicit restart as leaving the config migrated without the restart feels risky, as the user might forget about it and it'll unknowingly take effect with a future restart. Doing the restart inline gives us the opportunity to revert the changes as well, if it fails.
  2. Why expose the migration step via the tedge-mapper cli and not tedge config? That feels like an impl detail leak that only the mapper configs are migrated. In future if we decide to move more configs around, having a singular "migration interface" would have been nice. I'm thinking something like tedge config upgrade that will detect the existing config version and migrate it to the target version that the command was invoked with. Even at the code level, the migrate-config subcommand felt misplaced.
  3. The current API forces the user to do the migration one-by-one for each cloud, presumably to make the transition less error prone as the user would be able to validate things before proceeding to the next migration. But for all cloud profiles of a given cloud, the migration is done in one-shot and here we are inconsistent with the other behaviour. I'd be i favour of migrating all at once.
  4. Wouldn't it be safer to keep a backup of the old config at /etc/tedge/tedge.toml.old so that the user can revert back to it just in case something fails after the migration?

@jarhodes314
Copy link
Contributor Author

jarhodes314 commented Jan 7, 2026

  1. Why not restart the corresponding service after the config file migration? If we have intentionally left it to the user, thenit'd be good to give a hit about that to the user in the output. I prefer implicit restart as leaving the config migrated without the restart feels risky, as the user might forget about it and it'll unknowingly take effect with a future restart. Doing the restart inline gives us the opportunity to revert the changes as well, if it fails.

We could potentially do this, however it's also the case that this migration shouldn't change anything. If we did support relative paths in config files in the future then this could be a problematic assumption, but I don't see much

  1. Why expose the migration step via the tedge-mapper cli and not tedge config? That feels like an impl detail leak that only the mapper configs are migrated. In future if we decide to move more configs around, having a singular "migration interface" would have been nice. I'm thinking something like tedge config upgrade that will detect the existing config version and migrate it to the target version that the command was invoked with. Even at the code level, the migrate-config subcommand felt misplaced.

This is a good point, particularly since we only install tab-completions for tedge and not tedge-mapper so if it's under tedge it will be easier to use.

  1. The current API forces the user to do the migration one-by-one for each cloud, presumably to make the transition less error prone as the user would be able to validate things before proceeding to the next migration. But for all cloud profiles of a given cloud, the migration is done in one-shot and here we are inconsistent with the other behaviour. I'd be i favour of migrating all at once.

Particularly given the new default behaviour is currently set to only create separate mapper configs if no cloud configs exist in tedge.toml, this makes sense. I think it adds to the whole point of encapsulating the details of what the config migration/update is.

  1. Wouldn't it be safer to keep a backup of the old config at /etc/tedge/tedge.toml.old so that the user can revert back to it just in case something fails after the migration?

Maybe. If we did this, I would like there to be a clear process through which we remove this file automatically, since leaving it around will mostly likely cause confusion. This is particularly true since we generally encapsulate all of the configuration files so the users generally never need touch them.

@albinsuresh
Copy link
Contributor

  1. Wouldn't it be safer to keep a backup of the old config at /etc/tedge/tedge.toml.old so that the user can revert back to it just in case something fails after the migration?

Maybe. If we did this, I would like there to be a clear process through which we remove this file automatically, since leaving it around will mostly likely cause confusion. This is particularly true since we generally encapsulate all of the configuration files so the users generally never need touch them.

If we do the service restarts as part of the "migration" then we can cleanly remove the backup after the service restarts and connection tests are deemed successful.

@jarhodes314 jarhodes314 temporarily deployed to Test Pull Request January 8, 2026 14:43 — with GitHub Actions Inactive
@reubenmiller reubenmiller added theme:configuration Theme: Configuration management theme:c8y Theme: Cumulocity related topics theme:aws Theme: AWS cloud related topics theme:az Theme: Azure IoT related topics and removed theme:c8y Theme: Cumulocity related topics theme:aws Theme: AWS cloud related topics theme:az Theme: Azure IoT related topics labels Jan 12, 2026
Signed-off-by: James Rhodes <[email protected]>
@jarhodes314 jarhodes314 added this pull request to the merge queue Jan 13, 2026
@jarhodes314 jarhodes314 removed this pull request from the merge queue due to a manual request Jan 13, 2026
@jarhodes314 jarhodes314 enabled auto-merge January 13, 2026 10:10
@jarhodes314 jarhodes314 added this pull request to the merge queue Jan 13, 2026
Merged via the queue into thin-edge:main with commit a78ef0d Jan 13, 2026
51 of 52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:configuration Theme: Configuration management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants