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

[CT-3084] [Bug] UnparsedVersion.__lt__ is sensitive to order #8571

Closed
MichelleArk opened this issue Sep 6, 2023 · 0 comments · Fixed by #8559
Closed

[CT-3084] [Bug] UnparsedVersion.__lt__ is sensitive to order #8571

MichelleArk opened this issue Sep 6, 2023 · 0 comments · Fixed by #8559
Assignees
Labels
bug Something isn't working model_versions

Comments

@MichelleArk
Copy link
Contributor

The current implementation of UnparsedVersion.__lt__ is sensitive to the order of arguments, leading to surprising behaviour such as:

>>> from dbt.contracts.graph.unparsed import UnparsedVersion
>>> UnparsedVersion(12) < UnparsedVersion("2")
True
>>> UnparsedVersion(12) > UnparsedVersion("2")
True

This method also powers the version selection method and can lead to issues there. For example, if a model has versions [1, "2", 12], and when "2" is the latest version, version 12 is both an old and prerelease version.

@MichelleArk MichelleArk self-assigned this Sep 6, 2023
@github-actions github-actions bot changed the title UnparsedVersion.__lt__ is sensitive to order [CT-3084] UnparsedVersion.__lt__ is sensitive to order Sep 6, 2023
@MichelleArk MichelleArk added the bug Something isn't working label Sep 6, 2023
@MichelleArk MichelleArk changed the title [CT-3084] UnparsedVersion.__lt__ is sensitive to order [CT-3084] [Bug] UnparsedVersion.__lt__ is sensitive to order Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working model_versions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant