Repository navigation
fix(workbench): 修复移动目录后文件重建失败且无法关闭 - #2417
Merged
Merged
Conversation
xiaoyumuxi
marked this pull request as ready for review
November 25, 2026 12:29
9 tasks done
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
打开
test/controller/TestController.java后,将controller剪切到另一目录,旧标签仍指向原路径。点击“允许重新创建文件”再保存时,因为原父目录不存在,暂存文件创建失败;删除提示又没有可用的丢弃入口,关闭项目或应用会被保存失败阻断。改动 / Changes
moveOpenDocuments,让打开标签、文件监听和语言服务文档跟随新路径,与重命名和拖动保持一致。documentio.WriteMissing先补齐缺失父目录,再沿用同目录暂存及原子不覆盖提交。普通保存/自动保存没有因此获得重建权限,后来出现的文件、符号链接或目录仍不会被覆盖。unsavedDiscard,关闭成功后清除恢复草稿,避免下次启动恢复已丢弃内容。app.action.performed(document.discardDeleted),保存失败沿用现有结构化事件,并在目录编码测试中覆盖新 action。workspace-document-sync功能矩阵,整机验收状态保持pending。docs/assets/document-conflict-2405/保存本次前后对照截图及复现说明,仅作为代码评审资料,不由产品加载、不进入发行包。不在本 PR 范围内 / Out of scope
不改变远程文件创建协议、插件契约、硬链接保存选择及其他文档生命周期行为。未做 macOS 原生窗口完整工作流或 Windows 虚拟机验收;下方明确列出验证限制。
类型专属:fix
复现与根因
test/controller/TestController.java与test1→ 打开文件 → 将controller剪切粘贴到test1→ 在旧标签点击允许重建并保存。原行为为ENOENT保存失败且没有丢弃出口;期望为本地移动时标签跟随新路径,外部移走时允许明确重建或丢弃后关闭。treePaste在os.Rename后没有通知打开文档;WriteMissing在不存在的父目录直接CreateTemp;删除提示禁用了磁盘加载却没有关闭入口;重建失败没有恢复提示;异步检查没有捕获并核对路径。git log -S分别追溯WriteMissing、treePaste、删除提示禁用条件和检查授权条件,均来自 Viva 迁移提交0faecba49(Epic(0.7.0): 基于 Viva 框架的跨平台方案的迁移(#1794) #1799);基线为9d9ac81b2a16c947388240109274c2b1e43be13d。检查项
documentio/write_test.go::TestWriteMissingCreatesMissingParentDirectories原先报父目录不存在;document_observation_test.go::TestAcknowledgedDeletionRecreatesMissingParentDirectory原先不能完成保存;TestDeletedDocumentCanBeDiscardedAndClosed原先不能恢复可丢弃状态;filetree_menu_test.go::TestProjectTreeCutAndPasteMovesOpenDocuments原先标签未跟随。上述为修复前实际失败结果摘要;修复前原始控制台输出未单独归档。WriteMissing的 Save As 调用、普通/自动保存、关闭项目、重命名/拖动/插件重命名和异步检查;没有修改插件 API 或 SDK。pending。.agents/notes/implemented/bug-fix/2026-09-15-external-document-changes-and-guarded-save.md。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/workspace-document-sync.json的证据、行为和限制;两端整体实现/验收状态如实保留,没有把未执行的原生流程标记 verified。verify-platform-feature-matrix.sh(222 capabilities)及最终提交范围的verify-platform-feature-matrix-change.sh origin/main HEAD,后者报告capability records changed。.artifacts/下生成的矩阵视图。matrix-exempt。插件归属 / Plugin ownership
UI 验证 / UI evidence
TestVisualDeletedDocument,使用真实打开文件、删除父目录、检查、绘制和点击丢弃流程。light/dark × en-US/zh-Hans 四个场景通过;窗口 1000×640 logical points,PNG 为 2000×1280;代码提交5c267e2310e5bea54780dd56b76074651e98cf90(采集后仅增加静态评审资料,生产代码与截图一致)。命令见“验证”。修复前截图使用基线
9d9ac81b2a16c947388240109274c2b1e43be13d的原始生产提示,通过 Go overlay 采集;只调整视觉用例对旧按钮的断言与收尾,不伪造生产绘制或文件系统数据。统一日志系统 / Structured logging
performed("document.discardDeleted", surfaceButton),复用固定 Core 目录的app.action.performed;保存失败沿用editor.document.save_failed和现有错误通知;未新增日志目录或第二个写入器。scripts/logging/门禁已移除,等价门禁未恢复。本次TestLogEventsMatchCatalog已对链接 Core 做目录编码校验,但不将其描述为完整日志门禁通过;原生日志窗口操作链尚未验收。界面文案 / i18n
desktop.document.discardAndClose,补齐 en-US/zh-CN,运行生成器更新 Go catalog;Viva 通过i18n.Shared读取。verify-app-language-localization.mjs、generate-i18n.mjs --check与 i18n 脚本测试 62 项通过,没有放宽检查。逻辑归属 / Logic placement
性能与内存 / Performance and memory
设置 / Settings
N/A:没有新增或修改设置项、设置页或对话框配置。
插件契约 / Plugin contract
N/A:没有改插件契约、API、宿主方法、通知、能力版本或 Core pin。
发行包与资源 / Bundle and resources
docs/assets图片仅为静态评审资料。无用代码与重构 / Dead code and refactoring
验证 / Verification
GOFLAGS='-tags=dev,vivahead' ./.agents/skills/write-stable-tests/scripts/test-stability-macos.sh --package ./internal/documentio --package ./internal/workbench --suite-timeout-seconds 180 -- --filter '<下方 pattern>'-race(完整命令如下)TestVisualDeletedDocument(完整命令如下)node scripts/i18n/generate-i18n.mjs --check、node scripts/i18n/verify-app-language-localization.mjs、node --test --test-timeout=60000 scripts/i18n/test-i18n.mjs./scripts/agent-notes/verify-agent-notes.sh./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh、./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEADnode scripts/platform-feature-matrix/generate-platform-feature-matrix.mjs./scripts/desktop/verify/verify-runtime-bundle-immutability.shrg自查./.agents/skills/write-stable-tests/scripts/verify-test-stability.sh --base origin/maingit diff --check origin/main...HEAD计时回归 pattern:
竞态命令:
视觉与计时命令:
未能执行的检查和原因:
go test ./...,交给 CI;无头和文件系统测试不等于整机验收。pending。提交前确认 / Final checks
main(9d9ac81b2a16c947388240109274c2b1e43be13d),目标为main。gh pr create --draft,保持 Draft;平台验收和完整日志门禁未完成,不提前标记 ready。.artifacts/、target、缓存、凭据、个人路径或用户日志。图片是隔离测试目录及示例文档的真实渲染,不含用户数据。