The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(auth): keep the persisted clean-mark tests to the two invariants
kshitijk4poorf3ae63162ee5
diff --git a/tests/agent/test_credential_pool_profile_oauth_fork.py b/tests/agent/test_credential_pool_profile_oauth_fork.pyindex b16e8993d7f..fbae90a594f 100644--- a/tests/agent/test_credential_pool_profile_oauth_fork.py+++ b/tests/agent/test_credential_pool_profile_oauth_fork.py@@ -808,59 +808,3 @@ def test_persisted_mark_still_re_heals_when_the_root_store_gains_a_grant(fleet):_new_process(auth_mod)assert auth_mod.heal_forked_single_use_oauth_grants("anthropic") is Noneassert grants._oauth_heal_clean_mark_path().read_text() != marked---def test_unreadable_clean_mark_falls_back_to_healing(fleet, monkeypatch):- """The mark is a cache: corrupt, truncated or wrong-shaped content must- mean 'unknown' and re-run the heal, never raise into a credential path."""- import hermes_cli.auth as auth_mod- from hermes_cli import auth_oauth_grants as grants-- kid = _kid_with_api_key_only(fleet, "kid3")- fleet["use"](kid)- assert auth_mod.heal_forked_single_use_oauth_grants("anthropic") is None- mark = grants._oauth_heal_clean_mark_path()-- taken = _count_locks(monkeypatch)- for junk in ("{not json", "[]", '{"anthropic": "clean"}', ""):- mark.write_text(junk)- _new_process(auth_mod)- taken.clear()- assert auth_mod.heal_forked_single_use_oauth_grants("anthropic") is None- assert len(taken) == 2, f"{junk!r} did not fall back to the locked heal"---def test_persisted_mark_invalidates_on_a_size_change_that_keeps_the_mtime(fleet, monkeypatch):- """An mtime-only key is fine for a mark that dies with the process; one- that outlives it must also survive `rsync -t` / `tar -p` / a restore,- which put a file's timestamp back after rewriting its contents."""- import hermes_cli.auth as auth_mod-- kid = _kid_with_api_key_only(fleet, "kid4")- fleet["use"](kid)- assert auth_mod.heal_forked_single_use_oauth_grants("anthropic") is None-- target = kid / "auth.json"- before = target.stat()- target.write_text(target.read_text() + " " * 32)- os.utime(target, ns=(before.st_atime_ns, before.st_mtime_ns))- assert target.stat().st_mtime_ns == before.st_mtime_ns, "mtime was not restored"-- _new_process(auth_mod)- taken = _count_locks(monkeypatch)- assert auth_mod.heal_forked_single_use_oauth_grants("anthropic") is None- assert len(taken) == 2, "a same-mtime rewrite kept the stale clean mark alive"---def test_clean_mark_records_no_credential_material(fleet):- """It lands next to the store it describes; it must stay a stat cache."""- import hermes_cli.auth as auth_mod- from hermes_cli import auth_oauth_grants as grants-- kid = _kid_with_api_key_only(fleet, "kid5")- fleet["use"](kid)- assert auth_mod.heal_forked_single_use_oauth_grants("anthropic") is None- body = grants._oauth_heal_clean_mark_path().read_text()- for secret in ("sk-ant-oat01", "sk-ant-ort", "sk-static-key", "sk-local",- "access_token", "refresh_token"):- assert secret not in body, f"clean mark leaked {secret}"