feat(checkpoint-postgres)!: align version format and inline primitive storage with Python#1968
Conversation
🦋 Changeset detectedLatest commit: 7a85bb7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…s with Python parity fixes Fixes branching bug (#1812), adds task_path support, inline primitives, and globally unique version IDs. Upstream PRs: langchain-ai/langgraphjs#1967, langchain-ai/langgraphjs#1968
|
This PR directly addresses #1812 — the branching bug caused by deterministic integer versions in Root cause: When branching from the same checkpoint, Fix: In the meantime, we've published a temporary drop-in replacement package with all fixes from both #1967 and this PR:
Usage is a one-line import change: // Before:
import { PostgresSaver } from "@langchain/langgraph-checkpoint-postgres";
// After:
import { PostgresSaver } from "@logicpanel/langgraph-checkpoint-postgres";We'll deprecate the temporary package once these PRs are merged. |
Christian Bromann (christian-bromann)
left a comment
There was a problem hiding this comment.
Can we have some unit tests here to ensure we don't regress in the future?
863dddd to
d71f9ae
Compare
|
Christian Bromann (@christian-bromann) Christian BromannAdded unit tests in
All passing: |
|
so? |
… storage with Python BREAKING: Align checkpoint version format and channel_values storage with the Python implementation. Breaking changes: 1. Version format: getNextVersion now produces zero-padded string versions (e.g. "00000000000000000000000000000001.0482910384729105") instead of integer versions (1, 2, 3). Migration impact: Existing checkpoints with integer versions will still be readable. New checkpoints will use string versions. 2. Inline primitives: Primitive channel values (string, number, boolean, null) are now stored inline in the checkpoint JSONB column instead of in checkpoint_blobs. Requires PR langchain-ai#1967 (read-side merge) to be deployed first, so existing readers can handle both formats. These changes enable cross-compatibility between Python and JS checkpoint implementations sharing the same database, required for hybrid Python/JS LangGraph deployments.
…ne primitive storage Add unit tests covering the changes introduced in this PR: - getNextVersion: format validation, counter increment, backward compat with integer versions, uniqueness, string sorting, Python format parity - _dumpCheckpoint: inline primitive extraction (string, number, boolean, null) vs complex value exclusion - _dumpBlobs: primitive skipping, complex value serialization, mixed value handling - _loadCheckpoint: inline + blob merge, blob-wins-on-collision, backward compat with missing inline values
d71f9ae to
7a85bb7
Compare
Summary
BREAKING: Align checkpoint version format and channel_values storage with the Python implementation.
Breaking changes:
Version format:
getNextVersionnow produces zero-padded string versions (e.g."00000000000000000000000000000001.0482910384729105") instead of integer versions (1,2,3).Migration impact: Existing checkpoints with integer versions will still be readable. New checkpoints will use string versions. Active threads may need to be completed before upgrading, as
getNextVersionneeds to parse the current version format.Inline primitives: Primitive channel values (
string,number,boolean,null) are now stored inline in the checkpoint JSONB column instead of incheckpoint_blobs. Requires feat(checkpoint-postgres): add task_path support and inline primitive merging #1967 (read-side merge) to be deployed first, so existing readers can handle both formats.Why:
These changes enable cross-compatibility between Python and JS checkpoint implementations sharing the same database, which is required for hybrid Python/JS LangGraph deployments.
Upgrade path:
Test plan
getNextVersionproduces correct zero-padded string format