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
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.
This commit is contained in:
parent
f69ab294af
commit
c2541d088b
18 changed files with 552 additions and 75 deletions
|
|
@ -51,6 +51,7 @@ from api.services.workflow.run_usage_response import (
|
|||
format_public_cost_info,
|
||||
format_public_usage_info,
|
||||
)
|
||||
from api.services.workflow.run_creation import prepare_workflow_run_inputs
|
||||
from api.services.workflow.trigger_paths import (
|
||||
TriggerPathIssue,
|
||||
ensure_trigger_paths,
|
||||
|
|
@ -1302,13 +1303,27 @@ async def create_workflow_run(
|
|||
request: The create workflow run request
|
||||
user: The user to create the workflow run for
|
||||
"""
|
||||
workflow = await db_client.get_workflow(
|
||||
workflow_id, organization_id=user.selected_organization_id
|
||||
)
|
||||
if not workflow:
|
||||
raise HTTPException(status_code=404, detail="Workflow not found")
|
||||
|
||||
run_inputs = await prepare_workflow_run_inputs(
|
||||
db_client,
|
||||
workflow,
|
||||
use_draft=True,
|
||||
include_template_context=True,
|
||||
)
|
||||
|
||||
run = await db_client.create_workflow_run(
|
||||
request.name,
|
||||
workflow_id,
|
||||
request.mode,
|
||||
user.id,
|
||||
use_draft=True,
|
||||
organization_id=user.selected_organization_id,
|
||||
definition_id=run_inputs.definition_id,
|
||||
initial_context=run_inputs.initial_context,
|
||||
)
|
||||
return {
|
||||
"id": run.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue