Update tests

This commit is contained in:
Nuno Campos
2025-02-14 18:24:48 -08:00
parent 9706211aca
commit 7f4822931e
12 changed files with 36 additions and 664 deletions
@@ -16,6 +16,7 @@ from langgraph.checkpoint.base import (
CheckpointMetadata,
CheckpointTuple,
get_checkpoint_id,
get_checkpoint_metadata,
)
from langgraph.checkpoint.postgres import _internal
from langgraph.checkpoint.postgres.base import BasePostgresSaver
@@ -317,23 +318,7 @@ class PostgresSaver(BasePostgresSaver):
checkpoint["id"],
checkpoint_id,
Jsonb(self._dump_checkpoint(copy)),
self._dump_metadata(
{
**{
k: v
for k, v in config["configurable"].items()
if not k.startswith("__")
and isinstance(v, (str, int, bool, float))
},
**{
k: v
for k, v in config.get("metadata", {}).items()
if not k.startswith("__")
and isinstance(v, (str, int, bool, float))
},
**metadata,
}
),
self._dump_metadata(get_checkpoint_metadata(config, metadata)),
),
)
return next_config
@@ -16,6 +16,7 @@ from langgraph.checkpoint.base import (
CheckpointMetadata,
CheckpointTuple,
get_checkpoint_id,
get_checkpoint_metadata,
)
from langgraph.checkpoint.postgres import _ainternal
from langgraph.checkpoint.postgres.base import BasePostgresSaver
@@ -275,23 +276,7 @@ class AsyncPostgresSaver(BasePostgresSaver):
checkpoint["id"],
checkpoint_id,
Jsonb(self._dump_checkpoint(copy)),
self._dump_metadata(
{
**{
k: v
for k, v in config["configurable"].items()
if not k.startswith("__")
and isinstance(v, (str, int, bool, float))
},
**{
k: v
for k, v in config.get("metadata", {}).items()
if not k.startswith("__")
and isinstance(v, (str, int, bool, float))
},
**metadata,
}
),
self._dump_metadata(get_checkpoint_metadata(config, metadata)),
),
)
return next_config
@@ -24,6 +24,7 @@ from langgraph.checkpoint.base import (
Checkpoint,
CheckpointMetadata,
CheckpointTuple,
get_checkpoint_metadata,
)
from langgraph.checkpoint.postgres import _ainternal, _internal
from langgraph.checkpoint.postgres.base import BasePostgresSaver
@@ -423,23 +424,7 @@ class ShallowPostgresSaver(BasePostgresSaver):
thread_id,
checkpoint_ns,
Jsonb(self._dump_checkpoint(copy)),
self._dump_metadata(
{
**{
k: v
for k, v in config["configurable"].items()
if not k.startswith("__")
and isinstance(v, (str, int, bool, float))
},
**{
k: v
for k, v in config.get("metadata", {}).items()
if not k.startswith("__")
and isinstance(v, (str, int, bool, float))
},
**metadata,
}
),
self._dump_metadata(get_checkpoint_metadata(config, metadata)),
),
)
return next_config
@@ -758,23 +743,7 @@ class AsyncShallowPostgresSaver(BasePostgresSaver):
thread_id,
checkpoint_ns,
Jsonb(self._dump_checkpoint(copy)),
self._dump_metadata(
{
**{
k: v
for k, v in config["configurable"].items()
if not k.startswith("__")
and isinstance(v, (str, int, bool, float))
},
**{
k: v
for k, v in config.get("metadata", {}).items()
if not k.startswith("__")
and isinstance(v, (str, int, bool, float))
},
**metadata,
}
),
self._dump_metadata(get_checkpoint_metadata(config, metadata)),
),
)
return next_config
@@ -15,6 +15,7 @@ from langgraph.checkpoint.base import (
CheckpointTuple,
SerializerProtocol,
get_checkpoint_id,
get_checkpoint_metadata,
)
from langgraph.checkpoint.serde.jsonplus import JsonPlusSerializer
from langgraph.checkpoint.serde.types import ChannelProtocol
@@ -398,19 +399,7 @@ class SqliteSaver(BaseCheckpointSaver[str]):
checkpoint_ns = config["configurable"]["checkpoint_ns"]
type_, serialized_checkpoint = self.serde.dumps_typed(checkpoint)
serialized_metadata = self.jsonplus_serde.dumps(
{
**{
k: v
for k, v in config["configurable"].items()
if not k.startswith("__") and isinstance(v, (str, int, bool, float))
},
**{
k: v
for k, v in config.get("metadata", {}).items()
if not k.startswith("__") and isinstance(v, (str, int, bool, float))
},
**metadata,
}
get_checkpoint_metadata(config, metadata)
)
with self.cursor() as cur:
cur.execute(
@@ -16,6 +16,7 @@ from langgraph.checkpoint.base import (
CheckpointTuple,
SerializerProtocol,
get_checkpoint_id,
get_checkpoint_metadata,
)
from langgraph.checkpoint.serde.jsonplus import JsonPlusSerializer
from langgraph.checkpoint.serde.types import ChannelProtocol
@@ -464,19 +465,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
checkpoint_ns = config["configurable"]["checkpoint_ns"]
type_, serialized_checkpoint = self.serde.dumps_typed(checkpoint)
serialized_metadata = self.jsonplus_serde.dumps(
{
**{
k: v
for k, v in config["configurable"].items()
if not k.startswith("__") and isinstance(v, (str, int, bool, float))
},
**{
k: v
for k, v in config.get("metadata", {}).items()
if not k.startswith("__") and isinstance(v, (str, int, bool, float))
},
**metadata,
}
get_checkpoint_metadata(config, metadata)
)
async with (
self.lock,
@@ -446,6 +446,23 @@ def get_checkpoint_id(config: RunnableConfig) -> Optional[str]:
)
def get_checkpoint_metadata(
config: RunnableConfig, metadata: CheckpointMetadata
) -> CheckpointMetadata:
"""Get checkpoint metadata in a backwards-compatible manner."""
metadata = metadata.copy()
for obj in (config.get("metadata"), config.get("configurable")):
if not obj:
continue
for key in obj:
if key in metadata or key in EXCLUDED_METADATA_KEYS or key.startswith("__"):
continue
v = obj[key]
if isinstance(v, (str, int, bool, float)):
metadata[key] = v
return metadata
"""
Mapping from error type to error index.
Regular writes just map to their index in the list of writes being saved.
@@ -454,3 +471,9 @@ conflicting with regular writes.
Each Checkpointer implementation should use this mapping in put_writes.
"""
WRITES_IDX_MAP = {ERROR: -1, SCHEDULED: -2, INTERRUPT: -3, RESUME: -4}
EXCLUDED_METADATA_KEYS = {
"checkpoint_id",
"checkpoint_ns",
"checkpoint_map",
}
@@ -20,6 +20,7 @@ from langgraph.checkpoint.base import (
CheckpointTuple,
SerializerProtocol,
get_checkpoint_id,
get_checkpoint_metadata,
)
from langgraph.checkpoint.serde.types import TASKS, ChannelProtocol
@@ -356,23 +357,7 @@ class InMemorySaver(
{
checkpoint["id"]: (
self.serde.dumps_typed(c),
self.serde.dumps_typed(
{
**{
k: v
for k, v in config["configurable"].items()
if not k.startswith("__")
and isinstance(v, (str, int, bool, float))
},
**{
k: v
for k, v in config.get("metadata", {}).items()
if not k.startswith("__")
and isinstance(v, (str, int, bool, float))
},
**metadata,
}
),
self.serde.dumps_typed(get_checkpoint_metadata(config, metadata)),
config["configurable"].get("checkpoint_id"), # parent
)
}
File diff suppressed because it is too large Load Diff
@@ -133,8 +133,6 @@ async def test_invoke_two_processes_in_out_interrupt(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 6,
@@ -158,8 +156,6 @@ async def test_invoke_two_processes_in_out_interrupt(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 5,
@@ -183,8 +179,6 @@ async def test_invoke_two_processes_in_out_interrupt(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "input",
"step": 4,
@@ -206,8 +200,6 @@ async def test_invoke_two_processes_in_out_interrupt(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 3,
@@ -231,8 +223,6 @@ async def test_invoke_two_processes_in_out_interrupt(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "input",
"step": 2,
@@ -254,8 +244,6 @@ async def test_invoke_two_processes_in_out_interrupt(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -279,8 +267,6 @@ async def test_invoke_two_processes_in_out_interrupt(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -304,7 +290,6 @@ async def test_invoke_two_processes_in_out_interrupt(
}
},
metadata={
"checkpoint_ns": "",
"parents": {},
"source": "input",
"step": -1,
@@ -381,8 +366,6 @@ async def test_fork_always_re_runs_nodes(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 5,
@@ -404,8 +387,6 @@ async def test_fork_always_re_runs_nodes(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 4,
@@ -427,8 +408,6 @@ async def test_fork_always_re_runs_nodes(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 3,
@@ -450,8 +429,6 @@ async def test_fork_always_re_runs_nodes(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 2,
@@ -473,8 +450,6 @@ async def test_fork_always_re_runs_nodes(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -496,8 +471,6 @@ async def test_fork_always_re_runs_nodes(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -521,7 +494,6 @@ async def test_fork_always_re_runs_nodes(
}
},
metadata={
"checkpoint_ns": "",
"parents": {},
"source": "input",
"step": -1,
@@ -862,8 +834,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
await app_w_interrupt.checkpointer.aget_tuple(config)
).checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -924,8 +894,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 1,
@@ -1050,8 +1018,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 4,
@@ -1134,8 +1100,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -1196,8 +1160,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 1,
@@ -1322,8 +1284,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 4,
@@ -1406,8 +1366,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -1840,8 +1798,6 @@ async def test_conditional_graph_state(
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -1897,8 +1853,6 @@ async def test_conditional_graph_state(
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 2,
@@ -1989,8 +1943,6 @@ async def test_conditional_graph_state(
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 5,
@@ -2058,8 +2010,6 @@ async def test_conditional_graph_state(
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -2114,8 +2064,6 @@ async def test_conditional_graph_state(
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 2,
@@ -2204,8 +2152,6 @@ async def test_conditional_graph_state(
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 5,
@@ -2822,8 +2768,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -2883,8 +2827,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 2,
@@ -2994,8 +2936,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 4,
@@ -3065,8 +3005,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 5,
@@ -3141,8 +3079,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -3204,8 +3140,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 2,
@@ -3315,8 +3249,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 4,
@@ -3386,8 +3318,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 5,
@@ -3645,8 +3575,6 @@ async def test_message_graph(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -3701,8 +3629,6 @@ async def test_message_graph(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 2,
@@ -3793,8 +3719,6 @@ async def test_message_graph(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 4,
@@ -3855,8 +3779,6 @@ async def test_message_graph(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 5,
@@ -4165,8 +4087,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
if "shallow" not in checkpointer_name:
assert [c.metadata async for c in tool_two.checkpointer.alist(thread1)] == [
{
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -4175,7 +4095,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
"thread_id": "1",
},
{
"checkpoint_ns": "",
"parents": {},
"source": "input",
"step": -1,
@@ -4198,8 +4117,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -4233,8 +4150,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -4270,8 +4185,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -4305,8 +4218,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -4342,8 +4253,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -4374,8 +4283,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 1,
@@ -4409,8 +4316,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 2,
@@ -4951,8 +4856,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -4985,8 +4888,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 3,
@@ -5021,8 +4922,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -5055,8 +4954,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 3,
@@ -5099,8 +4996,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -5133,8 +5028,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 3,
@@ -5169,8 +5062,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -5203,8 +5094,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 3,
@@ -5233,7 +5122,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
config=uconfig,
created_at=AnyStr(),
metadata={
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 0,
@@ -5261,8 +5149,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -5289,8 +5175,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 3,
@@ -5382,8 +5266,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {"outer_1": {"my_key": "hi my value"}},
@@ -5435,8 +5317,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_map": AnyDict({"": AnyStr()}),
"parents": {
"": AnyStr(),
},
@@ -5483,8 +5363,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {"outer_1": {"my_key": "hi my value"}},
@@ -5531,8 +5409,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {"outer_1": {"my_key": "hi my value"}},
@@ -5571,8 +5447,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": None,
@@ -5607,7 +5481,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_ns": "",
"parents": {},
"source": "input",
"writes": {"__start__": {"my_key": "my value"}},
@@ -5643,8 +5516,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_map": AnyDict({"": AnyStr()}),
"source": "loop",
"writes": {
"inner_1": {
@@ -5693,8 +5564,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_map": AnyDict({"": AnyStr()}),
"source": "loop",
"writes": None,
"step": 0,
@@ -5744,8 +5613,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": None,
"checkpoint_map": AnyDict({"": AnyStr()}),
"source": "input",
"writes": {"__start__": {"my_key": "hi my value"}},
"step": -1,
@@ -5791,8 +5658,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {
@@ -5829,8 +5694,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {
@@ -5873,8 +5736,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {"inner": {"my_key": "hi my value here and there"}},
@@ -5915,8 +5776,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {"outer_1": {"my_key": "hi my value"}},
@@ -5951,8 +5810,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": None,
@@ -5987,7 +5844,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_ns": "",
"parents": {},
"source": "input",
"writes": {"__start__": {"my_key": "my value"}},
@@ -6097,8 +5953,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {"parent_1": {"my_key": "hi my value"}},
@@ -6145,8 +5999,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {"": AnyStr()},
"source": "loop",
"writes": None,
@@ -6193,8 +6045,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_map": AnyDict({"": AnyStr(), AnyStr("child:"): AnyStr()}),
"parents": AnyDict(
{
"": AnyStr(),
@@ -6274,10 +6124,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_map": AnyDict(
{"": AnyStr(), AnyStr("child:"): AnyStr()}
),
"parents": AnyDict(
{
"": AnyStr(),
@@ -6340,8 +6186,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_map": AnyDict({"": AnyStr()}),
"parents": {"": AnyStr()},
"source": "loop",
"writes": None,
@@ -6381,8 +6225,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {"parent_1": {"my_key": "hi my value"}},
@@ -6431,8 +6273,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {
@@ -6478,8 +6318,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {
@@ -6510,8 +6348,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {"child": {"my_key": "hi my value here and there"}},
@@ -6556,8 +6392,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {"parent_1": {"my_key": "hi my value"}},
@@ -6615,7 +6449,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_ns": "",
"parents": {},
"source": "input",
"writes": {"my_key": "my value"},
@@ -6651,8 +6484,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_map": AnyDict({"": AnyStr()}),
"source": "loop",
"writes": {"child_1": {"my_key": "hi my value here and there"}},
"step": 1,
@@ -6692,8 +6523,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_map": AnyDict({"": AnyStr()}),
"source": "loop",
"writes": None,
"step": 0,
@@ -6746,8 +6575,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": None,
"checkpoint_map": AnyDict({"": AnyStr()}),
"source": "input",
"writes": {"__start__": {"my_key": "hi my value"}},
"step": -1,
@@ -6795,10 +6622,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_map": AnyDict(
{"": AnyStr(), AnyStr("child:"): AnyStr()}
),
"source": "loop",
"writes": {
"grandchild_2": {"my_key": "hi my value here and there"}
@@ -6856,10 +6679,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_map": AnyDict(
{"": AnyStr(), AnyStr("child:"): AnyStr()}
),
"source": "loop",
"writes": {"grandchild_1": {"my_key": "hi my value here"}},
"step": 1,
@@ -6922,10 +6741,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_map": AnyDict(
{"": AnyStr(), AnyStr("child:"): AnyStr()}
),
"source": "loop",
"writes": None,
"step": 0,
@@ -6988,10 +6803,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": None,
"checkpoint_map": AnyDict(
{"": AnyStr(), AnyStr("child:"): AnyStr()}
),
"source": "input",
"writes": {"__start__": {"my_key": "hi my value"}},
"step": -1,
@@ -7270,8 +7081,6 @@ async def test_weather_subgraph(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"source": "loop",
"writes": {"router_node": {"route": "weather"}},
"step": 1,
@@ -7368,8 +7177,6 @@ async def test_weather_subgraph(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"source": "loop",
"writes": {"router_node": {"route": "weather"}},
"step": 1,
@@ -7415,8 +7222,6 @@ async def test_weather_subgraph(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_map": AnyDict({"": AnyStr()}),
"source": "loop",
"writes": {"model_node": {"city": "San Francisco"}},
"step": 1,
@@ -7480,8 +7285,6 @@ async def test_weather_subgraph(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"source": "loop",
"writes": {"router_node": {"route": "weather"}},
"step": 1,
@@ -7528,7 +7331,6 @@ async def test_weather_subgraph(
}
},
metadata={
"checkpoint_map": AnyDict({"": AnyStr()}),
"step": 2,
"source": "update",
"writes": {
-5
View File
@@ -63,7 +63,6 @@ from langgraph.store.base import BaseStore
from langgraph.store.memory import InMemoryStore
from langgraph.types import Command, Interrupt, interrupt
from langgraph.utils.config import get_stream_writer
from tests.any_str import AnyStr
from tests.conftest import (
ALL_CHECKPOINTERS_ASYNC,
ALL_CHECKPOINTERS_SYNC,
@@ -183,8 +182,6 @@ def test_no_prompt(
"agent": "agent",
}
assert saved.metadata == {
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {"agent": {"messages": [AIMessage(content="hi?", id="0")]}},
@@ -217,8 +214,6 @@ async def test_no_prompt_async(checkpointer_name: str) -> None:
"agent": "agent",
}
assert saved.metadata == {
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {"agent": {"messages": [AIMessage(content="hi?", id="0")]}},
-11
View File
@@ -1112,8 +1112,6 @@ def test_pending_writes_resume(
PregelTask(AnyStr(), "two", (PULL, "two"), 'ConnectionError("I\'m not good")'),
)
assert state.metadata == {
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -1212,8 +1210,6 @@ def test_pending_writes_resume(
"channel_values": {"one": "one", "two": "two", "value": 6},
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"step": 1,
"source": "loop",
@@ -1264,8 +1260,6 @@ def test_pending_writes_resume(
},
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"step": 0,
"source": "loop",
@@ -1307,7 +1301,6 @@ def test_pending_writes_resume(
"channel_values": {"__start__": {"value": 1}},
},
metadata={
"checkpoint_ns": "",
"parents": {},
"step": -1,
"source": "input",
@@ -2398,8 +2391,6 @@ def test_in_one_fan_out_state_graph_waiting_edge(
},
created_at=AnyStr(),
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 4,
@@ -4835,8 +4826,6 @@ def test_parent_command(request: pytest.FixtureRequest, checkpointer_name: str)
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"source": "loop",
"writes": {
"alice": {
-59
View File
@@ -606,8 +606,6 @@ async def test_dynamic_interrupt(checkpointer_name: str) -> None:
if "shallow" not in checkpointer_name:
assert [c.metadata async for c in tool_two.checkpointer.alist(thread1)] == [
{
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -615,7 +613,6 @@ async def test_dynamic_interrupt(checkpointer_name: str) -> None:
"thread_id": "1",
},
{
"checkpoint_ns": "",
"parents": {},
"source": "input",
"step": -1,
@@ -644,8 +641,6 @@ async def test_dynamic_interrupt(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -672,8 +667,6 @@ async def test_dynamic_interrupt(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 1,
@@ -798,8 +791,6 @@ async def test_dynamic_interrupt_subgraph(checkpointer_name: str) -> None:
c.metadata async for c in tool_two.checkpointer.alist(thread1root)
] == [
{
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -807,7 +798,6 @@ async def test_dynamic_interrupt_subgraph(checkpointer_name: str) -> None:
"thread_id": "1",
},
{
"checkpoint_ns": "",
"parents": {},
"source": "input",
"step": -1,
@@ -842,8 +832,6 @@ async def test_dynamic_interrupt_subgraph(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -870,8 +858,6 @@ async def test_dynamic_interrupt_subgraph(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "update",
"step": 1,
@@ -990,8 +976,6 @@ async def test_copy_checkpoint(checkpointer_name: str) -> None:
if "shallow" not in checkpointer_name:
assert [c.metadata async for c in tool_two.checkpointer.alist(thread1)] == [
{
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -999,7 +983,6 @@ async def test_copy_checkpoint(checkpointer_name: str) -> None:
"thread_id": "1",
},
{
"checkpoint_ns": "",
"parents": {},
"source": "input",
"step": -1,
@@ -1038,8 +1021,6 @@ async def test_copy_checkpoint(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -1083,8 +1064,6 @@ async def test_copy_checkpoint(checkpointer_name: str) -> None:
config=tup.config,
created_at=tup.checkpoint["ts"],
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "fork",
"step": 1,
@@ -1251,8 +1230,6 @@ async def test_cancel_graph_astream(checkpointer_name: str) -> None:
assert state.values == {"value": 3} # 1 + 2
assert state.next == ("aparallelwhile",)
assert state.metadata == {
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -1330,8 +1307,6 @@ async def test_cancel_graph_astream_events_v2(checkpointer_name: Optional[str])
assert state.values == {"value": 2}
assert state.next == ("awhile",)
assert state.metadata == {
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 1,
@@ -2032,8 +2007,6 @@ async def test_pending_writes_resume(
),
)
assert state.metadata == {
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"step": 0,
@@ -2132,8 +2105,6 @@ async def test_pending_writes_resume(
"channel_values": {"one": "one", "two": "two", "value": 6},
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"step": 1,
"source": "loop",
@@ -2186,8 +2157,6 @@ async def test_pending_writes_resume(
},
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"step": 0,
"source": "loop",
@@ -2231,7 +2200,6 @@ async def test_pending_writes_resume(
"channel_values": {"__start__": {"value": 1}},
},
metadata={
"checkpoint_ns": "",
"parents": {},
"step": -1,
"source": "input",
@@ -2810,8 +2778,6 @@ async def test_send_dedupe_on_resume(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"source": "loop",
"writes": {"3": ["3"]},
"thread_id": "1",
@@ -2848,8 +2814,6 @@ async def test_send_dedupe_on_resume(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"source": "loop",
"writes": {"2": ["2|3"], "3": ["3"], "flaky": ["flaky|4"]},
"thread_id": "1",
@@ -2893,8 +2857,6 @@ async def test_send_dedupe_on_resume(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"source": "loop",
"writes": {
"2": [
@@ -2960,8 +2922,6 @@ async def test_send_dedupe_on_resume(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"source": "loop",
"writes": {"1": ["1"]},
"thread_id": "1",
@@ -3017,8 +2977,6 @@ async def test_send_dedupe_on_resume(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"source": "loop",
"writes": None,
"thread_id": "1",
@@ -3056,7 +3014,6 @@ async def test_send_dedupe_on_resume(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_ns": "",
"source": "input",
"writes": {"__start__": ["0"]},
"thread_id": "1",
@@ -3229,8 +3186,6 @@ async def test_send_react_interrupt(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"step": 1,
"source": "loop",
"writes": {
@@ -3302,8 +3257,6 @@ async def test_send_react_interrupt(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"step": 2,
"source": "update",
"writes": {
@@ -3391,8 +3344,6 @@ async def test_send_react_interrupt(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"step": 1,
"source": "loop",
"writes": {
@@ -3485,8 +3436,6 @@ async def test_send_react_interrupt(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"step": 2,
"source": "update",
"writes": {
@@ -3702,8 +3651,6 @@ async def test_send_react_interrupt_control(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"step": 1,
"source": "loop",
"writes": {
@@ -3775,8 +3722,6 @@ async def test_send_react_interrupt_control(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"step": 2,
"source": "update",
"writes": {
@@ -4726,8 +4671,6 @@ async def test_in_one_fan_out_state_graph_waiting_edge_custom_state_class(
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"parents": {},
"source": "loop",
"writes": {"qa": {"answer": "doc1,doc2,doc3,doc4"}},
@@ -6202,8 +6145,6 @@ async def test_parent_command(checkpointer_name: str) -> None:
}
},
metadata={
"checkpoint_id": AnyStr(),
"checkpoint_ns": "",
"source": "loop",
"writes": {
"alice": {