Parity: a pass trims only its own .local directory

decorated_region compiles its oracle into chunk-generation-parity; when it
passed while chunk_generation was still running, the trim deleted
chunk_generation's dumps mid-run (FileNotFoundError on
*-987654321987-full.txt in CI on #1569, #1571 and #1584).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-24 23:09:48 +02:00
parent 65d7c4b027
commit cb1c9e6935
2 changed files with 21 additions and 1 deletions
+17
View File
@@ -283,3 +283,20 @@ class OracleReuseTests(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
class LargeOutputTests(unittest.TestCase):
def test_a_pass_clears_only_its_own_directory(self):
with tempfile.TemporaryDirectory() as tmp:
local, state = Path(tmp) / ".local", Path(tmp) / "state"
own, shared = local / "decorated-region-parity", local / "chunk-generation-parity"
for directory in (own, shared):
directory.mkdir(parents=True)
(directory / "dump.txt").write_bytes(b"x" * 16)
trace = {"commands": [["java", "-d", str(shared / "classes")], ["probe", str(own / "dump.txt")]]}
with mock.patch.multiple(parity, LOCAL=local, STATE_DIR=state, LARGE_OUTPUT=8):
parity.outputs_listing("decorated_region", fresh=True)
parity.clear_large_outputs("decorated_region", trace)
self.assertFalse((own / "dump.txt").exists())
# chunk_generation may still be writing there.
self.assertTrue((shared / "dump.txt").exists())
+4 -1
View File
@@ -679,7 +679,10 @@ def clear_large_outputs(name, trace):
top = path.relative_to(local).parts[0]
except (ValueError, IndexError):
continue
if top not in OWN_DIRECTORIES:
# Only the harness's own directory: another harness running beside it may be writing
# large files in a directory this one merely read (decorated_region compiles its oracle
# into chunk-generation-parity while chunk_generation writes its dumps there).
if top not in OWN_DIRECTORIES and top.startswith(name.replace("_", "-")):
directories.add(local / top)
for directory in directories:
for file in (directory.rglob("*") if directory.is_dir() else []):