Repository navigation
[ED-25748] Fix: Healer includes hard failures from earlier attempts of re-run evidence runs - #68
Draft
Svitlana-Dykun wants to merge 2 commits into
Draft
Svitlana-Dykun wants to merge 2 commits into
Svitlana-Dykun wants to merge 2 commits into
Conversation
…idence runs When a workflow run is re-run, GitHub increments the run_attempt number but keeps the same run ID. Artifacts and jobs belong to specific attempts, and the healer was only considering the latest attempt when: - Collecting hard failures from job logs - Searching for test evidence artifacts - Downloading artifacts for verification This caused the healer to miss tests that failed hard in an earlier attempt but not in the latest one, or whose artifacts only existed in an earlier attempt. Changes: - Add run-attempts.js module to query and aggregate data across all attempts - Update collect-log-hard-failures.js to collect from all attempts' job logs - Update find-test-evidence.js to consider artifacts from all attempts, preferring trace-backed evidence and later attempts when choosing - Update restore-nightly-playwright-builds.js to handle duplicate artifact names by selecting the latest attempt's version - Update tests to account for attempt field in evidence candidates - Log which attempts are being scanned for better observability The healer now treats any test that failed hard in ANY attempt of the evidence run as a healing candidate, and correctly downloads artifacts by their unique ID rather than by name to avoid ambiguity with re-runs. Ref: ED-25748 Co-authored-by: Svitlana-Dykun <Svitlana-Dykun@users.noreply.github.com>
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
Improves evidence selection to be attempt-aware: when searching for evidence for a specific test, we now query job logs to determine which attempt(s) the test actually failed in, and prioritize artifacts from those attempts. This handles the scenario where a test fails in attempt 1 but passes in attempt 2 (or doesn't run). Previously, we would prefer attempt 2's artifacts (latest attempt), which wouldn't contain evidence for the failure. Now we correctly use evidence from the attempt where the test actually failed. Changes: - Add collectHardFailuresWithAttempts() to track which attempts each test failed in (returns Map<testName, attempt[]>) - Update findEvidenceInRun() to query job logs and prefer artifacts from attempts where the test failed - When test failed in multiple attempts, use the latest failed attempt - Fall back to other attempts only if the failed attempt has no artifacts - Add parseHardFailureTitles export for testing - Add tests for 'failed in attempt 1, passed in attempt 2' scenario - Add tests for parseHardFailureTitles function Test results: All 359 tests pass (6 new tests added) The restore-nightly-playwright-builds.js change is kept because it's needed to handle duplicate build artifact names when downloading from re-runs. Using downloadArtifactById() instead of 'gh run download -n <name>' prevents failures when the same artifact name exists in multiple attempts. Ref: ED-25748 Co-authored-by: Svitlana-Dykun <Svitlana-Dykun@users.noreply.github.com>
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.
Summary
Fixes the test healer missing hard failures from earlier attempts when an evidence run was re-run. When a GitHub Actions workflow run is re-run, the run ID stays the same but the attempt number increments. Previously, the healer only considered the latest attempt, missing tests that failed in earlier attempts.
Problem
The Playwright test healer in auto mode was only considering the latest attempt of the evidence workflow run. When the evidence run was re-run:
This meant healing candidates were being overlooked.
Solution
Created a new
run-attempts.jsmodule that:Updated the healer scripts to:
How Attempt/Artifact Selection Works
Evidence Selection (Key Refinement)
When searching for evidence for a specific test:
This correctly handles scenarios like:
Artifact Download
When multiple attempts exist:
workflow_run.run_attemptThe healer prefers:
Why restore-nightly-playwright-builds.js Was Changed
The
restore-nightly-playwright-builds.jschange is necessary for this fix. When downloading build artifacts by name from a re-run usinggh run download -n <artifact-name>, the command fails or gets confused when multiple artifacts with the same name exist across attempts.By switching to
downloadArtifactById(), we:Without this change, the healer would fail to restore builds from re-run evidence runs, preventing verification even when the fix is correct.
Testing
find-test-evidence.test.jsto include attempt fieldcollect-log-hard-failures.test.jswith tests forparseHardFailureTitlesrun-attempts.test.jsJira
https://elementor.atlassian.net/browse/ED-25748