Commit 4b14143
committed
fix(knowledge): bound tombstone-forced full syncs, resurrect kept docs on connector delete
Two more real findings from this review round:
- A document whose refresh keeps failing every sync (e.g. permanently
oversized) never resurrects and never hard-deletes (it's present in
the listing, just unreadable) — correct on its own, but it also never
stops being counted by hasTombstonedDocs, so it would force a full
listing for this connector forever, permanently disabling incremental
sync on account of one stuck document. Bounded the check to the same
RETRY_WINDOW_DAYS already used for the stuck-document retry sweep
below: past the window, this connector stops forcing full syncs on
the stuck document's account. The document itself is unaffected —
it stays tombstoned either way, matching the existing 'last-known-good
forever' tolerance this codebase already accepts for any document
whose hydration keeps failing.
- The connector-DELETE route's deleteDocuments=false path (kept docs)
counted tombstoned documents but never resolved them one way or the
other. With the connector gone, there's no future sync left to ever
confirm or resurrect them, so they'd become permanent invisible
orphans holding storage forever. Since 'kept' documents become normal
standalone KB entries once detached from their connector, resurrect
any pending-removal ones as part of that transition — consistent
with what happens to their non-tombstoned sibling documents.1 parent e2eee0f commit 4b14143
2 files changed
Lines changed: 17 additions & 2 deletions
File tree
- apps/sim
- app/api/knowledge/[id]/connectors/[connectorId]
- lib/knowledge/connectors
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| 338 | + | |
338 | 339 | | |
339 | | - | |
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
344 | 350 | | |
345 | 351 | | |
346 | 352 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
519 | 527 | | |
520 | 528 | | |
521 | 529 | | |
522 | 530 | | |
523 | 531 | | |
524 | 532 | | |
525 | 533 | | |
526 | | - | |
| 534 | + | |
| 535 | + | |
527 | 536 | | |
528 | 537 | | |
529 | 538 | | |
| |||
0 commit comments