mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 14:26:00 +00:00
fix(steam): keep the applied record for a game the client did not report, and apply nothing after a lost write
Review: a game the client briefly refused lost its games_applied record, so its unchanged request later looked new and overwrote the Steam pick; it now keeps what was applied before. When the app rewrote games.json during both tries, the stale second read was applied; that pass now applies no per-game choice and keeps the record.
This commit is contained in:
1 parent
663da2948c
commit
449dc301bd
3 files changed
+38
-8
No files matched your search
@@ -707,6 +707,32 @@ class ReconcileTest(unittest.TestCase):
|
||||
self.assertFalse(COMPAT["write_game_requests"]({}, text))
|
||||
self.assertEqual(self.games(), {"10": {"valve": True, "dir": "Proton Experimental (ARM64)"}})
|
||||
|
||||
def test_an_app_the_client_briefly_refuses_keeps_its_applied_choice_live(self):
|
||||
page = FakePage({"0": TOOL, "10": TOOL, "11": TOOL}, [TOOL, TOOL_11, COMPAT["FEX_TOOL"]])
|
||||
self.write_games({"10": {"valve": True, "dir": "Proton 11.0 (ARM64)"}})
|
||||
self.reconcile(page)
|
||||
page.refused = {"10"}
|
||||
state = self.reconcile(page)
|
||||
self.assertEqual(state["games_applied"], {"10": {"valve": True, "dir": "Proton 11.0 (ARM64)"}})
|
||||
page.refused = set()
|
||||
page.sets.clear()
|
||||
page.mapping["10"] = COMPAT["FEX_TOOL"]
|
||||
self.reconcile(page)
|
||||
self.assertEqual(page.sets, [])
|
||||
self.assertEqual(page.mapping["10"], COMPAT["FEX_TOOL"])
|
||||
|
||||
def test_an_app_rewriting_its_choices_during_both_tries_applies_none_of_them_live(self):
|
||||
page = FakePage({"0": TOOL, "10": TOOL, "11": TOOL}, [TOOL, TOOL_11, COMPAT["FEX_TOOL"]])
|
||||
self.write_games({"10": {"valve": True, "dir": "Proton 11.0 (ARM64)"}})
|
||||
self.reconcile(page)
|
||||
page.sets.clear()
|
||||
page.mapping["10"] = COMPAT["FEX_TOOL"]
|
||||
self.write_games({"10": {"valve": True, "dir": "Proton 11.0 (ARM64)"}, "11": None})
|
||||
with mock.patch.dict(COMPAT["settled_game_requests"].__globals__, write_game_requests=lambda *_: False):
|
||||
state = self.reconcile(page)
|
||||
self.assertEqual(page.sets, [])
|
||||
self.assertEqual(state["games_applied"], {"10": {"valve": True, "dir": "Proton 11.0 (ARM64)"}})
|
||||
|
||||
def test_a_steam_pick_is_kept_at_the_next_start(self):
|
||||
config = self.steam / "config/config.vdf"
|
||||
config.parent.mkdir(parents=True)
|
||||
|
||||
Reference in new issue
Block a user