Skip to content
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

Priority indicators: update logic to match new priority matrix #40672

Merged
merged 6 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: major
Type: changed

Issue triage: update priority matrix.
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' ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone selects both "No revenue impact" and "Platform revenue" for some reason, I note it'll ignore the latter in favor of the former. Is that intended?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an interesting use case. I don't expect anyone to pick those 2 options together, but given that "No revenue impact" is the last option in the field, I feel comfortable saying that it should top the other options you picked before that.

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;
Loading