fix(python): skip redundant lockfile provenance verification#9739
Conversation
Greptile SummaryThis PR skips redundant GitHub Artifact Attestation re-verification for
Confidence Score: 5/5Safe to merge β the optimization is a pure fast-path addition, the downgrade guard is intact on the skip path, and the e2e test definitively validates the new behavior. The change is well-scoped: it only alters the install_precompiled flow, the integrity flag is captured before verify_checksum can mutate the lockfile entry, and the downgrade check fires on every skip-path invocation. The extracted verify_precompiled_provenance is functionally identical to the old inlined code with one tightened comparison (PartialEq vs discriminant, safe for a unit-variant enum). The e2e test is a negative proof β it will fail loudly if the attestation API is ever contacted on the fast path. No files require special attention. Important Files Changed
Reviews (4): Last reviewed commit: "[autofix.ci] apply automated fixes" | Re-trigger Greptile |
There was a problem hiding this comment.
Code Review
This pull request refactors the Python provenance verification logic to skip re-verifying GitHub attestations when valid integrity data already exists in the lockfile, improving installation efficiency. A new end-to-end test was added to ensure this behavior. The review feedback suggests using the standard equality operator for comparing provenance types to make the code more idiomatic.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
65ae907 to
f27934d
Compare
### π Features - **(cli)** add minimum release age flag to lock and ls-remote by @risu729 in [#9269](#9269) - **(config)** add run field for hooks by @risu729 in [#9718](#9718) - **(github)** add native oauth token source by @jdx in [#9654](#9654) - **(oci)** scope build to project config by default by @jdx in [#9766](#9766) - add support for prefixed latest version queries in outdated checks by @roele in [#9767](#9767) ### π Bug Fixes - **(activate)** guard bash chpwd hook under nounset by @risu729 in [#9716](#9716) - **(backend)** date-check latest stable fast path by @risu729 in [#9650](#9650) - **(config)** parse core tool options consistently by @risu729 in [#9742](#9742) - **(exec)** propagate __MISE_DIFF so nested mise recovers pristine PATH by @jdx in [#9765](#9765) - **(forgejo)** include prereleases when opted in by @risu729 in [#9717](#9717) - **(github)** avoid caching empty release assets by @risu729 in [#9616](#9616) - **(java)** resolve lockfile URLs from metadata by @risu729 in [#9719](#9719) - **(lock)** cache unavailable github attestations by @risu729 in [#9741](#9741) - **(pipx)** preserve options when reinstalling tools by @risu729 in [#9663](#9663) - **(python)** skip redundant lockfile provenance verification by @risu729 in [#9739](#9739) - **(vfox)** run pre_uninstall hook by @risu729 in [#9662](#9662) ### π Refactor - **(schema)** extract tool options definition by @risu729 in [#9649](#9649) ### β‘ Performance - **(aqua)** bake rkyv aqua package blobs by @risu729 in [#9535](#9535) ### π¦οΈ Dependency Updates - lock file maintenance by @renovate[bot] in [#9773](#9773) ### π¦ Registry - add vector ([github:vectordotdev/vector](https://github.com/vectordotdev/vector)) by @kquinsland in [#9761](#9761) - add oc and openshift-install (http backend) by @konono in [#9669](#9669) ### New Contributors - @konono made their first contribution in [#9669](#9669) - @kquinsland made their first contribution in [#9761](#9761)
Summary
provenance = "github-attestations"for the current platformlocked_verify_provenance/paranoidas the opt-in path to force install-time re-verificationPolicy alignment
The lockfile policy from #8688 and #8901 is that repeated installs may trust the lockfile checksum after provenance has already been established, while
locked_verify_provenance/paranoidcan force a fresh cryptographic check. The lockfile stores the provenance type, not the full attestation bundle.This PR applies that same policy to
core:python: checksum + positivegithub-attestationsprovenance is enough to skip the redundant GitHub attestation API call on normal installs. Missing provenance is not treated as verified and still goes through the existing verification path.Relation to #9741
#9741 handles unavailable GitHub Artifact Attestations for the aqua/github backends. It does not cover core Python, because precompiled Python uses
src/plugins/core/python.rsrather than those backends. This PR is still needed for Python lockfiles that already contain positivegithub-attestationsprovenance.Related history
locked_verify_provenance/paranoidre-verification.Source
Tests
cargo fmtgit diff --checkCARGO_BUILD_JOBS=1 /home/risu/.cargo/bin/cargo test --bin mise plugins::core::python::testsmise run test:e2e e2e/lockfile/test_lockfile_python_skip_provenance_verifyThis PR was updated by an AI coding assistant.