fix: never drop a held file for a missing region

Region filtering ranked every declared file, held or not, so a request
answered only by a missing file dropped the held fallback and emptied
the slot. Only held files now decide what gives way; the missing better
match stays reported.
This commit is contained in:
Abdessamad Derraz committed 2026-10-17 18:31:56 +02:00
1 parent 5cfcb9e746
commit e6c29452f9
6 files changed
+69 -8

No files matched your search

+11
View File
@@ -877,9 +877,14 @@ def platform_region_groups(
include_all: bool = False,
required_only: bool = False,
extras_out: list[dict] | None = None,
held_out: set[str] | None = None,
) -> tuple[dict[str, list[tuple[str, str]]], dict[tuple[str, str, str], str]]:
"""Group a platform's pack candidates the way region filtering reads them.
``held_out`` receives the destinations whose file the collection holds:
a missing file is grouped so the report can withdraw it, but it never
takes the slot of a held one (resolve_region_drops).
Returns the groups and, for every core extra, the destination it was
grouped under, keyed by (emulator, name). verify.py needs that mapping to
withdraw from its report exactly what the builder withdraws from the pack:
@@ -898,6 +903,10 @@ def platform_region_groups(
)
if dest:
members.append((dest, file_entry.get("name", "")))
if held_out is not None and db is not None and resolve_local_file(
file_entry, db, dest_hint=dest
)[0]:
held_out.add(dest)
extra_dests: dict[tuple[str, str, str], str] = {}
if not include_extras or db is None:
@@ -938,6 +947,8 @@ def platform_region_groups(
groups.setdefault(group_id, []).append((dest, name))
if extras_out is not None and id(extra) in held:
extras_out.append(extra)
if held_out is not None and id(extra) in held:
held_out.add(dest)
return groups, extra_dests