Merge pull request #1629 from ludovic111/fix/parity-trim-own-dirs

🤖 Agent: merged after verify passed and the integration run on the desktop.
This commit is contained in:
Ludovic Marie
2026-10-24 23:15:30 +02:00
committed by GitHub
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 []):