test(observability): validate sidebar route coverage
All checks were successful
CD Pipeline / deploy (push) Successful in 1m41s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m41s
This commit is contained in:
@@ -67,6 +67,7 @@ Guard 會檢查:
|
||||
- 側欄是否維持暖深咖啡背景與第二/三層足夠對比。
|
||||
- Topbar 是否仍載入觀測台 CSS 與健康 indicator。
|
||||
- 10 個觀測頁的 `active_page`、側欄 URL、側欄 label、`momo-observability-mode` 掛載清單是否一一對齊。
|
||||
- 10 個側欄 URL 是否都在 `routes/admin_observability_routes.py` 有對應 Flask route。
|
||||
|
||||
### 2. Production 10 頁 HTTP 巡檢
|
||||
|
||||
|
||||
@@ -246,6 +246,15 @@ def scan_nav_contract() -> list[str]:
|
||||
if active_page not in base_text:
|
||||
findings.append(f"{BASE_PATH}: momo-observability-mode list missing `{active_page}`")
|
||||
|
||||
route_suffix = url.replace("/observability", "", 1) or "/"
|
||||
route_pattern = re.compile(
|
||||
r"@admin_observability_bp\.route\(\s*['\"]"
|
||||
+ re.escape(route_suffix)
|
||||
+ r"['\"]"
|
||||
)
|
||||
if route_text and not route_pattern.search(route_text):
|
||||
findings.append(f"{ROUTE_PATH}: missing route `{route_suffix}` for `{label}`")
|
||||
|
||||
sidebar_observability_links = set(re.findall(r'href="(/observability/[^"]+)"', shell_text))
|
||||
expected_links = {url for _, _, url, _ in OBSERVABILITY_NAV_ITEMS}
|
||||
extra_links = sorted(sidebar_observability_links - expected_links)
|
||||
|
||||
Reference in New Issue
Block a user