refactor: remove placeholder join step

This commit is contained in:
lda
2026-09-05 17:47:57 +07:00 Verified
parent 043bda6a34
commit cccdbc0a47
42 changed files with 88 additions and 309 deletions
-3
View File
@@ -16,7 +16,6 @@ from wf_artifacts.drafts.models import (
DraftEndStep,
DraftForeachStep,
DraftInterruptStep,
DraftJoinStep,
DraftMatchStep,
DraftStep,
DraftSubgraphStep,
@@ -353,8 +352,6 @@ class WorkflowDraftAuthoringApi:
return outcomes
if isinstance(step, DraftInterruptStep):
return set(step.interrupt.outcomes)
if isinstance(step, DraftJoinStep):
return {"done"}
if isinstance(step, DraftSubgraphStep):
return set(step.subgraph.outcomes)
if isinstance(
-2
View File
@@ -11,7 +11,6 @@ from .models import (
DraftEndStep,
DraftForeachStep,
DraftInterruptStep,
DraftJoinStep,
DraftMatchCase,
DraftMatchStep,
DraftSubgraphStep,
@@ -27,7 +26,6 @@ __all__ = [
"DraftEndStep",
"DraftForeachStep",
"DraftInterruptStep",
"DraftJoinStep",
"DraftMatchCase",
"DraftMatchStep",
"DraftSubgraphStep",
+1 -6
View File
@@ -4,7 +4,7 @@ from typing import Any
from wf_authoring import WorkflowBuilder
from wf_authoring.dsl import PathExpr
from wf_core import JoinNode, SubgraphNode, Workflow
from wf_core import SubgraphNode, Workflow
from wf_core.paths import GraphSourcePath
from .models import (
@@ -12,7 +12,6 @@ from .models import (
DraftEndStep,
DraftForeachStep,
DraftInterruptStep,
DraftJoinStep,
DraftMatchStep,
DraftStep,
DraftSubgraphStep,
@@ -84,10 +83,6 @@ def _add_step(builder: WorkflowBuilder, step_id: str, step: DraftStep):
return builder.interrupt(
**interrupt_kwargs,
)
if isinstance(step, DraftJoinStep):
node = JoinNode(id=step_id, type="join")
builder.nodes.append(node)
return node
if isinstance(step, DraftEndStep):
return builder.end(step.end.outcome, id=step_id)
if isinstance(step, DraftWhenStep):
-9
View File
@@ -220,14 +220,6 @@ class DraftSubgraphStep(BaseModel):
subgraph: DraftSubgraphPayload
class DraftJoinStep(BaseModel):
"""Draft step that emits the current core join node."""
model_config = ConfigDict(extra="forbid")
join: JsonObject = Field(default_factory=dict)
class DraftEndPayload(BaseModel):
"""Payload for one explicit workflow terminal outcome."""
@@ -323,7 +315,6 @@ DraftStep = (
DraftUseStep
| DraftForeachStep
| DraftInterruptStep
| DraftJoinStep
| DraftEndStep
| DraftWhenStep
| DraftChooseStep
+1 -9
View File
@@ -8,7 +8,6 @@ from wf_core import (
EndNode,
ForeachNode,
InterruptNode,
JoinNode,
NodeUse,
SubgraphNode,
)
@@ -16,14 +15,7 @@ from wf_core import (
from ..nodes import NodeSpec
StepRef: TypeAlias = (
str
| NodeUse
| SubgraphNode
| ConditionNode
| ForeachNode
| InterruptNode
| JoinNode
| EndNode
str | NodeUse | SubgraphNode | ConditionNode | ForeachNode | InterruptNode | EndNode
)
"""A reference to a step, which can be either a string id or a node object
that should be auto-used."""
-38
View File
@@ -16,7 +16,6 @@ from wf_artifacts.drafts.models import (
DraftForeachStep,
DraftInterruptPayload,
DraftInterruptStep,
DraftJoinStep,
DraftMatchCase,
DraftMatchPayload,
DraftMatchStep,
@@ -425,43 +424,6 @@ def add_foreach_step(
)
@app.command("join")
def add_join_step(
ctx: typer.Context,
workspace_id: Annotated[str, typer.Argument(help="Draft workspace id.")],
revision: Annotated[
int, typer.Option("--revision", min=1, help="Expected workspace revision.")
],
step_id: Annotated[str, typer.Option("--step", help="New draft step id.")],
from_step: Annotated[
str | None, typer.Option("--from-step", help="Incoming step id.")
] = None,
from_outcome: Annotated[
str | None,
typer.Option("--from-outcome", help="Outcome on --from-step (default: ok)."),
] = None,
route: Annotated[
list[str] | None,
typer.Option("--route", help="Route mapping OUTCOME=TARGET. Repeat as needed."),
] = None,
) -> None:
"""Add a join step.
Example: `wf draft add join WS --revision 1 --step joined --route done=__end__`.
Run `wf draft validate WS` after editing.
"""
_submit_step(
ctx,
workspace_id=workspace_id,
revision=revision,
step_id=step_id,
step=DraftJoinStep(join={}),
from_step=from_step,
from_outcome=from_outcome,
routes=_parse_route_flags(route) or None,
)
@app.command("end")
def add_end_step(
ctx: typer.Context,
+1 -1
View File
@@ -56,7 +56,7 @@ def write_json_file(path: Path, payload: Any, *, force: bool) -> None:
output.write("\n")
except FileExistsError as exc:
raise CliInputError(
f"file {path!s} already exists; use --force to replace it"
f"file already exists: {path!s}; use --force to replace it"
) from exc
except OSError as exc:
raise CliInputError(f"could not write file {path!s}: {exc}") from exc
-2
View File
@@ -11,7 +11,6 @@ from .models import (
InputPathBinding,
InputValueBinding,
InterruptNode,
JoinNode,
JsonValue,
LiteralExpression,
NodeDef,
@@ -89,7 +88,6 @@ __all__ = [
"InputValueBinding",
"InterruptRequest",
"InterruptRoute",
"JoinNode",
"JsonValue",
"LiteralExpression",
"NodeDef",
-2
View File
@@ -30,7 +30,6 @@ from wf_core.models.steps import (
ForeachItemErrorPolicy,
ForeachNode,
InterruptNode,
JoinNode,
NodeUse,
Step,
SubgraphNode,
@@ -54,7 +53,6 @@ __all__ = [
"InputExpressionBinding",
"InputPathBinding",
"InputValueBinding",
"JoinNode",
"JsonValue",
"LiteralExpression",
"LiteralOperand",
+1 -14
View File
@@ -293,13 +293,6 @@ class ForeachNode(BaseModel):
return GraphSourcePath("context", ("foreach", self.id, "index"))
class JoinNode(BaseModel):
"""Control-flow step that marks a branch or frame as joined."""
id: str
type: Literal["join"]
class EndNode(BaseModel):
"""Explicit workflow terminal that sets the workflow-level outcome.
@@ -411,13 +404,7 @@ class InterruptNode(BaseModel):
Step = Annotated[
NodeUse
| SubgraphNode
| ConditionNode
| ForeachNode
| JoinNode
| EndNode
| InterruptNode,
NodeUse | SubgraphNode | ConditionNode | ForeachNode | EndNode | InterruptNode,
Field(discriminator="type"),
]
"""Discriminated union of all executable workflow graph steps."""
-9
View File
@@ -41,15 +41,6 @@ def handle_condition_step(
)
def handle_join_step() -> StepExecutionResult:
return StepExecutionResult(
outcome="done",
resolved_input={},
output={},
state_changes={},
)
def handle_interrupt_step(
run: RunState,
step: InterruptNode,
-6
View File
@@ -10,7 +10,6 @@ from wf_core.models.steps import (
EndNode,
ForeachNode,
InterruptNode,
JoinNode,
NodeUse,
SubgraphNode,
)
@@ -22,7 +21,6 @@ from wf_core.runtime.ops.foreach import step_foreach
from wf_core.runtime.ops.handlers import (
handle_condition_step,
handle_interrupt_step,
handle_join_step,
)
from wf_core.runtime.ops.index import WorkflowIndex, build_workflow_index
from wf_core.runtime.ops.merges import ReducerDefinition
@@ -149,8 +147,6 @@ def step_workflow(
raise
elif isinstance(step, ConditionNode):
step_result = handle_condition_step(run, step)
elif isinstance(step, JoinNode):
step_result = handle_join_step()
elif isinstance(step, EndNode):
return complete_end_step(
run=run,
@@ -264,8 +260,6 @@ async def step_workflow_async(
raise
elif isinstance(step, ConditionNode):
step_result = handle_condition_step(run, step)
elif isinstance(step, JoinNode):
step_result = handle_join_step()
elif isinstance(step, EndNode):
return complete_end_step(
run=run,
-2
View File
@@ -19,8 +19,6 @@ def declared_outcomes_for_step(step: Step, node_defs: dict[str, NodeDef]) -> set
if step.item_error.action in {"skip", "collect"}:
outcomes.add("completed_with_errors")
return outcomes
if step.type == "join":
return {"done"}
if isinstance(step, EndNode):
return set()
if isinstance(step, InterruptNode):