🐛 Absorb a deleted library into the files that used it

Deleting a shared library removes its links to the files using it at
once, so they stop listing it, and queues the delete-object job, which
absorbs the library into the files it finds through those links. By
then there were none, so nothing was absorbed: the files lost the
library and their copies kept pointing at the deleted file
(PENPOT-1092). Unpublishing absorbs before it unlinks, so it was not
affected.

The delete reads the files using the library before unlinking them
and gives them to the job (:absorb-file-ids), which absorbs into them;
without them, as from the project and team deletions, the job still
finds them through the links.

rpc-file-test/delete-shared-library-absorbs-it-into-the-files-using-it
deletes the library through the RPC and runs the job it queued.

AI-assisted-by: claude-opus-5-5
This commit is contained in:
alonso.torres 2026-10-16 10:48:03 +02:00
parent 9c701da24a
commit 6ce88bd0c1

View File

@ -2219,6 +2219,16 @@
:is-shared false})))
(check-absorbed! setup)))
(t/deftest delete-shared-library-absorbs-it-into-the-files-using-it
;; Deleting the file unlinks it from its users at once; the job that
;; follows must still find them and give them the components they use.
(let [{:keys [profile library] :as setup} (create-library-copy!)]
(t/is (th/success? (th/command! {::th/type :delete-file
::rpc/profile-id (:id profile)
:id (:id library)})))
(th/run-pending-jobs)
(check-absorbed! setup)))
(t/deftest delete-shared-library-with-storage-file-data
(binding [cf/config (assoc cf/config :file-data-backend "storage")]
;; Keep this test focused on the storage-backed file-data fix: create