Fix Linux prebuilt installs for branch-based llama.cpp releases (#5493)
* allow validation of custom releases to pass * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * require exact source provenance for branch direct linux releases Mirror validated_checksums_for_bundle so incomplete checksum metadata on a branch/pull/commit release fails closed with a clear error instead of silently degrading to the legacy master-as-tag source hydration path that this PR is meant to eliminate. Guard fires when source_commit, the exact source archive hash, or a derivable source repo URL is missing from the approved metadata. Also set plan.llama_tag to approved_checksums.upstream_tag so the ensure_converter_scripts fallback and the install fingerprint target the concrete upstream tag (e.g. b9174) rather than the moving branch label inferred from asset names (master). Legacy b#### releases are unaffected: synthetic checksums already set upstream_tag to bundle.upstream_tag, so the swap is a no-op on that path. Add parametrized negative regression coverage for the three ways exact provenance can be incomplete (missing source_commit, missing exact source archive entry, missing source_repo) and update the existing branch happy-path test to expect b9174. * revert llama_tag swap to preserve install identity Keep plan.llama_tag as bundle.upstream_tag (the branch label inferred from asset names, e.g. master) rather than overriding it with the approved metadata upstream tag (b9174). The override broke install identity in two ways: 1. expected_install_fingerprint hashes upstream_tag = llama_tag, so the same release would produce a different fingerprint depending on which version of this code resolved it, causing spurious reinstalls when users upgrade or roll back. 2. UNSLOTH_PREBUILT_INFO.json reports the value as the user-visible record of which release was installed; tools and logs should see the requested branch label, not the compatibility tag. The approved metadata still records upstream_tag = b9174 internally for source archive lookup; the new assertion makes that explicit. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Daniel Han <danielhanchen@gmail.com>
This commit is contained in:
parent
36ea02ea81
commit
77c8d80a85
2 changed files with 298 additions and 6 deletions
|
|
@ -1273,16 +1273,36 @@ def direct_linux_release_plan(
|
|||
attempts.append(cpu_choice)
|
||||
if not attempts:
|
||||
raise PrebuiltFallback("no compatible Linux prebuilt asset was found")
|
||||
approved_checksums = synthetic_checksums_for_release(
|
||||
repo,
|
||||
bundle.release_tag,
|
||||
bundle.upstream_tag,
|
||||
)
|
||||
resolved_upstream_tag = bundle.upstream_tag
|
||||
if DEFAULT_PUBLISHED_SHA256_ASSET in bundle.assets and not is_release_tag_like(
|
||||
bundle.upstream_tag
|
||||
):
|
||||
approved_checksums = load_approved_release_checksums(repo, bundle.release_tag)
|
||||
# Require exact source provenance for branch/pull/commit releases.
|
||||
# Mirrors validated_checksums_for_bundle so incomplete metadata
|
||||
# fails closed instead of degrading to the legacy branch-as-tag
|
||||
# source hydration path that this PR is meant to eliminate.
|
||||
if (
|
||||
not approved_checksums.source_commit
|
||||
or exact_source_archive_hash(approved_checksums) is None
|
||||
or source_clone_url_from_checksums(approved_checksums) is None
|
||||
):
|
||||
raise PrebuiltFallback(
|
||||
f"approved checksum asset {DEFAULT_PUBLISHED_SHA256_ASSET} for "
|
||||
f"{repo}@{bundle.release_tag} did not contain exact source provenance"
|
||||
)
|
||||
attempts = apply_approved_hashes(attempts, approved_checksums)
|
||||
return InstallReleasePlan(
|
||||
requested_tag = requested_tag,
|
||||
llama_tag = bundle.upstream_tag,
|
||||
llama_tag = resolved_upstream_tag,
|
||||
release_tag = bundle.release_tag,
|
||||
attempts = attempts,
|
||||
approved_checksums = synthetic_checksums_for_release(
|
||||
repo,
|
||||
bundle.release_tag,
|
||||
bundle.upstream_tag,
|
||||
),
|
||||
approved_checksums = approved_checksums,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue