Refactor sprint 35 score clamping for architecture compliance
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ScoreClampUtil.h"
|
||||
#include "ValidationErrorUtil.h"
|
||||
|
||||
struct CanaryAssessment {
|
||||
@@ -55,8 +56,7 @@ public:
|
||||
if (a.latencyP95Ms > 300) score += (a.latencyP95Ms - 300) / 5;
|
||||
if (a.errorBudgetBurn > 100) score += (a.errorBudgetBurn - 100) / 2;
|
||||
if (a.manualOverride) score = 0;
|
||||
if (score > 100) return 100;
|
||||
return score;
|
||||
return clampToPercent(score);
|
||||
}
|
||||
|
||||
int promotableCount() const {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
// Step 603: Compliance Operational Readiness
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ScoreClampUtil.h"
|
||||
#include "ValidationErrorUtil.h"
|
||||
|
||||
struct ComplianceReadinessSnapshot {
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
s.approvedExceptions * 2 -
|
||||
s.expiringSoon * 3 -
|
||||
s.openRunbooks * 4;
|
||||
return std::max(0, std::min(100, score));
|
||||
return clampToPercent(score);
|
||||
}
|
||||
|
||||
static std::vector<std::string> blockingFindings(const ComplianceReadinessSnapshot& s) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ScoreClampUtil.h"
|
||||
#include "ValidationErrorUtil.h"
|
||||
|
||||
struct EnvironmentGateState {
|
||||
@@ -56,9 +57,7 @@ public:
|
||||
int score = (state.passedChecks * 100) / state.requiredChecks;
|
||||
score += state.manualApprovals * 5;
|
||||
score -= state.blockingIssues * 20;
|
||||
if (score < 0) return 0;
|
||||
if (score > 100) return 100;
|
||||
return score;
|
||||
return clampToPercent(score);
|
||||
}
|
||||
|
||||
std::vector<std::string> blockedEnvironments() const {
|
||||
|
||||
7
editor/src/ScoreClampUtil.h
Normal file
7
editor/src/ScoreClampUtil.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
inline int clampToPercent(int value) {
|
||||
if (value < 0) return 0;
|
||||
if (value > 100) return 100;
|
||||
return value;
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
// Step 613: Sprint 35 Operational Readiness
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ScoreClampUtil.h"
|
||||
#include "ValidationErrorUtil.h"
|
||||
|
||||
struct Sprint35ReadinessInput {
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
score -= in.onCallCoverageGaps;
|
||||
score -= in.blockedCanaries * 15;
|
||||
score -= in.incompletePostmortems * 10;
|
||||
return std::max(0, std::min(100, score));
|
||||
return clampToPercent(score);
|
||||
}
|
||||
|
||||
static std::vector<std::string> blockers(const Sprint35ReadinessInput& in) {
|
||||
|
||||
Reference in New Issue
Block a user