mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-25 12:01:04 +02:00
fix: move draft and template context handling out of create_workflow_run (#560)
* fix: move draft and template context handling out of create_workflow_run create_workflow_run now only creates the run with the definition_id and initial_context provided by the caller. Test call paths explicitly resolve draft definitions and merge template context variables before creating the run, while production/runtime paths bind the published definition without adding template defaults. * fix: review comments * chore: format and minor cleanups --------- Co-authored-by: Abhishek Kumar <abhishek@a6k.me>
This commit is contained in:
parent
94dce42209
commit
90c5831984
19 changed files with 657 additions and 72 deletions
|
|
@ -28,6 +28,8 @@ async def test_agent_stream_uses_provider_path_param_not_query_param():
|
|||
user_id=22,
|
||||
organization_id=33,
|
||||
template_context_variables={"existing": "context"},
|
||||
released_definition=SimpleNamespace(id=55, template_context_variables={}),
|
||||
current_definition=None,
|
||||
)
|
||||
workflow_run = SimpleNamespace(id=44)
|
||||
provider = SimpleNamespace(handle_external_websocket=AsyncMock())
|
||||
|
|
@ -72,10 +74,10 @@ async def test_agent_stream_uses_provider_path_param_not_query_param():
|
|||
assert create_args[2] == "cloudonix"
|
||||
assert create_kwargs["organization_id"] == workflow.organization_id
|
||||
assert create_kwargs["initial_context"] == {
|
||||
"existing": "context",
|
||||
"provider": "cloudonix",
|
||||
"direction": "inbound",
|
||||
}
|
||||
assert create_kwargs["definition_id"] == 55
|
||||
provider.handle_external_websocket.assert_awaited_once()
|
||||
_, provider_kwargs = provider.handle_external_websocket.await_args
|
||||
assert provider_kwargs["params"] == {"custom": "value"}
|
||||
|
|
@ -92,6 +94,8 @@ async def test_agent_stream_rejects_when_concurrency_limit_reached():
|
|||
user_id=22,
|
||||
organization_id=33,
|
||||
template_context_variables={},
|
||||
released_definition=SimpleNamespace(id=55, template_context_variables={}),
|
||||
current_definition=None,
|
||||
)
|
||||
spec = SimpleNamespace(provider_cls=lambda _config: object())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue