purescript / registry-dev

Development work related to the PureScript Registry
https://github.com/purescript/registry
97 stars 80 forks source link

`compiler-versions` script: Compute supported compiler versions for all packages #639

Closed colinwahl closed 1 year ago

colinwahl commented 1 year ago

This PR builds on #632 and is a step towards #255. It extends to compiler-versions script with the option to compute the supported compiler versions for all packages in the manifest index.

The algorithm for finding the supported packages for a specific compiler version is the following:

  1. Topologically sort the current manifest index, initialize an empty DependencyIndex
  2. For each Manifest, try to solve via the previous DependencyIndex and then compile - if it succeeds, add the entry to the DependencyIndex, else record failure and continue

The end result is a DependencyIndex with as many entries as we could solve and then compile with that compiler version. Any Manifest not found there either didn't solve (meaning its dependencies are not supported by that compiler version) or didn't compiler (meaning its dependencies are supported by that compiler version, but that package is not). We record all entries and continue to the next compiler.

I am currently dumping results to a file and logging progress messages per entry we check. There are comprehensive debug logs. The failure results are sorted in topological order so that we can see how failures propagate throughout.

Usage:

For all packages, all compilers: GITHUB_TOKEN=xxx spago run -p registry-scripts -m Registry.Scripts.CompilerVersions -- --all-packages --all-compilers

For all packages, with a single compiler: GITHUB_TOKEN=xxx spago run -p registry-scripts -m Registry.Scripts.CompilerVersions -- --all-packages --compiler 0.13.0

For a single package, checking all compilers: GITHUB_TOKEN=xxx spago run -p registry-scripts -m Registry.Scripts.CompilerVersions -- --package prelude@3.0.0 --all-compilers

For a single package, checking a single compiler: GITHUB_TOKEN=xxx spago run -p registry-scripts -m Registry.Scripts.CompilerVersions -- --package prelude@3.0.0 --compiler 0.13.0

Future Work:

I've ran the script on 0.15.0 and 0.13.0 and the output looked fine at a glance. In the future we will need to add some verification checks (perhaps making sure the package sets for that compiler version are all included in this output), but I've left that as follow on work.

I've ran into spurious API failures while installing packages quite often, which should be alleviated by #638.

thomashoneyman commented 1 year ago

I think the algorithm is sound and I've been able to run this with the 0.15.x series and 0.14.x series of the compiler (trying 0.13.x now). Once I've verified the various CLI combinations I'll take a deeper code review. At a glance there are some lingering Debug imports we should remove.

thomashoneyman commented 1 year ago

I like the progress output, thanks for doing that!

[0.13.0 1343/10830] Checking aff-promise@2.0.0
thomashoneyman commented 1 year ago

It's taking a very long time to verify the 0.13.0 compiler, but so far I'm about 7,000 package versions in and no random failures (with #638 included on top of this code).