Repository navigation
fix(test): 插件设置截止测试结束后换回工作台插件服务,修复 workbench 测试包 panic - #2080
Merged
Merged
Conversation
#1982 让测试 harness 收尾时像 finishCloseProject 一样停止运行、构建和调试, TestPluginSettingsLatestQueuedDeadlineRequiresRestart 换上的空 pluginservice.Service 没有 Runs,收尾时 stopRunsForProject 空指针,整包 workbench 测试 panic。 测试结束时换回原来的服务,与同样换服务的 pluginsync 测试一致。
xiaoyumuxi
marked this pull request as ready for review
November 17, 2026 05:10
This was referenced Nov 17, 2026
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.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
#1982 让测试 harness 在收尾时按
finishCloseProject的顺序停止测试、调试、运行、构建和 VCS,再取消项目。TestPluginSettingsLatestQueuedDeadlineRequiresRestart把h.app.plugins换成空的&pluginservice.Service{},用完不换回;收尾时stopRunsForProject读到Runs == nil,后台任务里(*Runs).StopWorkspace空指针,整个internal/workbench测试包 panic。#1982 合入时 CI 还没跑完(被取消),所以没有拦住。改动 / Changes
desktop/internal/workbench/settings_plugin_effects_test.go:保存原来的h.app.plugins,测试结束时用defer换回,和同样换上空服务的pluginsync_test.go两个测试写法一致;加一行注释说明空服务没有运行、构建和后端。pluginservice.Service总带Runs,finishCloseProject面对空服务同样会 panic,问题在测试留下了不完整的服务。不在本 PR 范围内 / Out of scope
无。
类型专属:fix
复现与根因
f1a795556)运行go test ./internal/workbench -run TestPluginSettingsLatestQueuedDeadlineRequiresRestart -count=1,实际panic: runtime error: invalid memory address or nil pointer dereference,栈在pluginservice.(*Runs).StopWorkspace←workbench.(*App).stopRunsForProject.func1;期望测试通过。5f7b21b64)新增的 harness 收尾调用stopRunsForProject,遇上这个测试留下的空pluginservice.Service。internal/workbench测试;不影响产品。检查项
TestPluginSettingsLatestQueuedDeadlineRequiresRestart本身,修复前 panic(输出见上),修复后通过。grep -n 'pluginservice.Service{' desktop/internal/workbench/*_test.go只有三处,pluginsync_test.go两处已用defer换回,只有本测试没有。.agents/notes/implemented/bug-fix/记录:只是测试恢复状态,没有新的行为约束。范围检查 / Scope checks
功能矩阵 / Feature matrix
N/A:只改测试,没有用户可观察的变化。
插件归属 / Plugin ownership
N/A:测试只用内联的合成插件 ID
example,没有读取具体插件。UI 验证 / UI evidence
N/A:没有界面变化。
统一日志系统 / Structured logging
N/A:没有日志改动。
界面文案 / i18n
N/A:没有文案。
逻辑归属 / Logic placement
N/A:没有业务逻辑改动。
性能与内存 / Performance and memory
N/A:只改测试。
设置 / Settings
N/A:没有设置变化。
插件契约 / Plugin contract
N/A:没有契约变化。
发行包与资源 / Bundle and resources
N/A:没有运行时资源变化。
无用代码与重构 / Dead code and refactoring
验证 / Verification
go test ./internal/workbench -run TestPluginSettingsLatestQueuedDeadlineRequiresRestart -count=1go test ./internal/workbench -count=1(整包)未能执行的检查和原因: Linux、Windows 由 CI 运行;本机 Core 静态库是 84735ea 构建的,与固定版本不同,CI 以固定版本为准。
提交前确认 / Final checks
main创建;目标分支main