-
Notifications
You must be signed in to change notification settings - Fork 105
[HUD] Display on hud table the autorevert decisions #7304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jeanschmidt
wants to merge
8
commits into
main
Choose a base branch
from
jeanschmidt/hud_revert_info
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+420
−12
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e29c350
[AUTOREVERT] OOPS, test code leaking to production
jeanschmidt 3bf017d
Merge branch 'main' of https://github.com/pytorch/test-infra into jea…
jeanschmidt 1c6faa9
[HUD] Display on hud table the autorevert decisions
jeanschmidt 474eac7
20251006184840
jeanschmidt b7cb9e2
[HUD] fix lint
jeanschmidt eeda2db
20251006185513
jeanschmidt d09683f
20251006185738
jeanschmidt 879fbe4
20251006190956
jeanschmidt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"params": { | ||
"repo": "String", | ||
"shas": "Array(String)" | ||
}, | ||
"tests": [ | ||
{ | ||
"repo": "pytorch/pytorch", | ||
"shas": ["abc123", "def456"] | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SELECT | ||
commit_sha, | ||
groupArray(workflows) as all_workflows, | ||
groupArray(source_signal_keys) as all_source_signal_keys | ||
FROM misc.autorevert_events_v2 | ||
WHERE repo = {repo: String} | ||
AND action = 'revert' | ||
AND dry_run = 0 | ||
AND failed = 0 | ||
AND commit_sha IN {shas: Array(String)} | ||
GROUP BY commit_sha |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"params": { | ||
"repo": "String", | ||
"sha": "String" | ||
}, | ||
"tests": [ | ||
{ | ||
"repo": "pytorch/pytorch", | ||
"sha": "321e60abc123" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
SELECT | ||
commit_sha, | ||
workflows, | ||
source_signal_keys, | ||
ts | ||
FROM misc.autorevert_events_v2 | ||
WHERE | ||
repo = {repo: String} | ||
AND commit_sha = {sha: String} | ||
AND action = 'revert' | ||
AND dry_run = 0 | ||
AND failed = 0 | ||
ORDER BY ts DESC |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
.autorevertBanner { | ||
background-color: var(--sev-banner-bg); | ||
border: 2px solid var(--autoreverted-signal-border); | ||
border-radius: 8px; | ||
padding: 16px; | ||
margin: 16px 0; | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.bannerHeader { | ||
display: flex; | ||
align-items: center; | ||
gap: 8px; | ||
margin-bottom: 12px; | ||
font-size: 1.1em; | ||
} | ||
|
||
.warningIcon { | ||
font-size: 1.2em; | ||
} | ||
|
||
.bannerContent { | ||
color: var(--text-color); | ||
} | ||
|
||
.bannerContent p { | ||
margin: 8px 0; | ||
} | ||
|
||
.workflowList { | ||
margin: 12px 0; | ||
padding-left: 24px; | ||
} | ||
|
||
.workflowList li { | ||
margin: 6px 0; | ||
list-style-type: disc; | ||
} | ||
|
||
.workflowList a { | ||
color: var(--link-color); | ||
text-decoration: none; | ||
} | ||
|
||
.workflowList a:hover { | ||
text-decoration: underline; | ||
} | ||
|
||
.investigateMessage { | ||
font-style: italic; | ||
margin-top: 12px; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
import useSWR from "swr"; | ||
import styles from "./AutorevertBanner.module.css"; | ||
|
||
interface AutorevertDetails { | ||
commit_sha: string; | ||
workflows: string[]; | ||
source_signal_keys: string[]; | ||
job_ids: number[]; | ||
job_base_names: string[]; | ||
wf_run_ids: number[]; | ||
created_at: string; | ||
} | ||
|
||
interface SignalInfo { | ||
workflow_name: string; | ||
signals: Array<{ | ||
key: string; | ||
job_url?: string; | ||
hud_url?: string; | ||
}>; | ||
} | ||
|
||
export function AutorevertBanner({ | ||
repoOwner, | ||
repoName, | ||
sha, | ||
}: { | ||
repoOwner: string; | ||
repoName: string; | ||
sha: string; | ||
}) { | ||
const { data: autorevertData, error } = useSWR<AutorevertDetails>( | ||
`/api/autorevert/${repoOwner}/${repoName}/${sha}`, | ||
async (url) => { | ||
try { | ||
const response = await fetch(url); | ||
|
||
if (response.status === 404) { | ||
// No autorevert data for this commit | ||
return null; | ||
} | ||
|
||
if (!response.ok) { | ||
const errorText = await response.text(); | ||
throw new Error(`Failed to fetch: ${response.status} - ${errorText}`); | ||
} | ||
|
||
const data = await response.json(); | ||
return data; | ||
} catch (e) { | ||
// Silently fail - no autorevert data | ||
return null; | ||
} | ||
}, | ||
{ | ||
refreshInterval: 0, // Don't refresh autorevert data | ||
} | ||
); | ||
|
||
// Don't show banner if no data or error | ||
if (!autorevertData) { | ||
return null; | ||
} | ||
|
||
// Handle case where arrays might be undefined or have different structure | ||
const workflows = autorevertData.workflows || []; | ||
const sourceSignalKeys = autorevertData.source_signal_keys || []; | ||
const jobIds = autorevertData.job_ids || []; | ||
const wfRunIds = autorevertData.wf_run_ids || []; | ||
const jobBaseNames = autorevertData.job_base_names || []; | ||
|
||
// If no workflows data, don't show the banner | ||
if (!workflows.length) { | ||
return null; | ||
} | ||
|
||
// Group signals by workflow | ||
const signalsByWorkflow = new Map<string, SignalInfo>(); | ||
|
||
workflows.forEach((workflow, idx) => { | ||
if (!signalsByWorkflow.has(workflow)) { | ||
signalsByWorkflow.set(workflow, { | ||
workflow_name: workflow, | ||
signals: [], | ||
}); | ||
} | ||
|
||
const signalKey = sourceSignalKeys[idx] || ""; | ||
|
||
const signal = { | ||
key: signalKey, | ||
// Since we don't have job IDs in the table, we can't create direct job links | ||
job_url: undefined, | ||
// Try to create a HUD URL using the signal key as a filter | ||
hud_url: signalKey | ||
? `/hud/${repoOwner}/${repoName}/main?nameFilter=${encodeURIComponent( | ||
signalKey | ||
)}` | ||
: undefined, | ||
}; | ||
|
||
signalsByWorkflow.get(workflow)!.signals.push(signal); | ||
}); | ||
|
||
return ( | ||
<div className={styles.autorevertBanner}> | ||
<div className={styles.bannerHeader}> | ||
<span className={styles.warningIcon}>⚠️</span> | ||
<strong>This commit was automatically reverted</strong> | ||
</div> | ||
<div className={styles.bannerContent}> | ||
<p>This PR is attributed to have caused regression in:</p> | ||
<ul className={styles.workflowList}> | ||
{Array.from(signalsByWorkflow.values()).map((workflowInfo) => ( | ||
<li key={workflowInfo.workflow_name}> | ||
<strong>{workflowInfo.workflow_name}:</strong>{" "} | ||
{workflowInfo.signals.map((signal, idx) => ( | ||
<span key={idx}> | ||
{idx > 0 && ", "} | ||
<span>{signal.key}</span> | ||
</span> | ||
))} | ||
</li> | ||
))} | ||
</ul> | ||
<p className={styles.investigateMessage}> | ||
You can add the label <code>autorevert: disable</code> to disable | ||
autorevert for a specific PR. | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
} |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
accidental change?
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.
no tried to fix, but the message is not correct, I can remove the change