fix: choose a release asset by one rule

resolve_file picked and fetched a release asset in one step, and verify re-derived the choice in pending_release_asset, which refused any record whose size differed from a declared size. fbneo's donpachi, sfz3mix and twotiger samples declare an approximate size with no validation: an online build shipped them while verify reported them missing.

release_asset_paths now chooses on the database record under the rules declared_hash_verdict applies to bytes, and both the builder and verify call it. The builder then fetches that revision and holds its bytes to the declaration.
This commit is contained in:
Abdessamad Derraz committed 2026-11-22 02:26:45 +01:00
1 parent dd76142a9c
commit a39b1c25f3
7 files changed
+154 -108

No files matched your search

+4 -4
View File
@@ -314,7 +314,7 @@ def _resolve_for_platform(
disk and the large-file cache: verify never downloads. A frontend that
never reads the bytes takes the filename-free core's own image.
"""
from resolve.packfiles import pending_release_asset, resolve_declaration, run_is_offline
from resolve.packfiles import release_asset_paths, resolve_declaration, run_is_offline
override = slot_overrides.get(
declared_destination(file_entry)
@@ -326,9 +326,9 @@ def _resolve_for_platform(
if status in ("not_found", "hash_mismatch") and not run_is_offline():
# Not in the cache, and the release holds a copy that answers the
# declaration: an online build fetches and packs it (resolve_file).
asset = pending_release_asset(file_entry, db)
if asset:
return asset, RELEASE_ASSET_PENDING
assets = release_asset_paths(file_entry, db)
if assets:
return assets[0], RELEASE_ASSET_PENDING
if status == "not_found" and not reads_file_contents(mode):
found = agnostic_substitute(file_entry, sys_id, db, platform_profiles)
if found:
+4 -4
View File
@@ -155,15 +155,15 @@ class _EmulatorPack:
content_ids: dict[str, str | None] = field(default_factory=dict)
def pending(self, entry: dict, local_path: str | None, status: str) -> tuple[str | None, str]:
from resolve.packfiles import pending_release_asset, run_is_offline
from resolve.packfiles import release_asset_paths, run_is_offline
# Read from disk and the cache, as _resolve_for_platform does: a
# release asset the cache lacks is fetched by an online build
# (generate_emulator_pack resolves with offline=offline).
if status in ("not_found", "hash_mismatch") and not run_is_offline():
asset = pending_release_asset(entry, self.db)
if asset:
return asset, RELEASE_ASSET_PENDING
assets = release_asset_paths(entry, self.db)
if assets:
return assets[0], RELEASE_ASSET_PENDING
return local_path, status
def content_id(self, path: str | None) -> str | None:
+4 -4
View File
@@ -326,7 +326,7 @@ class ExtraResolver:
def resolve(self, fe: dict, dest: str) -> tuple[str | None, str, str]:
"""(local copy or None, resolver status, the core's disagreement)."""
from resolve.packfiles import pending_release_asset, resolve_file, run_is_offline
from resolve.packfiles import release_asset_paths, resolve_file, run_is_offline
from resolve.validation import core_size_refusal, validated_choice
local_path, status = resolve_file(
@@ -340,9 +340,9 @@ class ExtraResolver:
):
# The asset the online builder fetches in resolve_file. Its record
# answers the declaration, and there are no bytes on disk to check.
asset = pending_release_asset(fe, self.db)
if asset:
return asset, "release_asset", ""
assets = release_asset_paths(fe, self.db)
if assets:
return assets[0], "release_asset", ""
if status in ("not_found", "external", "user_provided") or not local_path:
return None, status, ""
# The cores reading a moved layout's file are found under the