The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(gitlock): name why a kept lock stayed, and stop a copy race with git 2.55 maintenance
Tekniumfebc878fe406
diff --git a/tests/hermes_cli/test_gitlock.py b/tests/hermes_cli/test_gitlock.pyindex 5b78ff4ccde..d660af3d865 100644--- a/tests/hermes_cli/test_gitlock.py+++ b/tests/hermes_cli/test_gitlock.py@@ -459,7 +459,14 @@ def test_a_killed_updates_lock_stays_while_any_git_works_in_the_checkout(repo: Pproc.kill()proc.wait()if not form.startswith("dashed"):- assert release_dead_index_lock(repo) is True, "once the checkout's git is gone the killed update's lock goes"+ released = release_dead_index_lock(repo)+ why = None+ if not released: # name which leg kept it: owner proof, an unreadable process, or a holder+ from hermes_cli import _early_recovery as er+ from hermes_cli.gitlock import _killed_update_owns+ why = {"killed_update_owns": _killed_update_owns(lock),+ "held_open": er._held_open(lock, repo, any_git=True)}+ assert released is True, f"once the checkout's git is gone the killed update's lock goes: {why}"@pytest.mark.skipif(not Path("/proc/self/fd").is_dir(), reason="ownership proof via /proc (Linux)")@@ -472,7 +479,9 @@ def test_a_git_elsewhere_exiting_mid_scan_is_gone_not_a_hidden_holder(repo: Pathfrom tests.waiting import wait_untilother = tmp_path / "other"- shutil.copytree(repo, other)+ # git >= 2.55 detaches `git maintenance run --auto` after the fixture's commits; it can delete+ # .git/objects/maintenance.lock mid-copy (shutil.Error). Copy only what the scan needs.+ shutil.copytree(repo, other, ignore=shutil.ignore_patterns("*.lock"))lock = repo / ".git" / "index.lock"lock.write_bytes(b"") # a killed git's: nothing holds itmarker = "hermes.test=exits-mid-scan"