Wait for recovery worker before releasing test fixtures (U5)

Why: ResumeInterruptedChildren starts a background worker; the recovery-hold test returned while it could still write to a temporary workspace and SQLite store, causing cleanup races.

Evidence: SELF Root e3a full combination exposed the TempDir/database-close race; the corrected target passed 100 repetitions and full Backend Go tests passed in /tmp/dependency-recovery-hold-wait-green-20261014-01a1345f.json and /tmp/dependency-backend-test-repair-all-go-green-20261014-01a1345f.json.

Impact: Test teardown synchronization only; no production recovery behavior changes.

Refs: Backend PR #196; Dev PR #537; R14/R15
This commit is contained in:
2026-10-14 04:15:17 +00:00
parent fffd5790cf
commit af2702de8a
+7
View File
@@ -80,6 +80,13 @@ func TestRecoveryHoldBlocksResumeUntilReleased(t *testing.T) {
if held, herr := st.HasOpenRecoveryHold(child.ID, string(child.ConversationID)); held || herr != nil {
t.Fatalf("解除后不应再有 hold:held=%v err=%v", held, herr)
}
// ResumeInterruptedChildren 启动后台续跑。等它完成后再让测试关闭数据库
// 和删除临时工作区,避免续跑与 t.Cleanup 并发写同一现场。
waitUntil(t, func() bool {
c.mgr.noticeMu.Lock()
defer c.mgr.noticeMu.Unlock()
return c.mgr.bgInFlight[c.run.ConversationID] == 0
})
}
// 会话级 hold:同会话的其他中断子 run 一并跳过(副作用疑点未核对前,