fix: arbitrate slots on the strongest profile proof

This commit is contained in:
Abdessamad Derraz committed 2026-10-06 04:32:19 +02:00
1 parent 2cafeb1d33
commit 619c282477
2 files changed
+46 -4

No files matched your search

+20
View File
@@ -555,5 +555,25 @@ class ManifestFollowsTheArbitration(unittest.TestCase):
self.assertEqual(by_dest[dest]["repo_path"], path)
class StrongestProfileClaimWins(unittest.TestCase):
"""yaps2 pins GameIndex.yaml by sha1; armsx2 matched a path only."""
def test_hash_proof_beats_path_proof(self):
from slots import Claim, Conflict, arbitrate, format_decision
def claim(emu, path, status):
return Claim("profile", "pcsx2/resources/GameIndex.yaml", "GameIndex.yaml",
emulator=emu, local_path=path, status=status)
conflict = Conflict(
"pcsx2/resources/GameIndex.yaml",
Claim("platform", "pcsx2/resources/GameIndex.yaml", "GameIndex.yaml",
local_path="p", status="path_exact"),
[claim("armsx2", "a", "path_exact"), claim("yaps2", "y", "sha1_exact")],
)
decision = arbitrate(conflict, "existence")
self.assertEqual(decision.winner.emulator, "yaps2")
self.assertIn("armsx2 expected another file", format_decision(decision))
if __name__ == "__main__":
unittest.main()