feat: implement scan terminal dashboard system and supporting services

This commit is contained in:
2569718930@qq.com
2026-05-28 08:24:50 +08:00
parent 725727d763
commit 5d784f78b9
27 changed files with 263 additions and 961 deletions
+2 -2
View File
@@ -18,9 +18,9 @@ def test_refresh_policy_cadences_are_layered():
def test_backend_defaults_use_refresh_policy():
import src.data_collection.weather_sources as weather_sources
import web.services.city_runtime as city_runtime
import web.services.scan_ai_config as scan_ai_config
import web.services.scan_terminal_config as scan_terminal_config
assert scan_ai_config.SCAN_TERMINAL_PAYLOAD_TTL_SEC == SCAN_ROWS_REFRESH_SEC
assert scan_terminal_config.SCAN_TERMINAL_PAYLOAD_TTL_SEC == SCAN_ROWS_REFRESH_SEC
assert city_runtime.CITY_FULL_CACHE_TTL_SEC == OBSERVATION_REFRESH_SEC
assert city_runtime.CITY_PANEL_CACHE_TTL_SEC == SCAN_ROWS_REFRESH_SEC
assert city_runtime.CITY_MARKET_CACHE_TTL_SEC == SCAN_ROWS_REFRESH_SEC
+10 -1
View File
@@ -6,6 +6,16 @@ from web.scan_terminal_payloads import (
build_stale_scan_terminal_payload,
)
from web.scan_terminal_ranker import build_ranked_scan_terminal_result
from web.routers.scan import router as scan_router
def test_scan_router_does_not_expose_terminal_ai_endpoint():
routes = {
getattr(route, "path", None): getattr(route, "methods", set())
for route in scan_router.routes
}
assert "/api/scan/terminal/ai" not in routes
def test_normalize_scan_terminal_filters_clamps_and_swaps_bounds():
@@ -149,4 +159,3 @@ def test_metar_gate_vetoes_yes_when_observed_breaks_above_bucket():
assert row["ai_decision"] == "veto"
assert "越过目标桶上沿" in row["ai_reason_zh"]