Conversation
When --overwrite is set and the local mapping references a target content item that no longer exists on disk, send the payload with the mapped targetContentID rather than -1, so we attempt to update the deleted item rather than silently creating a duplicate. Also extend the conflict branch in change-detection so overwrite resolves to shouldUpdate instead of flagging an unresolvable conflict. Additional housekeeping: - guard the cross-locale fallback so it only fires when no mapping exists at all (was previously overriding existingContentID even when set) - add .claude/settings.local.json to .gitignore - prettier pass on content-batch-processor.ts and change-detection.ts Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5PK
approved these changes
May 21, 2026
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.
Summary
Fixes a duplicate-content bug that fires when
--overwriteis used and the mapped target content item has been deleted in the target CMS. The previous code path silently created a new item (and a new mapping row), accumulating duplicates over repeated syncs. This change makes overwrite reuse the mappedtargetContentIDso the API attempts an update against the deleted ID rather than falling through to a create.Changes
src/lib/pushers/content-pusher/util/change-detection.tsstate.overwrite === truenow returnsshouldUpdate: trueinstead of flagging an unresolvable conflict.src/lib/pushers/content-pusher/content-batch-processor.tsprepareContentPayloads, when a mapping exists but the local target file is missing (isTargetContentItemDeleted) andstate.overwriteis on, the payload reusesexistingMapping.targetContentIDinstead of-1. Without overwrite, falls back to the prior behavior.findContentInOtherLocale) is now only invoked when there is no mapping AND no target entity — previously it could overwrite a just-resolvedexistingContentID..gitignore.claude/settings.local.jsonso local Claude Code settings stay untracked.Test plan
--overwrite, delete a target item in the target CMS, run sync, confirm a duplicate is NOT created (the API either updates the existing item or surfaces a clear failure).--overwrite, confirm prior conflict-handling behavior is unchanged (both source and target newer → reports conflict).npm run buildpasses (verified locally).