From 3994f6b038acf6cde64ee8e69e5e0acdd94e5e7e Mon Sep 17 00:00:00 2001
From: zhaozhaozz <6450679+zhaozhaozz@users.noreply.github.com>
Date: Tue, 10 Nov 2026 09:00:57 +0000
Subject: [PATCH] fix(dashboard): keep execution tables separate by producer
group
---
docs/test-reports.md | 14 +++++++++
gsb/incremental_project.py | 9 +++++-
gsb/public_sections.py | 3 +-
gsb/reports.py | 33 ++++++++++++++++++--
gsb/sync.py | 2 +-
static/app.js | 23 +++++++++++---
static/style.css | 3 ++
test/journey-summary-table.spec.cjs | 31 +++++++++++++++++++
test/prepare-site.py | 21 +++++++++++++
tests/test_incremental.py | 22 ++++++++++++++
tests/test_reports.py | 47 +++++++++++++++++++++++++++++
11 files changed, 199 insertions(+), 9 deletions(-)
diff --git a/docs/test-reports.md b/docs/test-reports.md
index deebd6a24..37015bd69 100644
--- a/docs/test-reports.md
+++ b/docs/test-reports.md
@@ -42,6 +42,20 @@ Actions 产物名使用 `ut-results`、`st-results`、`e2e-results`、`real-e2e-
5. `run.log`:兼容现有 CI 的 TAP / unittest / pytest 汇总,作为没有结构化报告时的后备来源。
6. Real E2E 评分:从 `benchmark-metrics.json`、`team-metrics.json`、`evolve-metrics.json` 分别读取 DeepResearchBench、BiomniBench、Research Team 和 PUCT Compression 的原生分数、交付状态与耗时。看板不统一不同评分器的量纲,也不设置质量通过门槛;prompt、原始响应、错误详情和凭据不会进入公开快照。
+### 通用执行表与分组
+
+任意仓库的 `dashboard-summary.json` 都可以附带 `table`,列顺序由 `columns` 声明,格子由生产者写成最终字符串。看板只转义并显示,不按仓库、产物名、列名解释或重算数字:
+
+```json
+{"tests":2,"passed":1,"failed":1,"skipped":0,"flaky":0,"table":{"title":"Service probes","group":{"key":"smoke","label":"L3 · smoke"},"columns":[{"key":"probe","label":"Probe"}],"rows":[{"probe":"probe-a"},{"probe":"probe-b"}]}}
+```
+
+`group` 是可选的通用分组身份,`key` 与 `label` 均为非空字符串。生产者可以用它区分测试层级、执行策略等;例如分别声明 L3、L4、L5,看板不会从工作流名或用例数猜层级。没有分组的旧表显示为「未分组(旧报告)」;没有表格的旧 summary 继续只提供计数。
+
+E2E 页提供分组筛选,每个分组、每个产物名保留最近有表格的运行,分别标明 run、SHA、attempt、分支和该表计数。各组不累加,后来的同名无表格产物不会遮住已有表格;展示的是最近有表格的运行,不保证它就是整仓最新的一次 CI。增量快照从所属分支线的完整已采集历史选表,不受最近 100 次运行窗口影响。同一 run 只认最新 attempt,最新 attempt 没有表时不会挪用它的旧 attempt。
+
+### 评分与计数
+
Real E2E 的简化分数与运行耗时随每次 run / attempt 保存在看板历史记录中。E2E 页按分支线、用例 ID 汇总最近 30 次有记录的运行;同一 run 重跑只采用最新 attempt;每个北京日取一次运行,手动或触发式优先,但只在最新 attempt 有可读 `real-e2e-results` 评分的运行中挑选,仍在运行或产物不可读的运行不会挡掉当天已读到的结果;缺失指标或耗时留空,不当作 0。E2E 页在每个用例下直接画出这些点的全部曲线,不需要打开弹窗。历史只从已采集的产物累积,无法用最新结果推造过去的趋势。
同一产物内只取一种报告格式,优先级为 summary、Playwright、标签化 summary、JUnit、log。分片产物必须互不重叠,避免同时上传同一层的合并报告和分片。用例数按报告中的测试实例(包含浏览器项目)计数,不是测试文件数;重试不重复计数。稳定通过率 = passed / tests;skipped 和 flaky 单列,不计稳定通过。零用例不显示 100%。
diff --git a/gsb/incremental_project.py b/gsb/incremental_project.py
index 280eecd5e..b991b03f1 100644
--- a/gsb/incremental_project.py
+++ b/gsb/incremental_project.py
@@ -13,9 +13,10 @@
from .work_trend import daily_trend
from .public_sections import public_ops, public_tests, score_history, daily_score_runs, latest_score_report, envelope
from .sync import stamp, date
+from .reports import summary_tables
-SUPPLEMENT_TESTS_VERSION = 7
+SUPPLEMENT_TESTS_VERSION = 8
COVERAGE_TIMEZONE = ZoneInfo("Asia/Shanghai")
COVERAGE_GATE_JOBS = ("Gate / UT", "Gate / ST", "Gate / Coverage")
@@ -324,6 +325,12 @@ def coverage_owner(artifact):
if tests.get("data"):
# Refresh test metrics without re-fetching the repository tree/Codecov.
tests["data"]["executed"] = _executed(runs)
+ # Tables are independent observations per producer group, not the
+ # latest same-name artifact. Read durable history so busy CI cannot
+ # push a less frequent group out of the 100-run current window.
+ table_runs = history.select("runs", lambda r, key=key: run_line.get(r["id"]) == key
+ and r["attempt"] == index[r["id"]]["attempt"])
+ tests["data"]["summary_tables"] = summary_tables(table_runs)
daily = history.select("runs", lambda r, key=key: r.get("channel") == "daily"
and run_line.get(r["id"]) == key, limit=120)
# The current CI window is capped at 100 runs and can lose yesterday's
diff --git a/gsb/public_sections.py b/gsb/public_sections.py
index 12e9ab6d1..bdd277a90 100644
--- a/gsb/public_sections.py
+++ b/gsb/public_sections.py
@@ -10,6 +10,7 @@
from .github import GitHubError
from .testparse import summarize_tree, package_of
from .real_e2e_definitions import definition as real_e2e_definition
+from .reports import summary_tables
def _score_with_definition(score):
@@ -262,7 +263,7 @@ def public_tests(ctx, runs, owns=None, coverage_eligible=None):
break
return {'notes': notes, 'tree_source': source, 'tree': {k: v for k, v in tree.items() if k != 'inventory'} if tree else None,
'inventory': [{**row, 'ci_cases': package_counts.get(row['package'], {}).get('tests'), 'ci_failed': package_counts.get(row['package'], {}).get('failed')} for row in (tree or {}).get('inventory', [])],
- 'test_scripts': scripts, 'artifacts_recent': artifacts[:30], 'executed': executed,
+ 'test_scripts': scripts, 'artifacts_recent': artifacts[:30], 'executed': executed, 'summary_tables': summary_tables(runs),
'score_history': score_history(runs), 'score_report': latest_score_report(runs), 'coverage': coverage}
diff --git a/gsb/reports.py b/gsb/reports.py
index 2d89759cd..62a68a0db 100644
--- a/gsb/reports.py
+++ b/gsb/reports.py
@@ -268,8 +268,37 @@ def summary_table(value):
if any(not isinstance(row, dict) or any(not isinstance(row.get(key), str) for key in keys) for row in rows):
return None
# Ignore undeclared cells and metadata, just as we omit raw report payloads.
- return {"title": value["title"], "columns": [{"key": c["key"], "label": c["label"]} for c in columns],
- "rows": [{key: row[key] for key in keys} for row in rows]}
+ table = {"title": value["title"], "columns": [{"key": c["key"], "label": c["label"]} for c in columns],
+ "rows": [{key: row[key] for key in keys} for row in rows]}
+ group = value.get("group")
+ if isinstance(group, dict) and all(isinstance(group.get(k), str) and group[k].strip() for k in ("key", "label")):
+ table["group"] = {k: group[k] for k in ("key", "label")}
+ return table
+
+
+def summary_tables(runs):
+ """Latest table per producer group/artifact, independent of counts-only reports."""
+ attempts = {}
+ for run in runs:
+ attempts[run["id"]] = max(attempts.get(run["id"], 0), run.get("attempt", 1))
+ selected = {}
+ for run in sorted(runs, key=lambda r: (r.get("updated_at") or r.get("created_at") or "", r["id"]), reverse=True):
+ if run.get("attempt", 1) != attempts[run["id"]]:
+ continue
+ for report in run.get("tests", []):
+ table = report.get("table")
+ if not table:
+ continue
+ identity = ((table.get("group") or {}).get("key", ""), report["name"])
+ if identity in selected:
+ continue
+ selected[identity] = {
+ "artifact": report["name"], "table": table, "totals": report.get("counts"),
+ "run_id": run["id"], "sha": run.get("sha"), "attempt": run.get("attempt", 1),
+ "branch": run.get("branch"), "created_at": report.get("created_at") or run.get("updated_at"),
+ "url": report.get("url"), "run_url": run.get("url"),
+ }
+ return list(selected.values())
def parse_report_zip(blob):
diff --git a/gsb/sync.py b/gsb/sync.py
index 7248fcfd9..826482f69 100644
--- a/gsb/sync.py
+++ b/gsb/sync.py
@@ -16,7 +16,7 @@
# 2: tagged catalogs and harness summaries are read from results artifacts.
# 3: Real E2E metrics are reduced to public score summaries.
-PARSER_VERSION = 5
+PARSER_VERSION = 6
def stamp(value):
diff --git a/static/app.js b/static/app.js
index ec421a34f..31565eb61 100644
--- a/static/app.js
+++ b/static/app.js
@@ -1154,12 +1154,22 @@
}));
}
- function summaryTables(executed) {
- return executed.filter(report => report.table).map(report => {
+ function summaryTables(reports) {
+ const available = reports.filter(report => report.table);
+ if (!available.length) return '';
+ const key = report => JSON.stringify(report.table.group?.key ?? null);
+ const groups = new Map(available.map(report => [key(report), report.table.group?.label || '未分组(旧报告)']));
+ const selected = groups.has(STATE.summaryGroup) ? STATE.summaryGroup : '';
+ let html = sectionHead('用例执行表', '每组保留最近有表格的运行;各组用例数独立,不累加。');
+ if (groups.size > 1) html += `
`;
+ return html + available.filter(report => !selected || key(report) === selected).map(report => {
const {title, columns, rows} = report.table;
// Cells already contain the producer's final display values. Keep both
// axes in declared order and render every cell as text.
- return `