Repository navigation
fix: advisory rollback form — block affected candidates in the normal loop, persist restart prompt (#1588) - #1596
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1860-pr.1596.144c52cThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1596.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Received — reviewing PR #1596 (branch |
[bot] 🏷 Review complete — verdict: mergeable (pending CI on the new head + human approval; per §7.4 this stays human-merged anyway since it touches load-bearing What I did: pulled ① Direction (original issue #1588): correct root-cause framing, not symptom-masking. Both defects were defects at decision points — the normal loop's install decision (only deferred while THIS machine matched) and the post-install re-evaluation key (disk instead of running version). The fix lands exactly there: ② Regression audit — existing behaviors on touched paths:
③ Code: clean. Module-level facts verified ( ④ Tests: real teeth, not ceremony. The two updated tests pin the new lifecycle with exact field assertions ( ⑤ Diff cleanliness: found one defect — the restructured parse/catch section in CI: prior head Release sequencing (§5): agreed with the PR's own recommendation — ship a no-op v0.1.168 first, observe a real 中文摘要:审核了回滚型公告的两个缺陷(正常更新回路把机器拉回缺陷版本的乒乓、回滚安装后无持久重启提示)——修复打在决策点根因上(安装前候选黑名单 + 按运行版本而非磁盘版本重评估),失败路径全部 fail-open,5 个测试断言有牙且复现原始缺陷,CI 全绿;我在 PR 分支直接补了一个纯空白缩进修正(已重新验证全绿),可以合并(按 §7.4 由人合并,发布建议先走 no-op v0.1.168)。 |
8390481 to
c1d9e1b
Compare
|
Rebased onto current master (was 3 days behind, Rebase resolution notes (the old CI green was misleading — it ran against the stale base):
New in this push (c1d9e1b):
Gates on the rebased head: typecheck ✓ · full unit suite 3582 tests / 0 fail ✓ · both registry e2e suites 9/9 ✓ (incl. the new 4-phase drill) · build ✓. §5 note: |
[bot] 🏷 Re-reviewing the rebased head |
… loop, persist restart prompt (#1588) Rollback-form advisories (target older than latest, latest inside affected) had two defects: (A) the normal self-update loop only deferred while the CURRENT version matched an active advisory — after a rollback install cleared state.active, follow-latest pulled the machine back into the defect every cycle; (B) after a successful rollback install disk < running, so staleInstallStatus and the banner went silent with no persistent restart signal. Fix A: checkForUpdate now consults advisoryBlocksVersion(candidate) before installing — a candidate inside any freshly parsed advisory's affected range is skipped (logged, retried next cycle). Fails open on unhealthy feeds and releases together with the deferral when the target cannot be resolved (F2 composition). Fix B: runAdvisoryCheck re-evaluates against the RUNNING version instead of the freshly installed disk version; the banner/status persists (pendingRestart + installedVersion) until a restart completes and the running version leaves the range, in both upgrade and rollback forms.
Whitespace-only: the restructured runAdvisoryCheck parse/catch section (src/advisory.ts) and the advisory deferral block (src/update.ts) were left at inconsistent indent levels relative to their enclosing try/if. No semantic change.
…ct restart-hint warnOnce key - tests/e2e/e2e-advisory-rollback.test.ts: same verdaccio fixture infra as e2e-registry.test.ts; publishes START(affected)/LATEST(latest, affected)/ TARGET(older, clean) + a billion-context-advisories packument, drives a resident 'bili start' through the full #1588 contract: control self-update, forced rollback to TARGET, no ping-pong across cycles (pre-restart), and the candidate gate refusing affected latest after restart. - src/advisory.ts: the post-install restart hint now warns under '${adv.id}:restart' instead of adv.id — the forced-install line already consumed the adv.id key in the same process, deduping the restart hint away (dead log line; the banner/status surfaces still worked). - ci-registry.yml + tests/e2e/README.md: wire the new suite + docs.
c1d9e1b to
8ca6808
Compare
[bot] 🏷 Round-2 review of rebased head What I did: pulled the rebased branch, verified all three rebase resolutions against master, audited the new e2e drill line-by-line, traced the warnOnce key change, and ran the local gate: typecheck ✓ · build ✓ · ① Rebase resolutions — all three verified correct:
② New additions audited:
③ Structured seven questions:
⚠ 一个非阻塞观察(启动时序): §5 release sequencing: 接受 no-op-first 已满足的论断(v0.1.177 即验证性 no-op 发布,0.1.177→0.1.178→0.1.179 升级链已干净跑过)。 CI: 分支新鲜度: 落后当前 master 3 个提交(compat-drop 域,不相交), 中文摘要:第二轮审核了 rebase 后的 head(c1d9e1b7)——三处 rebase 决议全部核对正确(installDir 去重、i18n 并集、rmSync 恢复),warnOnce 键修复了我第一轮漏掉的真缺陷(重启提示被去重成死日志行),新增 hermetic e2e 完全符合规范且四段断言有牙;本地 typecheck/build/单测 19/19/两 e2e 套件 9/9 + 新套件追加 2 次共 3/3 稳定,CI 13/13 全绿;发现一个非阻塞的启动时序观察(首查竞争,有界自愈,既有模式),可以合并(按 §7.4 由人合并)。 |
Fixes #1588
Rollback-form advisories (
targetOLDER thanlatest, withlatestinsideaffected) had two defects. Both are fixed at their decision points:A — target↔latest ping-pong (autoUpdate=ON)
The normal self-update loop only deferred while the current version matched an active advisory. After a rollback install,
runAdvisoryCheckre-evaluated against the freshly installed disk version (clean by construction) and clearedstate.active— so the next cycle's follow-latest pulled the machine back into the defect, and the watcher rolled it back again. Every ~2 cycles: two tarball downloads + in-place installs + log spam, for the whole advisory lifetime.Fix:
checkForUpdatenow consults a newadvisoryBlocksVersion(candidate)predicate before installing any candidate (src/update.ts). A candidate inside any freshly parsed advisory's affected range is skipped with an info log and retried next cycle. The predicate:B — no persistent restart prompt after a successful rollback install
After a rollback install, disk < running, so
staleInstallStatus()stayed silent — and the same re-evaluation that clearedstate.activekilled the web banner too. The only signal was one log line. (Upgrade form worked because disk > running.)Fix: the post-install re-evaluation is re-keyed from the freshly installed disk version to the running version. The banner/status persists with
pendingRestart: true+installedVersionuntil a restart completes and the running version leaves the affected range — in BOTH upgrade and rollback forms. The web banner renders a dedicated "safe version installed, restart to activate" line (zh/en);/__bili/status.advisorycarries the two fields automatically.Behavior changes (old → new)
[update] skipping X: covered by a critical-bug advisory's affected range (#1588), retried next cycle). Fails open on unhealthy feed / unresolvable target./__bili/status.advisory+ web banner: gainpendingRestart/installedVersion._resetUpdateThrottleForTest()(src/update.ts): theTHROTTLE_FILEpath resolves once at module load, so all in-process tests share one throttle state; non-forcedcheckForUpdatetests need an explicit reset. Zero production impact.Deliberately UNCHANGED:
staleInstallStatus()anddecideAutoRestart()still treat only disk > running as stale — whether a rollback should also trigger auto-restart is a separate product decision (flagged in #1588, not bundled here).config surface
Unchanged — no new config fields, env vars, or CLI flags. All changes are internal decision logic in
src/update.ts/src/advisory.tsplus the two additive status/banner fields above.Tests
tests/advisory.test.ts: 16 → 19 tests.pendingRestart/installedVersionand clears only after a simulated restart (re-run withcurrentVersion= installed target).checkForUpdatemust not pull the latest candidate into the defect (zero tarball fetches, disk untouched, skip logged).Gate on rebased head
07624b3e(on25edbbc1): typecheck clean · 3109/3125 pass, 0 fail · build OK.Release note (§5)
This touches load-bearing
src/update.ts. Recommended sequence: ship a no-op v0.1.168 first, observe a real upgrade succeed, then release this change. Note v0.1.167 already ships the pre-fix lifecycle (the #1582 reland landed in it), so this fix matters for every future rollback-form advisory — the defect itself stays dormant until such an advisory is actually published (advisories/package.jsoncurrently carries zero entries).