Share harness passes between worktrees and cap harnesses machine-wide

A pass is keyed by the content of the harness's dependencies, so it is
also valid in any worktree with the same files. Passes are published to
parity-shared/ beside the shared vanilla data, and a worktree adopts one
whose key matches its own files instead of running the harness: an
agent's gate only runs what its own changes affect, instead of the whole
suite from scratch. Every runner on the machine also shares
PARITY_MACHINE_JOBS slots, so several agents' gates can't overload it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-11 16:42:52 +02:00
parent bcfa2f6974
commit d061bdf2fb
3 changed files with 76 additions and 7 deletions
+19
View File
@@ -44,6 +44,25 @@ class ParityRunnerTests(unittest.TestCase):
source.write_text("two!")
self.assertTrue(parity.stale("x", state, hasher, "env"))
def test_a_pass_from_another_worktree_counts_only_for_the_same_content(self):
with tempfile.TemporaryDirectory() as temp:
elsewhere, here, shared = Path(temp, "a"), Path(temp, "b"), Path(temp, "shared")
for root in (elsewhere, here):
root.mkdir()
(root / "x.rs").write_text("same")
with mock.patch.object(parity, "SHARED", shared):
with mock.patch.object(parity, "ROOT", elsewhere):
record = {"status": "pass", "dependencies": ["x.rs"], "artifacts": []}
record["key"] = parity.key(record, parity.Hasher({}), "env")
parity.publish("x", record)
with mock.patch.object(parity, "ROOT", here):
state = {"harnesses": {}, "hashes": {}}
self.assertFalse(parity.stale("x", state, parity.Hasher(state["hashes"]), "env"))
self.assertTrue(state["harnesses"]["x"]["shared"])
(here / "x.rs").write_text("changed")
state = {"harnesses": {}, "hashes": {}}
self.assertTrue(parity.stale("x", state, parity.Hasher(state["hashes"]), "env"))
class OracleReuseTests(unittest.TestCase):
"""tools/parity_shim.py replays a run only when its inputs and outputs are as recorded."""