Header removals wait for the code editor to be left: autosave saves with drop=false, so follow_header adds and renames from the header but keeps a port or setting whose parameter is gone, and leaving the editor (blur or closing the panel) saves once more with removals; source saves of a flow run one at a time

This commit is contained in:
2026-10-15 21:31:04 +02:00
parent 5ca90ffece
commit ce2ce4e3e7
10 changed files with 105 additions and 24 deletions
+15
View File
@@ -192,6 +192,21 @@ def test_a_renamed_parameter_keeps_the_message_and_a_dropped_one_goes():
assert dropped.params == {"factor": 3}
def test_without_drop_a_missing_parameter_stays_and_the_rest_follows():
node = _flow(
[*READING, MessageSpec(name="garden.level", port="depth")], factor=3
).nodes[0]
paused = follow_header(node, "def process(depth): pass\n", drop=False)
renamed = follow_header(node, "def process(value, depth, factor): pass\n", False)
added = follow_header(node, "def process(depth, gain=2): pass\n", drop=False)
assert paused == node
assert renamed.requires[0] == READING[0].model_copy(update={"port": "value"})
assert [spec.port for spec in added.requires] == ["reading", "depth"]
assert added.params == {"factor": 3, "gain": 2}
def test_a_new_parameter_after_a_setting_is_a_setting():
node = _flow(READING, factor=3).nodes[0]