Header of process and node ports follow each other both ways: a panel edit rewrites only the def line of edited code, a code save reads the header back into input ports and settings (draft and response); Space types in the node editor again
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
@@ -557,6 +557,33 @@ async def test_the_live_socket_ends_when_its_client_goes(
|
||||
assert parked == []
|
||||
|
||||
|
||||
def test_saving_a_header_moves_the_node_ports_in_the_draft(
|
||||
client: TestClient, superuser_token_headers: dict[str, str]
|
||||
) -> None:
|
||||
saved = client.put(
|
||||
f"{PREFIX}/header", headers=superuser_token_headers, json=a_flow("header")
|
||||
).json()
|
||||
|
||||
response = client.put(
|
||||
f"{PREFIX}/header/nodes/logger/source",
|
||||
headers=superuser_token_headers,
|
||||
json={"code": "def process(reading, level, gain=2):\n return {}\n"},
|
||||
).json()
|
||||
|
||||
assert [spec["port"] for spec in response["node"]["requires"]] == [
|
||||
"reading",
|
||||
"level",
|
||||
]
|
||||
assert response["node"]["params"] == {"gain": 2}
|
||||
draft = client.get(f"{PREFIX}/header", headers=superuser_token_headers).json()
|
||||
assert draft["definition"]["version"] == response["version"]
|
||||
assert response["version"] == saved["definition"]["version"] + 1
|
||||
logger = next(n for n in draft["definition"]["nodes"] if n["id"] == "logger")
|
||||
assert logger["params"] == {"gain": 2}
|
||||
|
||||
client.delete(f"{PREFIX}/header", headers=superuser_token_headers)
|
||||
|
||||
|
||||
def test_a_shared_node_in_use_is_retired_only_with_detach(
|
||||
client: TestClient, superuser_token_headers: dict[str, str]
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user