Skip to content

fix(interaction-harness): evidence reaches the report without a file copy inside the test - #9066

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:harness/evidence-attach-by-body
Oct 31, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:harness/evidence-attach-by-body

Conversation

@vjeux

@vjeux vjeux commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Maintainer impact

A proof that writes evidence can fail on a loaded runner after every check it makes has already run. 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 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 inside testInfo.attach for more than 45 s, after writeEvidence had 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

writeEvidence attaches each file by body instead of path. 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 writeEvidence and for testInfo.attach: none touch how evidence is attached.

Why not just a disk stall

  • Host I/O pressure (/proc/pressure/io, sampled every second) stayed at 3, 6 and 8 ms/s at most during the three hung attaches.
  • The same pair of calls, a fresh 30 KB writeFileSync and a fs.promises.copyFile of 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

  • Failure before the change: the new self-test, which makes fs.promises.copyFile never return, times out at its 15 s budget in Chromium and WebKit.
  • Success after the change: the self-test passes in both engines (5 of 5 each), and the storyboard self-tests, which attach PNG buffers, pass.
  • Product/runtime behavior verified unchanged: no product code is touched; the harness browser spec passes in Chromium and WebKit, and the harness unit tests pass.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm exec playwright test --config playwright.interaction.config.ts --project chromium internal/interaction-harness/src/harness.interaction.browser.spec.ts
  • node internal/interaction-harness/scripts/webkit-container.mjs internal/interaction-harness/src/harness.interaction.browser.spec.ts
  • pnpm exec vitest run internal/interaction-harness

Local 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.

…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.
@vercel

vercel Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 30, 2026 10:34pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 30, 2026
@astracat-bot

astracat-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 30, 2026, 10:51 PM UTC

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: The accessibility audit did not run on this pull request. It runs after merges to main and before each release; pull requests that touch components run it with the ci:heavy-lanes label.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts says the reporter stores the body, but this config's list and github reporters only hold it in memory, so the written file is the copy CI uploads as interaction-evidence; a failing proof's output also no longer names its PNG and JSON evidence.
  • The @output header of harness.interaction.browser.spec.ts could list the new proof.

[Automated review]

Comment on lines +55 to +59
// 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Oct 31, 2026
@cixzhang
cixzhang marked this pull request as ready for review October 31, 2026 02:33
@cixzhang
cixzhang merged commit e03042b into meta:main Oct 31, 2026
136 of 140 checks passed
@vjeux
vjeux deleted the harness/evidence-attach-by-body branch October 31, 2026 04:34

This branch was successfully deployed

1 active deployment
Preview — 5192b89b Deployed Oct 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants