Skip to content

Commit 05feb90

Browse files
wwwillchenclaude
authored andcommitted
Extend deflake-e2e-recent-commits to scan PRs by wwwillchen/wwwillchen-bot (dyad-sh#2647)
## Summary - Extends the `deflake-e2e-recent-commits` command to also gather flaky tests from open PRs authored by `wwwillchen` and `wwwillchen-bot` - Parses Playwright Test Results comments on these PRs to extract flaky test names - Provides more comprehensive coverage for deflaking efforts by combining main branch CI runs with PR-reported flakes ## Test plan - Run `/dyad:deflake-e2e-recent-commits` and verify it now scans both main branch CI runs AND open PRs by the specified authors - Verify flaky tests from PR comments are correctly parsed and added to the deflake list 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2647" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end --> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Extends deflake-e2e-recent-commits to also scan open PRs by wwwillchen and wwwillchen-bot for Playwright-reported flaky tests. This broadens coverage beyond main-branch CI and improves deflaking accuracy. - **New Features** - Lists recent open PRs by wwwillchen and wwwillchen-bot. - Parses the latest “Playwright Test Results” bot comment to extract flaky test titles. - Merges PR-derived flakes with main-branch results, de-duplicates, and notes PR sources in the summary. - Updates no-results message to include PRs (“recent commits or PRs”). <sup>Written for commit 32766d6. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Documentation-only change that broadens the data sources described for collecting flaky tests; no runtime or production code is modified. > > **Overview** > Extends the `.claude` command `deflake-e2e-recent-commits` to **collect flaky Playwright tests from two sources**: recent `main` CI `html-report` artifacts *and* the latest “Playwright Test Results” bot comment on recent open PRs authored by `wwwillchen`/`wwwillchen-bot`. > > Updates the instructions to include the PR scanning/parsing workflow, to attribute flakes by source in the final report, and to change the no-flakes message to cover “recent commits or PRs.” > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 32766d6. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c21d5e9 commit 05feb90

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

.claude/commands/dyad/deflake-e2e-recent-commits.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Deflake E2E Tests from Recent Commits
22

3-
Automatically gather flaky E2E tests from recent CI runs on the main branch and deflake them.
3+
Automatically gather flaky E2E tests from recent CI runs on the main branch and from recent PRs by wwwillchen/wwwillchen-bot, then deflake them.
44

55
## Arguments
66

@@ -44,16 +44,29 @@ Automatically gather flaky E2E tests from recent CI runs on the main branch and
4444

4545
**Note:** Some runs may not have an html-report artifact (e.g., if they were cancelled early, the merge-reports job didn't complete, or artifacts have expired past the 3-day retention period). Skip these runs and continue to the next one.
4646

47-
2. **Parse flaky tests from results:**
47+
2. **Gather flaky tests from recent PRs by wwwillchen and wwwillchen-bot:**
4848

49-
From each `results.json`, extract flaky test names. A test is flaky if:
50-
- It has multiple results (retries occurred)
51-
- The final result status is `"passed"`
52-
- At least one prior result has status `"failed"`, `"timedOut"`, or `"interrupted"`
49+
In addition to main branch CI runs, scan recent open PRs authored by `wwwillchen` or `wwwillchen-bot` for flaky tests reported in Playwright report comments.
5350

54-
The test title format is: `<spec_file.spec.ts> > <Suite Name> > <Test Name>`
51+
a. List recent open PRs by these authors:
5552

56-
Parse each title to extract the spec file (everything before the first `>`).
53+
```
54+
gh pr list --author wwwillchen --state open --limit 10 --json number,title
55+
gh pr list --author wwwillchen-bot --state open --limit 10 --json number,title
56+
```
57+
58+
b. For each PR, find the most recent Playwright Test Results comment (posted by a bot, containing "🎭 Playwright Test Results"):
59+
60+
```
61+
gh api "repos/{owner}/{repo}/issues/<pr_number>/comments" --jq '[.[] | select(.user.type == "Bot" and (.body | contains("Playwright Test Results")))] | last'
62+
```
63+
64+
c. Parse the comment body to extract flaky tests. The comment format includes a "⚠️ Flaky Tests" section with test names in backticks:
65+
- Look for lines matching the pattern: ``- `<test_title>` (passed after N retries)``
66+
- Extract the test title from within the backticks
67+
- The test title format is: `<spec_file.spec.ts> > <Suite Name> > <Test Name>`
68+
69+
d. Add these flaky tests to the overall collection, noting they came from PR #N for the summary
5770

5871
3. **Deduplicate and rank by frequency:**
5972

@@ -70,7 +83,7 @@ Automatically gather flaky E2E tests from recent CI runs on the main branch and
7083

7184
4. **Skip if no flaky tests found:**
7285

73-
If no flaky tests are found, report "No flaky tests found in recent commits" and stop.
86+
If no flaky tests are found, report "No flaky tests found in recent commits or PRs" and stop.
7487

7588
5. **Install dependencies and build:**
7689

@@ -128,7 +141,8 @@ Automatically gather flaky E2E tests from recent CI runs on the main branch and
128141
7. **Summarize results:**
129142

130143
Report:
131-
- Total flaky tests found across commits
144+
- Total flaky tests found across main branch commits and PRs
145+
- Sources of flaky tests (main branch CI runs vs. PR comments from wwwillchen/wwwillchen-bot)
132146
- Which tests were successfully deflaked
133147
- What fixes were applied to each
134148
- Which tests could not be fixed (and why)

0 commit comments

Comments
 (0)