Repository navigation
fix(desktop): 构建树里的任务按声明的范围运行,不再以工作区请求项目任务 - #1874
Merged
Merged
Conversation
构建树的任务行不带项目,运行时原样传入窗口当前的项目和目标,空选择被 Core 当成工作区请求,只声明 project 范围的任务(如 Go 的 vet)报 plugin.build.invalidSelection;模型任务也没带上所属项目。 - runSelectedBuildTask:模型任务用它所属的项目;声明任务由 buildTaskSelection 按声明的范围推断项目或目标,推断不出时提示先选择。 - 选中项目时,构建树的任务分组只列出这个项目的模型任务。 - 新增词条 desktop.build.chooseTaskScope。 - IDE API 仍走严格的 runBuildTask,行为不变。
关闭没有改动的文件时,checkBeforeClose 先在后台检查磁盘,回来后才移除页签。测试只 settle 一次就断言,整包测试里机器忙时会偶发失败;改用 awaitDocumentState 有界等待。
xiaoyumuxi
marked this pull request as ready for review
November 13, 2026 18:17
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
在右侧 Build 窗口展开 Go Modules → 任务,运行 "Vet verification",Run 窗口报错:
vet只声明了project范围。树里的任务行不带项目,运行时原样传入窗口当前的项目和目标(都为空),Core 按"有目标用目标,否则有项目用项目,否则用工作区"判定范围,于是把它当作工作区请求拒绝了。模型任务(Model.Tasks)也有同样的问题:Core 要求模型任务带上所属项目,空选择同样会失败。改动 / Changes
从树上运行任务时推断范围(
build.go)runSelectedBuildTask:buildTaskSelection推断;推断不出时提示"请先选择此任务可以运行的项目或目标。",不发请求。buildTaskSelection按任务声明的范围(Scopes)和目标标签(TargetTags)依次尝试:target,且目标的标签匹配(TargetTags为空时匹配任意目标)。project。workspace。.的构建根目录项目,否则唯一的项目。runBuildTask报告。runBuildTask不变。IDE API(ide_api_dispatch.go)直接调用它,仍按请求原样交给 Core 校验,不做推断。任务分组按项目过滤(
build_tree.go)让 #1873 新增的关闭页签测试稳定(
close_tab_shortcut_test.go)TestCloseTabShortcutClosesTheSelectedEditorTab在整包测试里失败过一次(close_tab_shortcut_test.go:85: the chord did not close the file's tab)。单独连跑 3 次都通过。checkBeforeClose先在后台检查磁盘,结果回来后才移除页签。测试在第二次按快捷键后只settle()一次就断言,机器忙的时候等不到结果。awaitDocumentState(期限 8 秒)等待页签关闭。产品代码不变。文案与矩阵
desktop.build.chooseTaskScope(中英),已运行generate-i18n.mjs并提交生成结果。build-system-plugins.json的 verification 追加了这次的规则和测试。不在本 PR 范围内 / Out of scope
execution/workspace_scan.rs的EXCLUDED_DIRECTORIES)跳过.worktrees但不跳过.claude,也不读.gitignore。在主检出打开仓库时,.claude/worktrees/*下的每个工作树都会被识别成独立的构建系统实例。需要在 Core 仓库单独修。类型专属:fix
复现与根因
plugin.build.invalidSelection: The task vet does not run on the workspace.vet。runSelectedBuildTask从 Epic(0.7.0): 基于 Viva 框架的跨平台方案的迁移(#1794) #1799(0faecba49)起就原样传入p.build.projectID/targetID,按实例分标签页的旧 Build 窗口里也会出错。taskID(build_tree_view.go),于是从树上运行任务一定是空选择。desktop/代码,两端都受影响,本 PR 两端一并修复。检查项
desktop/internal/workbench/build_tree_test.go的TestBuildTreeTasksRunOnTheScopeTheyDeclare。runSelectedBuildTask临时改回原样传入选择后,失败输出为:TestBuildTaskSelectionFitsDeclaredScopes的 15 个表格用例覆盖推断顺序。runSelectedBuildTask的调用方:树的工具栏运行按钮(buildChosenAction)、行内运行按钮(build_tree_view.go)、右键菜单(build_menus.go)、命令run.selected(commands.go)、official_cargo_test.go。它们都经过新的推断。build任务只设置taskID,推断后仍是工作区或根项目,行为不变。runBuildTask,不经过推断。desktop/代码,已一并修复。buildTaskSelection的注释、功能矩阵和回归测试里;[Feature] 将 Viva 构建窗口与结构窗口的树投影、筛选和展开规则下沉到 Rust Core #1866 会把它下沉到 Core。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/build-system-plugins.json的 verification;真实插件组合与 Windows 实机仍记为待验收verify-platform-feature-matrix.sh和verify-platform-feature-matrix-change.sh origin/preview HEAD,都通过.artifacts/下的矩阵视图统一日志系统 / Structured logging
N/A:没有新增或改动生命周期、终态和失败路径的日志。推断不出范围时只弹提示,不开始操作;任务仍走已有的
beginBuildOperation/finishBuildTask。界面文案 / i18n
shared/i18n/,中英词条已补齐,已运行generate-i18n.mjs并提交生成结果verify-app-language-localization.mjs和generate-i18n.mjs --check都通过(11070/11070),没有放宽脚本逻辑归属 / Logic placement
Scopes、TargetTags和模型里的项目与目标性能与内存 / Performance and memory
N/A:只在点击运行时遍历一次已加载模型的项目和目标,不新增后台任务、进程或缓存。
设置 / Settings
N/A:没有新增或修改设置项。
插件契约 / Plugin contract
N/A:没有改动契约、宿主方法或通知。
发行包与资源 / Bundle and resources
verify-runtime-bundle-immutability.sh,通过无用代码与重构 / Dead code and refactoring
验证 / Verification
scripts/desktop/desktop-go.sh test ./internal/workbench ./internal/i18n -count=1(rebase 到最新 preview 之后)TestCloseTabShortcutClosesTheSelectedEditorTab失败(见上);改用有界等待后重跑通过(workbench 138.6s).agents/skills/write-stable-tests/scripts/test-stability-macos.sh --package ./internal/workbench -- --filter 'TestCloseTabShortcut'ClosesTheSelectedEditorTab310ms,ClosesTheFocusedTerminal90msscripts/desktop/desktop-go.sh test ./internal/workbench -run 'TestBuildTaskSelectionFitsDeclaredScopes|TestBuildTreeTasksRunOnTheScopeTheyDeclare' -v;临时恢复旧行为时失败(见上)scripts/desktop/desktop-go.sh vet ./internal/workbench ./internal/i18n、gofmtnode scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --checkverify-platform-feature-matrix.sh、verify-platform-feature-matrix-change.sh origin/preview HEADscripts/desktop/verify/verify-runtime-bundle-immutability.sh未能执行的检查和原因:
project范围的vet任务复现并验证。提交前确认 / Final checks
preview创建并已 rebase;目标分支是preview