Skip to content

refactor(engine): killer 的上游复制段归零 - #284

Merged
SheathedSharp merged 5 commits into
mainfrom
refactor/engine-killer-upstream-zero
Nov 12, 2026
Merged

SheathedSharp merged 5 commits into
mainfrom
refactor/engine-killer-upstream-zero

Conversation

@SheathedSharp

Copy link
Copy Markdown
Owner

结果

internal/killer 按本项目的停止语义重写,审计(对照 26dbcae)从 244 行降到 0:

范围 之前 之后
killer 生产 86 0
killer 测试 158 0

引擎总量 8,933 → 8,689 行 / 636 段 / 131 文件(生产 3,478,测试 5,211)。

重写内容

  • Target 把选择器与出生声明分开,Options 分成「覆盖范围 / 停止策略 / 观测」,unit 按选择、停止方式、锚点、身份证据与结果分组;engine 的依赖按时间与存活、进程事实、信号适配器分组。
  • 升级路径改为 slices.ContainsFunc 判定存活;matchPort、fillProcesses、probeWith 的主机选择按条件重组。语义不变:进程组优先、子先于父、只有拒绝探测才算端口消失。
  • 测试夹具重述:假时钟与信号记录重新组织,断言改用 slices;真实进程夹具把 helper 启动、pid 汇报与子进程派生拆开,进程树、忽略 SIGTERM、真实端口释放的用例覆盖不变。

验证

  • go vet ./...
  • go test -count=1 -timeout=8m ./...(全绿)
  • go test -race -count=1 ./internal/killer/
  • python3 scripts/audit-upstream-origin.py --upstream /tmp/sonar:killer 无输出,总量 8,689

基于已合并的 #282;分支已同步 main。

🤖 Generated with Claude Code

SheathedSharp and others added 5 commits November 12, 2026 11:15
Target 把选择器与出生声明分开,Options 分成「覆盖范围 / 停止策略 /
观测」,unit 按选择、停止方式、锚点、身份证据和结果分组;engine 的
依赖按时间与存活、进程事实、信号适配器分组。

行为不变:目标解析、进程组优先、子先于父的排序和升级等待都保持原样。

Co-Authored-By: Claude Code <noreply@anthropic.com>
假时钟与信号记录重新组织,断言改用 slices 比较;真实进程夹具把 helper
的启动、pid 汇报与子进程派生拆开,进程树和忽略 SIGTERM 的用例覆盖不变。

Co-Authored-By: Claude Code <noreply@anthropic.com>
对照 26dbcae:总量 8,933 → 8,689 行 / 636 段、131 个文件(生产 3,478、
测试 5,211),internal/killer 整包归零。

Co-Authored-By: Claude Code <noreply@anthropic.com>
@SheathedSharp
SheathedSharp merged commit d586413 into main Nov 12, 2026
13 checks passed
@SheathedSharp
SheathedSharp deleted the refactor/engine-killer-upstream-zero branch November 12, 2026 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant