style(ai): compact automation smoke workbench copy
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
ogt
2026-07-02 19:29:54 +08:00
parent ea74a0c5d4
commit 4ecb1911f7
4 changed files with 86 additions and 7 deletions

View File

@@ -97,6 +97,7 @@
- 2026-07-02 起 `/metrics` 必須匯出 AI automation scheduled health summary gauges`momo_ai_automation_scheduled_health_summary_total``momo_ai_automation_scheduled_health_family_status``momo_ai_automation_scheduled_health_primary_human_gate_count``momo_ai_automation_scheduled_health_writes_database_count`。Prometheus scrape 不得寄 Telegram、不寫 DB、不執行 current smoke只讀 scheduled health summary history。
- 2026-07-02 起 P4 source / deployment governance 必須提供 machine-readable report`scripts/ops/report_source_deploy_runtime_truth.py` 會分層輸出 Gitea / origin / local HEAD source truth、部署檔案 SHA256 readback、正式 `/health` runtime truth、optional container readback 與 GitHub freeze / `momo-db` protected / no DB write / no secret read 安全紅線。此 report 是推 Gitea 與正式部署後的 P4 收斂證據,不得把 source-control success 直接等同 deployment success 或 production runtime success。
- 2026-07-02 起 `/ai_intelligence``/observability/overview` 必須同樣套用 AI automation benchmark golden signals首屏需有 `AI 自動化狀態` 區塊,直接顯示「已自動落地、已驗證、異動狀態、下一步」。`/ai_intelligence` 需以 `/api/ai/pchome-growth/ai-automation-surface-summary` 只讀更新首屏,該 endpoint 由 `/api/ai/pchome-growth/ai-automation-readiness` 聚合 safe lanes 後輸出 `golden_signals``safe_automation_lanes``surface_contract``primary_human_gate_count=0``writes_database_count=0``next_machine_action``/observability/overview` 需用正式觀測資料分層呈現風險與下一步。raw endpoint、artifact、DB table、manual/human gate 文字不得進首屏訊號。
- 2026-07-02 起 `/ai_automation_smoke` 也必須採密集 AI 巡檢工作台:首屏使用 `data-density-guardrail="compact-smoke-workbench"`以「AI 巡檢、風險優先、推播摘要」短標籤保留狀態模式;重複說明、趨勢教學與診斷細節提示必須退到 hidden contract畫面第一層只保留狀態、數字、趨勢、每日摘要與檢查項目 summary。
- 2026-07-02 起 `/ai_intelligence` 商品明細與單品作戰詳情的四格價格證據必須可測PChome 價格、MOMO 參考價、差距、可信度需以 `data-evidence` 固定,並以 `aria-label="價格證據"` 對應可掃描區塊;候選待確認或缺資料只能顯示「候選待確認 / 待補」,不得捏造價格或讓使用者打開 raw payload 才知道判斷依據。
- 2026-07-02 起 `/ai_intelligence` 必須是密集 AI 工作台不得退回大段文字說明頁首屏與明細可見內容只保留短狀態、數字、四格證據與下一步按鈕KPI note、benchmark detail、alert 副句、策略說明、decision copy、來源長句與單品 reason list 不得佔用第一層視覺。`tests/test_ai_intelligence_text_density_guardrails.py` 必須鎖住 `data-density-guardrail="compact-ai-workbench"`、短任務文案、detail meta 與 hidden explanatory copy。
- 2026-07-02 起 `/observability/overview` 也必須採密集 AI 觀測工作台:首屏以 `data-density-guardrail="compact-observability-workbench"``AI 觀測 / 風險優先 / 下一步` 與 golden signals 先呈現狀態、數字與操作入口hero lede、signal note、route desc、host meta 與資料來源長句不得佔用第一層視覺。`tests/test_observability_text_density_guardrails.py` 必須鎖住 compact marker 與 hidden explanatory copy。

View File

@@ -101,7 +101,7 @@
## P1 - Product Visibility And Professional Website Experience
狀態: 進行中,本輪已完成 `/ai_intelligence``/observability/overview` 密集 AI 工作台文字密度守門。
狀態: 進行中,本輪已完成 `/ai_intelligence``/observability/overview``/ai_automation_smoke` 密集 AI 工作台文字密度守門。
目的: 讓 AI 自動化在產品裡可見,成為專業營運工作流,而不是只藏在後端。
@@ -128,6 +128,10 @@
- 首屏改成 `data-density-guardrail="compact-observability-workbench"`以「AI 觀測 / 風險優先 / 下一步」短標籤承接 golden signals。
- hero lede、signal note、route desc、host meta 與資料來源長句從可見 UI 退場,保留狀態、數字與子頁入口。
- `tests/test_observability_text_density_guardrails.py` 已鎖住 compact marker、第一層狀態數字與 explanatory copy hidden contract。
- `/ai_automation_smoke` 密集 AI 巡檢工作台文字密度 guard 已完成:
- 首屏改成 `data-density-guardrail="compact-smoke-workbench"`以「AI 巡檢 / 風險優先 / 推播摘要」短標籤承接 AI 健康檢查。
- hero lede、趨勢說明、每日摘要說明與診斷細節提示從可見 UI 退場,保留狀態、數字、趨勢、每日摘要與檢查項目 summary。
- `tests/test_ai_automation_smoke_text_density_guardrails.py` 已鎖住 compact marker、第一層狀態數字與 explanatory copy hidden contract。
已完成 / 下一步,必須照順序:
@@ -249,6 +253,7 @@
| P1.3 | AI intelligence product evidence guardrails | 已完成 | detail rows + single product detail expose four evidence cells + focused guard tests | P2 / P3 automation surfaces |
| P1.4 | AI intelligence compact workbench text-density guardrails | 已完成 | `/ai_intelligence` first viewport and drilldown hide explanatory copy; focused density guard test | P2.2 benchmark guardrails and future AI surfaces |
| P1.5 | Observability compact workbench text-density guardrails | 已完成 | `/observability/overview` first viewport hides explanatory copy; focused density guard test | Apply density guard to remaining high-visibility AI surfaces |
| P1.6 | AI automation smoke compact workbench text-density guardrails | 已完成 | `/ai_automation_smoke` first viewport hides explanatory copy; focused density guard test | Apply density guard to remaining high-visibility AI surfaces |
| P2.1 | External benchmark encoded into requirements | 已完成 | benchmark guide + focused guard test + first-viewport status | P3.1 safe lane expansion |
| P3.1 | Extend receipt / replay / drift pattern to more lanes | 已完成 | direct mapping candidate decision lane closeout route + focused tests | P3.2 scheduled automation health summaries |
| P3.2 | Scheduled automation health summaries | 已完成 | `/api/ai-automation/scheduled-health-summary` + smoke service focused tests | P3.3 rollback evidence packages |

View File

@@ -39,6 +39,33 @@
letter-spacing: 0.04em;
}
.smoke-mode-row {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 14px;
}
.smoke-mode {
display: inline-flex;
align-items: center;
min-height: 28px;
padding: 5px 10px;
border-radius: var(--momo-radius-xs);
background: var(--momo-bg-paper);
border: 1px solid var(--momo-border-light);
color: var(--momo-text-secondary);
font-size: 12px;
font-weight: 700;
white-space: nowrap;
}
.smoke-lede,
.smoke-help-copy,
.detail-box {
display: none;
}
.smoke-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
@@ -71,6 +98,7 @@
.status-critical { background: #fee2e2; color: #991b1b; }
.detail-box {
display: none;
background: var(--momo-bg-paper);
border: 1px solid var(--momo-border-light);
border-radius: var(--momo-radius-sm);
@@ -124,12 +152,17 @@
{% endblock %}
{% block content %}
<div class="smoke-hero mb-4">
<div class="smoke-hero mb-4" data-density-guardrail="compact-smoke-workbench">
<div class="d-flex flex-column flex-lg-row justify-content-between gap-3 position-relative" style="z-index: 1;">
<div>
<span class="smoke-pill mb-3"><i class="fas fa-robot"></i>AI 閉環守門</span>
<h1 class="fw-bold mb-2">AI 自動化健康檢查</h1>
<p class="mb-0 text-muted">確認 AI 建議、修復與通知是否能支援業績流程。</p>
<h1 class="fw-bold mb-1">AI 自動化健康檢查</h1>
<div class="smoke-mode-row" aria-label="AI 自動化狀態模式">
<span class="smoke-mode">AI 巡檢</span>
<span class="smoke-mode">風險優先</span>
<span class="smoke-mode">推播摘要</span>
</div>
<p class="mb-0 text-muted smoke-lede">確認 AI 建議、修復與通知是否能支援業績流程。</p>
</div>
<div class="text-lg-end">
<div id="overallStatus" class="h4 fw-bold mb-2">讀取中...</div>
@@ -162,7 +195,7 @@
<div class="d-flex flex-column flex-md-row justify-content-between gap-2 mb-3">
<div>
<h5 class="mb-1">最近健康檢查趨勢</h5>
<div class="text-muted small">保留最近檢查結果,判斷 AI 閉環是否連續穩定。</div>
<div class="text-muted small smoke-help-copy">保留最近檢查結果,判斷 AI 閉環是否連續穩定。</div>
</div>
<div class="text-muted small" id="historySummary">等待資料...</div>
</div>
@@ -175,7 +208,7 @@
<div class="d-flex flex-column flex-md-row justify-content-between gap-2 mb-3">
<div>
<h5 class="mb-1">每日摘要</h5>
<div class="text-muted small">用每日彙整快速找出連續風險。</div>
<div class="text-muted small smoke-help-copy">用每日彙整快速找出連續風險。</div>
</div>
</div>
<div class="table-responsive">
@@ -234,7 +267,7 @@ function renderSmoke(data) {
${badge(item.status)}
</div>
<p class="text-muted">${escapeHtml(item.summary)}</p>
<div class="detail-box">已保留診斷細節,請由維護者查看。</div>
<div class="detail-box" aria-hidden="true">已保留診斷細節,請由維護者查看。</div>
</div>
</div>
`).join('');

View File

@@ -0,0 +1,40 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_ai_automation_smoke_uses_compact_workbench_density_contract():
template = (ROOT / "templates/ai_automation_smoke.html").read_text(encoding="utf-8")
assert 'data-density-guardrail="compact-smoke-workbench"' in template
assert "AI 自動化健康檢查" in template
assert "AI 巡檢" in template
assert "風險優先" in template
assert "推播摘要" in template
assert ".smoke-lede,\n .smoke-help-copy,\n .detail-box" in template
assert ".detail-box {\n display: none;" in template
def test_ai_automation_smoke_keeps_status_numbers_and_hides_explanatory_copy():
template = (ROOT / "templates/ai_automation_smoke.html").read_text(encoding="utf-8")
for marker in ["正常", "注意", "嚴重", "產生時間", "最近健康檢查趨勢", "每日摘要"]:
assert marker in template
assert 'id="historySummary"' in template
assert 'id="trendStrip"' in template
assert 'id="dailySummaryRows"' in template
assert 'class="mb-0 text-muted smoke-lede"' in template
assert 'class="text-muted small smoke-help-copy"' in template
def test_ai_automation_smoke_preserves_runtime_summary_without_raw_details():
template = (ROOT / "templates/ai_automation_smoke.html").read_text(encoding="utf-8")
assert "${escapeHtml(item.summary)}" in template
assert 'class="detail-box" aria-hidden="true"' in template
assert "JSON.stringify(item.details" not in template
assert "JSONL" not in template
assert "健康檢查 API" not in template