The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(update): the new early-recovery regressions read text BOM-tolerantly and probe euid portably
Teknium7293aebbe92e
diff --git a/tests/hermes_cli/test_early_recovery.py b/tests/hermes_cli/test_early_recovery.pyindex 5bd8bdd5720..1ce7f2953f0 100644--- a/tests/hermes_cli/test_early_recovery.py+++ b/tests/hermes_cli/test_early_recovery.py@@ -206,9 +206,9 @@ def test_zip_journal_writer_never_writes_through_a_preexisting_temp(tmp_path, liexcept OSError:pytest.skip("symlinks need privileges here")er.write_zip_swap_journal(root, "staging", [["a.py", True]])- assert secret.read_text(encoding="utf-8") == "API_KEY=keep\n"+ assert secret.read_text(encoding="utf-8-sig") == "API_KEY=keep\n"journal = root / er.ZIP_SWAP_JOURNAL- assert not journal.is_symlink() and '"phase": "staging"' in journal.read_text(encoding="utf-8")+ assert not journal.is_symlink() and '"phase": "staging"' in journal.read_text(encoding="utf-8-sig")@pytest.mark.parametrize("body", ["", "{not json", '{"phase": "swap", "entries": [["a.py", true]]}',@@ -235,11 +235,12 @@ def test_an_unparsed_zip_journal_keeps_itself_and_every_backup(tmp_path, monkeypmonkeypatch.setattr(Path, "read_text", flaky)assert er.restore_interrupted_zip_swap(root) is Falseassert journal.is_file()- assert {p.name: p.read_text(encoding="utf-8") for p in root.iterdir() if p != journal and p.suffix != ".lock"} == {+ assert {p.name: p.read_text(encoding="utf-8-sig") for p in root.iterdir() if p != journal and p.suffix != ".lock"} == {"a.py": "NEW_A", "a.py.hermes-update-old": "OLD_A", "b.py": "OLD_B", "b.py.hermes-update-staging": "NEW_B"}[email protected](sys.platform == "win32" or os.geteuid() == 0, reason="POSIX modes; root ignores them")[email protected](sys.platform == "win32" or getattr(os, "geteuid", lambda: 0)() == 0,+ reason="POSIX modes; root ignores them")def test_dropping_a_staged_tree_never_changes_a_hardlinked_live_files_mode(tmp_path):live = tmp_path / "release"live.mkdir()diff --git a/tests/hermes_cli/test_update_interrupted_pull.py b/tests/hermes_cli/test_update_interrupted_pull.pyindex ca9b2b1741a..bb6716bc7ce 100644--- a/tests/hermes_cli/test_update_interrupted_pull.py+++ b/tests/hermes_cli/test_update_interrupted_pull.py@@ -419,7 +419,7 @@ def test_a_rollback_settles_beside_an_unrelated_tracked_edit_and_keeps_it(tmp_pa(root / "bulk" / "f1.txt").write_text("my edit\n", encoding="utf-8", newline="")assert er.restore_interrupted_pull(root) is Trueassert "reset --hard" not in capsys.readouterr().err- assert not marker.exists() and (root / "module.py").read_text(encoding="utf-8") == "good = True\n"+ assert not marker.exists() and (root / "module.py").read_text(encoding="utf-8-sig") == "good = True\n"assert _git(root, "status", "--porcelain", "--untracked-files=no") == "M bulk/f1.txt"@@ -443,7 +443,7 @@ def test_an_index_lock_judged_foreign_after_our_git_exited_is_never_reclaimed_laos.utime(lock, ns=(1_000_000_000, 1_000_000_000))assert er.restore_interrupted_pull(root) is Trueassert not lock.exists() and not marker.exists()- assert (root / "module.py").read_text(encoding="utf-8") == "good = True\n"+ assert (root / "module.py").read_text(encoding="utf-8-sig") == "good = True\n"def test_a_launch_that_cannot_get_the_repair_claim_never_continues_from_the_torn_tree(tmp_path, monkeypatch):