Managing import and upgrade steps in my code

I'm trying to figure out the exact behavior of the upgrade steps defined in the profile for an add-on.

In my add-on, I have three upgrade steps defined:

  • from version 1 to 2;
  • from version 2 to 3;
  • and from version 3 to 4.

I also have an import step defined.

IIUC, if version 4 of my add-on code is installed directly into a Plone site, only the import step is run. But if version 1 was previously installed, then the code in the filesystem was upgraded to version 4, and then the upgrade button is pressed in the Plone Setup page, the consecutive upgrade steps are run.

If that understanding is correct, the logical workflow would be to keep in the code all the upgrade steps (to be cumulatively applied, considering all the possibilities of installed previous versions), but only one import step, to setup the database to the expected state after a fresh install from the latest version of the add-on.

Is that reasonable? Or are there better ways to manage import and upgrade steps?

yes, that's reasonable.