CI: guard coordinator pushback test flips on parent still running (run #20 flake: post-commit flip re-failed requeued child on slow runner; test-only, no production change)
ci / test (push) Successful in 35m52s

This commit is contained in:
host committed 2026-11-05 02:54:22 +08:00
1 parent 159d7112ae
commit fa4588a119
1 file changed
+15 -2
+15 -2
View File
@@ -373,12 +373,25 @@ class CoordAuditTestCase(unittest.TestCase):
while time.time() < deadline:
conn = sqlite3.connect(self.db_path)
try:
# 翻状态与父任务终态判定必须在同一条语句里原子
# 完成:只在父任务仍 running 时翻子任务。旧写法
# 是无条件翻状态,合流提交推回(父回 queued、子
# 回 queued)之后、协调员线程退出之前,翻状态线
# 程的下一拍会把已重排的 C1 重新翻回 failed,慢
# 机器上即表现为“父 queued、子 failed”的假失败
# (Gitea run #20 唯一失败项正是此断言;产品侧
# 合流本身无问题,直接调合流的 test_merge_pushback
# 在同一轮 CI 里通过)。
conn.execute(
"UPDATE tasks SET status = 'failed',"
" error_text = 'boom' WHERE id = 'C1'")
" error_text = 'boom' WHERE id = 'C1' AND"
" (SELECT status FROM tasks WHERE id = 'P1')"
" = 'running'")
conn.execute(
"UPDATE tasks SET status = 'completed',"
" result_text = 'done' WHERE id = 'C2'")
" result_text = 'done' WHERE id = 'C2' AND"
" (SELECT status FROM tasks WHERE id = 'P1')"
" = 'running'")
conn.commit()
finally:
conn.close()