fix: count a shared destination once, filled

verify kept the worst verdict on the raw destination, the builder the first one it read. Both now key on the sanitized path and let a declaration that holds a file fill one that finds nothing.
This commit is contained in:
Abdessamad Derraz committed 2026-10-18 18:17:28 +02:00
1 parent c63a7e45b1
commit 34c8b925d7
3 files changed
+76 -10

No files matched your search

+5
View File
@@ -964,6 +964,11 @@ def generate_pack(
dedup_key,
existence_discrepancy(file_entry, local_path, platform_display),
)
if file_status.get(dedup_key) == "missing":
# An earlier declaration of this path found nothing; this
# one fills it, as verify counts it.
del file_status[dedup_key]
file_reasons.pop(dedup_key, None)
file_status.setdefault(dedup_key, "ok")
# Emulator-level validation: informational only for platform packs.
+19 -10
View File
@@ -814,6 +814,12 @@ def _mark_hidden(
return placed
def _dest_key(file_entry: dict, sys_id: str) -> str:
"""The path a declaration occupies, as the builder keys its pack."""
dest = sanitize_pack_path(file_entry.get("destination", file_entry.get("name", "")))
return dest or f"{sys_id}/{file_entry.get('name', '')}"
def _twin_index(
verify_systems: dict, db: dict, base_dest: str, zip_contents: dict,
) -> tuple[dict[str, int], dict[int, tuple[str, dict]]]:
@@ -1098,19 +1104,25 @@ def verify_platform(
if _twin_unmet(result, held_by):
continue
# Aggregate by destination
dest = file_entry.get("destination", file_entry.get("name", ""))
if not dest:
dest = f"{sys_id}/{file_entry.get('name', '')}"
# Aggregate by destination, keyed as the builder keys its pack.
# A declaration that finds nothing leaves the path to one that
# holds a file: the builder packs that file there, whatever the
# order the two are read in.
dest = _dest_key(file_entry, sys_id)
results_at.setdefault(dest, []).append(result)
required = file_entry.get("required", True)
cur = result["status"]
prev = file_status.get(dest)
hle = hle_index.get(file_entry.get("name", ""), False)
sev = compute_severity(cur, required, mode, hle)
if prev is not None and (cur == Status.MISSING) != (prev == Status.MISSING):
if cur == Status.MISSING:
continue
del file_status[dest], file_severity[dest]
prev = None
if prev is None or _STATUS_ORDER.get(cur, 0) > _STATUS_ORDER.get(prev, 0):
file_status[dest] = cur
file_required[dest] = required
hle = hle_index.get(file_entry.get("name", ""), False)
sev = compute_severity(cur, required, mode, hle)
prev_sev = file_severity.get(dest)
if prev_sev is None or _SEVERITY_ORDER.get(sev, 0) > _SEVERITY_ORDER.get(
prev_sev, 0
@@ -1192,10 +1204,7 @@ def verify_platform(
dest_to_name: dict[str, str] = {}
for sys_id, system in verify_systems.items():
for fe in system.get("files", []):
dest = fe.get("destination", fe.get("name", ""))
if not dest:
dest = f"{sys_id}/{fe.get('name', '')}"
dest_to_name.setdefault(dest, fe.get("name", ""))
dest_to_name.setdefault(_dest_key(fe, sys_id), fe.get("name", ""))
with_validation = sum(
1 for dest in file_status if dest_to_name.get(dest, "") in gt_filenames
)