运行对比页对齐服务端的实际输出:变化百分比按百分数写,归因、遮罩、差异说明照服务端给的显示

对照运行对比后端的实现核过一遍字段的写法:
- delta_pct 服务端已经乘过 100(12.5 是 +12.5%),占比 share 仍是小数(0.4 是 40%),两处分开格式化;原先把
  delta_pct 也当小数,会写成「+1250.0%」
- 维度归因服务端只给前 10 项、另有几项写在 note 里,照写;归不了因(查询结果截断、度量列遮罩、快照读不出来)时
  给空的 rows 和一句说明,只写说明、不画空表;万一多给了仍只列 10 项并写明另有几项
- 约定之外服务端顺带给的几项按可选字段用上:输入的 masked(两边写「已遮罩」,不标变了)、查询的 differences
  (结构变了差在哪,列在并排的 SQL 上面)和 problem(快照读不出来、与哈希不一致)、模板配置项的 labels(按节点
  类型翻好的叫法,键名放进悬停提示;没给或对不上时照写键名)
- 找默认基准时的 404 分两种:本次这条运行不存在(机读码 run_not_found)写「运行记录不存在」,其余写「未找到
  可作为基准的运行」
- check-compare 的夹具照服务端的写法改,补上述几种情形;菜单入口另查「问到基准之后才跳」(先跳到只带本次的地址、
  再让对比页去找,原先查不出来);check-all 登记实测耗时
This commit is contained in:
ThearchyHelios
2026-10-05 08:58:34 +08:00
parent e6c77ea4ee
commit 72da2e178a
8 changed files with 148 additions and 54 deletions
+9 -1
View File
@@ -3211,6 +3211,8 @@ export interface RunCompareTemplateNode {
change: 'added' | 'removed' | 'config' | (string & {})
/** 改了的配置项(节点配置里的键) */
keys: string[]
/** 约定之外、服务端顺带给的:各配置项在界面上的叫法,和 keys 一一对应。没给(或对不上)时照写键名 */
labels?: string[]
}
export interface RunCompareTemplate {
@@ -3237,6 +3239,8 @@ export interface RunCompareInput {
path: string
base: unknown
target: unknown
/** 约定之外、服务端顺带给的:取自设置了遮罩的列,两边的值都不给 */
masked?: boolean
}
export interface RunCompareAttributionRow {
@@ -3272,7 +3276,7 @@ export interface RunCompareMetric {
delta: number | null
/** 带正负号;比率、百分数写「个百分点」。没变化、不是数时可能为 null */
delta_rendered: string | null
/** 相对基准的变化比例(小数,0.125 是 +12.5%);基准为 0、缺值时为 null */
/** 相对基准变化了百分之几(已乘 100,保留两位:12.5 是 +12.5%,和占比的小数写法不同);基准为 0、缺值时为 null */
delta_pct: number | null
classification: RunCompareClass | (string & {})
reasons: string[]
@@ -3300,6 +3304,10 @@ export interface RunCompareQuery {
target_rows: number | null
base_truncated: boolean | null
target_truncated: boolean | null
/** 约定之外、服务端顺带给的:结构变了时差在哪,一处一句中文(按对结果的影响从大到小) */
differences?: string[]
/** 约定之外、服务端顺带给的:快照读不出来、与哈希不一致时的一句说明 */
problem?: string
}
/** GET /runs/{id}/compare?base=。任一未封存或封存核对不一致 409;不是同一工作流、是同一次运行 422 */