父 issue
背景
#726 关闭后继续扫描 runtime direct access。剩余的 pickers 多数是 token/consumer facade 调用,surfaceUIRuntime direct access 主要集中在 owner 文件;下一处值得做的小切片是 catalog runtime:
多个业务文件通过 s.catalog.persistedThreads != nil 判断 catalog 是否可用。
这泄露了 serviceCatalogRuntime 内部字段,和当前 runtime facade 方向不一致。
其余 catalog 调用已经基本是 runtime method,例如 recentPersistedThreadsForBackend / persistedThreadByIDForBackend。
本单只收口 catalog 可用性判断,不改变 persisted thread/workspace 查询行为。
目标
把 s.catalog.persistedThreads != nil 这类内部字段判断收口到 catalog runtime facade,并新增结构测试防止非 owner 文件直接访问 catalog 内部字段。
非目标
不改变 persisted thread/workspace 查询、缓存、fallback 或 backend filtering 语义。
不改变 /list、/use、workspace picker、thread merge 或 target picker 行为。
不改 pickers、surfaceUIRuntime、claims、queue 或 request gate。
完成标准
生产代码中除 service_runtime_clusters.go catalog owner 外,不再直接访问 .catalog.persistedThreads / .catalog.persistedThreadsLast / .catalog.persistedWorkspaces。
新增结构测试防止 catalog runtime 内部字段 direct access 回归。
persisted catalog、thread merge、workspace selection/target picker 相关测试通过。
子 issue 结果回卷到 调研核心大包与高耦合结构拆分方案 #713 后再关闭。
信息索引
相关文件:
internal/core/orchestrator/service_runtime_clusters.go
internal/core/orchestrator/service_thread_backend_partition.go
internal/core/orchestrator/service_thread_global.go
internal/core/orchestrator/service_surface_selection.go
internal/core/orchestrator/service_target_picker_add_workspace.go
扫描命令:
rg -n " \.catalog\.(persistedThreads|persistedThreadsLast|persistedWorkspaces)" internal/core/orchestrator --glob ' *.go'
建议范围
先加结构测试,允许 service_runtime_clusters.go 访问 catalog 内部字段,预期红灯命中业务文件。
在 serviceCatalogRuntime 增加 hasPersistedThreads() 或等价 facade。
替换业务文件里的 direct nil 判断。
跑目标测试和全量测试。
执行决策
实现参考
serviceCatalogRuntime.hasPersistedThreads() 返回 r != nil && r.persistedThreads != nil。
不改变 existing method 的 nil behavior。
结构测试只拦截 .catalog.persistedThreads / .catalog.persistedThreadsLast / .catalog.persistedWorkspaces,不拦截正常 runtime method 调用。
检查参考
建议验证命令:
go test ./internal/core/orchestrator -run ' Catalog|Persisted|Thread|Workspace|TargetPicker|SurfaceSelection' -count=1
go test ./internal/core/orchestrator -count=1
go test ./internal/core/orchestrator ./internal/core/control ./internal/app/daemon -count=1
go test ./...
bash scripts/check/go-file-length.sh && git diff --check
Guardrail:
若仅收口 catalog runtime 内部字段访问,不改变 route/state transition 或 Feishu card payload,remote / Feishu canonical docs 无需更新。
收尾参考
把完成结果、验证结果、verifier 结果和 commit 写回 调研核心大包与高耦合结构拆分方案 #713 。
关闭前运行 issuectl close-plan。
提交并通过 ./safe-push.sh 推送。
执行快照
当前阶段:close-out
当前执行点:close-out tail only;下一步只剩回卷 调研核心大包与高耦合结构拆分方案 #713 、commit/push、close-plan 和 finish --close。
已完成:结构测试红灯/绿灯;catalog runtime 内部字段判断已收口到 facade;独立 verifier 结果为 pass。
下一步:回卷 调研核心大包与高耦合结构拆分方案 #713 后提交推送,并运行 close-plan/finish 关闭本 issue。
当前阻塞:无。
最近改变的假设:pickers/surfaceUIRuntime 暂不混入本切片。
最后一致状态:本地测试 go test ./...、文件长度检查和 diff check 均通过;已提交 commit 7b83af68。
未完成尾项:push、close-plan、finish --close。
恢复步骤:检查 git status 与 push 状态,运行 issuectl close-plan/finish --close。
父 issue
背景
#726 关闭后继续扫描 runtime direct access。剩余的
pickers多数是 token/consumer facade 调用,surfaceUIRuntimedirect access 主要集中在 owner 文件;下一处值得做的小切片是 catalog runtime:s.catalog.persistedThreads != nil判断 catalog 是否可用。serviceCatalogRuntime内部字段,和当前 runtime facade 方向不一致。recentPersistedThreadsForBackend/persistedThreadByIDForBackend。本单只收口 catalog 可用性判断,不改变 persisted thread/workspace 查询行为。
目标
把
s.catalog.persistedThreads != nil这类内部字段判断收口到 catalog runtime facade,并新增结构测试防止非 owner 文件直接访问 catalog 内部字段。非目标
/list、/use、workspace picker、thread merge 或 target picker 行为。完成标准
service_runtime_clusters.gocatalog owner 外,不再直接访问.catalog.persistedThreads/.catalog.persistedThreadsLast/.catalog.persistedWorkspaces。信息索引
相关文件:
internal/core/orchestrator/service_runtime_clusters.gointernal/core/orchestrator/service_thread_backend_partition.gointernal/core/orchestrator/service_thread_global.gointernal/core/orchestrator/service_surface_selection.gointernal/core/orchestrator/service_target_picker_add_workspace.go扫描命令:
建议范围
service_runtime_clusters.go访问 catalog 内部字段,预期红灯命中业务文件。serviceCatalogRuntime增加hasPersistedThreads()或等价 facade。执行决策
实现参考
serviceCatalogRuntime.hasPersistedThreads()返回r != nil && r.persistedThreads != nil。.catalog.persistedThreads/.catalog.persistedThreadsLast/.catalog.persistedWorkspaces,不拦截正常 runtime method 调用。检查参考
建议验证命令:
Guardrail:
收尾参考
issuectl close-plan。./safe-push.sh推送。执行快照
go test ./...、文件长度检查和 diff check 均通过;已提交 commit7b83af68。