DeleteDocument vs. the shared pdfs row
step 1 created A=55640 -> pdfID=23529
step 2 CopyDocument(A) -> B=55641 pdfID=23529
step 3 CopyDocument(A) -> C=55642 pdfID=23529
all three share one pdfs row: True
keys(A)=1 objs(A)=0
guard docs referencing pdfID 23529: [55640,55641,55642]
all references are ours — safe to delete
step 4 DeleteDocument(A=55640) <-- 1 of 3 sharers
docs row A exists : False
pdfs row 23529 exists : True
docs row B exists : True
docs row C exists : True
keys(A)=1 objs(A)=0
docs still referencing pdf: [55641,55642]
step 5 DeleteDocument(B=55641) <-- 2 of 3
pdfs row 23529 exists : True
docs row C exists : True
step 6 DeleteDocument(C=55642) <-- last reference
pdfs row 23529 exists : True
docs referencing it: []
VERDICT
DeleteDocument removes ONLY the docs row.
pdfs blob left behind though nothing references it : True
keys rows left behind for the deleted doc : True
=> safe for shared blobs; leaks pdfs + keys rows.
cleanup removed our orphaned pdfs row 23529 (rows affected: 1)
cleanup docs rows left behind: A=False B=False C=False