Repository navigation
[PR] fix(update): also run boot smoke for dsh desktop copy during in-place self-update (#2082) | fix(update): dsh 桌面副本原地自更新时也跑 boot smoke(#2082) - #6322
Closed
BBleae wants to merge 1 commit into
Conversation
…elf in place (ranxianglei#2082) The ranxianglei#2082 boot smoke (PR ranxianglei#2091) was wired into refreshDshDesktopCopy only, the lane where another bili process refreshes the dsh desktop profile copy. When the running proxy IS that copy, hostManagedInstall exempts the layout (ranxianglei#1575) and the copy updates itself through the plain self-update lanes: checkForUpdate (periodic check, `bili update`) and forceInstallVersion (advisory force-install, web-panel install). Both called installViaTarball without bootSmoke, so a tarball whose entry parses but throws at load was swapped into the copy dsh respawns its plugin from. Arm the smoke on both lanes when the install dir is the dsh desktop copy. Other install layouts keep their current behaviour.
There was a problem hiding this comment.
Copilot was unable to review this pull request due to rate limiting. Please try again later. See Usage limits for GitHub Copilot for details.
Owner
|
Landed via batch PR #6455 (merged) — closing as superseded. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6321
#2082 / #2091 的后续:boot smoke 这道门只接在一条通道上,dsh 桌面副本给自己更新时走的两条通道都没有启用它。
问题
#2091 给
installViaTarball加了opts.bootSmoke:新副本换上之后跑一次node <installDir>/<main> --version,起不来就回滚。理由写在代码注释里——verifyEntries只证明入口能解析,不证明能启动,而 dsh 桌面副本正是运行中的 dsh 在代理死掉后重新拉起的那一份。但只有
refreshDshDesktopCopy传了这个选项(由另一个 bili 进程刷新桌面副本的那条通道)。代理自己从桌面副本运行时:hostManagedInstall(installDir)返回undefined,于是走普通的自更新路径;checkForUpdate(周期检查、bili update)调用installViaTarball时没带bootSmoke;forceInstallVersion(advisory 强制安装、面板里安装指定版本)也没传。结果:入口语法合法、一加载就抛错的包(顶层 throw、import 图断了、平铺的副本解析不到某个运行时依赖)在这两条通道上只过了
node --check,就被换进了桌面副本。这正是 #2091 要拦住的状态,而且在这种布局下更难恢复:坏掉的副本就是下次启动的那份,更新器本身也在它里面。改动
源码只改了
src/update.ts:isDshDesktopInstall(installDir):和hostManagedInstall开头一样的 realpath +isDshDesktopBiliCopy判断。checkForUpdate和forceInstallVersion给installViaTarball传{ bootSmoke: isDshDesktopInstall(installDir) }。bootSmoke本身、回滚路径(restoreFromBackup,在删除备份之前)、失败后的退避以及日志,都保持 #2091 留下的样子。安装目录不是 dsh 桌面副本时这个选项为false,行为不变。测试
新增
tests/issue2082-self-update-boot-smoke.test.ts(5 个测试,照issue2082-desktop-boot-smoke.test.ts的写法:假包的入口只有一行throw,boot smoke 起的是真的node子进程;registry 和 tarball 由进程内的 fetch 桩提供,不开 socket;DSH_HOME和各缓存目录都指向这个测试文件自己的临时目录):checkForUpdate(自动)遇到加载即抛错的包:磁盘上保留旧版本,入口文件不变,不记 last-install,安装目录旁边不留任何东西。checkForUpdate(强制,即bili update):同样回滚——磁盘上保留旧版本,入口文件不变,不记 last-install。forceInstallVersion装进桌面副本:返回ok: false,错误里带boot smoke和子进程的 stderr 那一行,磁盘上保留旧版本。auto-update/advisory:<id>。改动前 1–3 失败(坏包被换了进去)、4–5 通过;改动后 5/5。
本地运行(Windows,Node 22,开着离线网络防护,用一次性的 home 目录):
tsc --noEmit --project tsconfig.json、check:unused-exports、check:test-import-graph:通过。tests/update*.test.ts、tests/issue2082*.test.ts、tests/advisory*.test.ts、tests/issue3754-install-attribution.test.ts:200 / 200。tests/*.test.ts(1189 个文件,并发 4):11010 个测试,10925 通过 / 9 失败 / 9 取消 / 67 跳过。其中 8 个失败来自本地环境,和本改动无关:3 个是本地杀毒软件改写了回环 TLS 证书(graceful-close、issue3776-tls-mitm-diagnostics、responses-websocket里的 WSS 用例),1 个是log-retention在非 UTC 时区下失败,3 个被离线防护挡住(main-path-transport-retry、mitm、upstream-proxy-routing,它们需要真实 DNS / 非回环地址),1 个是issue3544-stale-proxy-rotation,因为 18787 端口上正跑着另一个 bili 实例。其余的(dsh-native1 个失败 + 4 个取消、context-provenance-outbound4 个取消、upstream-error-log1 个超时)逐个文件重跑都通过。ACP_TEST_REGISTRY=1、tests/e2e/e2e-registry*),CI 上也还什么都没跑过;以 CI 的test各车道(以及ci:full下的ci-registry)为准。兼容性 / 风险
--version,上限 20 秒,沿用 fix(#2082): dsh 插件工具消失 — 注册卡死自愈 + 桌面副本 boot smoke 门 #2091 现有实现);npm 全局、opencode 缓存副本和其他布局都不变。kernel/。check:unused-exports干净)。合并说明
改到了
src/update.ts(按 §7.4 属于 load-bearing),需要人工合并;并且按发版规则,更新器的改动要在一次 no-op 验证发版之后再发。在 CHANGELOG 的 [Unreleased] / Fixed 下加了一条。Refs #2082, #2091