Skip to content

fix: expose advisory on /__bili/overview so the web banner renders (#2152) - #2153

Merged
ranxianglei merged 2 commits into
masterfrom
2026-10-05_advisory-overview-banner
Oct 5, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-10-05_advisory-overview-banner

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What & why

Fixes #2152. The web UI's critical-advisory banner was dead code: renderBanners (src/web/client.ts) reads d.advisory off /__bili/overview — the web client's ONLY data source (it never calls /__bili/status) — but sendOverview never emitted the advisory field while sendStatus did. So d.advisory was always undefined and the banner stayed hidden forever; #1481/#1588's critical-defect advisories were invisible to anyone reading only the web UI (only the /acp panel and log surfaced them).

Fix

Compute the advisory field once — currentAdvisoryPayload() — and share it between both endpoints so they cannot drift apart again, then add it to sendOverview's payload. sendStatus now calls the same helper (byte-identical output). The existing banner read logic needs no change.

Behavior change (additive)

  • GET /__bili/overview response gains an advisory field: null when no advisory is active, otherwise the active entry {id, affected, target, reason, currentVersion, pendingRestart?, installedVersion?, targetFailed} — identical in construction to the field /__bili/status already returned. Purely additive; existing consumers unaffected (the web client finally gets the data its banner already reads).
  • GET /__bili/status: unchanged (same helper, byte-identical payload).

Regression test

New tests/advisory-endpoint-parity.test.ts boots a real proxy and pins the invariant: whatever advisory /__bili/status reports, /__bili/overview must report byte-for-byte the same (null when clean; active entry + targetFailed otherwise) across clean / active / unresolvable-target states. Verified to fail without the fix.

Pre-flight

  • npm run typecheck — clean (kernel build + tsc --noEmit).
  • Targeted tests (parity + advisory + acp-status + upstream-alerts): 40 pass / 0 fail.
  • npm run build — success, dist-import-annotations OK.

Closes #2152

…2152)

The web UI's critical-advisory banner (src/web/client.ts renderBanners) reads
d.advisory off /__bili/overview — its only data source; client.ts never calls
/__bili/status. But sendOverview never emitted the advisory field while
sendStatus did, so d.advisory was always undefined and the banner stayed hidden
forever. #1481/#1588's advisory mechanism was therefore invisible to anyone
reading only the web UI (only the /acp panel and log surfaced it).

Fix: compute the advisory field once (currentAdvisoryPayload) and share it
between both endpoints so they cannot drift apart again, then add it to
sendOverview's payload. The existing banner read logic needs no change.

Adds tests/advisory-endpoint-parity.test.ts pinning the invariant: whatever
advisory /__bili/status reports, /__bili/overview must report byte-for-byte the
same (null when clean, the active entry + targetFailed otherwise) across clean /
active / unresolvable-target states. Verified to fail without the fix.
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-05_advisory-overview-banner (1fb90ec)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2202-pr.2153.612ba93

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-pr2153.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

收到,开始 review PR #2153(分支 2026-10-05_advisory-overview-banner,2 files / +138 −3)。按规范走:①核对原 issue #2152 的断言 → ②回归审查(两端点既有行为清单)→ ③代码审查 → ④测试有效性 → ⑤diff 整洁度 + 本地定向验证。CI 状态一并确认。结论稍后按结构化七问给出。

…#2153)

The new currentAdvisoryPayload() block was inserted between the #811
stale-install doc comment and the sendStatus it describes, leaving the
comment stranded above an unrelated function.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review 结论 — PR #2153(fixes #2152,advisory banner 死代码)

① 是什么问题:Web UI 的 critical-advisory 横幅是死代码——渲染路径存在(renderBanners 从 /__bili/overview 读 d.advisory,且 overview 是 web client 唯一数据源,它从不调 /__bili/status),但 sendOverview 从未发出 advisory 字段,d.advisory 恒为 undefined,横幅永远不显示:#1481/#1588 的严重缺陷 advisory 对只看 Web UI 的用户完全不可见。

② 什么原因导致的:生产者侧遗漏 + 结构性漂移:/__bili/status 与 /__bili/overview 各自独立拼 payload,overview 建成及后续多次扩展(stale/alerts/conflicts/dshChannel)时无人补上 status 已有的 advisory 字段——两个端点没有共享计算点,漂移是必然结果而非偶发手误。

③ 怎么修复的:抽出唯一计算点 currentAdvisoryPayload()(getAdvisoryState() + targetFailed),两个端点共用,结构上不再可能漂移;overview 补字段,status 改调同一 helper(输出逐字节一致)。横幅渲染逻辑零改动。修的是数据源(疏),不是在渲染端兜底(堵)。

④ 是否有回归问题:无。逐项审过触碰路径的既有行为:

  • GET /__bili/status:payload 逐字节一致(同一表达式、同键序);
  • GET /__bili/overview:纯新增,新键插在 autoRestartOnUpdate 与 inFlight 之间,JSON 消费者按键解析,顺序无关;
  • 其他 overview 消费者(web-sessions / upstream-alerts 测试等)只读特定字段,不受影响;
  • advisory 状态机(src/advisory.ts)未动,fail-open 语义不变;
  • golden/wire-contract 快照未钉这两个端点的 payload,无需 regen;
  • 高危模式逐项过:无语义漂移、无 fail-fast→吞错、无阈值/时序/输出格式漂移(仅披露过的 additive 字段)。
    行为变更披露(Deliverables feat: OpenAI Responses API support (/v1/responses) #4):overview.advisory 由「不存在(undefined)」→「存在(null | active entry)」,PR body 已按旧值→新值披露。

⑤ 是否破坏缓存:不涉及——advisory 在请求时直接从进程内存读取,未触及任何跨请求缓存/重试/增量游标/去重策略;prefix cache 与 update throttle 不受影响。

⑥ 是否改了设计方向:不涉及——机制、数据流不变,只补齐缺失的最后一跳;与原 issue 提的最小改动方案方向一致(并进一步收敛为共享 helper 防复发)。

⑦ 是否引入新配置:不涉及——无新 env/config/CLI flag/默认值。

验证证据:

  • 原 issue 每条断言逐行核实(client.ts:232 唯一数据源;client.ts 全文无 /__bili/status;master 的 sendOverview 确缺该字段);
  • 本地:kernel build + typecheck clean;定向 7 文件套件(parity/advisory/advisory-panel/acp-status×2/upstream-alerts/web-sessions)48 pass / 0 fail;
  • 负向验证:server.ts 换回 master 版,parity 测试立即失败(undefined≠null 严格断言),恢复后通过——"verified to fail without the fix" 属实;
  • 测试是真测试:真实起 proxy、真实 HTTP 拉两端点,strict assert + clean/active/unresolvable-target 三态结构 deepEqual parity,端口走 listen(0),hermetic;
  • CI:两个 head 均全绿 20/20(含 kernel-guard / build-artifact / e2e real-client lanes / docs-sync / version-guard / ubuntu+windows × node22/24 全量回归);
  • 分支基于当前 master tip(bb41405),无 stale base;diff 2 文件 +138/−3,每行都与目的相关。

顺手小修(review nit):新插入的 helper 把既有的 #811 stale-install 注释挤到了不相干的函数上方(它原本描述 sendStatus)——已移回 sendStatus 正上方,comment-only 独立 commit 1fb90ec2,已推 PR 分支,CI 重跑后全绿。

结论:满足 §7.4 auto-merge 标准(单模块纯 fix / 有牙回归测试 / rebased head 全绿 / 不碰 config·persistence·kernel·update.ts·identity / diff 干净 / Closes #2152),CI 全绿——建议合并。合并请自行操作:#2153

@ranxianglei
ranxianglei merged commit 4e3ba1e into master Oct 5, 2026
20 checks passed
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.44-master.4e3ba1e (rolling master tag).

npm install -g billion-context@0.0.44-master.4e3ba1e  # 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 added a commit that referenced this pull request Oct 5, 2026
… CI red since #2153)

The test injects a DISABLED SessionStore, so its own server boot never
creates the real sessions dir, and /__bili/overview's walk deliberately
throws on a missing top-level dir (#1939) — 500 instead of 200. Passing
therefore hinged on a concurrently-running sibling file (e.g.
anthropic-cache-control.test.ts, the next name alphabetically, whose
un-injected boot mkdirs $HOME/.local/share/billion-context/sessions)
winning a cross-file race. PR runs got lucky; every master push run
since 4e3ba1e failed all four test lanes.

Pin BILI_SESSIONS_DIR to an owned empty tempdir instead.
@github-actions github-actions Bot mentioned this pull request Oct 6, 2026
@ranxianglei
ranxianglei deleted the 2026-10-05_advisory-overview-banner branch October 15, 2026 05:32
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.

[web] advisory banner 是死代码:/__bili/overview 不含 advisory 字段,web 客户端从不调用 /__bili/status

1 participant