Replies: 2 comments
评论 A 草稿 → #917(触发面:插件产物缺失 → profile 无法启动)补充一个同类的触发模式 + 一条与你们不同的恢复路径,供团队排期参考。 新触发模式:插件入口产物缺失/不完整(不依赖
|
0 replies
|
感谢 @ICCuse 补充"插件入口产物缺失/不完整"这一不依赖 remove 命令的触发模式,以及不同的恢复路径。它把问题的边界从"remove 的 exit-code 门控"扩展到"profile 引用的插件包半损坏"——与我们定位的 reconcile 跳过是同族不同触发的两面,对排期很有参考价值。 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
摘要
dsh plugin remove在 pnpm 非零退出(如 git-hosted 源瞬时网络错误)时,manifest 已被写入"依赖已删"状态,但 reconcile 因exitCode === 0门控被跳过,dsh.profile.bundles残留条目;此后该条目wasDependency恒为 false,删除分支永不触发,install/ls 均无法修复,profile 永久无法启动,只能手改 package.json。原帖假设经 rc.6 源码逐条证实,另发现启动错误信息中建议的install修复路径实际无效。复现步骤
dsh plugin --profile X add github:owner/repo,bundle 注册并可用。dsh plugin --profile X remove <bundle>,且在 pnpm 执行中出现瞬时错误(如 git-hosted 操作的ETIMEDOUT,本机实测 4/4 对照重跑通过,属非确定性触发)。dependencies移除(manifest 已写入),但以非零码退出。cannot resolve profile bundle "<bundle>",无法 boot。dsh plugin --profile X install、dsh plugin --profile X ls均不清理残留条目(已实测验证)。dsh.profile.bundles中残留条目后 profile 恢复。根因(源码定位,rc.6)
reconcile 被 pnpm exit code 门控 —
@deepseek-ai/dsh/lib/plugin-9h8shc4d.js:beforemanifest 快照;if (exitCode === 0) reconcilePlugins(before, dir);—— pnpm 非零退出时 reconcile 整体跳过。而 pnpm remove 会先写 manifest 再执行网络/清理操作,失败时 manifest 已处于"依赖已删"状态 →dsh.profile.bundles残留。残留条目一旦形成便永久存在 — 同文件
reconcilePlugins:beforeDeps(运行前)与dependencies(运行后)两个集合;wasDependency = beforeDeps.has(packageName) || dependencySet.has(packageName),仅wasDependency && !stillBundle才 splice;wasDependency = false→ 删除分支永不触发,条目被当作 in-box/用户自有条目永久保留。原帖对wasDependency的分析与 L62 完全一致。启动错误信息给出的修复路径无效(增量发现) —
@deepseek-ai/dsh-app-boot/lib/index.js:resolveBundleDir抛错文案:...run 'dsh plugin --profile X install' if its dependency is not installed;reconcilePlugins,同样的wasDependency判定,同样无法移除残留条目 —— 用户按提示操作必然失败。首次 add 偶发缺行是同族问题 — 原帖观察"全新 profile 首次 add 不填充 bundles 行":add 的 pnpm 非零退出 → reconcile 跳过 → 拼接分支(L52-56)未执行,第二次 add 成功才补上。
建议修复
方案 A(推荐)· reconcile 脱离 exit code 门控 + 残留条目独立判定:
beforeDeps:条目既不在dependencies中、又不在模板 bundle 集合(该文件已 importPROFILE_TEMPLATES/DEFAULT_PROFILE_BUNDLES,可区分 in-box 模板条目)时,直接移除或告警。dsh-app-bootL523 的错误提示文案(install 无法修复该场景)。方案 B · manifest 写入原子化:pnpm 成功提交后才更新 manifest,失败回滚。pnpm 自行写 manifest,dsh 难以原子控制,工程量大、收益低。
方案 C · 启动期自愈:boot 时对无法解析的 bundles 条目降级为告警并自动清理(保留
--dump-default-config等只读路径不受影响)。可兜底历史遗留坏 profile,但与 A 配合最佳。影响
dsh plugin新用户是极差的首次体验(原帖)。link:安装的 bundle 因无网络操作而正常移除)。环境
验证材料
plugin-9h8shc4d.jsL107/L121/L46-78 与dsh-app-boot/lib/index.jsL518-524;runPlugin→ 同一reconcilePlugins→ 同一wasDependency判定,故无法自愈。First analysis of discussion #913. Happy to open a PR with fix option A.
All reactions