refactor: make production gate impact only
Memind CI / Test, build, and release guards (push) Has been cancelled
Memind CI / Test, build, and release guards (push) Has been cancelled
This commit is contained in:
+18
-5
@@ -137,9 +137,18 @@ function validateImpactSelection(report, scenarioIds, errors) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection.policy_version !== 1) errors.push('impact policy_version must be 1');
|
||||
if (!['core', 'impact', 'full'].includes(selection.strategy)) {
|
||||
errors.push('impact strategy must be core, impact, or full');
|
||||
if (![1, 2].includes(selection.policy_version)) {
|
||||
errors.push('impact policy_version must be 1 or 2');
|
||||
}
|
||||
const allowedStrategies = selection.policy_version === 2
|
||||
? ['core', 'impact']
|
||||
: ['core', 'impact', 'full'];
|
||||
if (!allowedStrategies.includes(selection.strategy)) {
|
||||
errors.push(
|
||||
selection.policy_version === 2
|
||||
? 'impact strategy must be core or impact'
|
||||
: 'impact strategy must be core, impact, or full',
|
||||
);
|
||||
}
|
||||
if (!/^[0-9a-f]{40}$/i.test(selection.base_commit ?? '')) {
|
||||
errors.push('impact base_commit must be a full SHA');
|
||||
@@ -177,8 +186,12 @@ function validateImpactSelection(report, scenarioIds, errors) {
|
||||
if (selection.strategy === 'impact' && selection.impact_groups?.length === 0) {
|
||||
errors.push('impact report must contain at least one impact group');
|
||||
}
|
||||
if (selection.strategy !== 'full' && selection.unmapped_paths?.length > 0) {
|
||||
errors.push('unmapped runtime paths require a full Gate');
|
||||
if (selection.unmapped_paths?.length > 0) {
|
||||
errors.push(
|
||||
selection.policy_version === 2
|
||||
? 'unmapped runtime paths block the impact Gate'
|
||||
: 'unmapped runtime paths require a full Gate',
|
||||
);
|
||||
}
|
||||
if (selection.strategy === 'full') {
|
||||
if (!sameValues(scenarioIds, expectedScenarioIds())) {
|
||||
|
||||
Reference in New Issue
Block a user