Repository navigation
Deal the Linux web e2e shards by recorded test durations - #597
Merged
Merged
Conversation
yansfil
added a commit
that referenced
this pull request
Oct 6, 2026
Part of #561 ## Summary #597 deals the web e2e shards by recorded durations; its review found that a shard could run fewer tests than planned, or none, and stay green. This makes the step prove what it runs. - The shard file is written as UTF-8 bytes. Through a Windows runner's cp1252 stdout `›` was one byte Playwright read as no delimiter, so no test matched, and Playwright counts a `--test-list` that matches nothing as a pass. - `web-e2e-shard.py check` runs after the split: it fails the step unless `playwright test --list --test-list <shard file>` lists exactly the tests `split` planned, with one line saying how many matched nothing. - A problem with the list, the table or the plan is one line and exit status 1, never a traceback. - A `grep` that leaves fewer tests than shards leaves the extra shards an empty file and an early end, as the old `--shard` did, instead of a failure. - `durations --list` keeps only listed tests, takes a passing retry as its test, and reads a Windows runner's `ok` mark, so a refresh needs no hand pruning. - The balance claim became a report: the plan warns (first shard only) when listed tests are missing from the table or the heaviest shard is over 15 % above the mean, and docs/TESTING.md and CONTRIBUTING.md say what is dealt and what is not measured. ## Review - **판단해 주세요**: the duration table stays a Linux recording; only the pull request's Linux lane deals by it now that the nightly runs one shard per system (#566), so the macOS and Windows balance claim is removed, not measured. - **조심해서 볼 파일**: `.github/workflows/web-e2e.yml` - the step lists twice per shard (full, then `--test-list`) and `check` compares them; a mismatch fails the step. - **조심해서 볼 파일**: `scripts/web-e2e-shard.py` - `emit` writes bytes to `stdout.buffer`, `read` decodes UTF-8 explicitly. - **질문**: review item 6 (list once in the `build` job and hand shard files to the shards) is not done: it saves about 2 seconds of cold TypeScript load per shard and moves the list into an artifact, which this change does not need. ## Evidence - **확인한 것**: `python3 -m unittest discover -s scripts/tests` passes (160 tests); new ones run the script with `PYTHONIOENCODING=cp1252` and assert the shard file is exactly the UTF-8 bytes, `check` passes and fails (nothing matched, unplanned tests selected, empty shard), inputs fail as one line without `Traceback`, and the table names only `file › title` keys of existing specs. - **확인한 것**: against the real suite, `split`, `playwright --list --test-list` and `check` pass for all four shards (44, 47, 43 and 45 tests, 179 in all); a shard file naming a test that does not exist fails `check` with "would run 0 tests, not the 44 planned". - **확인한 것**: a one-test `grep` over four shards gives shard 1 the test and shards 2 to 4 an empty file. - **확인한 것**: the committed table is unchanged by the new parser: regenerated from the same 118 logs with `durations --list` it is identical (179 tests). - **확인하지 못한 것**: a Windows runner. The encoding is covered by a cp1252 run on macOS and the `ok` mark by a log line; the real Windows nightly runs one shard per lane, so this path does not run there today.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of with-hide/hide-private#100
Summary
Playwright's
--shardcuts the tests in file order into runs of equal count, and a test takes 1 to 60 seconds, so the four Linux shards of run37402687007took 6.1, 11.0, 8.7 and 10.2 minutes; the slowest shard sets the run's wall time.A shard of a lane with more than one shard now runs the tests
scripts/web-e2e-shard.py splitdeals it: each test weighs its recorded seconds fromweb/e2e/shard-durations.json, longest first into the lightest shard.--test-list, so retries, the flaky report and--grepare unchanged; the nightly's macOS and Windows shards use the same table.Review
.github/workflows/web-e2e.yml- theEnd-to-endstep lists, splits and passes--test-list; a failed list or split fails the step, never runs none.scripts/web-e2e-shard.py- the title key drops a run line's tags (@platform) so a listed test and a logged test name the same entry.Evidence
python3 -m unittest discover -s scripts/testspasses (149 tests); 13 new ones cover the split on a fixed list, one shard per test whatever the table knows, the median for a new test, a shard with no test failing, and the committed table dealing four shards within 5 % of each other.playwright test --list --test-listfor the four shards lists 44, 47, 43 and 45 tests, 179 in all, the whole suite once.verify(run 37405118763, all four Linux shards, all tests passed) took 9.2, 9.2, 8.9 and 9.6 minutes against 6.1, 11.0, 8.7 and 10.2 before: the slowest shard drops 1.4 minutes and the spread from 4.9 to 0.7 minutes. One run on a shared runner pool, so the gain in median wall time is not measured here.