feat(dashboard): optimize cache and AI pick confidence
All checks were successful
CD Pipeline / deploy (push) Successful in 2m46s

This commit is contained in:
OoO
2026-05-01 16:01:52 +08:00
parent 0334051aa7
commit 3920701e1a
9 changed files with 198 additions and 27 deletions

View File

@@ -68,9 +68,13 @@ def test_set_sales_processed_cache_adds_timestamp_and_aliases():
assert cache_manager._SALES_PROCESSED_CACHE["realtime_sales_monthly"] is entry
def test_dashboard_cache_clear_restores_expected_shape():
def test_dashboard_cache_clear_restores_expected_shape(tmp_path, monkeypatch):
from services import cache_manager
shared_cache = tmp_path / "dashboard_full_cache.pkl"
shared_cache.write_bytes(b"stale")
monkeypatch.setattr(cache_manager, "_DASHBOARD_SHARED_CACHE_FILE", shared_cache)
cache_manager._DASHBOARD_DATA_CACHE["consolidated_data"] = ["stale"]
cache_manager._DASHBOARD_DATA_CACHE["full_data"] = ["stale"]
@@ -83,6 +87,7 @@ def test_dashboard_cache_clear_restores_expected_shape():
"full_data": None,
"full_timestamp": None,
}
assert not shared_cache.exists()
def test_cache_dicts_are_only_defined_in_cache_manager():