Repository navigation
fix(interaction-harness): evidence reaches the report without a file copy inside the test - #9066
Conversation
…copy inside the test `writeEvidence` attached each file by path, so Playwright copied it into the test's output folder (a mkdir and a copyFile) inside the test. On a loaded runner that attach waited past the test's 60 s budget in 3 of about 720 runs of one proof, more than 45 s each, after the evidence file itself had been written in at most 54 ms. The host showed no I/O pressure meanwhile, and the same write and copy, repeated in a separate process for 25 minutes on the same disk, never took more than 0.36 s. Attached by body, the evidence goes to the reporter, which stores it outside the test's time, and no file work of the attachment runs in the test. The file is still written for local paths. A self-test makes the copy never return: with the path attachment it times out; by body it passes.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: The accessibility audit did not run on this pull request. It runs after merges to Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
This looks ready to approve once it leaves draft: attaching evidence by body takes the awaited mkdir and copyFile out of testInfo.attach, and the new self-test fails at its 15 s budget if a path attachment comes back. Two optional documentation touch-ups:
- The comment in
output.tssays the reporter stores the body, but this config'slistandgithubreporters only hold it in memory, so the written file is the copy CI uploads asinteraction-evidence; a failing proof's output also no longer names its PNG and JSON evidence. - The
@outputheader ofharness.interaction.browser.spec.tscould list the new proof.
[Automated review]
| // By body, not path: Playwright copies a path attachment into the | ||
| // test's output folder with file calls inside the test, and on a loaded | ||
| // runner that copy has waited past the test's whole budget. A body goes | ||
| // to the reporter, which stores it outside the test's time; the file | ||
| // above stays for local paths. |
There was a problem hiding this comment.
This config's reporters are list and, in CI, github (playwright.interaction.config.ts): they keep a body attachment in memory, print only text/* bodies for a failing test, and write nothing. So the file written above is the evidence's only persisted copy, the one CI uploads as interaction-evidence, rather than a convenience for local paths. Suggested wording: "A body goes to the reporters in memory, and none of the configured ones persists it; the file above is the copy that is kept." Attaching the written paths as one text/plain attachment would also keep a failing proof's output pointing at its PNG and JSON evidence, which it no longer names.
Maintainer impact
A proof that writes evidence can fail on a loaded runner after every check it makes has already run.
writeEvidenceattached each file by path, so Playwright copied it into the test's output folder (amkdirand acopyFile) inside the test, on the test's own timeout. Under a 3-CPU cap with 16 workers, one interaction proof timed out 4 times in 720 runs, each in its evidence step; the 3 runs with per-call timings all hung insidetestInfo.attachfor more than 45 s, afterwriteEvidencehad made the folder and written the file in at most 54 ms.Intended invariant
Evidence is still written under
test-results/interaction-evidence/for local paths and still reaches the test report; the time a test takes no longer includes copying it.Change
writeEvidenceattaches each file bybodyinstead ofpath. Playwright hands a body to the reporter, which stores it outside the test's time, so no file call of the attachment runs inside the test. The file itself is written as before.Prior art
Open pull requests searched for
writeEvidenceand fortestInfo.attach: none touch how evidence is attached.Why not just a disk stall
/proc/pressure/io, sampled every second) stayed at 3, 6 and 8 ms/s at most during the three hung attaches.writeFileSyncand afs.promises.copyFileof it, repeated every 200 ms in a separate process on the same disk for 25 minutes (7,426 pairs, beside the proof's runs): write p50 0.3 ms, p99 0.8 ms, max 190 ms; copy p50 0.8 ms, p99 2.3 ms, max 354 ms.So the copy is not slow as such; what holds it inside a busy test worker is not established, and the fix does not depend on it: by body, the attachment does no file work in the test at all.
Evidence
fs.promises.copyFilenever return, times out at its 15 s budget in Chromium and WebKit.Scope
Testing
pnpm exec playwright test --config playwright.interaction.config.ts --project chromium internal/interaction-harness/src/harness.interaction.browser.spec.tsnode internal/interaction-harness/scripts/webkit-container.mjs internal/interaction-harness/src/harness.interaction.browser.spec.tspnpm exec vitest run internal/interaction-harnessLocal gates at 5192b89: Prettier, ESLint and the harness typecheck pass on the changed files; the root build passes; the core UI suite passes; the node project passes except two process-timing cases in
packages/cli/foundation/release/cache.test.mjs, which pass when that file runs alone (34 of 34), on this head and on main; the harness browser spec passes in Chromium (52 of 52) and in WebKit apart from the backward self-test, a flake on main that #8535 fixes.