Repository navigation
refactor20260927(layers/P2-03): 将平台能力与 PTY 归回基础模块 - #79
Merged
Merged
Conversation
…tests 镜像 [mechanical]
按 scripts/refactor/src_layout_map.tsv 中 phase=P2-03 的 61 行 git mv(45 个 src 文件 + src/web/pty/ 整目录 9 个文件 + 15 条 tests 镜像行 17 个文件),共 71 个文件,全部 R100:
- src/utils/{clipboard,open_url,power_inhibitor}.* -> src/platform/;utils 的 terminal_* 与 upgrade/console.hpp -> src/platform/terminal/
- hooks/hook_runner.* -> platform/process/process_runner.*;lsp/lsp_process.* -> platform/process/piped_process.*;lsp/lsp_which.* -> platform/process/which.*;daemon/platform{.hpp,_posix.cpp,_windows.cpp} -> platform/process/os_process*
- desktop/locale.* -> platform/;desktop 的 folder_picker / context_picker / open_in_explorer / notifications* / custom_toast* / strings -> platform/native_ui/
- src/web/pty/ -> src/pty/;tests/web/pty/ -> tests/pty/;14 个测试 -> tests/platform/
验证:git diff --cached -M100% --name-status 71 行全部 R100;本提交不改任何文件内容,include 改写与 CMake 在后续提交。
…lize_includes 输出)[mechanical] python scripts/refactor/normalize_includes.py --scope src:50 文件 76 行;--scope tests:30 文件 31 行。全部是引号内路径的整体替换(旧模块根形式或同目录裸名 -> platform/... 或 pty/...),其它字节不动。 验证:两个范围 --check 均 exit 0、changed_lines 0;git diff --numstat 每个文件增加 = 删除,-U0 补丁里 +/- 行全部是 #include 行。搬走文件内部指回旧目录的裸名 include(14 行,如 platform/clipboard.cpp 的 base64.hpp)工具无法解析,在下一提交手工改。
…命名、CMake 清单与转发头、文档路径同步 内容修改(与前两个 [mechanical] 提交分开): - platform/process/process_runner.hpp 定义 platform::ProcessSpec(原 hooks/hook_config.hpp 的 HookCommandSpec),不再 include hooks;hooks/hook_config.hpp 改为 `using HookCommandSpec = platform::ProcessSpec;`,hooks 内部与 tests/hooks 沿用旧名;hooks 之外的调用点(grep_tool、worktree_manager、terminal_resolver、channels/setup、daemon/worker、remote_control/channel_plugin 及对应测试)改用 platform::ProcessSpec。run_hook_* 函数名暂不改。 - platform/process/piped_process.* 改为 acecode::platform 的 PipedProcess / SpawnOptions,platform/process/which.* 改为 acecode::platform;新增 lsp/lsp_platform_aliases.hpp 保留 lsp::LspProcess / LspSpawnOptions / FileExistsFn / which / which_in / quote_windows_arg 别名,lsp_client.hpp 与 lsp_server_registry.hpp 改 include 它;channels(bridge / runtime / setup)、environment/toolchains 与 test_support/channels 直接改用 platform:: 名字(layout-map §6「P2-03 起 bridge/setup 改用 platform/process」)。 - os_process*(原 daemon/platform*)与 terminal/console.hpp(原 upgrade/console.hpp)只搬位置,命名空间 acecode::daemon / acecode::upgrade 暂留,头注释说明。 - 搬走文件里指回旧目录的 14 行裸名 include 手工改为模块根形式(clipboard.cpp 的 base64/encoding、logger.hpp ×5、strings.cpp 的 locale、4 个自包含头名)。 - CMakeLists.txt:ACECODE_NATIVE_BRIDGE_SUPPORT_SOURCES 的 11 行、ACECODE_NOTIFICATION_BACKEND_SOURCES 2 行、target_sources 的 2 处 notifications_win/stub、2 处注释;cmake/acecode_source_paths.cmake 的 winpty_agent_location 与两个 .mm;cmake/acecode_winpty.cmake 注释。P2-04 的 runtime_files / agent_browser_runtime / open_request / workspace_registry 四行未动。 - 20 个 2 行转发头留在旧路径(utils 7、upgrade 1、hooks 1、lsp 2、daemon 1、desktop 8),src/layers.tsv 登记 20 条 exception(rule R1,R2,owner Claude-p2-03,expires 2026-10-15)。src/web/pty/ 的 4 个头**不留转发头**:新模块名 pty 与旧子目录同名,src/web/ 下的 `"pty/x.hpp"` 会先命中转发头,MSVC 又按父包含者目录把转发头里的 include 解析回它自己(#pragma once 后为空),routes_environment.cpp 实测 C2027 未定义 PtySessionRegistry;lint 亦判 R8 歧义。web 内三个使用方、worker.cpp 与 tests 已全部改写。 - 文档路径:CLAUDE.md(Desktop Shell / Mouse+Clipboard / ConsoleDock / Windows 弹框 / LSP 段)、AGENT.md、tests/README.md、docs/localization.md、docs/desktop-shell/multi-workspace.md、docs/plan/reviews/theme-management-001-web.md、docs/string-utilities-refactor.md、docs/help-source/group6.py(经 build_help.py 重新生成 sources.json,其余生成物无 diff)、tests/cpp_source_paths.json(desktop/context_picker.cpp 的值);搬走的测试与 open_url.hpp 的头注释路径同步。 验证:全新目录 build-p2(Ninja + MSVC 2022 Release,BUILD_TESTING=ON,ACECODE_BUILD_DESKTOP=ON)构建 acecode / acecode-desktop / acecode_unit_tests 通过,acecode-desktop.exe 的 link 行只有 acecode_desktop_support.lib + acecode_native_bridge_support.lib;check_layers --enforce-parent-includes 161 -> 160(消失的边:hook_runner.hpp -> hook_config.hpp 的 base->domain);normalize_includes --check src/tests exit 0;check_doc_paths 85 -> 85;check_file_size / check_ownership --strict exit 0。完整记录见 verification/P2-03-platform-and-pty.md。
… --check 用例的夹具不继承过渡期 exception 行 两处工具修正,都是 P2 转发头登记后才暴露的: - validate_map.py:旧路径上的 2 行转发头与搬走的文件经映射表落到同一最终路径,原碰撞检查把它报成「case-insensitive destination collision」,--strict 直接失败(P2-03 实测 24 项)。现在按内容识别转发头(恰为 `#pragma once` + 一行 include,且该 include 解析到的文件与自己同目标),列进报告的 forwarding_headers 而不计入碰撞;旧路径上若是一份真实内容的重复文件仍报碰撞。inspect() 新增可选 root 参数,migrate_branch 的纯清单调用不传 root 时行为不变。 - tests/test_migrate_branch.py::test_check_enforces_final_layout_lint_ownership_seed_and_paths_without_writing 把仓库真实的 src/layers.tsv 原样拷进「最终布局」夹具,而 --check 按 strict 语义要求 exceptions 表为空,P2 登记的每条转发头 exception 都变成一条 R13,用例随 P2 分支进度失败。夹具改为只取 exception 之外的行。 验证:scripts/refactor/tests 新增 test_p2_forwarding_header_is_not_a_destination_collision(正例 / 无 root / 非转发头的重复文件三段);unittest discover 全量通过;本树 validate_map --strict exit 0,forwarding_headers 20 项。
…ion 行,回退转发头识别的工具改动 主代理 2026-09-27 决策 D24:P2 各任务不在旧路径留 2 行转发头、不往 layers.tsv 加 exception 行 —— 映射表的精确行会把转发头与已搬走的真文件映射到同一最终路径,validate_map --strict 与 migrate_branch --check 都报 destination collision;include 改写已由 normalize_includes(本树)与 migrate_branch --apply-map(遗留分支)按映射表完成,转发头没有独立价值。 - 删除 de834f5 加的 20 个转发头(utils 7、upgrade 1、hooks 1、lsp 2、daemon 1、desktop 8);搬走的 .hpp 旧路径不再留任何文件。src/web/pty/ 本来就没留(见 de834f5 说明)。 - src/layers.tsv 删掉 20 条 exception 行,恢复到 master 的内容。 - 回退 be02de4:validate_map 的转发头识别与 test_migrate_branch 夹具改动都是为转发头服务的,D24 之后无需保留;scripts/refactor 与 master 完全一致。 验证:全仓 grep 旧路径 include 0 处;check_layers --enforce-parent-includes 160(161 - 1);validate_map --strict exit 0;normalize_includes --check src/tests exit 0;check_doc_paths 85;check_file_size / check_ownership --strict exit 0。
…pty.md 提交表、§7.2 P2 闸门逐项、内容修改说明(ProcessSpec / PipedProcess / which、CMake、文档)、D24 备案、本机 Windows 全新目录 build-p2 的构建 / 冒烟目标 / desktop 不链 testable / 目标快照对照 / 全量单测 5115-5114-9-0 / pty 三后端用例 / Web 控制台停靠区 ConPTY 冒烟、lint 161 -> 160 与工具结果、遗留事项。
… 全量单测 5115-5114-9-0 / 快照对照 removed 0 / lint 152) 参照快照是 P2-02 合入后 master 原样采集的,P2-02 的文件仍在过渡目录,而 --reverse-map 会把本树里同样的过渡路径反查回 G0 旧路径;把参照用同一个 translate_for_comparison(reverse=True) 换算到旧路径坐标系后再比:removed 0,added 只有 src/lsp/lsp_platform_aliases.hpp。
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.
将进程执行、原生桌面辅助、终端能力和 PTY 后端迁回 platform / pty,消除 hooks 对配置的反向依赖。旧路径不保留转发头;现有调用语义、namespace 和 OS 分支保持。
对应 OpenSpec
refactor20260927-restructure-src-layers的 P2-03。纯搬迁与 include 改写保留独立提交,不 squash。验证: