Repository navigation
fix: expose advisory on /__bili/overview so the web banner renders (#2152) - #2153
Conversation
…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.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2202-pr.2153.612ba93This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2153.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review 结论 — PR #2153(fixes #2152,advisory banner 死代码) ① 是什么问题:Web UI 的 critical-advisory 横幅是死代码——渲染路径存在( ② 什么原因导致的:生产者侧遗漏 + 结构性漂移: ③ 怎么修复的:抽出唯一计算点 ④ 是否有回归问题:无。逐项审过触碰路径的既有行为:
⑤ 是否破坏缓存:不涉及——advisory 在请求时直接从进程内存读取,未触及任何跨请求缓存/重试/增量游标/去重策略;prefix cache 与 update throttle 不受影响。 ⑥ 是否改了设计方向:不涉及——机制、数据流不变,只补齐缺失的最后一跳;与原 issue 提的最小改动方案方向一致(并进一步收敛为共享 helper 防复发)。 ⑦ 是否引入新配置:不涉及——无新 env/config/CLI flag/默认值。 验证证据:
顺手小修(review nit):新插入的 helper 把既有的 #811 stale-install 注释挤到了不相干的函数上方(它原本描述 结论:满足 §7.4 auto-merge 标准(单模块纯 fix / 有牙回归测试 / rebased head 全绿 / 不碰 config·persistence·kernel·update.ts·identity / diff 干净 / Closes #2152),CI 全绿——建议合并。合并请自行操作:#2153 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.44-master.4e3ba1e # this exact build
npm install -g billion-context@master # always the newest merged build
|
… 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.
What & why
Fixes #2152. The web UI's critical-advisory banner was dead code:
renderBanners(src/web/client.ts) readsd.advisoryoff/__bili/overview— the web client's ONLY data source (it never calls/__bili/status) — butsendOverviewnever emitted theadvisoryfield whilesendStatusdid. Sod.advisorywas alwaysundefinedand the banner stayed hidden forever; #1481/#1588's critical-defect advisories were invisible to anyone reading only the web UI (only the/acppanel 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 tosendOverview's payload.sendStatusnow calls the same helper (byte-identical output). The existing banner read logic needs no change.Behavior change (additive)
GET /__bili/overviewresponse gains anadvisoryfield:nullwhen no advisory is active, otherwise the active entry{id, affected, target, reason, currentVersion, pendingRestart?, installedVersion?, targetFailed}— identical in construction to the field/__bili/statusalready 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.tsboots a real proxy and pins the invariant: whateveradvisory/__bili/statusreports,/__bili/overviewmust report byte-for-byte the same (null when clean; active entry +targetFailedotherwise) across clean / active / unresolvable-target states. Verified to fail without the fix.Pre-flight
npm run typecheck— clean (kernel build +tsc --noEmit).npm run build— success, dist-import-annotations OK.Closes #2152