Skip to content

Self-improving AI Employees for everyone

fix(temporal): no secret rides a generation's snapshot; nodes get theirs back (RFC-0006 1b.31)

trohitg461e9e564a5c
diff --git a/RFC-0005-EVENT-OS-ON-TEMPORAL.md b/RFC-0005-EVENT-OS-ON-TEMPORAL.md
index 9f57ee6a..060bd0d2 100644
--- a/RFC-0005-EVENT-OS-ON-TEMPORAL.md
+++ b/RFC-0005-EVENT-OS-ON-TEMPORAL.md
@@ -1136,7 +1136,7 @@ After the upgrade to SDK 1.34.0, new patch ids ship dormant for one release (`pa
| Item | Commit | Notes |
|---|---|---|
-| 0.1 Webhook routing and auth | db55d4e9 | Route table in `nodes/trigger/webhook_trigger/_routes.py`. The expected header value is read from the saved node parameters. It is blocked from snapshots, Temporal input and workflow export, except the Start-path parameter snapshot, which still carries it until Phase 1b (1b.31, 1b.32; RFC-0006 §17.8). |
+| 0.1 Webhook routing and auth | db55d4e9 | Route table in `nodes/trigger/webhook_trigger/_routes.py`. The expected header value is read from the saved node parameters. It is blocked from snapshots, Temporal input and workflow export. The Start-path parameter snapshot carried it until 1b.31; a controller started before 1b.31 keeps its copy until 1b.32 (RFC-0006 §17.8). |
| 0.2 Scoped task events | daddf460 | The broadcast frame is an identity-only envelope. |
| 0.3 Body cap | 1ebfd5d9 | `WEBHOOK_MAX_BODY_BYTES` lives in `.env.template` and is read through `core.env_defaults`. Poll events are not capped yet; that moves to Phase 3. |
| 0.4 Start once per generation | b4656c22 | A runtime-mutation ledger claim alone; no `rearm` flag, no deterministic run id. |
diff --git a/RFC-0006-TEMPORAL-DESIGN-PATTERNS.md b/RFC-0006-TEMPORAL-DESIGN-PATTERNS.md
index a6953288..d16b8be7 100644
--- a/RFC-0006-TEMPORAL-DESIGN-PATTERNS.md
+++ b/RFC-0006-TEMPORAL-DESIGN-PATTERNS.md
@@ -6192,7 +6192,7 @@ Phase 1b is new to RFC-0005's rollout (§20).
| Id | Fix | § |
|---|---|---|
-| 1b.31 | The Start-path parameter snapshot is sanitized; activities restore secrets from the saved row; the sanitizer drops `Authorization`, `Proxy-Authorization` and `Cookie` values. RFC-0007 AP.2a makes the sanitizer change first, for its generic approval card | 17.8 |
+| 1b.31 | The Start-path parameter snapshot is sanitized; activities restore secrets from the saved row; the sanitizer drops `Authorization`, `Proxy-Authorization` and `Cookie` values. It lands whole before RFC-0007 AP.2a, whose generic approval card needs the sanitizer change; that change alone would drop a saved `Authorization` header from the settings a generation's runs read | 17.8 |
| 1b.32 | Live controllers refresh a known listener's snapshot on re-registration, which clears raw copies held since Start | 17.8 |
| 1b.33 | Named dev-server ports (`TEMPORAL_HTTP_PORT`, `TEMPORAL_METRICS_PORT`, passed as `--http-port` and `--metrics-port`) and `services/netpolicy.py` on the HTTP request node, the node's own bug fix. `own_ports_from_env` skips the AI proxy. A small netpolicy port registry takes the live Browser DevTools, egress-proxy and ADB ports, one line each in the Browser runtime and the Android router. The wrong `--metrics-port` comment in `_runtime.py` is fixed here | 17.8 |
| 1b.34 | The worker pool always polls; the flag only sets the routing of new runs | 15.2 |
@@ -6222,10 +6222,10 @@ Phase 1b is new to RFC-0005's rollout (§20).
- the WhatsApp and Drive download fix (276d833b).
2. **Batch A:**
- 1b.1c, 1b.1b, 1b.2;
- - then RFC-0007 AP.1, AP.2a, AP.2b, AP.2c, AP.3, 1b.42, AP.4a, AP.4b, AP.4c, AP.5, AP.6;
+ - then RFC-0007 AP.1, 1b.31 (from batch C), AP.2a, AP.2b, AP.2c, AP.3, 1b.42, AP.4a, AP.4b, AP.4c, AP.5, AP.6;
- then 1b.3, 1b.8, 1b.5, 1b.10, 1b.28, 1b.26, 1b.25, 1b.27, 1b.29, 1b.30, 1b.9.
3. **Batch B:** 1b.13, 1b.14, 1b.15, 1b.16, 1b.17, 1b.18, 1b.19, 1b.21, 1b.20, 1b.22, 1b.23, 1b.24.
-4. **Batch C:** 1b.46, 1b.31, 1b.32, 1b.33, 1b.34, 1b.35, 1b.37, 1b.36, 1b.38b, 1b.39.
+4. **Batch C:** 1b.46, 1b.32, 1b.33, 1b.34, 1b.35, 1b.37, 1b.36, 1b.38b, 1b.39.
5. **Batch D:** 1b.43, 1b.45.
RFC-0007 AP.7, which starts writing `approval_wait_version=1`, lands after the release that ships AP.1-AP.6: a release reads a flag one release before any release writes it (RFC-0005 §24.3).
@@ -6237,7 +6237,7 @@ Rules:
- 1b.1 before 1b.2;
- 1b.2 before 1b.8, 1b.9 and RFC-0007 AP.4b.
- **Approvals:**
- - RFC-0007 AP.2a takes 1b.31's sanitizer change;
+ - 1b.31 lands whole before RFC-0007 AP.2a;
- AP.4c comes before 1b.14.
- **Retries:**
- 1b.30 before every new unlimited policy (1b.9, 1b.16, 1b.20);
@@ -6247,8 +6247,7 @@ Rules:
- 1b.15 before 1b.23;
- 1b.17 before 1b.18.
- **Batch C:**
- - 1b.46 before 1b.31;
- - 1b.31 and 1b.32 in one release;
+ - 1b.31 and 1b.32 in one release, so 1b.32 lands before the next release; 1b.46 then drops the `generation > 0` condition at the deploy funnel;
- 1b.33 before 1b.38b;
- 1b.35 before 1b.36.
- **Golden and docs:** 1b.42 comes before the first reviewed golden entry (RFC-0007 AP.4a), and 1b.45 comes last.
diff --git a/RFC-0007-APPROVALS-ON-TEMPORAL.md b/RFC-0007-APPROVALS-ON-TEMPORAL.md
index 12647397..ebcb2c52 100644
--- a/RFC-0007-APPROVALS-ON-TEMPORAL.md
+++ b/RFC-0007-APPROVALS-ON-TEMPORAL.md
@@ -530,7 +530,7 @@ Team jobs, Workspace tasks and manual Runs do not carry it, so their calls stay
- **1b.5 (sends wait while stopped):** shrinks to v0 rows and Retry, and leaves turn rows to their turn.
- **1b.9, 1b.10:** unchanged.
- **1b.14 (cancel a chat run past 24 h):** after AP.4c, inside the restarted window (§4.7).
-- **1b.31:** its sanitizer change (`authorization`, `proxyauthorization`, `cookie`) moves to AP.2a.
+- **1b.31** lands whole before AP.2a, so the generic card's lines show no `Authorization`, `Proxy-Authorization` or `Cookie`. Its sanitizer change alone would drop a saved `Authorization` header from the settings a generation's runs read, so it comes with the restore from the saved row.
- **1b.42:** moves to just before AP.4a (§4.6 item 7).
- **The plan's open Ask-first gaps:** the gap of specless tools closes for v1 (D7). Dev-graph sends without an Approval node stay unheld (D12).
@@ -541,7 +541,7 @@ One commit per step, each with its tests. After every commit, run the replay cor
| Step | What | Main files | Replay |
|---|---|---|---|
| AP.1 | The class table (§4.1) and its test: names, values, completeness, the cross-check with `repeats.py`, `class_of` cases | `services/approvals/classes.py`, `tests/services/approvals/test_classes.py` | none |
-| AP.2a | Modes and the class-based check, v1 only: the mode column and `set_mode`; `check` is mode × class, with the Browser rule; generic rows for specless tools; Stripe held; the sanitizer keys | `models/approvals.py`, `services/approvals/rules.py`, `tool_calls.py`, `handlers.py`, `services/workflow_sanitizer.py`, `core/database.py` | none (activity code) |
+| AP.2a | Modes and the class-based check, v1 only: the mode column and `set_mode`; `check` is mode × class, with the Browser rule; generic rows for specless tools; Stripe held | `models/approvals.py`, `services/approvals/rules.py`, `tool_calls.py`, `handlers.py`, `core/database.py` | none (activity code) |
| AP.2b | Rules, turn rows and the decline note: the `approval_allows` table, the note column, `send{always}`, `discard{note}`, the turn rows' decision rules (§4.6 item 4), WS commands to list and remove rules, rules deleted with the employee | `models/approvals.py`, `services/approvals/*`, `core/database.py` | none |
| AP.2c | CLI and in-process drafts (D9): a call id for every MCP call, the node id, notes claimed by the context bridge | `services/approvals/tool_calls.py`, `services/handlers/tools.py`, `services/cli_agent/workflow_tools.py`, `context_bridge.py` | none |
| AP.3 | Client: the mode menu and its "Allowed without asking…" list; Allow / Always allow / Decline with a note; the generic card; the pills; Reply while a call waits; cards linked by run; the waiting turn; the wording | `client/src/features/chat/*` (approval, composer, thread, data), Home | none |
diff --git a/server/services/deployment/handlers.py b/server/services/deployment/handlers.py
index 1c9ba421..444ed6fc 100644
--- a/server/services/deployment/handlers.py
+++ b/server/services/deployment/handlers.py
@@ -190,7 +190,7 @@ async def handle_deploy_workflow(data: Dict[str, Any], websocket: WebSocket) ->
)
from services.employees.team_runtime import admit_team_plan
from services.workflow_migrations import normalize_workflow_graph
- from services.workflow_sanitizer import sanitize_workflow_graph
+ from services.workflow_sanitizer import sanitize_runtime_payload, sanitize_workflow_graph
parameters_by_id = data.get("parameters_by_id")
if not isinstance(parameters_by_id, dict):
@@ -340,7 +340,13 @@ async def handle_deploy_workflow(data: Dict[str, Any], websocket: WebSocket) ->
workflow_id=workflow_id,
graph_version=graph_version,
generation=int(data.get("generation") or 0),
- **({"parameter_snapshot": data.get("parameters_by_id") or {}} if int(data.get("generation") or 0) > 0 else {}),
+ # No secret rides the snapshot into Temporal: a node gets its
+ # saved ones back when it runs (plugin.base.saved_settings).
+ **(
+ {"parameter_snapshot": sanitize_runtime_payload(data.get("parameters_by_id") or {})}
+ if int(data.get("generation") or 0) > 0
+ else {}
+ ),
user_id=str(
(
getattr(
diff --git a/server/services/handlers/tools.py b/server/services/handlers/tools.py
index 2c1d9fd1..5a3bcbd5 100644
--- a/server/services/handlers/tools.py
+++ b/server/services/handlers/tools.py
@@ -237,7 +237,16 @@ async def _dispatch_tool(tool_name: str, tool_args: Dict[str, Any], config: Dict
plugin_cls = None if is_registered_agent(node_type) else get_node_class(node_type)
if plugin_cls is not None:
from services.approvals.tool_calls import check_in_process
- from services.plugin import NodeContext
+ from services.plugin import NodeContext, ToolNode
+
+ if config.get("node_id") and isinstance(config.get("parameter_snapshot"), dict) and not issubclass(plugin_cls, ToolNode):
+ from core.container import container
+ from services.workflow_sanitizer import restore_dropped
+
+ # The run's copy of an action node's settings carries no secrets;
+ # its saved row has them. A ToolNode reads only the run's copy.
+ database = config.get("database") or container.database()
+ node_params = restore_dropped(node_params, await database.get_node_parameters(config["node_id"]) or {})
# Ask first: a call that sends is refused while the workflow asks
# first (it cannot wait as a draft here); a restricted tool runs
diff --git a/server/services/node_executor.py b/server/services/node_executor.py
index 9f8a4ff1..67b6f247 100644
--- a/server/services/node_executor.py
+++ b/server/services/node_executor.py
@@ -20,6 +20,7 @@ from pydantic import ValidationError
from services.node_registry import get_node_class
from services.parameter_resolver import template_view
from services.plugin.base import NodeUserError, locked_tool_fields, restore_locked_fields, saved_settings
+from services.workflow_sanitizer import restore_dropped
# Wave 11.D.13 sunset: every handler that was imported here is now
# either (a) called lazily from a plugin's execute_op / execute method,
# or (b) retired entirely. The dispatcher itself only needs the
@@ -285,7 +286,9 @@ class NodeExecutor:
"""Load from DB, validate, inject API keys (``inject_keys``)."""
# Merge with DB parameters (DB provides defaults, frontend can override)
db_params = await saved_settings(self.database, node_id, parameter_snapshot)
- merged = {**db_params, **params} if params else db_params
+ # A map the run carries (its headers, without secrets) gets the saved
+ # secrets back, unless the model supplied that map itself.
+ merged = restore_dropped({**db_params, **params}, db_params, keep=tool_args or ()) if params else db_params
# On an LLM tool call the model never chooses a node's locked fields
# (``server_controlled_fields``: the sending account, the browser
diff --git a/server/services/plugin/base.py b/server/services/plugin/base.py
index 64295524..3e5840d2 100644
--- a/server/services/plugin/base.py
+++ b/server/services/plugin/base.py
@@ -116,10 +116,15 @@ def restore_locked_fields(
async def saved_settings(database: Any, node_id: str, parameter_snapshot: Any = None) -> Dict[str, Any]:
- """A node's own settings: the run's captured copy, else its saved row."""
+ """A node's own settings: the run's captured copy, else its saved row.
+ The captured copy carries no secrets (services/workflow_sanitizer.py),
+ so they come back from the saved row."""
+ from services.workflow_sanitizer import restore_dropped
+
+ saved = dict(await database.get_node_parameters(node_id) or {})
if isinstance(parameter_snapshot, dict) and node_id in parameter_snapshot:
- return dict(parameter_snapshot[node_id] or {})
- return dict(await database.get_node_parameters(node_id) or {})
+ return restore_dropped(dict(parameter_snapshot[node_id] or {}), saved)
+ return saved
NODE_WAIT_INTERRUPTED = "NodeWaitInterrupted"
diff --git a/server/services/workflow_sanitizer.py b/server/services/workflow_sanitizer.py
index 7e8ad604..878bf70d 100644
--- a/server/services/workflow_sanitizer.py
+++ b/server/services/workflow_sanitizer.py
@@ -9,7 +9,7 @@ from __future__ import annotations
import re
from copy import deepcopy
-from typing import Any, Mapping
+from typing import Any, Iterable, Mapping
def _key(value: Any) -> str:
@@ -75,6 +75,10 @@ _SENSITIVE_EXACT = frozenset(
"encryptionkey",
"oauthtoken",
"authtoken",
+ # Header maps (httpRequest, proxyRequest, webhookResponse).
+ "authorization",
+ "proxyauthorization",
+ "cookie",
}
)
@@ -188,6 +192,25 @@ def sanitize_runtime_payload(value: Any) -> Any:
return deepcopy(value)
+def restore_dropped(target: Mapping[str, Any], saved: Mapping[str, Any], *, keep: Iterable[str] = ()) -> dict[str, Any]:
+ """``target`` with what :func:`sanitize_runtime_payload` drops put back
+ from ``saved``: a node's settings captured for a run carry no secrets,
+ and its saved row has them. Only keys ``target`` lacks are copied, at any
+ depth of nested maps (lists are left as they are); top-level keys in
+ ``keep`` are left alone. Changes neither input."""
+ restored = dict(target)
+ keep = frozenset(keep)
+ for key, value in dict(saved or {}).items():
+ if key in keep:
+ continue
+ if key not in restored:
+ if _blocked_key(_key(key)):
+ restored[key] = deepcopy(value)
+ elif isinstance(restored[key], Mapping) and isinstance(value, Mapping):
+ restored[key] = restore_dropped(restored[key], value)
+ return restored
+
+
def _sanitize_node(node: Mapping[str, Any]) -> dict[str, Any]:
cleaned = {key: sanitize_runtime_payload(node[key]) for key in sorted(_NODE_FIELDS) if key in node}
position = node.get("position")
@@ -240,4 +263,4 @@ def sanitize_workflow_graph(data: Mapping[str, Any]) -> dict[str, Any]:
return cleaned
-__all__ = ["sanitize_runtime_payload", "sanitize_workflow_graph"]
+__all__ = ["restore_dropped", "sanitize_runtime_payload", "sanitize_workflow_graph"]
diff --git a/server/tests/services/test_agent_bindings.py b/server/tests/services/test_agent_bindings.py
index e6377a3f..dde3df3b 100644
--- a/server/tests/services/test_agent_bindings.py
+++ b/server/tests/services/test_agent_bindings.py
@@ -169,8 +169,11 @@ async def test_native_tool_dispatch_preserves_server_execution_scope(monkeypatch
return SimpleNamespace(result=None, node_data=None, tool_args=None)
monkeypatch.setattr(node_registry, "get_node_class", lambda name: Tool)
monkeypatch.setattr(tool_calls, "check_in_process", check)
+ async def no_saved_row(_node_id):
+ return {}
config = {"node_type": "snapshotTest", "node_id": "tool", "run_scope": "owner_chat",
- "generation": 4, "employee_job_id": "job", "parameter_snapshot": {"tool": {"recipient": "original"}}}
+ "generation": 4, "employee_job_id": "job", "parameter_snapshot": {"tool": {"recipient": "original"}},
+ "database": SimpleNamespace(get_node_parameters=no_saved_row)}
await _dispatch_tool("run", {"run_scope": "forged", "parameter_snapshot": {}}, config)
for key in ("run_scope", "generation", "employee_job_id", "parameter_snapshot"):
assert captured[key] == config[key]
diff --git a/server/tests/services/test_runtime_tool_context.py b/server/tests/services/test_runtime_tool_context.py
index 839b86be..faecc2e3 100644
--- a/server/tests/services/test_runtime_tool_context.py
+++ b/server/tests/services/test_runtime_tool_context.py
@@ -59,8 +59,8 @@ async def test_captured_legacy_target_ignores_live_upgrade():
database = SimpleNamespace(get_node_parameters=AsyncMock(return_value={"runtime_behavior_version": 1}))
_, context, _, _ = await prepare_native_runtime(database, "old", {},
{"parameter_snapshot": {"old": {}}}, [], [])
+ # Only secrets come back from the saved row, never a later upgrade.
assert "runtime_behavior_version" not in context
- database.get_node_parameters.assert_not_awaited()
@pytest.mark.asyncio
diff --git a/server/tests/services/test_snapshot_secrets.py b/server/tests/services/test_snapshot_secrets.py
new file mode 100644
index 00000000..d7cc8361
--- /dev/null
+++ b/server/tests/services/test_snapshot_secrets.py
@@ -0,0 +1,92 @@
+"""No secret rides a run's copy of its nodes' settings into Temporal, and
+every node still runs with its saved secrets (RFC-0006 1b.31): the sanitizer
+drops them, and the node's saved row puts them back where it runs."""
+
+from __future__ import annotations
+
+from copy import deepcopy
+from types import SimpleNamespace
+from unittest.mock import AsyncMock
+
+import pytest
+
+import nodes # noqa: F401 -- populate plugin registry
+from services.workflow_sanitizer import restore_dropped, sanitize_runtime_payload
+
+SAVED = {
+ "url": "https://api.example/orders",
+ "method": "GET",
+ "api_key": "saved-key",
+ "headers": {"Authorization": "Bearer saved", "Proxy-Authorization": "Basic p", "Cookie": "s=1", "Accept": "application/json"},
+ "items": [{"token": "t"}],
+}
+
+
+def test_the_header_secrets_are_dropped():
+ assert sanitize_runtime_payload(SAVED)["headers"] == {"Accept": "application/json"}
+
+
+def test_restore_dropped_puts_back_only_what_the_sanitizer_drops():
+ target = {**sanitize_runtime_payload(SAVED), "url": "https://api.example/refunds"}
+ before = deepcopy((target, SAVED))
+
+ restored = restore_dropped(target, {**SAVED, "timeout": 30})
+
+ # The run's own values stay, lists are left as they are, and a key the
+ # sanitizer keeps is not copied in.
+ assert restored == {**SAVED, "url": "https://api.example/refunds", "items": [{}]}
+ assert (target, SAVED) == before
+ assert restore_dropped(target, SAVED, keep=("headers",))["headers"] == {"Accept": "application/json"}
+
+
+async def test_a_run_from_its_snapshot_sends_the_saved_authorization(harness):
+ harness.database.get_node_parameters = AsyncMock(return_value=SAVED)
+ captured = sanitize_runtime_payload(SAVED)
+ snapshot = {"http": captured}
+
+ params = await harness.executor._prepare_parameters(
+ "http", "httpRequest", dict(captured), "s", parameter_snapshot=snapshot, inject_keys=False
+ )
+ assert params["headers"]["Authorization"] == "Bearer saved"
+
+ # A headers map the model chose replaces the saved one.
+ params = await harness.executor._prepare_parameters(
+ "http",
+ "httpRequest",
+ {**captured, "headers": {"Accept": "text/plain"}},
+ "s",
+ tool_args={"headers": {"Accept": "text/plain"}},
+ parameter_snapshot=snapshot,
+ inject_keys=False,
+ )
+ assert params["headers"] == {"Accept": "text/plain"}
+
+
[email protected](("node_type", "restored"), [("httpRequest", True), ("taskManager", False)])
+async def test_an_in_process_action_tool_gets_its_saved_secrets(monkeypatch, node_type, restored):
+ # A ToolNode (Task Manager) reads only the run's copy.
+ from services.approvals import tool_calls
+ from services.handlers import tools
+
+ seen = {}
+
+ async def check(context, node_cls, params, tool_args):
+ seen["params"] = params
+ return tool_calls.Checked(result={"status": "checked"})
+
+ monkeypatch.setattr(tool_calls, "check_in_process", check)
+ database = SimpleNamespace(get_node_parameters=AsyncMock(return_value=SAVED))
+ captured = sanitize_runtime_payload(SAVED)
+ config = {
+ "node_type": node_type,
+ "node_id": "n1",
+ "parameters": captured,
+ "parameter_snapshot": {"n1": captured},
+ "database": database,
+ }
+
+ assert await tools._dispatch_tool("tool", {}, config) == {"status": "checked"}
+ assert ("Authorization" in seen["params"]["headers"]) is restored
+ assert database.get_node_parameters.await_count == int(restored)
diff --git a/server/tests/services/test_workflow_parameter_preservation.py b/server/tests/services/test_workflow_parameter_preservation.py
index e47c34a5..2f1335ae 100644
--- a/server/tests/services/test_workflow_parameter_preservation.py
+++ b/server/tests/services/test_workflow_parameter_preservation.py
@@ -336,6 +336,70 @@ async def test_restart_rearm_keeps_saved_node_secrets(recording_db, monkeypatch)
assert recording_db.deleted_parameter_ids == []
+async def test_start_hands_deploy_a_snapshot_without_secrets(recording_db, monkeypatch):
+ """A generation's runs carry its copy of the nodes' settings into
+ Temporal, so the copy keeps no secret; each node gets its saved ones
+ back when it runs (RFC-0006 1b.31). The saved rows stay as they are."""
+ import core.container
+ from services.deployment import handlers as deployment_handlers
+
+ workflow_service = SimpleNamespace(
+ is_workflow_deployed=lambda _workflow_id: False,
+ deploy_workflow=AsyncMock(return_value={"success": True, "triggers_setup": [], "deployment_id": "deployment"}),
+ )
+ container_stub = MagicMock()
+ container_stub.database.return_value = recording_db
+ container_stub.workflow_service.return_value = workflow_service
+ monkeypatch.setattr(core.container, "container", container_stub)
+
+ broadcaster = SimpleNamespace(
+ lock_workflow=AsyncMock(return_value=True), unlock_workflow=AsyncMock(), update_node_status=AsyncMock(),
+ update_workflow_status=AsyncMock(), update_deployment_status=AsyncMock(),
+ )
+ broadcaster_stub = types.ModuleType("services.status_broadcaster")
+ broadcaster_stub.get_status_broadcaster = lambda: broadcaster
+ monkeypatch.setitem(sys.modules, "services.status_broadcaster", broadcaster_stub)
+
+ import services.workflow_validator as validator_module
+
+ monkeypatch.setattr(
+ validator_module,
+ "validate_workflow",
+ AsyncMock(return_value={"errors": [], "warnings": []}),
+ )
+ monkeypatch.setattr(deployment_handlers, "_deployment_tasks", {})
+
+ trigger_id, http_id = "1:webhookTrigger:1", "1:httpRequest:1"
+ trigger = {"path": "orders", "header_name": "X-Token", "header_value": "kept-secret"}
+ http = {"url": "https://api.example/orders", "headers": {"Authorization": "Bearer saved", "Accept": "application/json"}}
+ await recording_db.save_node_parameters(trigger_id, trigger)
+ await recording_db.save_node_parameters(http_id, http)
+
+ result = await deployment_handlers.handle_deploy_workflow(
+ {
+ "workflow_id": "1",
+ "nodes": [
+ {"id": trigger_id, "type": "webhookTrigger", "position": {"x": 0, "y": 0}, "data": {}},
+ {"id": http_id, "type": "httpRequest", "position": {"x": 200, "y": 0}, "data": {}},
+ ],
+ "edges": [],
+ # The saved settings, as Start passes them.
+ "parameters_by_id": {trigger_id: trigger, http_id: http},
+ "generation": 1,
+ },
+ None,
+ )
+ await deployment_handlers._deployment_tasks["1"]
+
+ assert result["success"] is True
+ snapshot = workflow_service.deploy_workflow.await_args.kwargs["parameter_snapshot"]
+ assert snapshot[trigger_id] == {"path": "orders", "header_name": "X-Token"}
+ assert snapshot[http_id] == {"url": "https://api.example/orders", "headers": {"Accept": "application/json"}}
+ assert await recording_db.get_node_parameters(trigger_id) == trigger
+ assert await recording_db.get_node_parameters(http_id) == http
+
+
@pytest.mark.asyncio
async def test_save_preserves_description(patched_handlers):
"""Saving nulled the description because the kwarg was never passed."""