Expose validation transparency in Trust Center
This commit is contained in:
@@ -1573,6 +1573,7 @@ function renderTrustCenterPanel() {
|
||||
${renderTrustStatus('运行体检', runtime.label, runtime.note)}
|
||||
</div>
|
||||
${renderRuntimeHealthPanel(runtime)}
|
||||
${renderValidationTransparencyPanel()}
|
||||
${renderTerminologyModePanel()}
|
||||
<div class="trust-center-copy">
|
||||
<p>出生资料、保存星盘、配对记录、问事记录和计算设置默认保存在本机浏览器。导出报告会写入你主动下载的文件;PDF 后端工件仅由本地 API 生成。</p>
|
||||
@@ -1589,6 +1590,51 @@ function renderTrustCenterPanel() {
|
||||
`;
|
||||
}
|
||||
|
||||
const VALIDATION_TRANSPARENCY = {
|
||||
source: 'Yoga logic benchmark',
|
||||
charts: '60 charts',
|
||||
comparableRules: '82 comparable rules',
|
||||
precision: 'Precision 96.48%',
|
||||
recall: 'Recall 93.99%',
|
||||
f1: 'F1 95.22%',
|
||||
unmappedPyjhora: 'unmapped_pyjhora: 718',
|
||||
gates: ['golden cases', 'BPHS invariants', 'release-quality-gate'],
|
||||
};
|
||||
|
||||
function renderValidationTransparencyPanel() {
|
||||
return `
|
||||
<div class="validation-transparency-panel">
|
||||
<div class="calculation-settings-head">
|
||||
<strong>Validation Transparency</strong>
|
||||
<span>${escapeHtml(VALIDATION_TRANSPARENCY.source)} · ${escapeHtml(VALIDATION_TRANSPARENCY.charts)} · ${escapeHtml(VALIDATION_TRANSPARENCY.comparableRules)}</span>
|
||||
</div>
|
||||
<div class="validation-transparency-grid">
|
||||
${renderValidationTransparencyMetric('Precision', VALIDATION_TRANSPARENCY.precision, '命中的规则中,与参考比较一致的比例。')}
|
||||
${renderValidationTransparencyMetric('Recall', VALIDATION_TRANSPARENCY.recall, '参考可比较规则中,被当前引擎找回的比例。')}
|
||||
${renderValidationTransparencyMetric('F1', VALIDATION_TRANSPARENCY.f1, 'Precision 与 Recall 的综合分。')}
|
||||
${renderValidationTransparencyMetric('Coverage gap', VALIDATION_TRANSPARENCY.unmappedPyjhora, '仍未映射的 PyJHora/B.V. Raman 规则保持可见。')}
|
||||
</div>
|
||||
<div class="validation-transparency-boundary">
|
||||
<strong>边界</strong>
|
||||
<span>这些数字来自 references/validation_logic_report.json 的 Yoga 规则对照,不是个人事件预测准确率;出生时间、地点、星历、流派选择和现实事件记录仍会影响解读。</span>
|
||||
</div>
|
||||
<div class="capability-command-tags">
|
||||
${VALIDATION_TRANSPARENCY.gates.map(gate => `<span>${escapeHtml(gate)}</span>`).join('')}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
function renderValidationTransparencyMetric(label, value, note) {
|
||||
return `
|
||||
<div class="validation-transparency-metric">
|
||||
<span>${escapeHtml(label)}</span>
|
||||
<strong>${escapeHtml(value)}</strong>
|
||||
<small>${escapeHtml(note)}</small>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
function getTrustCenterStatusMessage(pwa, runtime = getRuntimeHealthStatus()) {
|
||||
const health = window.__jyotishRuntimeHealth || {};
|
||||
if (health.status === 'checking') return '正在运行健康检查...';
|
||||
|
||||
@@ -5725,6 +5725,56 @@ body { font-family: var(--font-body); background: var(--bg-page); color: var(--t
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.validation-transparency-panel {
|
||||
margin: 10px 0;
|
||||
padding: 10px;
|
||||
border: 1px solid var(--border-light);
|
||||
border-left: 3px solid var(--green);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--bg-surface);
|
||||
}
|
||||
.validation-transparency-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.validation-transparency-metric {
|
||||
min-width: 0;
|
||||
padding: 9px;
|
||||
border: 1px solid var(--border-light);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--bg-white);
|
||||
}
|
||||
.validation-transparency-metric span,
|
||||
.validation-transparency-metric small {
|
||||
display: block;
|
||||
color: var(--text-muted);
|
||||
font-size: 11px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.validation-transparency-metric strong {
|
||||
display: block;
|
||||
margin: 3px 0;
|
||||
color: var(--text-heading);
|
||||
font-size: 13px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.validation-transparency-boundary {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
margin: 8px 0;
|
||||
padding: 9px;
|
||||
border: 1px solid var(--border-light);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--bg-white);
|
||||
color: var(--text-secondary);
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.validation-transparency-boundary strong {
|
||||
color: var(--text-heading);
|
||||
}
|
||||
.terminology-mode-panel {
|
||||
margin: 10px 0;
|
||||
padding: 10px;
|
||||
@@ -6115,6 +6165,7 @@ body { font-family: var(--font-body); background: var(--bg-page); color: var(--t
|
||||
.trust-status-grid,
|
||||
.terminology-mode-options,
|
||||
.case-workspace-controls { grid-template-columns: 1fr; }
|
||||
.validation-transparency-grid { grid-template-columns: 1fr; }
|
||||
.case-workspace-counts,
|
||||
.case-bulk-actions,
|
||||
.workspace-chart-list,
|
||||
|
||||
@@ -306,3 +306,5 @@
|
||||
- 云端复查:PR #6 head `5399c6f` 的 `validate`、`test`、`release-quality-gate` 均失败;step metadata 显示依赖安装和 Vite 环境诊断已成功,失败仍发生在 pytest/quality gate 内部。GitHub annotations 仍只显示 exit code,日志/API 受权限限制;本机 Docker daemon 未运行,暂不能用 Linux 容器复现。
|
||||
- 增补 CI 失败诊断:`.github/workflows/test.yml` 的 pytest 改为 `-vv --maxfail=1 --junitxml=artifacts/pytest.xml` 并上传 `pytest-diagnostics`;`ci.yml` 与 `release-quality-gate.yml` 将 quality gate stdout tee 到 artifact 并上传,下一轮云端失败可直接定位首个 Linux runner 差异。
|
||||
- 云端 CI 收口完成:推送 `925e73e` 后,GitHub PR #6 最新 head 的 `validate`、`test`、`release-quality-gate` 三条检查均为 success;release-only browser/release 守门已在云端可运行。
|
||||
- 完成准确率透明度页面:Trust Center 新增 Validation Transparency,直接展示 `references/validation_logic_report.json` 当前 Yoga 对照口径:60 charts、82 comparable rules、Precision 96.48%、Recall 93.99%、F1 95.22%、unmapped_pyjhora 718,并明确这些是 Yoga 规则对照指标,不是个人事件预测准确率。
|
||||
- TDD/验证完成:先让 `test_trust_center_exposes_validation_transparency` 红灯确认缺口,再实现转绿;修复移动端 selector 回归后,`python3 -B -m pytest tests/test_frontend_productization.py::test_first_use_onboarding_is_actionable tests/test_frontend_productization.py::test_mobile_layout_keeps_dense_sections_single_column tests/test_frontend_productization.py::test_trust_center_exposes_validation_transparency -q` 通过;`npm run build --prefix jyotish-app` 通过;`python3 scripts/run_quality_gate.py --profile quick --skip-yoga-logic` 通过,覆盖 201 个核心 pytest、npm build 与 runtime smoke。
|
||||
|
||||
+2
-1
@@ -100,4 +100,5 @@
|
||||
- [x] PR merge ref 复现与 release-only workflow 守门:在 `/tmp/yinduzhanxing-pr6-merge` 拉取 PR #6 merge ref,确认完整依赖安装后 pytest 与 quick gate 通过;新增手动发布质量门 workflow 跑 release profile 与 Playwright Chromium,并为 CI/test workflow 增加 Vite/Node/Python 诊断。
|
||||
- [x] CI 失败 artifact 诊断:pytest 改为 `-vv --maxfail=1 --junitxml`,quick/release quality gate 输出 tee 到 artifact,避免云端只暴露 exit code。
|
||||
- [x] 云端 CI 收口:PR #6 head `925e73e` 的 `validate`、`test`、`release-quality-gate` 三条 GitHub Actions 检查均已通过。
|
||||
- [ ] 下一步:进入成品化最后一批缺口,优先补普通用户交付形态(部署/桌面打包/公开演示环境)和准确率透明度页面。
|
||||
- [x] 准确率透明度页面:Trust Center 新增 Validation Transparency 面板,展示 Yoga logic benchmark 的 60 charts、82 comparable rules、Precision/Recall/F1、unmapped_pyjhora 与“不是个人事件预测准确率”的边界说明。
|
||||
- [ ] 下一步:进入成品化最后一批缺口,优先补普通用户交付形态(部署/桌面打包/公开演示环境)。
|
||||
|
||||
@@ -402,6 +402,34 @@ def test_runtime_smoke_covers_ai_and_report_recovery() -> None:
|
||||
assert token in smoke
|
||||
|
||||
|
||||
def test_trust_center_exposes_validation_transparency() -> None:
|
||||
main = read("main.js")
|
||||
style = read("style.css")
|
||||
for token in [
|
||||
"renderValidationTransparencyPanel",
|
||||
"VALIDATION_TRANSPARENCY",
|
||||
"Validation Transparency",
|
||||
"Yoga logic benchmark",
|
||||
"60 charts",
|
||||
"82 comparable rules",
|
||||
"Precision 96.48%",
|
||||
"Recall 93.99%",
|
||||
"F1 95.22%",
|
||||
"unmapped_pyjhora",
|
||||
"golden cases",
|
||||
"release-quality-gate",
|
||||
"不是个人事件预测准确率",
|
||||
]:
|
||||
assert token in main
|
||||
for token in [
|
||||
".validation-transparency-panel",
|
||||
".validation-transparency-grid",
|
||||
".validation-transparency-metric",
|
||||
".validation-transparency-boundary",
|
||||
]:
|
||||
assert token in style
|
||||
|
||||
|
||||
def test_click_smoke_covers_core_interactive_workflows() -> None:
|
||||
smoke_path = ROOT / "tests" / "run_frontend_click_smoke.py"
|
||||
quality_gate = (ROOT / "scripts" / "run_quality_gate.py").read_text(encoding="utf-8")
|
||||
|
||||
Reference in New Issue
Block a user