feat(scoring): composite recency decay and severity weights persisted in DB [FASE-5.1]

This commit is contained in:
2026-05-18 15:07:12 +02:00
parent 2ee59d4e18
commit 05b221a22d
13 changed files with 588 additions and 154 deletions

View File

@@ -15,16 +15,16 @@ class ScoringWeights:
tests: float
detection_rules: float
d3fend: float
freshness: float
platform_diversity: float
recency: float
severity: float
def __post_init__(self) -> None:
fields = [
self.tests,
self.detection_rules,
self.d3fend,
self.freshness,
self.platform_diversity,
self.recency,
self.severity,
]
for f in fields:
if f < 0:
@@ -43,6 +43,15 @@ class ScoringWeights:
tests=40.0,
detection_rules=25.0,
d3fend=15.0,
freshness=10.0,
platform_diversity=10.0,
recency=10.0,
severity=10.0,
)
# Backward-compatible aliases for older API payloads
@property
def freshness(self) -> float:
return self.recency
@property
def platform_diversity(self) -> float:
return self.severity