Skip to content

Commit ef93382

Browse files
committed
Puppeteer _resolve_installed_browser_path: fall back to newest mtime when no SemVer
Chromium build IDs (e.g. ``1618494``) aren't valid SemVer, so ``SemVer.parse`` returns ``None`` for all candidates. When two builds end up in the cache (typical ``chromium@latest`` reinstall flow: original build + newly-resolved ``latest``) we fell through to ``return None`` because ``parsed_candidates=[]`` and ``len(candidates) > 1``. ``provider.install('chrome', no_cache=True)`` then failed the post-install load with "Installed package did not produce runnable binary 'chrome'" — exactly the CI failure on ``test_chrome_alias_installs_real_browser_binary``. Add a deterministic fallback: sort unparseable candidates by file mtime and pick the newest, so a ``latest`` reinstall still resolves to the freshly-downloaded build instead of bailing out.
1 parent 72c1825 commit ef93382

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

abxpkg/binprovider_puppeteer.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,21 @@ def _resolve_installed_browser_path(
406406
]
407407
if parsed_candidates:
408408
return max(parsed_candidates, key=lambda item: item[0])[1]
409+
if not candidates:
410+
return None
409411
if len(candidates) == 1:
410412
return candidates[0][1]
411-
return None
413+
# Multiple cached builds but none parse as ``SemVer`` (e.g. chromium's
414+
# integer build IDs like ``1618539``). Fall back to the newest one
415+
# by file mtime so post-install lookups land on the freshly-
416+
# downloaded version rather than ``None``.
417+
candidates.sort(
418+
key=lambda item: (
419+
item[1].stat().st_mtime if item[1].exists() else 0,
420+
item[0],
421+
),
422+
)
423+
return candidates[-1][1]
412424

413425
def _refresh_symlink(self, bin_name: str, target: Path) -> Path:
414426
bin_dir = self.bin_dir

0 commit comments

Comments
 (0)