docs: publish structured runtime context

This commit is contained in:
lda
2026-09-05 00:34:58 +07:00 Verified
parent 71dc5ba8e8
commit c389590a9c
17 changed files with 431 additions and 92 deletions
+3 -7
View File
@@ -801,13 +801,9 @@ def test_foreach_reference_treats_dotted_id_as_one_literal_segment() -> None:
state_schema={"type": "object"},
output_schema={"type": "object"},
)
each = builder.foreach(
id="orders.v2", over=state_path("orders"), as_="order"
)
each = builder.foreach(id="orders.v2", over=state_path("orders"), as_="order")
assert each.item == GraphSourcePath(
"context", ("foreach", "orders.v2", "item")
)
assert each.item == GraphSourcePath("context", ("foreach", "orders.v2", "item"))
assert str(each.item) == 'context.foreach."orders.v2".item'
assert str(each.index) == 'context.foreach."orders.v2".index'
@@ -840,5 +836,5 @@ def test_foreach_ref_works_in_node_input_binding() -> None:
input=[input_from(each.item, "order")],
)
binding = work.input[0]
assert isinstance(binding, object)
assert isinstance(binding, InputPathBinding)
assert str(binding.path) == "context.foreach.orders.item"
+4 -1
View File
@@ -277,6 +277,7 @@ def test_workflow_builder_subgraph_adds_native_subgraph_node() -> None:
def test_foreach_ref_works_in_subgraph_input_binding() -> None:
from wf_authoring import state_path
from wf_core.models.steps import InputPathBinding
child = build_demo_workflow()
parent = WorkflowBuilder(
@@ -291,4 +292,6 @@ def test_foreach_ref_works_in_subgraph_input_binding() -> None:
id="run_child",
input=[input_from(each.item, "order")],
)
assert str(step.input[0].path) == "context.foreach.orders.item"
binding = step.input[0]
assert isinstance(binding, InputPathBinding)
assert str(binding.path) == "context.foreach.orders.item"