feat(bot): add horizon commands

This commit is contained in:
dasemu committed 2026-03-13 08:40:55 +01:00
1 parent 00efa356c3
commit 2a34054399
4 files changed
+566 -45

No files matched your search

+41
View File
@@ -30,6 +30,47 @@ def test_prediction_run_roundtrip(tmp_path):
assert loaded == payload
def test_load_predictions_for_date_ignores_newer_other_dates(tmp_path):
"""Date-specific loads must not be displaced by a newer run for tomorrow."""
store = SQLiteStore(tmp_path / "skipredictor.db")
today_payload = {
"generated_at": "2026-03-13T06:00:00+00:00",
"prediction_date": "2026-03-13",
"stations": {
"pajares": {
"station_name": "Valgrande-Pajares",
"open_probability": 0.79,
"km_open": 10.1,
"crowd_level": "low",
"weather_summary": "Temp 0-5 C",
"rule_overrides": [],
"prediction_source": "ml",
}
},
}
tomorrow_payload = {
"generated_at": "2026-03-13T07:00:00+00:00",
"prediction_date": "2026-03-14",
"stations": {
"pajares": {
"station_name": "Valgrande-Pajares",
"open_probability": 0.88,
"km_open": 7.4,
"crowd_level": "medium",
"weather_summary": "Temp 2-7 C",
"rule_overrides": ["Warm rain expected."],
"prediction_source": "hybrid",
}
},
}
store.save_prediction_run(today_payload)
store.save_prediction_run(tomorrow_payload)
loaded = store.load_predictions_for_date(prediction_date="2026-03-13")
assert loaded == today_payload
def test_feature_importances_replace_latest_values(tmp_path):
"""Saving importances twice for the same target must replace older rows."""
store = SQLiteStore(tmp_path / "skipredictor.db")