Skip to content

fix: ordering of dev and post components#2299

Open
JeanChristopheMorinPerso wants to merge 1 commit intoconda:mainfrom
JeanChristopheMorinPerso:fix/cep33-devdev-ordering
Open

fix: ordering of dev and post components#2299
JeanChristopheMorinPerso wants to merge 1 commit intoconda:mainfrom
JeanChristopheMorinPerso:fix/cep33-devdev-ordering

Conversation

@JeanChristopheMorinPerso
Copy link
Copy Markdown
Contributor

@JeanChristopheMorinPerso JeanChristopheMorinPerso commented Mar 29, 2026

Description

This PR fixes a small bug with dev and post components in versions that I found while working on adding version interval ranges support to rattler.

Basically, I found that rattler was considering a version 1.2devdev to be smaller than 1.2dev. This I think is wrong based on https://github.com/conda/ceps/blob/main/cep-0033.md and conda.models.version.VersionOrder agrees with that.

The same problem also happened with the post component, but in reverse.

>>> import rattler
>>> rattler.Version('1.2dev') < rattler.Version('1.2devdev')
False
>>> rattler.Version('1.2post') > rattler.Version('1.2postpost')
False

while in conda:

>>> conda.models.version.VersionOrder('1.2dev') < conda.models.version.VersionOrder('1.2devdev')
True
>>> conda.models.version.VersionOrder('1.2post') > conda.models.version.VersionOrder('1.2postpost')
True

The problem seem to stem from the fact that tag_no_case kind of matched on the prefix, I think. I'm still very new to rust, so I might be wrong. But the fix seems legit to me.

The docs on tag_no_case say (emphasis mine):

will return the part of the input that matches the argument with no regard to case.

(https://docs.rs/nom/latest/nom/bytes/fn.tag_no_case.html)

How Has This Been Tested?

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: Amp (see https://ampcode.com/threads/T-019d36ed-fd10-7368-b400-481c3646f900, in this case it used gpt 5.4 in its deepest thinking mode)

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added sufficient tests to cover my changes.

Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
@JeanChristopheMorinPerso JeanChristopheMorinPerso changed the title Fix ordering of dev and post components fix: ordering of dev and post components Mar 29, 2026
}

#[test]
fn dev_is_only_special_for_exact_runs() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we also have checks to see if something is a dev version? Maybe we can assert those too here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants