From fb2b69bdbbf3cf33706989635ca3416b97667ea7 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 8 Nov 2026 20:34:01 -0300 Subject: fix: test/daemon.py --upgrade --gui waited for a second view's frame in the session's own captures (caps/view-1), which no build writes since a session shows one frontend of its own: the second window is a replica client, opened as window_clients' second is (its own process and captures), and after the upgrade the session's window is drawn again while the old build's client window is let go and told to upgrade too Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/daemon.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/test/daemon.py b/test/daemon.py index d4add27f..622684f6 100644 --- a/test/daemon.py +++ b/test/daemon.py @@ -1765,7 +1765,8 @@ def upgrades(old, new): def gui_upgrades(old, new): """Upgrade in a window session (test mode: hidden windows, captured): - two windows, an unsaved edit and a shell's job, onto another build.""" + its window, a client window, an unsaved edit and a shell's job, onto + another build.""" scratch = Path(__file__).resolve().parent.parent.parent / '.scratch' / 'daemon' / 'dmn' root = Path(tempfile.mkdtemp(prefix='rtgu-', dir=scratch)) env = {k: v for k, v in os.environ.items() if not k.startswith('PARDES_') and 'PAGER' not in k} @@ -1803,11 +1804,12 @@ def gui_upgrades(old, new): client.write(f'/pane/{text}/body', b'unsaved\n') client.write(f'/pane/{shell}/pty/data', b'sleep 1000; echo done-after-upgrade\r') sleeper = wait_for('the sleep', lambda: [p for p in processes(root) if cmdline(p)[:2] == [b'sleep', b'1000']])[0] - attach = subprocess.run([str(binary), '--attach=win'], env=env, cwd=root, timeout=10, - stdout=subprocess.PIPE, stderr=subprocess.PIPE) - assert attach.returncode == 0, attach.stderr - frames = [caps / 'latest.ppm', caps / 'view-1' / 'latest.ppm'] - wait_for('both windows drawn', lambda: all(f.exists() for f in frames)) + # A second window: a replica client of the session (its own + # process, its captures its own), as window_clients' second. + second = Window(root, 'second', [str(binary), '--attach=win'], env) + started.append(second.pid) + frames = [caps / 'latest.ppm', root / 'second' / 'latest.ppm'] + wait_for('both windows drawn', lambda: all(f.exists() for f in frames), timeout=20) install(new, binary) time.sleep(.05) mark = time.time() @@ -1821,13 +1823,17 @@ def gui_upgrades(old, new): client.write(f'/pane/{text}/exec', b'Undo\n') assert client.read(f'/pane/{text}/body') == b'one\ntwo\n' assert alive(shell_pid) and ppid(shell_pid) == proc.pid and alive(sleeper) - wait_for('both windows drawn again', lambda: all(f.stat().st_mtime > mark for f in frames)) + wait_for('the window drawn again', lambda: frames[0].stat().st_mtime > mark) + # The second, a client of the old build: let go and told to upgrade too. + second.p.wait(timeout=30) + said = second.err.read_bytes() + assert b'upgrade this client too' in said or b'run the same pardes at both ends' in said, said[-400:] said = Replica(root / 'pardes-replica.sock').hello('win', semantics(new)) assert said == ('welcome', proc.pid, 'win'), said os.kill(sleeper, signal.SIGTERM) wait_for('the shell carrying on', lambda: b'done-after-upgrade\n' in client.read(f'/pane/{shell}/body')) - print(f'upgrade: window session {proc.pid}, its daemon, shell {shell_pid} and two windows on the new build; ' - 'the edit, its undo and the job kept') + print(f'upgrade: window session {proc.pid}, its daemon, shell {shell_pid} and its window on the new build, ' + 'a client window of the old build let go and told to upgrade too; the edit, its undo and the job kept') client.write(f'/pane/{shell}/exec', b'Exit\n') proc.wait(timeout=10) client.socket.close() -- cgit v1.3