Commit 6205cc8
committed
fix(knowledge): close remaining hard-delete race window, guard listing-time skip/drop resurrection
Two more real findings, both closing gaps in the previous round's fixes:
- The FOR UPDATE lock protected resurrect/soft-delete (applied inside
the same transaction) but hardDeleteDocuments still ran after that
transaction committed, using IDs snapshotted under the lock. A
concurrent 'delete connector, keep documents' request could still
detach those same documents in the gap between commit and the
hardDeleteDocuments call. Added an optional expectedConnectorId
parameter to hardDeleteDocuments/hardDeleteDocumentBatch — when
provided, it re-verifies connectorId at the moment of the actual
delete query, not just the caller's earlier snapshot. Every other
caller is unaffected (parameter is optional, defaults to no filter).
- Two more listing-time paths could resurrect a tombstoned document
without ever verifying its content: a listing-time skippedReason
short-circuits classification straight to 'unchanged' before the
hash comparison ever runs, and empty non-deferred content classifies
as 'drop' unconditionally regardless of hash. Both are now added to
failedExternalIds when reappearing on an existing (possibly
tombstoned) document, same treatment as the deferred-hydration
equivalents from the prior round.1 parent d2fe611 commit 6205cc8
2 files changed
Lines changed: 50 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
689 | 689 | | |
690 | 690 | | |
691 | 691 | | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
700 | 702 | | |
701 | 703 | | |
702 | 704 | | |
| |||
718 | 720 | | |
719 | 721 | | |
720 | 722 | | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
721 | 727 | | |
722 | 728 | | |
723 | 729 | | |
| |||
729 | 735 | | |
730 | 736 | | |
731 | 737 | | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
732 | 744 | | |
733 | 745 | | |
734 | 746 | | |
| |||
1019 | 1031 | | |
1020 | 1032 | | |
1021 | 1033 | | |
1022 | | - | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
1023 | 1039 | | |
1024 | 1040 | | |
1025 | 1041 | | |
| |||
1166 | 1182 | | |
1167 | 1183 | | |
1168 | 1184 | | |
1169 | | - | |
| 1185 | + | |
| 1186 | + | |
1170 | 1187 | | |
1171 | 1188 | | |
1172 | 1189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2325 | 2325 | | |
2326 | 2326 | | |
2327 | 2327 | | |
2328 | | - | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
2329 | 2339 | | |
2330 | 2340 | | |
2331 | 2341 | | |
| |||
2336 | 2346 | | |
2337 | 2347 | | |
2338 | 2348 | | |
2339 | | - | |
| 2349 | + | |
| 2350 | + | |
2340 | 2351 | | |
2341 | 2352 | | |
2342 | 2353 | | |
| |||
2346 | 2357 | | |
2347 | 2358 | | |
2348 | 2359 | | |
2349 | | - | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
2350 | 2365 | | |
2351 | 2366 | | |
2352 | 2367 | | |
| |||
2361 | 2376 | | |
2362 | 2377 | | |
2363 | 2378 | | |
2364 | | - | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
2365 | 2384 | | |
2366 | 2385 | | |
2367 | 2386 | | |
| |||
0 commit comments