test(playwright): isolate output dirs of ATR runs #11368
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.50) × (1 − Review Confidence (0.59)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 573 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 92% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.380
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #11368"
general
weight: 0.35
juan-fernandez
<!-- dd-meta {"pullId":"ace5767e-4cc9-4fed-a984-239ab4e470a7","source":"chat","resourceId":"e0b523e8-6e59-4ac5-8c24-443fbd1817d7","workflowId":"e592c63c-db46-4e3a-9bd4-6a7f672688fe","codeChangeId":"e592c63c-db46-4e3a-9bd4-6a7f672688fe","sourceType":"ap-custom-agent"} -->
What does this PR do?
getUniqueOutputDir()) tointegration-tests/playwright/playwright-atr.spec.js.PLAYWRIGHT_OUTPUT_DIRon the 17 Playwright launches in that spec that still used the defaulttest-results/directory. The value is set after any scenario env spread, and each Mocha retry gets a new directory. The existing./test-results-serial-atr-${scenario}launch is unchanged.integration-tests/ci-visibility/playwright-dynamic-atr-projects.config.jsandintegration-tests/ci-visibility/playwright-snapshot-retryability/config.jsreadoutputDir: process.env.PLAYWRIGHT_OUTPUT_DIR, so the launches that use those configs are isolated too.Motivation
Root cause. Every describe in this spec uses
createParallelIt(integration-tests/helpers/index.js, concurrency 2). Every scenario runsplaywright testfrom the same sandbox cwd.integration-tests/playwright.config.jssetsoutputDir: process.env.PLAYWRIGHT_OUTPUT_DIR, so a launch without that variable uses the sharedtest-results/directory. Playwright clears its output directory on startup and removes worker artifact directories on exit, so a sibling run can delete files a running child still needs. That child then exits before Test Optimization flushes its events, and the receiver fails with:Some failures instead reach the assertion with an empty test list, for example
AssertionError: 0 !== 2atplaywright-atr.spec.js:575and:655. Only 1 of the 18 launches in this file was isolated before this change. The same isolation fixed this symptom in sibling suites: #11096 (programmatic reruns), #11139 (test management) and #11358 (active test span).Impact (Flaky Test Management).
playwright-atr.spec.json playwright@1.38.0 and @latest, across 15 distinct failing pipelines in the last 14 days (6 on master, including today). Summed failing-test duration is about 21,900s.da05b35d7215f3e2, "playwright@1.38.0 flaky test retries finalizes dynamic ATR when an expected failure passes", attempt_to_fix_id5A946N: https://app.datadoghq.com/ci/test/flaky?query=fingerprint_fqn%3Ada05b35d7215f3e2Additional Notes
Testing
Passed (Node v24.13.0 in the Bits Code session):
node --check integration-tests/playwright/playwright-atr.spec.js, plus syntax checks of both modified configsnpm run lint:editorconfigrg -n -A 20 'playwright test' integration-tests/playwright/playwright-atr.spec.js: all 18 launches setPLAYWRIGHT_OUTPUT_DIR.Blocked (repository dependencies were not installed in the session sandbox):
npm_config_offline=true npx eslint integration-tests/playwright/playwright-atr.spec.js integration-tests/ci-visibility/playwright-dynamic-atr-projects.config.js integration-tests/ci-visibility/playwright-snapshot-retryability/config.jsexited 2 with a missing@eslint/js.PLAYWRIGHT_VERSION=oldest ./node_modules/.bin/mocha --timeout 80000 integration-tests/playwright/playwright-atr.spec.jsand thelatestvariant exited 127 because mocha was not installed.No integration runs, repeated runs or red/green reproduction were completed. CI must confirm both ESLint and the
integration-playwrightjob.Risks
Low. The change only affects test specs and fixture configs, and only where each child run writes its Playwright artifacts. Both configs previously used Playwright's default directory when the variable is unset, and that behavior stays the same.
---
Prepared in Bits Code session: https://app.datadoghq.com/code/e0b523e8-6e59-4ac5-8c24-443fbd1817d7
The dd-trace Flaky-Test ROI Recommender opened this PR via Bits Code.
---
PR by Bits - View session in Datadog
Comment @datadog to request changes