Repository navigation
fix(sync): converge event create onto an imported provider identity row - #5443
Merged
tyler-dane merged 2 commits intoDec 5, 2026
Merged
tyler-dane merged 2 commits into
tyler-dane merged 2 commits into
Conversation
A webhook or pull import can store a new provider event between the provider write and the create's put. The put then hit E11000 on provider_event_identity and the user saw a failed save. The create now replaces the imported row and its occurrences, so the event keeps its Compass id. The backend also passes the SyncClientError into the command submit failure, so the log shows the status and correlation id. Generated-By: PostHog Desktop Task-Id: 0a34c050-6fdf-41f4-a8ac-bf00a51837af
Generated-By: PostHog Desktop Task-Id: 0a34c050-6fdf-41f4-a8ac-bf00a51837af
tyler-dane
marked this pull request as ready for review
December 5, 2026 20:34
tyler-dane
deleted the
posthog-self-driving/fixsync-converge-event-create-onto-an-9b2cec
branch
December 5, 2026 20:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5441
Fixes #5442
What and why
Problem
put(), which upserts by_idonly. If a webhook or pull import stores the same Google event first under a new_id, theput()insert collides onprovider_event_identity(E11000). The new db test reproduces this exactreplaceOneerror.throwSyncCommandSubmitFailuredrops theSyncClientError.Changes
_id, because the web and later commands address it by that id. Updating the imported row in place (asupsertExceptiondoes) would leave the event under an id that the client does not know.putCreatedProviderEventinprovider-command.internal.ts. Both create paths use it: the plain create and the "this and following" remainder create, which has the same race.throwSyncCommandSubmitFailuretakes the wholeSyncClientErrorand passes it on assyncError, sosyncFailureLogContextlogs the status and correlation id. Log levels do not change:logLevelForSyncClientErrorgives the same level as before for every kind.Warning
Residual risks, both narrow:
Agent context
replaceOne._id.Verify
bun run verify --strict:VERDICT: PASS. Checks run: test:sync, test:backend:fast, type-check, lint, knip. No PRE-EXISTING or FLAKY failures.replaces the row an import stored between the provider write and putfails onmainwith E11000 onprovider_event_identity, and passes with this change.Created with PostHog Desktop from this inbox report.
Origin