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

The wrong Python version is tested when testing automatic updates #73

Open
6 tasks done
robmoss2k opened this issue Dec 10, 2024 · 5 comments
Open
6 tasks done
Labels
Bug Issues where something has happened which was not expected or intended

Comments

@robmoss2k
Copy link

Checklist

  • I confirm there are no unresolved issues reported on the Chocolatey Status page.
  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my problem.
  • I have verified this is not an issue for a specific package.
  • I have verified this issue is not security related.
  • I confirm I am using official, and not unofficial, or modified, Chocolatey products.

What You Are Seeing?

When testing automatic updates, streams are sorted lexicographically descending. This means that Python 3.9 is tested instead of Python 3.14. The same is most likely true of many packages.

What is Expected?

Python 3.14.0-a2 should be the recipient of the test install.

How Did You Get This To Happen?

  1. I created a PR against chocolatey-packages.
  2. AppVeyor shows Python 3.9 as the recipient of the test install.

System Details

  • Operating System: Windows 11
  • Windows PowerShell version: 7.4.6
  • Chocolatey CLI Version: v2.4.1
  • Chocolatey Licensed Extension version: N/A
  • Chocolatey License type: Free
  • Terminal/Emulator: Terminal

Installed Packages

I'm not sure, this is the hosted environment used for testing.

Output Log

https://ci.appveyor.com/project/chocolateycommunity/chocolatey-packages/builds/51144306

Additional Context

The problem is here. I'm not enough of a PowerShell guru to know how to test this, but I believe the fix is:

if ($res.Streams -is [HashTable]) { $streams = $streams | Sort-Object { [System.Version]::Parse($_) } -Descending }
@robmoss2k robmoss2k added the Bug Issues where something has happened which was not expected or intended label Dec 10, 2024
@TheCakeIsNaOH
Copy link
Member

When testing automatic updates, streams are sorted lexicographically descending. This means that Python 3.9 is tested instead of Python 3.14. The same is most likely true of many packages.

The names of steams are not necessarily versions, for example some packages have streams based on the release type (e.g "alpha", "beta" and "stable" steams).
https://github.com/TheCakeIsNaOH/chocolatey-packages/blob/master/looking-glass-host/update.ps1
https://github.com/chocolatey-community/chocolatey-packages/blob/master/automatic/libreoffice-streams/update.ps1

So it would not be appropriate to blindly try to parse the steam names as versions.

@robmoss2k
Copy link
Author

So it would not be appropriate to blindly try to parse the steam names as versions.

This isn't blind parsing. It's Microsoft's implementation of semantic versioning.

@Thilas
Copy link

Thilas commented Jan 6, 2025

@TheCakeIsNaOH is right, it was implemented that way for this exact reason. If the streams order matters, then the update.ps1 script should pass an OrderedDictionary instead of a HashTable.

Note that you can use the Get-Version cmdlet provided by AU (see also the AUVersion type) to parse a semver 2 like version and sort them accordingly.

@robmoss2k
Copy link
Author

Forgive me for asking the obvious question @Thilas @TheCakeIsNaOH - when is the version we test against not important? Doesn't the streams order always matter? What's the point in running a test when we update a package against an outdated version of the package that we already tested?

@Thilas
Copy link

Thilas commented Jan 8, 2025

I would rather agree on that, the streams order does always matter to me. But to avoid unnecessary breaking change at the time, it was decided to sort keys alphabetically when passing a HashTable and introduce the support for OrderedDictionary where we keep the original streams order.

My point is that you don't need to change chocolatey-au, you can fix the issue your are pointing out directly in the package, where you know best how to sort streams. That's what I do for all the packages I maintain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues where something has happened which was not expected or intended
Projects
None yet
Development

No branches or pull requests

3 participants