feat(simple_metrics): warn when frequency_alert is below the 1m floor (SIENTIAPDE-2190)

This commit is contained in:
PedroHMCosme
2026-10-07 15:28:45 -03:00
parent 40f8d8174b
commit 7222b5d1ef
4 changed files with 97 additions and 0 deletions

View File

@@ -115,6 +115,27 @@ def simple_metrics(config: dict[str, Any]):
}
MIN_FREQUENCY_ALERT_SECONDS = 60
def frequency_alert_warning(frequency_alert: str | None) -> str | None:
"""
Warning message when `frequency_alert` is below the 1-minute floor or does not parse,
otherwise None. Warn only: the configured value is kept (SIENTIAPDE-1995 decision 7).
"""
if not frequency_alert:
return None
try:
# str(): a non-string value (e.g. a number typed into the doc) must warn, not raise
# AttributeError and fail the whole create_schedule_config activity.
seconds = parse_frequency(str(frequency_alert))
except ValueError:
return f'frequency_alert={frequency_alert!r} is not a valid frequency'
if seconds < MIN_FREQUENCY_ALERT_SECONDS:
return f'frequency_alert={frequency_alert} is below the 1m floor; kept as configured'
return None
def minimal_retrain(config: dict[str, Any]):
"""
Build minimal retrain configuration from pipeline config.