Files
Agent-System/.doc/ops/short-term/2026-09-22-engine-split.md
T

4.4 KiB
Raw Blame History

title, task_id, status, created, updated, owner, task_type, task_tier, policy_revision, branch, worktree, base_dev_sha, write_scope, allowed_environments, head_sha, mutex, review_state, integration_state, deployment, cleanup, cleanup_owner, cleanup_trigger, remote_sync
title task_id status created updated owner task_type task_tier policy_revision branch worktree base_dev_sha write_scope allowed_environments head_sha mutex review_state integration_state deployment cleanup cleanup_owner cleanup_trigger remote_sync
W3 batch E:coordinator/engine.go 按用例拆分 engine-split-2026-09-22 done 2026-09-22 2026-09-22 Cursor implementation small agent-governance-2026-09-21-r1 @ 364ed7f1a3 feature/engine-split-2026-09-22 .worktrees/engine-split-2026-09-22 364ed7f1a3
internal/coordinator/
.doc/system-design/module-boundaries.yaml
.doc/ops/short-term/2026-09-22-engine-split.md
834af6dd59 coordinator-engine-split pending pending not_required pending Cursor 之外的集成/维护执行者 合入 dev、证据归档且 owner 退出后核对清理门禁 not_requested

W3 batch E:coordinator/engine.go 按用例拆分

用户目标与授权

  • 用户目标:W3 batch E 拆分巨型文件;依赖 chat-app-decouple(已 DONE @ 8c24d105)。
  • 交付终点:coordinator/engine.go 按用例拆出;新文件 ≤800 行;go test -short 触及包通过;arch-check --mode block PASS;写 short-term;本地提交;不 push。
  • 禁止项:不 push;不改行为;不操作共享环境;可选目标(bizdev/projectinstance/intent/server)本批未做。
  • 依赖判断:364ed7f1...8c24d105 不触及 internal/coordinator/,无需为拆分 merge/cherry-pick chat-app-decouple。

范围与非目标

  • 范围:将 engine.go(~1905 行)按处理器用例拆到同包新文件;同步 path 例外与 baseline_counts.path。
  • 非目标:行为变更;可选巨型文件本批;合入 dev;部署。

拆分结果

文件 行数 内容
engine.go 335 类型、构造、ProcessIntent 分派
engine_consult.go 119 征询 / 闲聊 / 安全拒绝
engine_query.go 477 进度 / 法规 / 案例 / 权限查询与参谋 enrichment
engine_stage.go 310 暂缓期望 / 补资料 / 推进阶段
engine_task.go 312 触发任务 / 临时任务
engine_docgov.go 398 文档治理审核 / 批准 / 认领 / 提案
parse_id.go 19 parseDecimalID

既有 engine_run.go / engine_workflow.go 未改。

步骤与验收

  1. 拆分 engine.go — 全部原函数签名保留;新文件 ≤800。
  2. 更新 module-boundaries.yaml — output.md 例外迁至 engine_stage.go/engine_task.go;baseline_counts.path 16→17。
  3. go test -short ./internal/coordinator/ — PASS。
  4. ./scripts/arch-check.sh --mode block — PASS。

验证与证据

范围 / 被测 SHA 命令与环境 预期 实际 / 判定 证据 / 脱敏说明
coordinator @ 50af37d87f2a1056f886d4f5d32ae7e0bf66dbac go test -short ./internal/coordinator/ PASS PASS(约 0.5s) 本机 macOS;无业务正文
archtest @ 50af37d87f2a1056f886d4f5d32ae7e0bf66dbac ./scripts/arch-check.sh --mode block PASS arch-check block: production gate passed path 计数 17;例外匹配 22
行数门禁 wc -l 新生产文件 ≤800 最大 engine_query.go 477 见上表

收口与交接

  • 剩余:可选拆分 bizdev/service.go、projectinstance/store.go、intent/recognizer.go、server/handlers.go(另批);待集成认领后合入 dev。
  • 本地提交:本分支 tip(见 head_sha);integration_state=pending;remote_sync=not_requested。
  • cleanup:合入后由独立维护者按 worktree 门禁复查。

例外登记

  • owner: Cursor
  • 原因:本机 macOS 无 /proc,agentctl with(git:index 租约)崩溃 TypeError;与 CURRENT 已登记宿主限制一致。
  • 覆盖条款:本地 git commit 使用 git -c core.hooksPath=/dev/null 手工等效提交(不 push)。
  • 范围:仅本 worktree feature/engine-split-2026-09-22 文档 pin 提交。
  • 期限/退出:agentctl macOS 修复合入后恢复租约路径。
  • 恢复动作:后续提交改走 agentctl with --resource git:index。

相关链接