Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(checkpoint-postgres): store channel_values correctly #577

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions libs/checkpoint-postgres/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ export class PostgresSaver extends BaseCheckpointSaver {
* @param config The config to use for retrieving the checkpoint.
* @returns The retrieved checkpoint tuple, or undefined.
*/
async getTuple(config: RunnableConfig): Promise<CheckpointTuple | undefined> {
async getTuple(
config: RunnableConfig
): Promise<CheckpointTuple | undefined> {
const {
thread_id,
checkpoint_ns = "",
Expand Down Expand Up @@ -416,8 +418,7 @@ export class PostgresSaver extends BaseCheckpointSaver {
async put(
config: RunnableConfig,
checkpoint: Checkpoint,
metadata: CheckpointMetadata,
newVersions: ChannelVersions
metadata: CheckpointMetadata
): Promise<RunnableConfig> {
if (config.configurable === undefined) {
throw new Error(`Missing "configurable" field in "config" param`);
Expand All @@ -443,7 +444,7 @@ export class PostgresSaver extends BaseCheckpointSaver {
thread_id,
checkpoint_ns,
checkpoint.channel_values,
newVersions
checkpoint.channel_versions
);
for (const serializedBlob of serializedBlobs) {
await client.query(UPSERT_CHECKPOINT_BLOBS_SQL, serializedBlob);
Expand Down
6 changes: 2 additions & 4 deletions libs/checkpoint-postgres/src/tests/checkpoints.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ describe("PostgresSaver", () => {
const runnableConfig = await postgresSaver.put(
{ configurable: { thread_id: "1" } },
checkpoint1,
{ source: "update", step: -1, writes: null, parents: {} },
checkpoint1.channel_versions
{ source: "update", step: -1, writes: null, parents: {} }
);
expect(runnableConfig).toEqual({
configurable: {
Expand Down Expand Up @@ -168,8 +167,7 @@ describe("PostgresSaver", () => {
},
},
checkpoint2,
{ source: "update", step: -1, writes: null, parents: {} },
checkpoint2.channel_versions
{ source: "update", step: -1, writes: null, parents: {} }
);

// verify that parentTs is set and retrieved correctly for second checkpoint
Expand Down