Avoid Python patch version in engine hash (Cherry-pick of #19784) #19799
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #19781 by ensuring the engine hash (as computed by calculate_engine_hash.sh) only uses the implementation, major version and minor version, not the patch version (e.g.
cpython 3 9
instead ofPython 3.9.17
. Before this, the patch version could differ between runners on CI, and that would change the engine hash, leading to jobs attempting to rebuild the engine.This is motivated by the assumption that the engine only depends on the CPython ABI version, which is the same for all patch versions, and thus having the hash change based on the patch version is unnecessary.
GitHub seems to upgrade the Python versions across runners in phases, meaning
actions/setup-python
with a version specifier of3.9
will sometimes be 3.9.17, and sometimes 3.9.18. When the the engine is built with one version, and then a test job has a different version, the test job would notice the mismatch in engine hash and start rebuilding the Rust engine. See #19780 for verification of this.This explains why CI has been failing inconsistently: sometimes we get lucky and all jobs run with the same Python version, but often we don't.
This is one approach to fixing #19781, that's probably better than #19783.
(Only one of this and #19783 needs to merge.)