Repository navigation
[PR] fix: require package identity for the high-cost plugin advisory, not just the loader id - #7082
ranxianglei wants to merge 1 commit into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10667-pr.7082.f2d1433This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr7082.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…just the loader id The dsh cost-advisory gate fired on the cordis.patch.yml patch-entry id alone (`auto-review`). A community plugin (PerryLink/dsh-auto-review) that reuses that loader id but loads a different package was misidentified as the official @deepseek-ai/dsh-experimental-auto-review and flagged high-cost — the second false positive of this advisory (#7068; the first, disabled entries, was #3838). The entry's `name:` line is the package dsh actually loads for that id, so the advisory now requires the id match to be confirmed by package identity: - name present: it must name the official package (full, or unscoped tail); a present-but-different name is a verdict — no advisory; - name absent (entries predating the name convention): fall back to the official package being installed in a profile bundle (same on-disk probe shape as probeDshIotThinking in src/notices.ts). parseDshPatchEntries now captures the first indented `name:` of each entry block (quotes stripped; column-0 and post-list-item lines ignored) and DshPatchEntry gains an optional `name` field — entries without a name line parse exactly as before, keeping the existing strict deepEqual tests green. Behavior change: a nameless enabled entry that does NOT have the official package installed in any profile bundle no longer fires the advisory (it fired before). That class is exactly the false-positive class this fixes. Closes #7068
d873940 to
c46291a
Compare
[bot] 🏷 查重: 不重复 — 镜像 open+closed 检索「cost advisory / auto-review / 误报」: 本 PR 是该线程唯一在途 PR(无并列第二 PR)。相关条目: #3838(第一次误报, 标签: PR 已带 bug + p2 + dsh + scope/wiring(按本 PR 自身 diff 判定,满足最低档);源 issue #7068 已带 bug + p2 + dsh + scope/wiring + scope/docs。无需补。 状态核实(实时): PR head 已 rebase 到当前 master( 审核结论(独立重审,非复读 issue)① 方向关: 修的是根因不是症状。判定链「条目存在且未 disabled → id 是 auto-review → 就是官方高成本插件」缺了「这个条目实际加载哪个包」这一步——loader id 是本地别名,不是包身份; ② 回归关(逐条清点既有行为):
③ 代码关: 命名达意( ④ 测试关: 5 个新 advisory 测试全是真测试、断言有牙——#7068 复现(社区 name→不告)、name 判决(不同 name + 官方包在盘→不告,钉死「不兜底」)、磁盘兜底双向(在盘→告/不在盘→不告)、unscoped 匹配;4 个新 parser 测试钉死块作用域/引号剥离/列 0 不归属/首个生效/嵌套列表项后不泄漏。 ⑤ diff 整洁度: 4 文件 183+/27-,单 commit,每行都与本 PR 目的相关;无跑题文件、无空行/重排噪音、无 lockfile 变动。干净。 八问
判定: 可合(等 CI test 矩阵全绿后)。顺提的 #7080(横幅无关闭按钮)、#7081(链接钉死已关闭的 #2462)已核实存在、拆分合规,不在本 PR 范围内,由各自 issue 后续安排。 |
来源: #7068 分析高成本插件告警误报时发现(第二次误报;第一次 #3838 已由 #3840 修复 disabled 维度)
问题
高成本插件告警(dsh auto-review)只比对
cordis.patch.yml的 patch 条目id(auto-review),从不比对条目实际加载的包。社区插件 PerryLink/dsh-auto-review(- id: auto-review+name: dsh-auto-review)被认成官方@deepseek-ai/dsh-experimental-auto-review,触发永久横幅——而官方插件根本没装(#7068 报告者已验证 global prefix + 各 profile 的 node_modules)。修法(issue 方案 C)
条目
name:行就是 dsh 为该 loader id 加载的包,因此 id 命中后必须再确认包身份:node_modules里(与src/notices.tsprobeDshIotThinking同一探测形状,不 spawn npm)。parseDshPatchEntries顺带捕获每个条目块内首个缩进name:(去引号;列 0 与嵌套列表项之后的行不归属该条目),DshPatchEntry增加可选name字段——没有 name 行的文本解析结果与之前逐字节一致(既有 strict deepEqual 测试不动、保持绿)。测试
tests/dsh-patch-entries.test.ts+4:name 捕获、引号剥离+块作用域、列 0 不归属+首个生效、嵌套列表项后不泄漏;tests/issue2462-plugin-advisory.test.ts+5:社区 name → 不告([bug] Second false positive on high-cost plugin alert: detection only compares patch entry id, community plugin dsh-auto | [bug] 高成本插件告警第二次误报:检测只比对 patch 条目 id,社区插件 dsh-auto-review 被认成 @deepseek-ai/dsh-experimental-auto-review #7068 复现)、name 不同+官方包在盘 → 不告(name 是判决)、无 name+包在盘 → 告、无 name+包不在盘 → 不告、无 scope 官方名 → 告;既有writeProfilePatch助手为 auto-review id 补上真实形态的 name 行。顺提(不在本 PR 内,需决策)
Closes #7068