Skip to content

Avoid orphaned HistoryItemContent rows during duplicate handling#1369

Open
fitchmultz wants to merge 2 commits intop0deje:masterfrom
fitchmultz:fix/orphaned-history-item-content
Open

Avoid orphaned HistoryItemContent rows during duplicate handling#1369
fitchmultz wants to merge 2 commits intop0deje:masterfrom
fitchmultz:fix/orphaned-history-item-content

Conversation

@fitchmultz
Copy link
Copy Markdown

Fixes #1368

Summary

  • keep the duplicate-handling fix focused on History.add(_:)
  • remove the broader one-time orphan cleanup migration and helper
  • add focused regression coverage for both unsaved and already-persisted duplicate items

Details

The original change fixed the unsaved duplicate path, but it also introduced a broader cleanup migration that went beyond the narrow bugfix.

This version keeps the smallest direct fix and also covers the directly attached saved-duplicate case that surfaced while adding regression tests. In both cases, duplicate collapse should leave one history item and no orphaned HistoryItemContent rows.

Testing

xcodebuild test -project Maccy.xcodeproj -scheme Maccy -destination 'platform=macOS' CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY='' -only-testing:MaccyTests/HistoryTests/testAddingDuplicateUnsavedItemDoesNotLeaveOrphanedContentRows
xcodebuild test -project Maccy.xcodeproj -scheme Maccy -destination 'platform=macOS' CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY='' -only-testing:MaccyTests/HistoryTests/testAddingDuplicateSavedItemStillCollapsesWithoutOrphanedContentRows

@weisJ weisJ self-assigned this Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate history insertion can orphan HistoryItemContent rows

2 participants