← Back to Pull requests

test(playwright): isolate output dirs of ATR runs #11368

Closed
unknown closed this pull request without merging on Nov 23, 2026 10:00 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 09:47 UTC
Author

<!-- 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?

  • Adds a call-time output-directory allocator (getUniqueOutputDir()) to integration-tests/playwright/playwright-atr.spec.js.

  • Sets a fresh PLAYWRIGHT_OUTPUT_DIR on the 17 Playwright launches in that spec that still used the default test-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.

  • Makes integration-tests/ci-visibility/playwright-dynamic-atr-projects.config.js and integration-tests/ci-visibility/playwright-snapshot-retryability/config.js read outputDir: process.env.PLAYWRIGHT_OUTPUT_DIR, so the launches that use those configs are isolated too.

  • This is a test-only change. Assertions, timeouts, retries, concurrency and skip conditions are unchanged.
  • Motivation

    Root cause. Every describe in this spec uses createParallelIt (integration-tests/helpers/index.js, concurrency 2). Every scenario runs playwright test from the same sandbox cwd. integration-tests/playwright.config.js sets outputDir: process.env.PLAYWRIGHT_OUTPUT_DIR, so a launch without that variable uses the shared test-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:

    Error: gatherPayloadsUntilChildExit: child exited with no matching payloads (after 1000ms grace period)
        at integration-tests/ci-visibility-intake.js:574
    

    Some failures instead reach the assertion with an empty test list, for example AssertionError: 0 !== 2 at playwright-atr.spec.js:575 and :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).

  • 9 flaky tests in playwright-atr.spec.js on 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.

  • Representative fingerprint: da05b35d7215f3e2, "playwright@1.38.0 flaky test retries finalizes dynamic ATR when an expected failure passes", attempt_to_fix_id 5A946N: https://app.datadoghq.com/ci/test/flaky?query=fingerprint_fqn%3Ada05b35d7215f3e2

  • Other fingerprints: 1906a74a7a2bab9d, 695b248f63b32cce, facef3fbd557381, 1a3725bf72a3650e, 1391c60c339298f9, a91ef3e99c85c680, a2086ab834cba099, 16bf12ef4de51267.
  • Additional 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 configs

  • npm run lint:editorconfig

  • rg -n -A 20 'playwright test' integration-tests/playwright/playwright-atr.spec.js: all 18 launches set PLAYWRIGHT_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.js exited 2 with a missing @eslint/js.

  • PLAYWRIGHT_VERSION=oldest ./node_modules/.bin/mocha --timeout 80000 integration-tests/playwright/playwright-atr.spec.js and the latest variant 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-playwright job.

    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

    Diff: 573 lines (+429 / -144) across 7 files Reviewer: juan-fernandez Review duration: 13m
    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
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 92% · Reviewer familiarity: 35%
    58%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Assignees
    Unassigned
    Labels
    risk: low confidence: 58.6% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.8% (MEDIUM) · Higher = larger blast radius
    49.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 58.6% · Lower = rushed or shallow review
    58.6%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.6% · Safe to merge
    20.6%