Repository navigation
[PR] refactor(web): unified built-in notice registry — one table, one render loop (#5548 P1) - #5554
ranxianglei wants to merge 3 commits into
Conversation
…er loop (#5548 P1) Every built-in web notice now lives as ONE entry in src/notices.ts (id, tone, i18n key set, server-side active predicate). The web client renders whatever the overview reports through a single generic loop over #notices-banner-region; the per-notice builders/banners/wiring added one by one in #5079, #5469 and the retired #5547 are gone. Adding a 4th notice is a table row + its i18n keys + its store allowlist id — no admin/client/page edits. - new src/notices.ts: NoticeEntry registry + never-throwing visibleNotices() - admin.ts: overview gains notices[] (replaces the two bespoke payload fields); new GET /__bili/notices serves the same array - client.ts: bili_pckNoticeBanner/bili_wmNoticeBanner collapse into one bili_noticeBanner({tone,on,desc,hint,dismiss}); one loop wires .notice-dismiss buttons against POST /__bili/notices/dismiss - page.ts: two static banner divs -> single #notices-banner-region - i18n: per-notice dismissed toasts merge into one notices.dismissed key (zh/en); web-i18n dead-key guard learns to scan src/notices.ts (registry strings count as references) - tests: new tests/notice-registry.test.ts (registry invariants, both locales, fresh-install visibility order, dismiss-hides-only-one) Behavior is deliberately unchanged (P1 of the approved #5548 design: P2 adds local JSON announcements + full schema, P3 remote GitHub raw + CI gate).
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7904-pr.5554.ed78086This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5554.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…#5548 P1, unused-exports gate)
|
(ai: qwen/qwen3.8-27b) CI 的 |
…ns() so the env knob is honored (#5548 P1 review) The pck entry's active predicate read loadConfigFile().promptCache, while the old overview payload read opts.promptCache (loadOptions: env > file). A user who set the documented ACP_PROMPT_CACHE_ROUTING=auto/enabled env var without touching the config file would see the "self-stamping off" notice even though their effective routing is not disabled — and the /acp status surface (which reads through loadOptions() on purpose) would disagree with the web overview. Read through loadOptions() like every other pck surface; add a registry test pinning the env-aware suppression.
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复 —— 本 PR 是 #5548 P1(注册表化)的唯一实现线,近期 open/closed issue 与 PR 中无并行工作。 标签:bug + scope/ui + p3(PR 审核发现两处真实缺陷——一处 CI 门红、一处 env 配置层回归,均已在分支内修复;属 web 面板面,体验级严重度)。 审核结论:方向对,发现并已修掉一个真回归 + 确认 CI 红已解① 方向关:与 #5548 P1 设计(owner 已批准)一致——一张表( ② 回归审查(既有行为逐项清点):两条公告的触发条件(effective routing disabled 且未关 / 无 rollout override 且未关)、关闭语义(服务端
③ 代码审查:渲染循环的防御式解析(非对象/缺 id 跳过、dataset 取 id、内容全过 escapeHtml)干净;payload 字段变更( ④ 测试有效性:新 ⑤ diff 整洁度:干净,7 个文件每一行都服务 P1,无跑题改动。 本地证据(新 head 1c8981b)
结构化八问
判定:可合——两处问题均已修复并在本地验证(门/typecheck/定向 31/31),已推送至 PR 分支(1c8981b1e);等新 head 的 CI 全套转绿后由你合并即可。 |
|
(ai: vllm-qwen/qwen3.8-27b) Found a same-scope parallel implementation: PR #5557 (opened 16:28Z, ~24 min after this PR) implements the same approved design phase (#5548 P1 — built-in notice registry + single renderer), with the same file set, the same overview payload shape change ( Mechanism comparison:
Per policy I am not closing either PR — the keep-one decision belongs to the owner (it is raised as a decision request in the #5557 thread, recommendation: keep #5557). Happy to give this PR the same independent review pass before the decision if you want it. |
|
(ai: 已并入 #5575 —— 按 owner 裁定不再拆分,本 PR 作废。) |
#5548 分期实施 P1:注册表化(设计见 issue,owner 已批准)。
做什么
内置 web 公告从此只有一张表(
src/notices.ts)+ 一个渲染循环。现状是每条公告手抄五个文件——#5079 抄第一遍、#5469 抄第二遍、#5547 抄第三遍被砍掉。P1 把这三遍的重复全部收进注册表:src/notices.ts(新)NoticeEntry{id,tone,keys,active}表;visibleNotices()永不抛错src/server/admin.tsnotices[];新增GET /__bili/notices(同一数组)src/web/client.tsbili_noticeBanner(s)+ 单循环;dismiss 按钮统一.notice-dismiss,id 取自 data-idsrc/web/page.ts#notices-banner-regionsrc/web/i18n.tsnotices.dismissed(zh/en);现有文案一字未改tests/web-i18n.test.tssrc/notices.ts纳入扫描范围(注册表字符串算引用)tests/notice-registry.test.ts(新)验收判据达成:再加一条内置公告 = 注册表一行 + 几条 i18n + store allowlist 一个 id,admin/client/page 零改动。
行为
刻意零变化(纯重构):两条公告的触发条件、关闭语义、颜色(warn/ok)、文案全部原样。P2/P3(本地 JSON 公告、远程 GitHub raw + CI 门)另开 PR。
证据
typecheck 干净;build 干净;定向套件 30/30 绿(notice-registry、wm-fastpath-intro-notice、issue5079-pck-default-off(含 live-proxy e2e)、web-i18n、web-update-banner、web-relay-warn)。