fix(review): guard placeholder in scanner reconcile + test dual-write path

Round-1 review follow-ups (PR #857):
- scanner.py: skip the rename-reconcile when the existing metadata point is a
  placeholder. reconcile_document_path only touches real chunks, so a not-yet-
  indexed file would just incur a 0-point set_payload; the real index writes the
  current path anyway.
- test_sharing_state.py: add a dedup-hit case where the file was renamed AND the
  user is new to the ACL, asserting both set_payload writes fire (file_path/title
  and acl_principals).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-05 01:18:58 +02:00
co-authored by Claude Opus 4.8
parent bded41de5d
commit a03bc0af66
2 changed files with 32 additions and 2 deletions
+7 -2
View File
@@ -587,13 +587,18 @@ async def scan_user_documents(
)
)
file_queued += 1
elif existing_metadata is not None:
elif existing_metadata is not None and not existing_metadata.get(
"is_placeholder", False
):
# Unchanged content (not re-queued) but the file may have
# been renamed/moved: a rename keeps the fileid while
# changing the path, and the dedup miss here means the
# etag changed without a modified_at bump. Refresh the
# stale path/title metadata without re-embedding. No-op
# when the path is unchanged.
# when the path is unchanged. Skip placeholders: reconcile
# only touches real chunks, so a not-yet-indexed file would
# just incur a 0-point set_payload (the real index writes
# the current path anyway).
try:
await reconcile_document_path(
file_id,