Skip to content

Delivery view: a 7-day line chart per metric instead of a single today/7-day number #1212

Closed

Description

@Birfy

需求

交付视图顶部现在只有 Today / 7 days 两列数字。用户要的是最近 7 天(含今天)的动态折线图,能看出趋势,而不只是一个数。

现状(core/src/client/delivery-view.js @ main)

metricRows() 把 snapshot.today 与 snapshot.week 摊成两列;DeliveryHeader 只渲染表格与三行文字(CI、open、as of)。host 侧 metrics 只有 today / week 两个聚合对象(delivery-board.js:300-311),没有任何按天的序列,所以前端现在画不出趋势。

要做成什么

  1. host 侧出按天的序列:metrics.daily = 7 条,每条 { start: ISO, newIssues, closedIssues, newPullRequests, mergedPullRequests, ci: { failed, total, counted, superseded } },按 Asia/Shanghai 00:00 切日,最后一条是今天(今天这一天可以是「截至现在」的部分日,但必须标明 partial: true,不许把半天装成整天)。
  2. 前端每条指标画一条折线:New issues / Closed issues / New pull requests / Merged PRs / CI 红占比,各一张小折线(纯 SVG,不加图表库),x 轴 7 天、今天在最右;点有 tooltip 或至少 title 显示日期与数值。
  3. 不许画谎:某天取不到数(unknown)就断开线段,不要连成 0;今天未过完的线用虚线或空心点,并在图注里写明「今天为部分日」。
  4. 保留现有两列数字,折线是新增,不替换。

验收

  • metrics.daily 的契约测试:3 天夹具、跨 Asia/Shanghai 日界、含 skipped(不进分母)与 unknown 的日子;断言长度 7、今天标 partial、unknown 不打 0。
  • 渲染测试:7 个点、缺口不连成 0、今天用虚线/空心点、没有数据时给一行说明而不是空 SVG。
  • 不新增依赖;bundle 体积不因此明显上涨(build-client --check 仍 exit 0)。
  • 请求成本说明:每天一次 actions runs 分页,7 天 = 7 次,比现在 ciDays: 7 已经做的量不增加。

已知边界

  • 不要求做统计显著性、趋势拟合或预测;这是「看得见变化」,不是「证明变好」。
  • 7 天窗口固定,不做可选区间(先不做)。

Activity

  1. added
    enhancementNew feature or request
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    area:uiWeb/desktop UI and copy
    on Oct 26, 2026
  2. Birfy commented on Oct 26, 2026

    @Birfy
    CollaboratorAuthor

    Triage(2026-10-26):agent-ready,类型 enhancement,区域 area:ui(+ area:host 只在 host 那半落地时由实现 PR 自带,不必现在加)。这是两半的一张单,认领时按半来。

    前端(Dev4,现在可开工):新建 core/src/client/delivery-chart.js(纯 SVG 折线,无新依赖),在 core/src/client/delivery-view.js 的 DeliveryHeader 里只加一处渲染调用;视觉按已定基线,保留现有 Today / 7 days 两列,折线是新增不是替换。

    host(Dev3,等 #1211 合入再做):metrics.daily 的 7 天序列在 core/src/host/delivery-board.js,而 #1211 正在改同一个文件,现在并行必撞——所以 host 那半不在本单第一拍,等 #1211 合入 main 后再开。

    验收按正文四条:metrics.daily 契约(长度 7、今天 partial: true、跨 Asia/Shanghai 日界、unknown 不打 0、skipped 不进分母);渲染(7 点、缺口不连成 0、今天虚线/空心点、无数据给一行说明而非空 SVG);build-client --check 仍 exit 0、不新增依赖;请求成本不高于现在 ciDays: 7 的量。

    risk:T* 只由控制器写(不手写、不转录;缺档看 risk tier (report only) 的 job summary,不阻塞)。认领评论里带分支名。

  3. Birfy commented on Oct 26, 2026

    @Birfy
    CollaboratorAuthor

    标签口径更正(Written-by: Triage):上一条里「area:host 只在 host 那半落地时由实现 PR 自带」这句收回 —— area:host 不在 AGENTS.md 的六个 area 里(area:social / area:ui / area:automation / area:release / area:security / area:docs),它是按实现位置分的,正是 2026-10-23「area 按用户可见行为面、不按 core/ 位置」要避免的;整棵树里没有任何文档提到它,只在 #1203(已关)和 #1213 两张上出现过,属漂移。

    所以:host 那半落地时不要新打 area:host;这张保持 area:ui(折线画在页面上),若那次改动同时动了 core/src/host/delivery-board.js,按可见面补 area:automation 即可。#1213 上的 area:host 我已换成 area:automation(6406879476)。

  4. Birfy commented on Oct 26, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Dev4

    Claimed. Branch dev/feat/1212-delivery-chart, cut at 6f788ff9 (current main).

    Front-end half only, per the split on this issue:

    Visual baseline: one line per metric, label | 7-day line 120×24 | today | 7-day total, header Today / 7 days; 1.5px line, r=2 points, today hollow, the partial today segment dashed, unknown days break the path instead of dropping to zero, colours from existing CSS variables, each point carries a title (2026-10-26 · 12 / 2026-10-26 · 未取到), no SVG when there is no data, five charts stacked, the line moves under the row below 720px (checked at 720 and 1080).

  5. added
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    and removed
    agent-readyMaintainer-approved spec: an agent may take it. Only maintainers set this; never in a template
    on Oct 26, 2026
  6. Birfy commented on Oct 26, 2026

    @Birfy
    CollaboratorAuthor

    Triage(2026-10-26)归属拆分,避免两个半场互相踩:

    • host 半(metrics.daily)已由 #1222 承载(已 agent-ready,标签 enhancement + area:automation)。#1219 已于 03:59:54Z 合入 main,所以那张单的前置已满足。
    • 本单只算前端半:delivery-chart.js + delivery-view.js 一处渲染,保持 area:ui;本单正文里那段 metrics.daily 契约验收(长度 7、今天 partial、unknown 不打 0)执行人在 #1222,前端这边只做消费与空态。
    • 契约以 #1222 的消费者形状为准:{ date: 'YYYY-MM-DD', partial?, …metrics, ci: { failed, counted, total } | null },读不到是 null 不是 0,daily 整体缺失是 null(走空态「7 天数据未取到」)。前端测试别按本单正文的旧措辞(start: ISO、ci.superseded)写断言——那两处已被 #1222 的形状取代,实现 PR 在正文里说明取舍。

    其余不变:本单仍 agent-working,认领者未变。

  7. removed
    agent-workingAn agent has claimed this issue (the claim comment names the branch)
    on Oct 26, 2026
  8. Birfy commented on Oct 26, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Dev4

    Done in main 4ba81f3a (PR #1221, PASS at 166418c1, merge 4ba81f3ad33511af5af330fa7029d78272e87a9).

    agent-working removed here; the PR itself is closed and merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:uiWeb/desktop UI and copyenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions