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

Semver comparison issues for migrations in same dev release set #820

Open
iFergal opened this issue Jul 18, 2024 · 0 comments
Open

Semver comparison issues for migrations in same dev release set #820

iFergal opened this issue Jul 18, 2024 · 0 comments
Labels
bug Something isn't working triage

Comments

@iFergal
Copy link
Contributor

iFergal commented Jul 18, 2024

Version

1.2.0-dev1 - 1.2.0-dev10

Environment

Mac OS, Python 3.12.2

Expected behavior

I think we should be able to check migrations on a higher dev tag for the same version.

Not sure if we would plan on consolidating migrations prior to the next patch release instead, but I'd imagine that might cause headaches in workflows if stakeholders are involved in using test environments that are persisted.

Actual behavior

This error is raised, despite dev4 being older.

keri.kering.ConfigurationError: Database version=1.2.0-dev4 is ahead of library version=1.2.0-dev10

The reason for this is the Semver library will compare dev4 and dev10 as strings lexographically, and consider 4 bigger than 1 (ignoring the 0).

>>> semver.compare('1.2.0-dev4', '1.2.0-dev10')
1
>>> semver.compare('1.2.1', '1.2.0')
1
>>> semver.compare('1.2.0-4', '1.2.0-10')
-1

If the build number is just an integer, it works as intended as 4 < 10.

I quite like having dev in the version, so maybe could call .replace('dev', '') before semver comparing?

Steps to reproduce

  • Create an agent at a lower 1.2.0 dev tag
  • Move to a higher 1.2.0 dev tag
  • Call kli migrate on that agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

1 participant