Skip to content
Open
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
4 changes: 2 additions & 2 deletions packages/sync-engine/src/database/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ export class PostgresClient {
.map((x) => `"${x}" = EXCLUDED."${x}"`)
.join(',')},
last_synced_at = :last_synced_at
WHERE "${table}"."last_synced_at" IS NULL
OR "${table}"."last_synced_at" < :last_synced_at;`
WHERE "${table}"."last_synced_at" IS NULL
OR "${table}"."last_synced_at" <= :last_synced_at;`
Comment on lines +202 to +203
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring example immediately above this query still shows a strict "< :last_synced_at" comparison, but the implementation now uses "<=". Please update the example so documentation matches the actual behavior.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes conflict resolution semantics for equal timestamps, but there isn't a test asserting that an event with the same created/last_synced_at as the stored row still overwrites data. Please add coverage (e.g., extend the existing "older timestamp does not override" webhook test to include a same-timestamp update that should override).

Suggested change
OR "${table}"."last_synced_at" <= :last_synced_at;`
OR "${table}"."last_synced_at" < :last_synced_at;`

Copilot uses AI. Check for mistakes.
}

/**
Expand Down
Loading