Repository navigation
refactor(engine): daemon 的上游复制段归零,引擎审计清零 - #302
Merged
Merged
Conversation
根目录 23 个生产文件按职责重述:连接关闭顺序、锁的获取与释放、生命周期 钩子、日志轮转、端口解析与配置编辑保持原有语义;RPC 方法名、JSON 字段、 错误码与日志文案未改。文件路径未动,复制段从 1,584 行归零。 Co-Authored-By: Claude Code <noreply@anthropic.com>
rpc 的线上结构与 schema、runsreg 的注册/退出与改名、groupstart 的地址 登记按字段语义重述。JSON tag 序列、结构体字段顺序、错误码与判定顺序未 变;协议 schema 的逐字节回归通过。生产代码复制段归零。 Co-Authored-By: Claude Code <noreply@anthropic.com>
server、integration、stream、lock、socket、listen、testguard 与 treekill 系列测试重写:harness 与局部命名按实际动作命名,重复断言收成辅助函数, 表驱动用例合并。测试函数数不变,断言覆盖不减少(stat 与枚举检查移入 辅助函数与期望表),未删用例或加 Skip。 Co-Authored-By: Claude Code <noreply@anthropic.com>
groups.init/config/rename/read、worktree_ports、store 与 handlers_store 的 测试重构为 rig 结构体与辅助方法,重复的读取与错误检查收进方法内(调用点 仍然 fail 测试)。夹具端口、服务名与目录换成等价取值并同步断言;测试 函数数不变,未删用例或加 Skip。 Co-Authored-By: Claude Code <noreply@anthropic.com>
kill_handlers、docker、runs、cwd、up、doctor 集成测试重构:连接样板收成 辅助函数,重复的快照读取与解码收成一处(调用点仍 fail 测试),用例主体 按实际动作命名。测试函数数不变,断言覆盖不减少。 Co-Authored-By: Claude Code <noreply@anthropic.com>
rpc、runsreg、groupstart 的测试重写:schema 断言收成读取辅助函数,逐字节 比对仍是「磁盘文件 == Marshal()」;注册、退出、会话与地址分配的用例换 等价夹具并同步断言。测试函数数与改动前一致,未改 schema 文件本身。 审计输出归零:对照 26dbcae 已无 5 行以上的复制段。 Co-Authored-By: Claude Code <noreply@anthropic.com>
对照 26dbcae:总量 5,530 → 0 行 / 0 段 / 0 文件。审计脚本以 0 退出, 「上游声明可以移除」的判据已经成立;声明本身的移除单独提交。 Co-Authored-By: Claude Code <noreply@anthropic.com>
…n-upstream-zero # Conflicts: # engine/internal/daemon/runsreg/registry.go
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.
结果
internal/daemon按本项目对象模型重写,审计(对照26dbcae)从 5,530 行降到 0,整个引擎的复制段清零:从 9,610 起的整轮清理:ports 677、killer 244、groups 842、cmd 1,540、scanner 760、store 17、daemon 5,530。
重写内容
rpc/、runsreg/、groupstart/按字段语义重述。RPC 方法名、JSON tag 序列、结构体字段顺序、错误码、schema 内容与判定顺序均未改变。Marshal())保留。main的合并:fix(engine): 就绪超时消息点名该抬高的字段 #298 新增的Registry.Running与本轮重写的before同处一文件,冲突按「两者都保留」解决;合并后全量测试与审计再次通过。验证
go vet ./...go test -count=1 -timeout=8m ./...(全绿)go test -race -count=1 -timeout=10m ./internal/daemon/...GOOS=windows GOARCH=amd64/arm64 go build ./internal/daemon/gofmt对改动文件无输出python3 scripts/audit-upstream-origin.py --upstream /tmp/sonar:0 行 / 0 段 / 0 文件,退出码 0已知环境问题(非本次引入)
本机三个 docker 集成用例(hung / healthy / stale container list)失败,原因是 daemon 用登录 shell 的 PATH 覆盖了测试注入的假 docker 目录(
docker ps ran 0 times)。我在HEAD的临时 worktree 上复跑原始测试,失败信息完全相同,确认与本次改写无关;没有改断言或加 Skip 掩盖。下一步
本 PR 不删除 Sonar 声明。声明移除(
engine/UPSTREAM.md、THIRD_PARTY_NOTICES.md的 Sonar 段、engine/LICENSE指路句、scripts/license_test.py断言、docs/product.md的参考提及)单独一个 PR 提交,因为那是判据成立后的独立决定。🤖 Generated with Claude Code