-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add isSameAuthor check when classifying flaky tests with Dr.CI (#4688)
I strengthen the `isSameHeadBranch` check to become `isSameAuthor` to avoid an FP in flaky detection when the same author submits multiple PRs of the same change. For example, * Cherry picking pytorch/pytorch#111845 * Draft PR and then submit a real PR (I remember seeing an example of this, but couldn't find the PR number now) I choose to use author email here because that's readily available in the commit info of the workflow run. The commit info, however, is not available in `torch-workflow-job` DynamoDB table which powers the search. So, an additional Rockset query is needed foreach flaky match. ### Testing ``` curl --request POST \ --url 'http://localhost:3000/api/drci/drci?prNumber=111845' \ --data 'repo=pytorch' ```
- Loading branch information
Showing
10 changed files
with
98 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { | ||
removeJobNameSuffix, | ||
isSameFailure, | ||
isSameHeadBranch, | ||
isSameAuthor, | ||
removeCancelledJobAfterRetry, | ||
} from "../lib/jobUtils"; | ||
import { JobData, RecentWorkflowsData, BasicJobData } from "lib/types"; | ||
|
@@ -55,30 +55,30 @@ describe("Test various job utils", () => { | |
).toStrictEqual("Test `run_test.py` is usable without boto3/rockset"); | ||
}); | ||
|
||
test("test isSameHeadBranch", () => { | ||
expect(isSameHeadBranch("", "")).toEqual(false); | ||
|
||
expect(isSameHeadBranch("mock-branch", "")).toEqual(false); | ||
|
||
expect(isSameHeadBranch("", "mock-branch")).toEqual(false); | ||
|
||
expect(isSameHeadBranch("mock-branch", "mock-branch")).toEqual(true); | ||
|
||
expect(isSameHeadBranch("ciflow/trunk/1", "ciflow/trunk/2")).toEqual(false); | ||
|
||
expect(isSameHeadBranch("ciflow/trunk/1", "ciflow/trunk/1")).toEqual(true); | ||
|
||
expect(isSameHeadBranch("gh/user/1/head", "gh/user/2/head")).toEqual(true); | ||
|
||
expect(isSameHeadBranch("gh/user/1/head", "gh/user/1/head")).toEqual(true); | ||
test("test isSameAuthor", async () => { | ||
const job: RecentWorkflowsData = { | ||
head_sha: "123", | ||
authorEmail: "[email protected]", | ||
// The rest doesn't matter | ||
id: "", | ||
completed_at: "", | ||
html_url: "", | ||
failure_captures: [], | ||
}; | ||
const failure: RecentWorkflowsData = { | ||
head_sha: "456", | ||
authorEmail: "[email protected]", | ||
// The rest doesn't matter | ||
id: "", | ||
completed_at: "", | ||
html_url: "", | ||
failure_captures: [], | ||
}; | ||
|
||
expect( | ||
isSameHeadBranch("gh/user/1/head", "gh/another-user/2/head") | ||
).toEqual(false); | ||
expect(await isSameAuthor(job, failure)).toEqual(true); | ||
|
||
expect( | ||
isSameHeadBranch("gh/user/1/head", "gh/another-user/1/head") | ||
).toEqual(false); | ||
failure.authorEmail = "different.author"; | ||
expect(await isSameAuthor(job, failure)).toEqual(false); | ||
}); | ||
|
||
test("test isSameFailure", () => { | ||
|
a4c39aa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
torchci – ./
torchci-fbopensource.vercel.app
torchci-git-main-fbopensource.vercel.app
hud.pytorch.org
torch-ci.com
www.torch-ci.com
hud2.pytorch.org
torchci.vercel.app