From f5eaddb2cf28a9b72d5dd5b3b10502a316d4de85 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 09:41:55 -0300 Subject: Split control messages by scope: the root ctl takes the session's builtins and reads the settings, a pane's ctl its own Every builtin could only be clicked, or written to exec, and the settings could be read only as the Config window's prose. acme keeps window verbs on a window's ctl, and webfs and upas/fs keep session settings on a root ctl. Each builtin now declares its scope (scope = .session; settings are all session, the rest pane), read by the registry. The root /ctl takes session builtins and reads every setting in the words a write takes, so its read written back changes nothing (panel and scene effects now take on/off like the toggles, to make that true); a pane's ctl takes the pane's builtins beside get, lock and unlock. Writes are checked whole and refused in Plan 9's ctl words (unknown control message "X", wrong #args ...), which 9ns now maps to EINVAL (cloud9 re-pinned at a8c7a715). A builtin that would prompt for its argument fails the write instead, and a refusal is answered at once, not after the frame. Co-Authored-By: Claude Opus 5.5 --- test/fs.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/fs.py b/test/fs.py index ccf3eb89..82d7cf0b 100644 --- a/test/fs.py +++ b/test/fs.py @@ -245,6 +245,24 @@ def discovery(binary, embedded=False): raise AssertionError('focus took a serial no pane has') except OSError as refused: assert 'no such window' in str(refused), refused + # /ctl reads the settings as a write takes them and takes the + # session's builtins; a pane's ctl takes the pane's. + settings = client.read('/ctl') + assert b'Verbose ' in settings and b'Platform' not in settings, settings + client.write('/ctl', settings) + assert client.read('/ctl') == settings + client.write('/ctl', b'Verbose off\n') + assert b'Verbose off\n' in client.read('/ctl') + for path, line, why in (('/ctl', b'Del\n', 'not a session control message "Del"'), + ('/ctl', b'Nope 3\n', 'unknown control message "Nope 3"'), + (f'/pane/{first}/ctl', b'Newcol\n', 'not a window control message "Newcol"')): + try: + client.write(path, line) + raise AssertionError(f'{path} took {line!r}') + except OSError as refused: + assert why in str(refused), refused + client.write(f'/pane/{first}/ctl', b'Msg said through ctl\n') + assert 'said through ctl' in ''.join(cell[0] for cell in client.screen()['cells']) assert set(client.list('/pane')) == {'new', str(fixture), str(first), str(second)} client.write(f'/pane/{first}/body', b'first pane', truncate=True) assert client.read(f'/pane/{first}/body') == b'first pane' @@ -315,7 +333,7 @@ def discovery(binary, embedded=False): assert client.read('/src/pardes.zig').startswith(b'const std') assert client.stat('/src/pardes.zig')['mode'] == 0o444 assert b'pub const Pardes' in client.read(f'/pane/{look(client, "/virtual/src/pardes.zig")}/body') - print('9P discovery: listing/stat/find are inert; new, remove, look, exec, name, sel, log, ctl lock and focus behave') + print('9P discovery: listing/stat/find are inert; new, remove, look, exec, name, sel, log, ctl lock, focus and the ctl split behave') def run_file(binary): -- cgit v1.3