Skip to content

feat(web): critical-update banner — the #1870 notice reaches the browser - #2846

Merged
ranxianglei merged 5 commits into
masterfrom
feat/web-update-banner
Oct 12, 2026
Merged

ranxianglei merged 5 commits into
masterfrom
feat/web-update-banner

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Why

The critical-update notice (#1870, #1977 display policy) only ever surfaced on the /acp panel and acp_status — the web UI had no update banner at all. The browser's only upgrade cue was the disk-vs-running stale banner (#1603). A user on an old install never learned a critical release existed; the notes-package staleout of 0.1.191–0.1.193 (fixed in #2818) made exactly this gap visible in practice.

What

surface change
GET /__bili/status + GET /__bili/overview new updateReady — one shared updateReadyPayload() (the #2152 advisory-parity lesson: single source, no drift), null when the span is invisible
src/web/page.ts #update-banner above #stale-banner — the original stale banner is kept untouched
src/web/client.ts renderBanners composes the line per locale from the structured payload, HTML-escaped (registry summary is remote-doc text flowing into innerHTML)
src/web/i18n.ts sys.update / sys.update_available / sys.update_ready zh + en
tests/web-update-banner.test.ts wire parity across both endpoints; #1977 silence (routine/recommended-only span → null on the wire); version selection; per-locale composition; escaping

Two deliberate wording rules (aa14eb6b):

  1. ≥ version, never exactly version — any release at-or-above the critical one is safe, and hosts with auto-update often land on a newer build. available therefore carries the minimum version that contains the fix (first critical in the ascending span); ready carries the on-disk version a restart delivers. The TUI line reads Critical update available: ≥ 0.1.193 — ….
  2. zh/en compose separately — the server sends kind/version/summary, never a baked English sentence, so the zh UI shows a fully-Chinese line instead of a mixed one.

No install prescription anywhere (28602246): the wording never tells the user to npm install -g … — bili runs under several hosts (npm -g / opencode plugin / dsh / pi) with different install flows, so the line just names the version and the host's own docs say how.

Behavior

  • critical span newer than the running version →
    • zh:「升级提醒:发现 critical 修复,请升级到 v0.1.193 或更新版本 — …」
    • en: "Update notice: critical fix available — upgrade to v0.1.193 or newer: …"
  • critical span + disk already newer →
    • zh:「升级提醒:critical 修复已就绪 v0.1.193 — 重启 bili 即可生效」
    • en: "Update notice: critical fix ready (v0.1.193) — restart bili to apply"
      (与 stale banner 并存,语义不同:一个讲发布内容,一个讲重启)
  • routine/recommended only → banner stays hidden (Release-notes visibility should be silent by default (owner decision) — advisories stay the only auto-visible channel #1977: silent by default — the web must not become a routine-update nag)

Verification

  • node --import tsx --test tests/web-update-banner.test.ts tests/update-notes.test.ts tests/acp-panel.test.ts tests/acp-status.test.ts tests/web-i18n.test.ts tests/web-conflict-banner.test.ts tests/advisory-endpoint-parity.test.ts tests/plugin-status-provenance.test.ts → 81 pass, 0 fail
  • npm run typecheck clean; unused-exports gate clean

Risk

Management-endpoint + web-UI + wording only — no proxy/data-path changes.

The critical-update line (#1870, #1977 display policy) only ever surfaced
on the /acp panel and acp_status; the web UI had NO update notice at all
— the browser only had the disk-vs-running stale banner. A remote user on
an old install never learned a critical release existed, which the
notes-package staleout of 0.1.191-0.1.193 made painfully visible.

- admin.ts: one updateReadyLine() feeds BOTH /__bili/status and
  /__bili/overview (the #2152 advisory-parity lesson: one source, no
  drift) — null when invisible (#1977: routine/recommended stay silent)
- page.ts: #update-banner above #stale-banner (the original surface is
  kept untouched; the new banner carries release context, stale stays
  the generic restart cue)
- client.ts renderBanners: shows the wire line behind a localized
  label, escapeHtml'd (registry summary is remote-doc text)
- tests/web-update-banner.test.ts: wire parity across both endpoints,
  #1977 silence for non-critical spans, ready vs available wording,
  pending-restart branch, page/client/escape assertions
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: feat/web-update-banner (80857ff)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.3284-pr.2846.b690aeb

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr2846.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 收到,开始 review。方向:web 端补上 #1870 critical-update notice(此前只在 /acp 面板与 acp_status 出现)。审查中(方向关 → 回归清点 → 代码/测试有效性),结论按八问体例随后给出。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review 结论(结构化八问)

已验证:全 diff 通读(单 commit,5 文件 +185/-1)、对最新 master merge-tree 干净(分支 behind 但无冲突);本地定向跑 web-update-banner / web-i18n / web-routing / web-conflict-banner / advisory-endpoint-parity / update-notes / admin-probe = 51 pass, 0 fail;typecheck 干净、unused-exports gate 干净;CI 28/28 check runs 全绿(config-surface / version / kernel / lane / docs 各 guard、build-artifact、hermetic registry e2e、ubuntu/windows × node22/24 测试矩阵)。查重:无同类在途 PR。

  1. 是什么问题:发版可见性:分级标签的 release 元数据(模型撰写摘要)+ 用户版跨 span 更新说明 + acp_status //acp 面板送达「更新已就绪待重启」(#1577 延伸) #1870 的 critical-update 通知此前只出现在 /acp 面板与 acp_status;web UI 没有任何发布提醒面——旧安装用户唯一线索是 disk-vs-running 的 stale banner,它只讲重启、不讲发布内容,用户无从得知存在 critical release(0.1.191–0.1.193 notes-package staleout 让该盲区实际暴露)。
  2. 什么原因导致的:缺表面,不是缺状态——watcher 状态(release-notes span)与展示策略(Release-notes visibility should be silent by default (owner decision) — advisories stay the only auto-visible channel #1977 静默默认)早已存在,只是没接到 web 端点/页面/客户端。修在源头:复用既有单一事实源,不复制状态。
  3. 影响范围与严重程度:纯新增显示面。仅当 span 含 critical-tier 条目时浏览器才出现一行,其余情况 wire 上是 null(静默)。对现有用户零影响,属补盲区。
  4. 怎么修复的:一个 updateReadyLine() 同时喂 /__bili/status 与 /__bili/overview([web] advisory banner 是死代码:/__bili/overview 不含 advisory 字段,web 客户端从不调用 /__bili/status #2152 advisory-parity 教训——单源防漂移);page 在 #stale-banner 上方加 #update-banner(原 stale banner 未动);client 在本地化标签后渲染、先 escapeHtml(registry summary 是远端文档文本流入 innerHTML——已转义,正则钉死)。
  5. 是否有回归问题:审过的既有行为逐项——两管理端点 payload 纯增量(updateReady: string|null,既有字段逐字节不变,diff 核对 + admin-probe/advisory-endpoint-parity 绿);页面既有 banner 元素与 renderBanners 的 stale/passthrough/conflicts 逻辑未动;i18n 表仅新增 zh/en 双语言 key(web-i18n parity gate 绿);无代理/数据路径改动。高危模式逐项过:无语义漂移、无 fail-fast 变吞错、无阈值/时序/输出格式漂移、热路径零新增网络/fs(同步内存读,≤20 条目 filter+sort)。结论:无回归。
  6. 是否破坏缓存:不涉及——未触碰任何缓存/重试/增量游标/去重键;prefix-cache 请求路径零改动。
  7. 是否改了设计方向:没有——沿用既有模式(banner 栈、[web] advisory banner 是死代码:/__bili/overview 不含 advisory 字段,web 客户端从不调用 /__bili/status #2152 单源、Release-notes visibility should be silent by default (owner decision) — advisories stay the only auto-visible channel #1977 静默默认);banner 随 overview 页渲染,与 stale/conflicts/advisory banner 的呈现位置一致。
  8. 是否引入新配置:没有——无新 env/config/CLI flag(config-surface-guard 绿)。

测试有效性:新套件起真实 server + hermetic sessions 目录,4 个 wire case 用 deepEqual 钉两端点字节级 parity、#1977 静默 case(routine/recommended-only → null)、available/ready 两个措辞分支、escape 正则 pin——去掉转义、漏掉任一端点字段、或让 routine 变可见都会红,断言有牙。一条非阻塞观察:通知行正文为英文(zh locale 下也是「升级提醒: Critical update available: …」),与 /acp 面板 describeUpdateReady 措辞一致、标签已本地化——是单源策略下的有意取舍,不算缺陷。

判定:可合。 方向正确(补真缺口、修在源头)、diff 干净(每行都在题上)、回归清点无破坏、测试有牙、CI 全绿。合并由你操作。

ework-agent added 4 commits October 12, 2026 10:14
…differently

describeUpdateReady and the acp_status section both told every user to
`npm install -g billion-context@X`, but bili runs under several hosts
(npm -g / opencode plugin / dsh / pi) with different install flows — the
wrong hint is worse than none. Name the version, let each client's own
docs say how.

- update-notes.ts: describeUpdateReady loses the install suffix on all
  branches (web banner, /acp panel, acp_status all share the wording)
- acp-status.ts: drop the "Update with: npm install -g …" line
- tests: pin the ABSENCE of any npm-install prescription
The banner read "Critical update available: 0.1.193" — as if exactly that
version were the target. Any release >= the critical one is safe, and hosts
with auto-update often land on a newer build, so the guidance must be
"upgrade to vX or newer" (大到等于). Baking an English sentence also left the
zh UI showing a mixed-language line.

- update-notes.ts: describeUpdateReady's available branch now names the
  MINIMUM fixed version (first critical in the ascending span) with a >=
  prefix; new updateBannerPayload() exports kind/version/summary so the
  SERVER never bakes a sentence — locales compose it
- admin.ts: /__bili/status + /__bili/overview carry the structured payload
- client.ts + i18n.ts: zh 「请升级到 v{version} 或更新版本」/ en "upgrade to
  v{version} or newer", ready branch "重启 bili 即可生效" / "restart bili
  to apply" — each fully localized, remote summary HTML-escaped
- tests: pin version selection (minimum critical, disk version on ready),
  parity, #1977 silence, per-locale composition, no npm-install prescription
@ranxianglei
ranxianglei merged commit bf5f885 into master Oct 12, 2026
32 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.328-master.bf5f885 (rolling master tag).

npm install -g billion-context@0.0.328-master.bf5f885  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

@ranxianglei ranxianglei mentioned this pull request Oct 13, 2026
@ranxianglei
ranxianglei deleted the feat/web-update-banner branch October 15, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant