[Feature] 清理 installedPluginFacts 的无界清单元读取与 contextsChanged/syncFunctionRelay 的静默丢错
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start by reading installedPluginFacts in desktop/internal/workbench/plugins.go and the three call sites (plugins.go, memory_monitor.go, plugin_displace.go), then compare with the bounded-read path via pluginpkg.ManifestFile, pluginservice.MaxManifestBytes and pluginservice.ReadInstalled. Next read contextsChanged and syncFunctionRelay in desktop/internal/pluginservice/activation.go where the errors are dropped. Done means the manifest read is bounded and shared, approval/read/parse failures surface as structured diagnostics without changing the listed entries, and tests cover corrupt manifests and relay sync failure.
Written by the indexing model from the issue text.
Description
Problem to solve / 要解决的问题
审查 PR #2339 涉及的文件及其紧邻上下文时,核实到两处既有债务(均早于 #2339 存在):
desktop/internal/workbench/plugins.go中installedPluginFacts(约第 579–584 行):- 对每个
entry直接os.ReadFile(filepath.Join(entry.Installed.Path, "plugin.json")),未使用pluginpkg.ManifestFile与有界读取上限(pluginservice.MaxManifestBytes),也未共享版本选择/读取快照; approvals.Approval(...)、os.ReadFile(...)和json.Unmarshal(...)的错误均被静默吞掉,没有任何日志或错误回传(三个调用点:workbench/plugins.go、workbench/memory_monitor.go、workbench/plugin_displace.go,经rg -n 'installedPluginFacts|"plugin\.json"' desktop/internal核实为workbench唯一非测试的"plugin.json"直读处)。
- 对每个
desktop/internal/pluginservice/activation.go中:contextsChanged()(第 159 行)使用_ = s.SyncFunctionRelay(ctx, entries)丢弃错误;syncFunctionRelay()(json.Unmarshal失败分支)直接continue静默跳过损坏清单而不汇总错误。
保留它的代价:
- 安装包异常超大或权限/损坏导致的失败无法在统一日志或诊断中定位;
- 插件上下文变化刷新 cross-plugin function relay 失败时静默退化为旧状态。
Proposed solution / 建议方案
- 让
installedPluginFacts复用pluginpkg.ManifestFile与有界读取(或接入pluginservice.ReadInstalled/ 统一的只读清单摘要入口),并对审批记录查询、读取及 JSON 解析失败记录结构化诊断或汇总降级原因(保留现有“列表仍展示条目 ID/版本/路径”的产品语义)。 - 为
pluginservice/activation.go::contextsChanged增加对非取消错误的显式结构化日志/错误回调接线,并评估syncFunctionRelay是否应随 partial-error 语义向上汇总损坏清单错误;同步在测试中覆盖损坏清单与 relay 同步失败路径。 - 风险:
contextsChanged来自上下文观察者回调,需避免刷新失败造成界面报错风暴或锁重入。
Target platform / 目标平台
Cross-platform / 跨平台
Area / 模块
Extensions / 扩展
Priority / 优先级
P2 / 后续考虑:目前不着急,可安排到后续版本
Alternatives considered / 已考虑的替代方案
保持现状继续忽略错误会导致故障静默吞没;而在修复重读快照的 PR(#2339)中顺带改动 installedPluginFacts 和观察者错误处理语义会扩大行为变更范围并影响既有调用方预期,因此按既有债务单独建单。
Additional context / 补充信息
在评审并验证 PR #2339(关联 #2058)期间核查相关文件时发现;不涉及新增用户可见能力。
Checklist / 提交前检查
- I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 151
- Avg merge
- 3h 48m
- Merged PRs (30d)
- 571
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from 1lck/Lithe-IDEA
-
review: medium
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
1lck/Lithe-IDEA#2432 ·
Maintainers usually reply within 1 day
-
review: medium
Difficulty 1/5 Under an hour Newbie friendliness 82/100
1lck/Lithe-IDEA#2431 ·
Maintainers usually reply within 1 day
-
refactor review: high
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
1lck/Lithe-IDEA#2376 ·
Maintainers usually reply within 1 day
-
area:ui enhancement P2 platform:cross-platform refactor review: high
Difficulty 1/5 Under an hour Newbie friendliness 84/100
1lck/Lithe-IDEA#2365 ·
Maintainers usually reply within 1 day
-
review: medium
Difficulty 3/5 1-2 days Newbie friendliness 57/100
1lck/Lithe-IDEA#2434 ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
rel: fix
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Deltares/fews-web-oc#2400 ·
Maintainers usually reply within 1 day
-
Command bar: Tab-to-search on claude.ai falls back to Google site: search instead of opening a prompt on ClaudePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ardia-browser/ardia#4426 ·
Maintainers usually reply within 1 day
-
Bug report: isValidISODateDashOnly accepts text before or after the date-timePossibly taken @bardrop claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
pnp/cli-microsoft365#7713 ·
Maintainers usually reply within 1 day
-
Diagram: Journey Type: Bug / Error
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
mermaid-js/mermaid-v13#1293 ·
Maintainers usually reply within 1 day