fix(steam): track Steam Lite undo by target id and record the resolved OOM arm

This commit is contained in:
Kurt Himebauch committed 2026-11-26 21:33:57 -05:00
1 parent 8d4571ac4c
commit 58b3c3e9b8
3 files changed
+24 -7

No files matched your search

@@ -413,10 +413,9 @@ class Actions:
"""Undo a held intervention; targets whose undo failed stay held for the next restore."""
present = {t.get("id") for t in targets}
mine = [t for t in targets if t.get("id") in held]
out = self.each(mine, method, params)
for target in mine:
if isinstance(out.get(target.get("title") or "?"), int):
held.discard(target.get("id"))
undone = set()
out = self.each(mine, method, params, undone)
held.difference_update(undone)
held.intersection_update(present)
return out
+3 -3
View File
@@ -247,7 +247,7 @@ def system_available(dev: Device) -> int | None:
return int(parts[1]) // 1024 if len(parts) >= 2 and parts[1].isdigit() else None
def oom_trial(dev: Device, app: str, profile: str, run_dir: Path, args) -> dict:
def oom_trial(dev: Device, app: str, profile: str, run_dir: Path, args, arm: str | None = None) -> dict:
"""Fresh Steam, launch, load the save, and see whether the session survives."""
run_dir.mkdir(parents=True, exist_ok=True)
ensure_steam(dev, fresh=True)
@@ -259,7 +259,7 @@ def oom_trial(dev: Device, app: str, profile: str, run_dir: Path, args) -> dict:
total = args.idle + 60 + args.title + 10 + args.watch + 20
rec = recorder(dev, total, args.interval, name)
events = {"profile": profile, "app": app, "started": time.time(), "kind": "oom", "env": args.env or [],
"arm": args.arm or profile}
"arm": arm or profile}
time.sleep(args.idle)
dev.mark("launch")
t0 = time.monotonic()
@@ -808,7 +808,7 @@ def main(argv=None) -> int:
if args.arm and not arms and len(names) > 1:
arm = "%s-%s" % (args.arm, name)
run_dir = args.out / ("oom-%s-%s-r%d" % (args.app, arm, i + 1))
events = oom_trial(dev, args.app, profile, run_dir, args)
events = oom_trial(dev, args.app, profile, run_dir, args, arm)
print(json.dumps({k: events.get(k) for k in ("arm", "profile", "loaded", "survived",
"died_after_s", "exit", "launch_s")}), flush=True)
else:
+18
View File
@@ -218,6 +218,24 @@ class ActionsTest(unittest.TestCase):
self.assertEqual(actions.frozen, {'w'})
self.assertTrue(actions.holding())
def test_undo_results_follow_target_ids_when_titles_repeat(self):
log = []
first = dict(STORE, id='w1')
second = dict(STORE, id='w2', webSocketDebuggerUrl='ws://127.0.0.1:8080/devtools/page/w2')
c = client(log, broken=())
failing = c.opener
def opener(url):
session = failing(url)
if url.endswith('/w'):
session.broken = ('Page.setWebLifecycleState',)
return session
c.opener = opener
actions = Actions(c, clock=lambda: 0.0)
actions.frozen = {'w1', 'w2'}
actions.thaw([first, second])
self.assertEqual(actions.frozen, {'w1'})
def test_a_closed_target_is_no_longer_held(self):
self.actions.frozen = {'gone'}
self.actions.thaw(TARGETS)