diff --git a/libs/langgraph/tests/test_large_cases.py b/libs/langgraph/tests/test_large_cases.py index 5d6ba5e37..f15cd5c23 100644 --- a/libs/langgraph/tests/test_large_cases.py +++ b/libs/langgraph/tests/test_large_cases.py @@ -7782,7 +7782,6 @@ def test_nested_graph_state( }, "step": 1, "thread_id": "1", - "checkpoint_ns": AnyStr("inner:"), "langgraph_node": "inner", "langgraph_path": [PULL, "inner"], "langgraph_step": 2, @@ -7977,7 +7976,6 @@ def test_nested_graph_state( "step": 1, "parents": {"": AnyStr()}, "thread_id": "1", - "checkpoint_ns": AnyStr("inner:"), "langgraph_node": "inner", "langgraph_path": [PULL, "inner"], "langgraph_step": 2, @@ -8020,7 +8018,6 @@ def test_nested_graph_state( "step": 0, "parents": {"": AnyStr()}, "thread_id": "1", - "checkpoint_ns": AnyStr("inner:"), "langgraph_node": "inner", "langgraph_path": [PULL, "inner"], "langgraph_step": 2, @@ -8069,7 +8066,6 @@ def test_nested_graph_state( "step": -1, "parents": {"": AnyStr()}, "thread_id": "1", - "checkpoint_ns": AnyStr("inner:"), "langgraph_node": "inner", "langgraph_path": [PULL, "inner"], "langgraph_step": 2, @@ -8420,51 +8416,65 @@ def test_doubly_nested_graph_state( ), ) child_state = app.get_state(outer_state.tasks[0].state) - assert ( - child_state.tasks[0] - == StateSnapshot( - values={"my_key": "hi my value"}, - tasks=( - PregelTask( - AnyStr(), - "child_1", - (PULL, "child_1"), - state={ - "configurable": { - "thread_id": "1", - "checkpoint_ns": AnyStr(), - } - }, - ), + assert child_state == StateSnapshot( + values={"my_key": "hi my value"}, + tasks=( + PregelTask( + AnyStr(), + "child_1", + (PULL, "child_1"), + state={ + "configurable": { + "thread_id": "1", + "checkpoint_ns": AnyStr(), + } + }, ), - next=("child_1",), - config={ + ), + next=("child_1",), + config={ + "configurable": { + "thread_id": "1", + "checkpoint_ns": AnyStr("child:"), + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict( + { + "": AnyStr(), + AnyStr("child:"): AnyStr(), + } + ), + } + }, + metadata={ + "langgraph_checkpoint_ns": AnyStr("child:"), + "langgraph_node": "child", + "langgraph_path": ["__pregel_pull", "child"], + "langgraph_step": 2, + "langgraph_triggers": ["branch:to:child"], + "parents": {"": AnyStr()}, + "source": "loop", + "writes": None, + "step": 0, + "thread_id": "1", + }, + created_at=AnyStr(), + parent_config=( + None + if "shallow" in checkpointer_name + else { "configurable": { "thread_id": "1", "checkpoint_ns": AnyStr("child:"), "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict( + { + "": AnyStr(), + AnyStr("child:"): AnyStr(), + } + ), } - }, - metadata={ - "parents": {"": AnyStr()}, - "source": "loop", - "writes": None, - "step": 0, - "thread_id": "1", - }, - created_at=AnyStr(), - parent_config=( - None - if "shallow" in checkpointer_name - else { - "configurable": { - "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), - "checkpoint_id": AnyStr(), - } - } - ), - ).tasks[0] + } + ), ) grandchild_state = app.get_state(child_state.tasks[0].state) assert grandchild_state == StateSnapshot( @@ -8502,7 +8512,6 @@ def test_doubly_nested_graph_state( "writes": {"grandchild_1": {"my_key": "hi my value here"}}, "step": 1, "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_checkpoint_ns": AnyStr("child:"), "langgraph_node": "child_1", "langgraph_path": [PULL, AnyStr("child_1")], @@ -8583,7 +8592,6 @@ def test_doubly_nested_graph_state( }, "step": 1, "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_checkpoint_ns": AnyStr("child:"), "langgraph_node": "child_1", "langgraph_path": [ @@ -8636,7 +8644,6 @@ def test_doubly_nested_graph_state( "writes": None, "step": 0, "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_node": "child", "langgraph_path": [PULL, AnyStr("child")], "langgraph_step": 2, @@ -8932,7 +8939,6 @@ def test_doubly_nested_graph_state( "step": 1, "parents": {"": AnyStr()}, "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_node": "child", "langgraph_path": [PULL, AnyStr("child")], "langgraph_step": 2, @@ -8971,7 +8977,6 @@ def test_doubly_nested_graph_state( "step": 0, "parents": {"": AnyStr()}, "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_node": "child", "langgraph_path": [PULL, AnyStr("child")], "langgraph_step": 2, @@ -9023,7 +9028,6 @@ def test_doubly_nested_graph_state( "step": -1, "parents": {"": AnyStr()}, "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_node": "child", "langgraph_path": [PULL, AnyStr("child")], "langgraph_step": 2, @@ -9073,7 +9077,6 @@ def test_doubly_nested_graph_state( } ), "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_checkpoint_ns": AnyStr("child:"), "langgraph_node": "child_1", "langgraph_path": [ @@ -9128,7 +9131,6 @@ def test_doubly_nested_graph_state( } ), "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_checkpoint_ns": AnyStr("child:"), "langgraph_node": "child_1", "langgraph_path": [ @@ -9190,7 +9192,6 @@ def test_doubly_nested_graph_state( } ), "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_checkpoint_ns": AnyStr("child:"), "langgraph_node": "child_1", "langgraph_path": [ @@ -9252,7 +9253,6 @@ def test_doubly_nested_graph_state( } ), "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_checkpoint_ns": AnyStr("child:"), "langgraph_node": "child_1", "langgraph_path": [ @@ -10379,7 +10379,6 @@ def test_weather_subgraph( "step": 1, "parents": {"": AnyStr()}, "thread_id": "14", - "checkpoint_ns": AnyStr("weather_graph:"), "langgraph_node": "weather_graph", "langgraph_path": [PULL, "weather_graph"], "langgraph_step": 2, diff --git a/libs/langgraph/tests/test_large_cases_async.py b/libs/langgraph/tests/test_large_cases_async.py index c5d4a0ffc..4f5c688aa 100644 --- a/libs/langgraph/tests/test_large_cases_async.py +++ b/libs/langgraph/tests/test_large_cases_async.py @@ -5332,7 +5332,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: }, "step": 1, "thread_id": "1", - "checkpoint_ns": AnyStr("inner:"), "langgraph_node": "inner", "langgraph_path": [PULL, "inner"], "langgraph_step": 2, @@ -5529,7 +5528,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: "step": 1, "parents": {"": AnyStr()}, "thread_id": "1", - "checkpoint_ns": AnyStr("inner:"), "langgraph_node": "inner", "langgraph_path": [PULL, "inner"], "langgraph_step": 2, @@ -5572,7 +5570,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: "step": 0, "parents": {"": AnyStr()}, "thread_id": "1", - "checkpoint_ns": AnyStr("inner:"), "langgraph_node": "inner", "langgraph_path": [PULL, "inner"], "langgraph_step": 2, @@ -5621,7 +5618,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: "step": -1, "parents": {"": AnyStr()}, "thread_id": "1", - "checkpoint_ns": AnyStr("inner:"), "langgraph_node": "inner", "langgraph_path": [PULL, "inner"], "langgraph_step": 2, @@ -5976,51 +5972,65 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: ), ) child_state = await app.aget_state(outer_state.tasks[0].state) - assert ( - child_state.tasks[0] - == StateSnapshot( - values={"my_key": "hi my value"}, - tasks=( - PregelTask( - AnyStr(), - "child_1", - (PULL, "child_1"), - state={ - "configurable": { - "thread_id": "1", - "checkpoint_ns": AnyStr(), - } - }, - ), + assert child_state == StateSnapshot( + values={"my_key": "hi my value"}, + tasks=( + PregelTask( + AnyStr(), + "child_1", + (PULL, "child_1"), + state={ + "configurable": { + "thread_id": "1", + "checkpoint_ns": AnyStr(), + } + }, ), - next=("child_1",), - config={ + ), + next=("child_1",), + config={ + "configurable": { + "thread_id": "1", + "checkpoint_ns": AnyStr("child:"), + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict( + { + "": AnyStr(), + AnyStr("child:"): AnyStr(), + } + ), + } + }, + metadata={ + "langgraph_checkpoint_ns": AnyStr("child:"), + "langgraph_node": "child", + "langgraph_path": ["__pregel_pull", "child"], + "langgraph_step": 2, + "langgraph_triggers": ["branch:to:child"], + "parents": {"": AnyStr()}, + "source": "loop", + "writes": None, + "step": 0, + "thread_id": "1", + }, + created_at=AnyStr(), + parent_config=( + None + if "shallow" in checkpointer_name + else { "configurable": { "thread_id": "1", "checkpoint_ns": AnyStr("child:"), "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict( + { + "": AnyStr(), + AnyStr("child:"): AnyStr(), + } + ), } - }, - metadata={ - "parents": {"": AnyStr()}, - "source": "loop", - "writes": None, - "step": 0, - "thread_id": "1", - }, - created_at=AnyStr(), - parent_config=( - None - if "shallow" in checkpointer_name - else { - "configurable": { - "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), - "checkpoint_id": AnyStr(), - } - } - ), - ).tasks[0] + } + ), ) grandchild_state = await app.aget_state(child_state.tasks[0].state) assert grandchild_state == StateSnapshot( @@ -6058,7 +6068,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: "writes": {"grandchild_1": {"my_key": "hi my value here"}}, "step": 1, "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_checkpoint_ns": AnyStr("child:"), "langgraph_node": "child_1", "langgraph_path": [PULL, AnyStr("child_1")], @@ -6143,7 +6152,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: }, "step": 1, "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_checkpoint_ns": AnyStr("child:"), "langgraph_node": "child_1", "langgraph_path": [ @@ -6198,7 +6206,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: "writes": None, "step": 0, "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_node": "child", "langgraph_path": [PULL, AnyStr("child")], "langgraph_step": 2, @@ -6498,7 +6505,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: "step": 1, "parents": {"": AnyStr()}, "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_node": "child", "langgraph_path": [PULL, AnyStr("child")], "langgraph_step": 2, @@ -6537,7 +6543,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: "step": 0, "parents": {"": AnyStr()}, "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_node": "child", "langgraph_path": [PULL, AnyStr("child")], "langgraph_step": 2, @@ -6589,7 +6594,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: "step": -1, "parents": {"": AnyStr()}, "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_node": "child", "langgraph_path": [PULL, AnyStr("child")], "langgraph_step": 2, @@ -6643,7 +6647,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } ), "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_checkpoint_ns": AnyStr("child:"), "langgraph_node": "child_1", "langgraph_path": [ @@ -6700,7 +6703,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } ), "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_checkpoint_ns": AnyStr("child:"), "langgraph_node": "child_1", "langgraph_path": [ @@ -6764,7 +6766,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } ), "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_checkpoint_ns": AnyStr("child:"), "langgraph_node": "child_1", "langgraph_path": [ @@ -6828,7 +6829,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } ), "thread_id": "1", - "checkpoint_ns": AnyStr("child:"), "langgraph_checkpoint_ns": AnyStr("child:"), "langgraph_node": "child_1", "langgraph_path": [ @@ -7244,7 +7244,6 @@ async def test_weather_subgraph( "step": 1, "parents": {"": AnyStr()}, "thread_id": "14", - "checkpoint_ns": AnyStr("weather_graph:"), "langgraph_node": "weather_graph", "langgraph_path": [PULL, "weather_graph"], "langgraph_step": 2,