From 2178b3ebe8fb47673193b89e340fdb7bdae15886 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sun, 13 Sep 2026 20:14:11 -0700 Subject: [PATCH] test: trim guard-cache race tests to the invariants Fold the whitespace-only case into the empty-file miss test and drop test_overwrite_is_all_or_nothing: it wrote sequentially, so it exercised nothing about os.replace atomicity that the publish test does not. --- tests/gateway/test_adapter_guard_cache_race.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/gateway/test_adapter_guard_cache_race.py b/tests/gateway/test_adapter_guard_cache_race.py index 286be3d496..37b3ec7a16 100644 --- a/tests/gateway/test_adapter_guard_cache_race.py +++ b/tests/gateway/test_adapter_guard_cache_race.py @@ -32,9 +32,6 @@ class TestReadGuardCache: f = tmp_path / "gw-adapter-guard-cafe" f.write_text("", encoding="utf-8") assert gw_conftest._read_guard_cache(f) is None - - def test_whitespace_only_is_a_miss(self, tmp_path): - f = tmp_path / "gw-adapter-guard-cafe" f.write_text("\n \n", encoding="utf-8") assert gw_conftest._read_guard_cache(f) is None @@ -75,12 +72,3 @@ class TestWriteGuardCacheAtomic: assert staging not in evictable finally: staging.unlink(missing_ok=True) - - def test_overwrite_is_all_or_nothing(self, tmp_path): - """os.replace swaps the whole file: after any successful publish the - content is complete, never a truncated prefix of the new verdict.""" - f = tmp_path / "gw-adapter-guard-cafe" - gw_conftest._write_guard_cache_atomic(f, "clean") - long_msg = "violation " * 5000 - gw_conftest._write_guard_cache_atomic(f, long_msg) - assert f.read_text(encoding="utf-8") == long_msg