refactor20260927(P2-04): 归位 IPC 协议与工作区模块 - #80
Merged
Merged
Conversation
…space(测试镜像同步) [mechanical]
纯 git mv(17 个文件,全部 R100,内容零改动):
- src/daemon/{runtime_files.hpp,runtime_files.cpp,guid.hpp} -> src/ipc/
- src/desktop/{open_request.hpp,open_request.cpp,agent_browser_runtime.hpp,agent_browser_runtime.cpp,daemon_protocol.hpp} -> src/ipc/
- src/desktop/workspace_registry.{hpp,cpp} -> src/workspace/
- src/web/handlers/files_handler.{hpp,cpp} -> src/workspace/(D21:被下层借用的 web 文件允许移出;namespace 暂不改)
- tests/daemon/runtime_files_test.cpp、tests/desktop/{agent_browser_runtime,open_request}_test.cpp -> tests/ipc/
- tests/desktop/workspace_registry_test.cpp、tests/web/files_handler_test.cpp -> tests/workspace/
对应 scripts/refactor/src_layout_map.tsv 中 phase=P2-04 的 17 条 move 行(layout-map.md §2)。
include 改写在下一提交(normalize_includes.py)。
…为 ipc/、workspace/ 模块根形式 [mechanical] python scripts/refactor/normalize_includes.py --scope src → 22 文件 31 行 python scripts/refactor/normalize_includes.py --scope tests → 12 文件 13 行 随后 --check 两个范围均 exit 0(changed_lines 0、errors 0)。 git diff --numstat(histogram)44/44,-U0 补丁里全部 +/- 行都是 `#include "` 行。 改写内容:旧模块根写法(desktop/workspace_registry.hpp、daemon/runtime_files.hpp、 web/handlers/files_handler.hpp 等)与被搬走文件在旧目录里的同目录裸名 (runtime_files.hpp、guid.hpp、daemon_protocol.hpp、agent_browser_runtime.hpp、 open_request.hpp、workspace_registry.hpp、files_handler.hpp)统一改为 ipc/… 与 workspace/…;.mm(agent_browser_host_mac.mm)同样处理。 src/ipc/runtime_files.cpp 里指向留在 daemon 的 platform.hpp 的裸名 include 工具无法 解析(不在同目录,映射表也没有它的目标),在下一提交手工改为 daemon/platform.hpp。
…n 的裸名 platform.hpp 改为 daemon/platform.hpp runtime_files.cpp 原本与 daemon/platform.hpp 同目录,用裸名 #include "platform.hpp";搬到 src/ipc/ 后裸名无法解析,而映射表里 platform.hpp 是 P2-03 的搬迁对象(→ platform/process/ os_process.hpp)、目标尚不存在,normalize_includes 按规则不猜测、不改写,这里手工改为模块根形式 daemon/platform.hpp。lint 按映射表把 daemon/platform.hpp 归到 platform(rank 2)< ipc(5), 不产生新违规;P2-03 合入后重跑 normalize 会把它改到新路径。 按 D24(主代理 2026-09-27):搬走的 .hpp 旧路径不留转发头、layers.tsv 不加 exception 行, include 改写已由 normalize_includes(本树)与 migrate_branch --apply-map(遗留分支)按映射表完成。
…ogs_dir 从 config 移到 utils/paths,20 个只用这三个函数的文件改 include utils/paths.hpp - src/config/config.cpp 的三个函数定义(原 485-501 行,18 行含空行)逐字节搬到 src/utils/paths.cpp(放在 get_run_dir_override() 之后;新增同目录 #include "constants.hpp" 以取 SUBDIR_RUN / SUBDIR_LOGS);声明从 config.hpp 逐字节搬到 utils/paths.hpp。 namespace 仍是 acecode,所有调用点写法不变;get_run_dir 的 override 语义、resolve_data_dir 的 redirect 缓存语义都不动,运行期行为零变化。 - config.hpp 改为 #include "utils/paths.hpp" 透传(utils rank 0 < config rank 3,合法), 因此只经 config.hpp 间接拿到这三个函数的文件(含非 Windows 平台分支)全部照常编译。 - 20 个文件原来 include config/config.hpp 只为这三个函数(layout-map 估计 19 个,以实测为准: 多出的一个是 runtime_files.cpp,它另外只用 utils/constants.hpp 且已直接 include), 改为 include utils/paths.hpp(按 utils/ 块字母序插入;expert_registry.cpp、hook_registry.cpp、 tests/utils/paths_test.cpp 原本已有 utils/paths.hpp,只删 config 行): daemon/startup_diagnostics、memory/memory_paths、channels/runtime、desktop/edge_app_launcher、 desktop/single_instance_posix、experts/expert_registry、hooks/hook_config、hooks/hook_registry、 loop/loop_store、provider/auth/github_auth、provider/auth/xai_auth、session/session_storage、 session/thread_service、tool/theme_create_tool、upgrade/apply、upgrade/diagnostics、 ipc/agent_browser_runtime、ipc/open_request、ipc/runtime_files、tests/utils/paths_test。 判定方法:扫描 config.hpp 及其 4 个直接包含头声明的全部标识符,这些文件正文里除三个函数外 一个都没用到;非 Windows 的 #else / __APPLE__ / __linux__ 分支逐段核对过只用 <string> / <optional> / <vector>(paths.hpp 自带)。 - scripts/layers/size_baseline.txt:config.cpp 2875 -> 2857(行数只降,按 README 同步下调上限)。 check_layers 总数 161 不变(session_storage.cpp / hook_registry.cpp 两条既有 finding 只是行号 -1)。
…kspace/
- CMakeLists.txt ACECODE_NATIVE_BRIDGE_SUPPORT_SOURCES 只改四行:daemon/runtime_files.cpp、
desktop/agent_browser_runtime.cpp、desktop/open_request.cpp、desktop/workspace_registry.cpp
-> src/ipc/…、src/workspace/…;另把 ws2_32 链接说明里的 daemon/runtime_files.cpp 改成
ipc/runtime_files.cpp。cmake/*.cmake 与 cmake/deepin/CMakeLists.txt 没有引用这些文件。
- tests/cpp_source_paths.json(D4:前端架构测试只改这张表):agent_browser_runtime.{cpp,hpp}
两个值改到 src/ipc/,键不变;node web/src/lib/agentBrowserArchitecture.test.js 19 项通过。
- 文档只改路径字面量:CLAUDE.md(workspace_registry_test、files_handler 两处、handlers 大括号
清单拆出 files、Desktop Shell 两处 workspace_registry 标注新位置)、docs/agent-browser.md、
docs/desktop-shell/{design,multi-workspace,tasks}.md、web/README.md。
check_doc_paths findings 85 -> 82:搬迁引入的 6 处已改回,另修掉 desktop-shell/design.md
里本就指错目录的 runtime_files 三处。
# Conflicts: # src/session/session_storage.cpp # src/session/thread_service.cpp
…ranch-inventory 公告
openspec/changes/refactor20260927-restructure-src-layers/verification/P2-04-ipc-and-workspace.md:
提交表、§7.2 闸门逐项、build-p2 三轮构建、tests/{desktop,workspace,ipc} 子集(383 用例 0 失败)、
全量单测 5115 / 5114 / 9 SKIP / 0 失败(与 P2-02 之后 master 的参照逐条相同)、目标快照
(两侧换算回旧路径后 59 target / 3572 元组逐元组相同,unexpected=false;原样路径对照差异恰为
本任务 17 个文件及其对象)、lint(161 → 161,合入 P2-02 后 153 → 153;validate_map / file_size /
ownership --strict 与 normalize --check 均 exit 0;check_doc_paths 85 → 82)、遗留事项。
branch-inventory.md 追加「P2-04 公告」(D24 口径:旧路径不留转发头,分支用 normalize_includes 改写)。
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.
将跨进程协议归到 ipc,工作区注册与文件处理归到 workspace,目录定位函数归到 utils/paths。旧路径不留转发头,减少 config / desktop / web 之间的反向依赖。
对应 OpenSpec
refactor20260927-restructure-src-layers的 P2-04,已接入 PR #79 的平台搬迁;纯移动和 include 改写保留独立提交,不 squash。验证:
aa6872f961b6f4e73210bac0e5de1cb8db9594c9的全新 Windows 八个目标构建通过;本机 5114 项执行、9 项跳过、0 失败。真实 Desktop 的工作区激活、文件预览和退出验证通过。详细记录:
openspec/changes/refactor20260927-restructure-src-layers/verification/P2-04-ipc-and-workspace.md第 10 节。最终验收补录及 blame-ignore 登记不改变上述已验证的代码。