Disable auto-gc in the task-lifecycle remote fixture
ci / test (pull_request) Successful in 2m13s

Why: git receive-pack runs 'gc --auto' in the background after a push;
the fixture's TemporaryDirectory teardown then races the gc writer and
fails with OSError 39 (remote.git not empty) — observed on the PR #285
runner (job 1967). The fixture remote holds no durable value, so auto-gc
is pure flake surface.

Evidence: the failing test passes 5/5 locally after the fix; full
make test-governance green (104 tests).

Impact: test fixture only; no governance-script behavior change.

Refs: Dev CI run 1438 job 1967; same race family as the upload-host
TempDir flake fixed earlier.
This commit is contained in:
2026-10-09 17:10:18 +00:00
parent fdf373b78a
commit bbdd3f4505
+4
View File
@@ -29,6 +29,10 @@ class TaskLifecycleTests(unittest.TestCase):
"TASK_PARENT_BRANCH", "TASK_PARENT_PR", "FORCE_ABANDON", "TASK_TARGET_BRANCH"): "TASK_PARENT_BRANCH", "TASK_PARENT_PR", "FORCE_ABANDON", "TASK_TARGET_BRANCH"):
self.env.pop(key, None) self.env.pop(key, None)
self.git(self.root, "init", "--bare", "--initial-branch=main", str(self.remote)) self.git(self.root, "init", "--bare", "--initial-branch=main", str(self.remote))
# receive-pack 默认在后台跑 gc --auto,与 TemporaryDirectory 清理竞态
# (CI 实测 OSError 39 remote.git not empty);夹具远端无留存价值,直接关。
self.git(self.remote, "config", "gc.auto", "0")
self.git(self.remote, "config", "receive.autogc", "false")
self.git(self.root, "init", "--initial-branch=main", str(self.repo)) self.git(self.root, "init", "--initial-branch=main", str(self.repo))
shutil.copytree(SOURCE / "scripts", self.repo / "scripts") shutil.copytree(SOURCE / "scripts", self.repo / "scripts")
(self.repo / "Makefile").write_text("precheck:\n\t@bash scripts/task.sh precheck\n") (self.repo / "Makefile").write_text("precheck:\n\t@bash scripts/task.sh precheck\n")