Skip to content

Re-land #1483: remote maintenance advisory + force-update (after no-op 0.1.166 validation) - #1582

Merged
ranxianglei merged 1 commit into
masterfrom
2026-09-28_reland-advisory
Sep 28, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-09-28_reland-advisory

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Re-lands #1483 (reverted by #1580) as step 4 of the updater-change discipline (AGENTS.md §'⚠ Releasing changes to the auto-update mechanism itself').

Why it is safe to re-land now

Step 3 — no-op release validated the existing path end-to-end (live, this machine):

10:38:18 [update] auto-update enabled (checking every 180s)
10:38:18 [advisory] watcher enabled (checking every 180s, independent of auto-update)
10:38:23 [update] checking npm registry for billion-context (startup check)…
10:38:23 [update] new version found: 0.1.165 → 0.1.166, downloading…
10:38:26 [update] installed 0.1.165 → 0.1.166. Restart to finish.
10:38:28 [warn] running v0.1.165 but v0.1.166 is installed — restart bili to activate

That run was the advisory-capable branch build installed as a real npm copy (tarball → npm install -g, readlink empty, dist contains billion-context-advisories), so the hop itself was executed by the new updater code: registry resolve → tarball → sha512 → staged in-place install → disk flip. Disk now runs registry 0.1.166 (advisory marker absent — expected, master is post-revert).

What this re-lands

Full content of #1483 at its merged head 1cc07c1 (revert-of-revert of 44171bf, rebased onto 3bacfe0 — includes the post-review fixes F1/F2: unresolvable target must not wedge the self-update loop):

  • companion npm package billion-context-advisories (CI publishes from advisories/ on master pushes, independent of app releases)
  • startup + 180s watcher (independent of autoUpdate), fail-open on any fetch/parse failure, one deduped warn
  • affected-range force-install to target (rollback = install an older version), warning surfaces the reason; autoUpdate=false still receives critical advisories (kill switch: BILI_ADVISORY_URL=off)
  • publication gate: semver-valid, not-latest, advisory-only-on-version-bumps

Gates

  • typecheck ✓ (after npm install to restore the reverted semver/@types/semver deps)
  • tests: advisory+update targeted 62/62; full suite 2979 pass / 0 fail / 12 e2e-gated skips
  • build ✓

After merge

  1. Release 0.1.167 (routine).
  2. Publish the first empty advisory (dry run: watcher hits, no affected range, no force) and observe a 0.1.166 instance pick it up.
  3. Follow-up observation: 0.1.166 fleet auto-updates to 0.1.167 via the old path, then 0.1.167 carries the new updater for subsequent hops.

Parent issue: #1481. Previous review history and the revert rationale: #1483, #1580.

@ranxianglei
ranxianglei merged commit e258bc8 into master Sep 28, 2026
13 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-28_reland-advisory (43dff1f)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.1513-pr.1582.1fb1dc1

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

Verification complete — re-land confirmed correct, CI green, post-merge step 1 is ready.

Content verification

Regression review — existing behaviors touched → verdicts

Existing behavior Verdict
Normal self-update loop Preserved — defers only while an advisory is active AND its target resolvable (F2 escape verified in code + test); manual bili update passes force=true (src/cli.ts:547-550) so it bypasses deferral
Host-managed lanes (#991/#1196) Preserved — the deferral branch still runs refreshDshProfileCopy for host-managed dirs, so owner-channel self-heal continues while deferred; forceInstallVersion refuses in-place writes on pnpm-store/host-tree copies
Source-checkout guard (#580) Preserved — re-checked inside forceInstallVersion, refuses with manual instructions
Stale/restart mechanism (#327/#806/#811) Preserved for upgrades; silent for rollbacks → finding below
Throttling / cross-process lock New .advisory-check throttle file follows the .update-check pattern; installs reuse the same lock + backup/verify/rollback chain, with a re-check of disk version under the lock (TOCTOU-safe)
dist self-containment contract Kept — semver added to tsup noExternal, exact pin 7.8.5; zod remains the sole external dep
/__bili/status shape Intended additive change: new advisory field ({id,target,reason,targetFailed} | null)

Behavior changes (all intended, disclosed)

  1. One background GET to the npm registry every ~3 min even when auto-update is off (that is the feature's point); hard off: BILI_ADVISORY_CHECK=0 / "advisoryCheck": false; soft off: point BILI_ADVISORY_URL at an unreachable URL. Documented in CONFIGURATION.md en+zh (config surface was owner-signed-off in 搞一个自动强制更新,针对重大bug的版本 #1481 floor 4 before implementation).
  2. Additive advisory field in /__bili/status.
  3. While an advisory is active, the normal self-update loop yields to it (manual bili update unaffected).
  4. Pushes touching advisories/** on master now auto-publish billion-context-advisories via CI — note this already fired: 0.0.2 (empty doc) was published at 10:43:46Z right after your merge, i.e. post-merge step 2 ("publish first empty advisory") happened automatically. npm latest of the app itself is still 0.1.166 — no accidental publish.

Test validity

16 new tests with real teeth — spot-checked the F2 regression test verbatim: asserts install untouched, cannotResolveTarget()=true, advisoryDeferring()=false across two cycles, exactly one warn per process. Rollback-shape install, git-checkout refusal, pnpm-store refusal, fail-open, cadence throttle and deferral are all pinned by behavior assertions, not tautologies. Independent local run on the release branch: 3062 tests, 3050 pass / 0 fail / 12 e2e-gated skips; typecheck + build clean.

Finding (non-blocking) → filed as #1588

One design gap found during review — single root cause (matching/deferral keyed on the current version rather than the candidate/post-restart state), two faces, both manifesting only under rollback-shaped advisories; autoUpdate-off users (the primary audience) are unaffected:

  • A: affected-range covering latest + target < latest ⇒ ~180s ping-pong between target and latest for autoUpdate-on users, for the advisory's whole lifetime (churn only, full safety chain intact, no corruption);
  • B: after a successful rollback, staleInstallStatus is silent (disk < running) and the banner clears in the same cycle ⇒ no persistent restart prompt — one log line is all the user gets.
    Suggested fixes are in the issue; both touch src/update.ts semantics, so they'd need the no-op validation sequence if you want them implemented. Priority is yours — it only bites if a rollback-shaped advisory is ever actually published.

Post-merge steps

  1. ✅ Release 0.1.167 prepared: PR release v0.1.167 #1587 (branch 2026-09-28_release-v0.1.167, isolated bump commit, full local pre-flight green: ci/typecheck/test/build). Merge when ready — or close it and use the one-click fast path instead; the drift guard makes both safe.
  2. ✅ Empty advisory already live as billion-context-advisories@0.0.2 (auto-published by your merge); remaining observation = watch a 0.1.167 instance log the watcher hitting it with no action, once release v0.1.167 #1587 ships.
  3. Passive fleet observation as planned (0.1.166 fleet → 0.1.167 via old path, then the new updater carries subsequent hops).

中文摘要:重落地内容与 #1483 逐字节一致、CI 与本地全套验证通过、既有行为无回归(仅两处有意变更并已披露:auto-update 关闭时仍有每 3 分钟的后台公告轮询、status 端点新增 advisory 字段);审核中发现一个「回滚形态公告」下的设计缺口(振荡 + 回滚后无持久重启提示,仅影响开启自动更新的用户),已立项 #1588 待你拍板;发布 0.1.167 的 PR #1587 已备好,可以合并。

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