summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 16:31:13 -0300
committerGabriel Schneider <[email protected]>2026-11-23 17:32:07 -0300
commit414f62fe02ed2968e500faecac90b01ab303b850 (patch)
treee451d9ef672ba85064af204934ffa45c8ce22943
parent6f9a8b907a504c28aef6c68b923508419b54f0ee (diff)
downloadpardes-414f62fe02ed2968e500faecac90b01ab303b850.tar.gz
pardes-414f62fe02ed2968e500faecac90b01ab303b850.zip
test/daemon.py `upgrades`: a file's `Changes` layer shown on the old build is shown on the new (round 9's brief: a wire-31 session with the layer shown on a pane comes through as wire 34 with the layer shown): before the Upgrade a throwaway jj repository (a line taken away by a committed change; committed, as pardes never snapshots the working copy), its file looked at from the shell and `Changes @-` run, the taken-away line drawn; after it, 9P's `body` the file's text without that line and the line drawn again; run with the installed build f34d3a74cc4a (wire 31) to this tree's ReleaseSafe build (PASS, 50 s), between this tree's Debug and ReleaseSafe builds both ways (PASS, 66 s and 39 s, loads 1.0-1.3); that its lines are read-only after the load is held by core/jj.zig "a session dumped by a build whose layer was a view's bit and no lines (wire 31) loads with the layer shown ..." and the refusal tests (a key on the layer's lines is not reachable through 9P)
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
-rw-r--r--test/daemon.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/daemon.py b/test/daemon.py
index 9522153d..22a8c3b7 100644
--- a/test/daemon.py
+++ b/test/daemon.py
@@ -3590,6 +3590,24 @@ def upgrades(old, new):
text = int(client.read('/look'))
client.write(f'/pane/{text}/body', b'unsaved\n')
assert client.read(f'/pane/{text}/body') == b'one\ntwo\nunsaved\n'
+ # A file of a jj repository with its `Changes` layer shown (a build
+ # of wire 31: ghost rows, a view's bit; wire 34: the pane's read-only
+ # lines): shown again after the Upgrade.
+ layered = None
+ if shutil.which('jj'):
+ repo = root / 'repo'
+ repo.mkdir()
+ jj = ['jj', '--config=user.name=t', '--config=user.email=t@t', '--quiet']
+ subprocess.run(jj + ['git', 'init'], cwd=repo, env=env, check=True, capture_output=True)
+ (repo / 'l.txt').write_text('kept-one\ngone-line-xyzzy\nkept-two\n')
+ subprocess.run(jj + ['commit', '-m', 'one'], cwd=repo, env=env, check=True, capture_output=True)
+ (repo / 'l.txt').write_text('kept-one\nkept-two\n')
+ # Committed: pardes never snapshots the working copy.
+ subprocess.run(jj + ['commit', '-m', 'two'], cwd=repo, env=env, check=True, capture_output=True)
+ client.write(f'/pane/{shell}/look', f'{repo / "l.txt"}\n'.encode())
+ layered = int(client.read('/look'))
+ client.write(f'/pane/{layered}/exec', b'Changes @-\n')
+ wait_for('the layer drawn', lambda: 'gone-line-xyzzy' in screen_text(client), timeout=30)
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]
# A second terminal: a view of its own (an older build's), or a client.
@@ -3676,6 +3694,12 @@ def upgrades(old, new):
assert any(row.split()[0] == str(text).encode() and row.split()[2] == b'1' for row in client.read('/index').splitlines()), client.read('/index')
client.write(f'/pane/{text}/exec', b'Undo\n')
assert client.read(f'/pane/{text}/body') == b'one\ntwo\n', client.read(f'/pane/{text}/body')
+ # The layer shown before it: shown, its line drawn, the file's text
+ # (9P's body) without it.
+ if layered is not None:
+ assert client.read(f'/pane/{layered}/body') == b'kept-one\nkept-two\n', client.read(f'/pane/{layered}/body')
+ wait_for('the layer drawn again', lambda: 'gone-line-xyzzy' in screen_text(client), timeout=30)
+ print('upgrade: a file\'s Changes layer shown on the old build shown on the new, its line drawn, 9P\'s body the file\'s text without it')
# The shell, its job and its pty: the same, the session's still.
assert alive(shell_pid) and ppid(shell_pid) == session and alive(sleeper)
# Both terminals drawn again, each its own view.