Skip to content

Commit

Permalink
Priority indicators: update logic to match new priority matrix (#40672)
Browse files Browse the repository at this point in the history
* Priority indicators: update logic to match new priority matrix

We now ask different questions in our issue templates:
Automattic/jetpack#40501

This commit updates the logic to match the new questions and answers. It also captures the optional extra information ("other impact(s)") an issue can have, since that info can bump the severity, and in turn the priority, of an issue.

See pfVjQF-su-p2

* Update impact wording

See Automattic/wp-calypso#97049 (comment)

* Be more explicity in final logged priority message

See Automattic/jetpack#40672 (comment)

* Support multiple potential extra details that can bump pri

See Automattic/jetpack#40672 (comment)

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/12787245820

Upstream-Ref: Automattic/jetpack@e3b32ec
  • Loading branch information
jeherve authored and matticbot committed Jan 15, 2025
1 parent f166897 commit e16d044
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 34 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [6.0.1-alpha] - unreleased
## [7.0.0-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

Expand All @@ -16,6 +16,7 @@ This is an alpha version! The changes listed here are not final.
### Changed
- AI Labeling: allow plugin-specific feature labels as well.
- Board triage: add automatic triage to Fediverse project board.
- Issue triage: update priority matrix.
- Prompt for labels: update conditions to include "[<plugin> Feature]" labels.
- Support References: send Slack message when an issue is labeled as customer report.
- Support references: stop gathering p2 comments in list of support references.
Expand Down Expand Up @@ -291,7 +292,7 @@ This is an alpha version! The changes listed here are not final.

- Initial release

[6.0.1-alpha]: https://github.com/Automattic/action-repo-gardening/compare/v6.0.0...v6.0.1-alpha
[7.0.0-alpha]: https://github.com/Automattic/action-repo-gardening/compare/v6.0.0...v7.0.0-alpha
[6.0.0]: https://github.com/Automattic/action-repo-gardening/compare/v5.1.0...v6.0.0
[5.1.0]: https://github.com/Automattic/action-repo-gardening/compare/v5.0.0...v5.1.0
[5.0.0]: https://github.com/Automattic/action-repo-gardening/compare/v4.0.0...v5.0.0
Expand Down
75 changes: 60 additions & 15 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52792,37 +52792,82 @@ const debug = __nccwpck_require__( 7197 );

/**
* Figure out the priority of the issue, based off issue contents.
* Logic follows this priority matrix: pciE2j-oG-p2
* Logic follows this priority matrix: pfVjQF-su-p2
*
* @param {string} body - The issue content.
* @return {string} Priority of issue.
*/
function findPriority( body ) {
let priority = 'TBD';

debug( `find-priority: Looking for priority indicators in issue body: ${ body }` );

// Look for priority indicators in body.
const priorityRegex =
/###\sImpact\n\n(?<impact>.*)\n\n###\sAvailable\sworkarounds\?\n\n(?<blocking>.*)\n/gm;
/###\sSite\sowner\simpact\n\n(?<impact>.*)\n\n###\sSeverity\n\n(?<severity>.*)\n\n###\sWhat\sother\simpact\(s\)\sdoes\sthis\sissue\shave\?\n\n(?<extra>.*)\n/gm;
let match;
while ( ( match = priorityRegex.exec( body ) ) ) {
const [ , impact = '', blocking = '' ] = match;
const { impact = '', extra = '' } = match.groups || {};
let { severity = '' } = match.groups || {};
const extras = extra.split( ', ' );

debug(
`find-priority: Reported priority indicators for issue: "${ impact }" / "${ blocking }"`
`find-priority: Reported priority indicators for issue: "${ impact }" / "${ severity }" / "${ extra }"`
);

if ( blocking === 'No and the platform is unusable' ) {
return impact === 'One' ? 'High' : 'BLOCKER';
} else if ( blocking === 'No but the platform is still usable' ) {
return 'High';
} else if ( blocking === 'Yes, difficult to implement' ) {
return impact === 'All' ? 'High' : 'Normal';
} else if ( blocking !== '' && blocking !== '_No response_' ) {
return impact === 'All' || impact === 'Most (> 50%)' ? 'Normal' : 'Low';
// Folks can provide additional information that can bump severity.
// We also do not want that extra information to downgrade the severity.
if ( extra !== '' && extra !== '_No response_' && ! extras.includes( 'No revenue impact' ) ) {
if (
( extras.includes( 'Individual site owner revenue' ) ||
extras.includes( 'Agency or developer revenue' ) ) &&
severity !== 'Critical'
) {
severity = 'Major';
}
// Bump severity to the max if platform revenue is impacted too.
if ( extras.includes( 'Platform revenue' ) ) {
severity = 'Critical';
}
}

const impactIndicators = {
isolated: 'Fewer than 20% of the total website/platform users',
scattered: 'Between 20% and 60% of the total website/platform users',
widespread: 'More than 60% of the total website/platform users',
};

if ( severity === 'Critical' ) {
priority = impact === impactIndicators.isolated ? 'High' : 'BLOCKER';
} else if ( severity === 'Major' ) {
if ( impact === impactIndicators.widespread ) {
priority = 'BLOCKER';
} else if ( impact === impactIndicators.scattered ) {
priority = 'High';
} else {
priority = 'Normal';
}
} else if ( severity === 'Moderate' ) {
if ( impact === impactIndicators.widespread ) {
priority = 'High';
} else if ( impact === impactIndicators.scattered ) {
priority = 'Normal';
} else {
priority = 'Low';
}
} else if ( severity !== '' && severity !== '_No response_' ) {
priority = impact === impactIndicators.widespread ? 'Normal' : 'Low';
} else {
priority = 'TBD';
}
return 'TBD';
}

debug( `find-priority: No priority indicators found.` );
return 'TBD';
debug(
`find-priority: ${
priority === 'TBD' ? 'No' : priority
} priority indicators found. Priority set to ${ priority }.`
);
return priority;
}

module.exports = findPriority;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "repo-gardening",
"version": "6.0.1-alpha",
"version": "7.0.0-alpha",
"description": "Manage Pull Requests and issues in your Open Source project (automate labelling, milestones, feedback to PR authors, ...)",
"author": "Automattic",
"license": "GPL-2.0-or-later",
Expand Down
75 changes: 60 additions & 15 deletions src/utils/parse-content/find-priority.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,82 @@ const debug = require( '../debug' );

/**
* Figure out the priority of the issue, based off issue contents.
* Logic follows this priority matrix: pciE2j-oG-p2
* Logic follows this priority matrix: pfVjQF-su-p2
*
* @param {string} body - The issue content.
* @return {string} Priority of issue.
*/
function findPriority( body ) {
let priority = 'TBD';

debug( `find-priority: Looking for priority indicators in issue body: ${ body }` );

// Look for priority indicators in body.
const priorityRegex =
/###\sImpact\n\n(?<impact>.*)\n\n###\sAvailable\sworkarounds\?\n\n(?<blocking>.*)\n/gm;
/###\sSite\sowner\simpact\n\n(?<impact>.*)\n\n###\sSeverity\n\n(?<severity>.*)\n\n###\sWhat\sother\simpact\(s\)\sdoes\sthis\sissue\shave\?\n\n(?<extra>.*)\n/gm;
let match;
while ( ( match = priorityRegex.exec( body ) ) ) {
const [ , impact = '', blocking = '' ] = match;
const { impact = '', extra = '' } = match.groups || {};
let { severity = '' } = match.groups || {};
const extras = extra.split( ', ' );

debug(
`find-priority: Reported priority indicators for issue: "${ impact }" / "${ blocking }"`
`find-priority: Reported priority indicators for issue: "${ impact }" / "${ severity }" / "${ extra }"`
);

if ( blocking === 'No and the platform is unusable' ) {
return impact === 'One' ? 'High' : 'BLOCKER';
} else if ( blocking === 'No but the platform is still usable' ) {
return 'High';
} else if ( blocking === 'Yes, difficult to implement' ) {
return impact === 'All' ? 'High' : 'Normal';
} else if ( blocking !== '' && blocking !== '_No response_' ) {
return impact === 'All' || impact === 'Most (> 50%)' ? 'Normal' : 'Low';
// Folks can provide additional information that can bump severity.
// We also do not want that extra information to downgrade the severity.
if ( extra !== '' && extra !== '_No response_' && ! extras.includes( 'No revenue impact' ) ) {
if (
( extras.includes( 'Individual site owner revenue' ) ||
extras.includes( 'Agency or developer revenue' ) ) &&
severity !== 'Critical'
) {
severity = 'Major';
}
// Bump severity to the max if platform revenue is impacted too.
if ( extras.includes( 'Platform revenue' ) ) {
severity = 'Critical';
}
}

const impactIndicators = {
isolated: 'Fewer than 20% of the total website/platform users',
scattered: 'Between 20% and 60% of the total website/platform users',
widespread: 'More than 60% of the total website/platform users',
};

if ( severity === 'Critical' ) {
priority = impact === impactIndicators.isolated ? 'High' : 'BLOCKER';
} else if ( severity === 'Major' ) {
if ( impact === impactIndicators.widespread ) {
priority = 'BLOCKER';
} else if ( impact === impactIndicators.scattered ) {
priority = 'High';
} else {
priority = 'Normal';
}
} else if ( severity === 'Moderate' ) {
if ( impact === impactIndicators.widespread ) {
priority = 'High';
} else if ( impact === impactIndicators.scattered ) {
priority = 'Normal';
} else {
priority = 'Low';
}
} else if ( severity !== '' && severity !== '_No response_' ) {
priority = impact === impactIndicators.widespread ? 'Normal' : 'Low';
} else {
priority = 'TBD';
}
return 'TBD';
}

debug( `find-priority: No priority indicators found.` );
return 'TBD';
debug(
`find-priority: ${
priority === 'TBD' ? 'No' : priority
} priority indicators found. Priority set to ${ priority }.`
);
return priority;
}

module.exports = findPriority;

0 comments on commit e16d044

Please sign in to comment.