重整觀測台總覽新版視覺
All checks were successful
CD Pipeline / deploy (push) Successful in 58s

This commit is contained in:
OoO
2026-05-13 19:19:59 +08:00
parent bd6310365e
commit bc47f79a77
5 changed files with 137 additions and 87 deletions

View File

@@ -25,6 +25,7 @@ WEB_CSS_PATH = Path("web/static/css/observability-system.css")
SHELL_PATH = Path("templates/components/_ewoooc_shell.html")
BASE_PATH = Path("templates/ewoooc_base.html")
ROUTE_PATH = Path("routes/admin_observability_routes.py")
OVERVIEW_PATH = Path("templates/admin/observability_overview.html")
@dataclass(frozen=True)
@@ -136,6 +137,23 @@ FORBIDDEN_BASE_PATTERNS = [
),
]
FORBIDDEN_OVERVIEW_COPY = [
"AI Observability Command Room",
"Risk Signals",
"AI Calls / 24h",
"Host Cascade",
"AI Runtime",
"Learning Loop",
">Command<",
">Runtime<",
">Quality<",
"RAG hits",
"Cache hits",
"30d episodes",
"MCP calls",
"force-throttle",
]
def line_number(text: str, index: int) -> int:
return text.count("\n", 0, index) + 1
@@ -240,6 +258,21 @@ def scan_base_topbar() -> list[str]:
return findings
def scan_overview_copy() -> list[str]:
path = ROOT / OVERVIEW_PATH
if not path.exists():
return [f"{OVERVIEW_PATH}: missing required overview page"]
text = path.read_text(encoding="utf-8")
findings: list[str] = []
for snippet in FORBIDDEN_OVERVIEW_COPY:
if snippet in text:
findings.append(
f"{OVERVIEW_PATH}: legacy English overview copy `{snippet}` must be localized to the V2 workbench language"
)
return findings
def scan_shell() -> list[str]:
path = ROOT / SHELL_PATH
if not path.exists():
@@ -324,6 +357,7 @@ def main() -> int:
findings.extend(scan_css())
findings.extend(scan_shell())
findings.extend(scan_base_topbar())
findings.extend(scan_overview_copy())
findings.extend(scan_nav_contract())
if findings:
@@ -337,6 +371,7 @@ def main() -> int:
print(f"- css guardrails checked: {len(REQUIRED_CSS_SNIPPETS)}")
print(f"- sidebar/nav guardrails checked: {len(REQUIRED_SHELL_SNIPPETS)}")
print(f"- base/topbar guardrails checked: {len(REQUIRED_BASE_SNIPPETS) + len(FORBIDDEN_BASE_PATTERNS)}")
print(f"- overview copy guardrails checked: {len(FORBIDDEN_OVERVIEW_COPY)}")
print(f"- nav contract checked: {len(OBSERVABILITY_PAGES)} pages")
return 0