套用 AI surface benchmark golden signals
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
This commit is contained in:
75
tests/test_ai_surface_benchmark_guardrails.py
Normal file
75
tests/test_ai_surface_benchmark_guardrails.py
Normal file
@@ -0,0 +1,75 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def _read(path: str) -> str:
|
||||
return (ROOT / path).read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_ai_intelligence_first_viewport_has_benchmark_golden_signals():
|
||||
template = _read("templates/ai_intelligence.html")
|
||||
strip = template.split('aria-label="AI 自動化狀態"', 1)[1].split(
|
||||
'<div class="growth-command-focus"',
|
||||
1,
|
||||
)[0]
|
||||
|
||||
assert 'data-benchmark-guardrail="golden-signals"' in strip
|
||||
assert 'data-signal="automated-landing"' in strip
|
||||
assert 'data-signal="verified"' in strip
|
||||
assert 'data-signal="change-state"' in strip
|
||||
assert 'data-signal="next-machine-action"' in strip
|
||||
assert "已自動落地" in strip
|
||||
assert "已驗證" in strip
|
||||
assert "異動狀態" in strip
|
||||
assert "下一步" in strip
|
||||
assert "loadAutomationBenchmarkStrip()" in template
|
||||
assert "/api/ai/pchome-growth/ai-automation-readiness" in template
|
||||
|
||||
|
||||
def test_observability_overview_first_viewport_has_benchmark_golden_signals():
|
||||
template = _read("templates/admin/observability_overview.html")
|
||||
strip = template.split('aria-label="AI 自動化狀態"', 1)[1].split(
|
||||
'<div class="obs-command-strip">',
|
||||
1,
|
||||
)[0]
|
||||
|
||||
assert 'data-benchmark-guardrail="golden-signals"' in strip
|
||||
assert 'data-signal="automated-landing"' in strip
|
||||
assert 'data-signal="verified"' in strip
|
||||
assert 'data-signal="change-state"' in strip
|
||||
assert 'data-signal="next-machine-action"' in strip
|
||||
assert "已自動落地" in strip
|
||||
assert "已驗證" in strip
|
||||
assert "異動狀態" in strip
|
||||
assert "下一步" in strip
|
||||
assert "維持監控" in strip
|
||||
assert "先處理風險" in strip
|
||||
|
||||
|
||||
def test_benchmark_guardrail_surfaces_keep_evidence_on_demand_language():
|
||||
combined = "\n".join(
|
||||
[
|
||||
_read("templates/ai_intelligence.html").split('aria-label="AI 自動化狀態"', 1)[1].split(
|
||||
'<div class="growth-command-focus"',
|
||||
1,
|
||||
)[0],
|
||||
_read("templates/admin/observability_overview.html").split('aria-label="AI 自動化狀態"', 1)[1].split(
|
||||
'<div class="obs-command-strip">',
|
||||
1,
|
||||
)[0],
|
||||
]
|
||||
)
|
||||
|
||||
forbidden_visible_terms = [
|
||||
"DB writes",
|
||||
"Artifact",
|
||||
"endpoint",
|
||||
"JSON",
|
||||
"table",
|
||||
"manual review",
|
||||
"human gate",
|
||||
]
|
||||
for term in forbidden_visible_terms:
|
||||
assert term not in combined
|
||||
Reference in New Issue
Block a user