From f681c4cb101f72d9705615a60e7f65ea87ed145f Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 16 Oct 2026 10:48:03 +0200 Subject: [PATCH] :bug: 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 --- backend/test/backend_tests/rpc_file_test.clj | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/test/backend_tests/rpc_file_test.clj b/backend/test/backend_tests/rpc_file_test.clj index 5050934d45..80e8505003 100644 --- a/backend/test/backend_tests/rpc_file_test.clj +++ b/backend/test/backend_tests/rpc_file_test.clj @@ -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