From 1887c4e82058edac9dcae4131b8e46ee96e49f5b Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 28 Jul 2026 11:32:47 -0700 Subject: [PATCH] test(photon): allow auth.lock sentinel in temp-file leak assertions Maintainer follow-up: #60427's leak tests predate #64902's cross-process lock, whose auth.lock sentinel legitimately persists next to auth.json. --- tests/plugins/platforms/photon/test_auth.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/plugins/platforms/photon/test_auth.py b/tests/plugins/platforms/photon/test_auth.py index 7efb5dcfab53..75aa150f73d7 100644 --- a/tests/plugins/platforms/photon/test_auth.py +++ b/tests/plugins/platforms/photon/test_auth.py @@ -85,7 +85,13 @@ def test_save_auth_never_world_readable(tmp_hermes_home: Path) -> None: def test_save_auth_leaves_no_temp_files(tmp_hermes_home: Path) -> None: photon_auth.store_photon_token("secret-token") - leftovers = [p.name for p in tmp_hermes_home.iterdir() if p.name != "auth.json"] + leftovers = [ + p.name + for p in tmp_hermes_home.iterdir() + # auth.lock is the cross-process lock sentinel from + # hermes_cli.auth._auth_store_lock — expected to persist. + if p.name not in ("auth.json", "auth.lock") + ] assert leftovers == [] @@ -157,7 +163,13 @@ def test_save_auth_closes_raw_fd_when_fdopen_fails(tmp_hermes_home: Path) -> Non f"raw fd {fd} leaked after forced os.fdopen failure; " f"closed={closed_fds!r}" ) - leftovers = [p.name for p in tmp_hermes_home.iterdir() if p.name != "auth.json"] + leftovers = [ + p.name + for p in tmp_hermes_home.iterdir() + # auth.lock is the cross-process lock sentinel from + # hermes_cli.auth._auth_store_lock — expected to persist. + if p.name not in ("auth.json", "auth.lock") + ] assert leftovers == [], f"temp file leaked after fdopen failure: {leftovers}"