Skip to content

Respect handler import rules when cleaning missing items - #1092

Merged
KevinJump merged 1 commit into
v17/mainfrom
fix/clean-respects-import-rules
Sep 15, 2026
Merged

KevinJump merged 1 commit into
v17/mainfrom
fix/clean-respects-import-rules

Conversation

@KevinJump

Copy link
Copy Markdown
Owner

Summary

  • uSync.Publisher's ExcludeContentTypes/IncludeContentTypes handler settings were only applied when importing files. The 'clean' delete-missing-items pass ignored them, so a partial sync (e.g. some doc types excluded) would delete items on the target it simply never sent.
  • DeleteMissingItemsAsync now checks each delete candidate against the same ShouldImportAsync rules used on import, via a new ShouldImportDeletedItemAsync helper (serializes the item and runs it through ShouldImportAsync).
  • Reporting and real deletes now share this check, so a report can't say an item "will be deleted" when it actually wouldn't be.
  • Added HandlerSettings-aware overloads of CleanFolderAsync/DeleteMissingItemsAsync to carry the config through. Old overloads are marked [Obsolete] (removal in v20) and forward to the new ones, rather than being changed in place, to avoid breaking existing overrides.

Test plan

  • dotnet build uSync.BackOffice/uSync.BackOffice.csproj
  • dotnet build uSync.Extend/uSync.Extend.csproj (handlers overriding the old abstract methods still compile)
  • dotnet test uSync.Tests/uSync.Tests.csproj — 156 passed

🤖 Generated with Claude Code

uSync.Publisher's ExcludeContentTypes / IncludeContentTypes handler
settings were only applied when importing files - a 'clean' delete
missing items pass ignored them, so items never sent by a partial
sync (e.g. an excluded doc type) were treated as missing and deleted.

DeleteMissingItemsAsync now runs each delete candidate through the
same ShouldImportAsync rules used on import, via a new
ShouldImportDeletedItemAsync helper that serializes the item and
checks it. Reporting and real deletes use the same check so a report
can no longer say an item 'will be deleted' when it actually won't.

New HandlerSettings-aware overloads of CleanFolderAsync and
DeleteMissingItemsAsync carry the config through; the old overloads
are marked Obsolete (removal in v20) rather than changed, to avoid
breaking existing overrides.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@KevinJump
KevinJump merged commit cf8047b into v17/main Sep 15, 2026
5 checks passed
@KevinJump
KevinJump deleted the fix/clean-respects-import-rules branch September 15, 2026 09:06
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.

1 participant