fix(datasource): keep manually deleted items deleted across syncs - #2684
Open
mdrkrg wants to merge 4 commits into
Open
fix(datasource): keep manually deleted items deleted across syncs#2684mdrkrg wants to merge 4 commits into
mdrkrg wants to merge 4 commits into
Conversation
17 tasks
A document the user deleted from the KB was re-created by the next sync while the source still reported it. Add regression tests for the deletion exclusion: user-deleted items stay deleted across syncs, a failed update-replace leaves no tombstone, and a swept child re-appearing at the source is re-ingested.
Sync re-created knowledge the user had deleted while the source still reported it. Deleted rows now act as a persistent exclusion for their data source and external item: sync never brings them back, while sync-internal deletions are physically removed so re-added items can be re-synced.
A transient error while checking the tombstone let the sync fall through and re-create an item the user had deleted from the KB. Such items now count as failed instead of being re-created.
mdrkrg
force-pushed
the
feat/ds-sync-tombstone
branch
from
August 13, 2026 15:59
288ff72 to
4b14c86
Compare
Fail closed when live lookup errors, skip rows in deleting state, surface user_deleted_excluded on tombstone skips, and fail update replace when hard-delete does not complete.
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.
Description
修复 #2623 报告问题的部分根因:用户删除的知识库条目,只要源端仍报告,下次同步就会重建。复用知识软删除(
deleted_at)为 tombstone(意图为持久的用户删除排除),删除后,同步将永不拉回该条目。预期行为:用户删除的条目保持删除,后续同步不会将其带回;同步的例行维护(文件更新、源端文件删除 为现有行为、子条目清理)不会导致条目被意外排除(通过硬删除实现),失败会在下次同步恢复。
已知限制:数据源以相同 external_id 重建的文件在 tombstone 存在期间不会重新出现。如果有必要管理被软删除的条目,等后续 issue / PR 讨论。
此 PR 引入行为上的变更,可能需要进一步讨论用户面的设计 / 文档更新。
Type of Change
Related Issue
Related #2623, but not fixed entirely.
Testing
TestProcessSync_TombstonedItemIsNotResurrected:用户删除保持删除,计 skippedTestProcessSync_UpdateIngestFailureRecoversNextSync:更新失败 -> 下次重建而非跳过TestProcessSync_SweptChildReappearsIsReingested:swept 子条目重新出现 -> 重新入库Checklist
git diff --check origin/main...HEADpassesgolangci-lint run --new-from-rev=origin/main ./...)docs/, Swagger annotations, etc.)Screenshots / Recordings