fix(chrome): sort Playwright Chromium by revision, not lexically#74
fix(chrome): sort Playwright Chromium by revision, not lexically#74nsiddharth wants to merge 1 commit into
Conversation
|
@nsiddharth is attempting to deploy a commit to the andylizf's projects Team on Vercel. A member of the Team first needs to authorize it. |
andylizf
left a comment
There was a problem hiding this comment.
The sort fix is correct — lexicographic sort breaks when Playwright revisions cross the 3→4 digit boundary (e.g. chromium-999 > chromium-1208). The _playwright_revision helper + test look good.
However, like #73, this PR is based on an older main and carries a large number of unrelated regressions (removes --cdp-url, --user-data-dir isolation, pre-commit hooks, reverts production URLs, etc.).
Could you rebase onto the latest origin/main so the PR contains only the chrome.py sort fix + test?
git fetch upstream main
git rebase upstream/main
git push --force-with-lease_candidate_chrome_paths sorted Playwright's chromium-* matches as strings (reverse=True), so once a revision crosses the 3->4 digit boundary "chromium-999" ranks above "chromium-1187" and find_chrome() returns an older browser than intended. Sort by the integer revision instead.
872bed3 to
0d12ed6
Compare
|
Thanks for the review! Rebased onto the latest |
What
_candidate_chrome_pathssorts Playwright'schromium-*browserdirectories lexicographically:
The comment promises "Newest chromium-NNNN first," but a string sort
breaks that contract once the revision crosses the 3→4 digit boundary:
"chromium-999"ranks above"chromium-1187". Sincefind_chrome()returns the first valid match, the resolver then silently selects an
older Chromium than the one the user just installed.
This triggers whenever two or more Playwright Chromium revisions are
cached and straddle that boundary — a normal state after
playwright installupgrades, which leave older revisions in place.Fix
Sort by the integer revision parsed from
chromium-<n>instead of bystring. Paths without a recognizable revision sort last (
-1) ratherthan raising.
Test
Adds
test_playwright_chromium_sorted_by_revision_not_lexically, whichfeeds
chromium-999,chromium-1187,chromium-1208and asserts thecandidate list is newest-first. It fails on the old lexicographic sort
(
chromium-999landed first) and passes with this change. The existingchrome-path tests are unaffected (
6 passed).