From 27d00865d0cc5749e656668ae14f3955491c9490 Mon Sep 17 00:00:00 2001 From: Florin Bilt Date: Tue, 26 Mar 2024 16:29:35 +0200 Subject: [PATCH 1/2] Change the message from "Copy summary" to be similar to the comment 0 when filing a new regression bug --- ui/perfherder/alerts/StatusDropdown.jsx | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/ui/perfherder/alerts/StatusDropdown.jsx b/ui/perfherder/alerts/StatusDropdown.jsx index 1a2d4acc980..ff60b2daced 100644 --- a/ui/perfherder/alerts/StatusDropdown.jsx +++ b/ui/perfherder/alerts/StatusDropdown.jsx @@ -161,18 +161,35 @@ export default class StatusDropdown extends React.Component { }; copySummary = async () => { - const { filteredAlerts, alertSummary, frameworks } = this.props; + const { alertSummary, repoModel, filteredAlerts, frameworks } = this.props; const { browsertimeAlertsExtraData } = this.state; const textualSummary = new TextualSummary( frameworks, filteredAlerts, alertSummary, - true, + null, await browsertimeAlertsExtraData.enrichAndRetrieveAlerts(), ); + + const templateArgs = { + bugType: 'defect', + framework: getFrameworkName(frameworks, alertSummary.framework), + revision: alertSummary.revision, + revisionHref: repoModel.getPushLogHref(alertSummary.revision), + alertHref: `${window.location.origin}/perfherder/alerts?id=${alertSummary.id}`, + alertSummary: textualSummary.markdown, + alertSummaryId: alertSummary.id, + }; + + const templateText = + 'Perfherder has detected a {{ framework }} performance change from push [{{ revision }}]({{ revisionHref }}).\n\n{{ alertSummary }}\n\nAs author of one of the patches included in that push, we need your help to address this regression.\nDetails of the alert can be found in the [alert summary]({{ alertHref }}), including links to graphs and comparisons for each of the affected tests. Please follow our [guide to handling regression bugs](https://wiki.mozilla.org/TestEngineering/Performance/Handling_regression_bugs) and **let us know your plans within 3 business days, or the patch(es) may be backed out** in accordance with our [regression policy](https://www.mozilla.org/en-US/about/governance/policies/regressions/).\n\nIf you need the profiling jobs you can trigger them yourself from treeherder job view or ask a sheriff to do that for you.\n\nYou can run these tests on try with `./mach try perf --alert {{ alertSummaryId }}`\n\nFor more information on performance sheriffing please see our [FAQ](https://wiki.mozilla.org/TestEngineering/Performance/FAQ).\n'; + templateSettings.interpolate = /{{([\s\S]+?)}}/g; + const fillTemplate = template(templateText); + const commentText = fillTemplate(templateArgs); + // can't access the clipboardData on event unless it's done from react's // onCopy, onCut or onPaste props so using this workaround - navigator.clipboard.writeText(textualSummary.markdown).then(() => {}); + navigator.clipboard.writeText(commentText).then(() => {}); }; toggle = (state) => { From c22ebf14f952628b9a7a696056cd27524da284cb Mon Sep 17 00:00:00 2001 From: Florin Bilt Date: Wed, 27 Mar 2024 15:58:40 +0200 Subject: [PATCH 2/2] Added specific messages for regression and improvement. --- ui/perfherder/alerts/StatusDropdown.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/perfherder/alerts/StatusDropdown.jsx b/ui/perfherder/alerts/StatusDropdown.jsx index ff60b2daced..a267f391051 100644 --- a/ui/perfherder/alerts/StatusDropdown.jsx +++ b/ui/perfherder/alerts/StatusDropdown.jsx @@ -180,9 +180,13 @@ export default class StatusDropdown extends React.Component { alertSummary: textualSummary.markdown, alertSummaryId: alertSummary.id, }; + const containsRegression = textualSummary.alerts.some( + (item) => item.is_regression === true, + ); + const templateText = containsRegression + ? 'Perfherder has detected a {{ framework }} performance change from push [{{ revision }}]({{ revisionHref }}).\n\n{{ alertSummary }}\n\nAs author of one of the patches included in that push, we need your help to address this regression.\nDetails of the alert can be found in the [alert summary]({{ alertHref }}), including links to graphs and comparisons for each of the affected tests. Please follow our [guide to handling regression bugs](https://wiki.mozilla.org/TestEngineering/Performance/Handling_regression_bugs) and **let us know your plans within 3 business days, or the patch(es) may be backed out** in accordance with our [regression policy](https://www.mozilla.org/en-US/about/governance/policies/regressions/).\n\nIf you need the profiling jobs you can trigger them yourself from treeherder job view or ask a sheriff to do that for you.\n\nYou can run these tests on try with `./mach try perf --alert {{ alertSummaryId }}`\n\nFor more information on performance sheriffing please see our [FAQ](https://wiki.mozilla.org/TestEngineering/Performance/FAQ).\n' + : 'Perfherder has detected a {{ framework }} performance change from push [{{ revision }}]({{ revisionHref }}).\n\n{{ alertSummary }}\n\nDetails of the alert can be found in the [alert summary]({{ alertHref }}), including links to graphs and comparisons for each of the affected tests.\n\nIf you need the profiling jobs you can trigger them yourself from treeherder job view or ask a sheriff to do that for you.\n\nYou can run these tests on try with `./mach try perf --alert {{ alertSummaryId }}`\n\nFor more information on performance sheriffing please see our [FAQ](https://wiki.mozilla.org/TestEngineering/Performance/FAQ).\n'; - const templateText = - 'Perfherder has detected a {{ framework }} performance change from push [{{ revision }}]({{ revisionHref }}).\n\n{{ alertSummary }}\n\nAs author of one of the patches included in that push, we need your help to address this regression.\nDetails of the alert can be found in the [alert summary]({{ alertHref }}), including links to graphs and comparisons for each of the affected tests. Please follow our [guide to handling regression bugs](https://wiki.mozilla.org/TestEngineering/Performance/Handling_regression_bugs) and **let us know your plans within 3 business days, or the patch(es) may be backed out** in accordance with our [regression policy](https://www.mozilla.org/en-US/about/governance/policies/regressions/).\n\nIf you need the profiling jobs you can trigger them yourself from treeherder job view or ask a sheriff to do that for you.\n\nYou can run these tests on try with `./mach try perf --alert {{ alertSummaryId }}`\n\nFor more information on performance sheriffing please see our [FAQ](https://wiki.mozilla.org/TestEngineering/Performance/FAQ).\n'; templateSettings.interpolate = /{{([\s\S]+?)}}/g; const fillTemplate = template(templateText); const commentText = fillTemplate(templateArgs);