From 7e5099727acc75514156286c2c9355bc45b220a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Tejero=20Cantero?= Date: Wed, 28 Oct 2026 11:48:04 +0100 Subject: [PATCH] :bug: Make the base the only snapshot a file-gc test relies on MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The save in file-gc-keeps-the-fragments-a-base-names took an automatic snapshot of pre-edit main, which names the same fragments as the branch base, so the test passed even with bases left out of liveness. It now drops every other snapshot before the pass. AI-assisted-by: claude-opus-5-5 Signed-off-by: Álvaro Tejero Cantero --- backend/test/backend_tests/branch_pointer_base_test.clj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/test/backend_tests/branch_pointer_base_test.clj b/backend/test/backend_tests/branch_pointer_base_test.clj index 6f95db3bf8..e930a300a1 100644 --- a/backend/test/backend_tests/branch_pointer_base_test.clj +++ b/backend/test/backend_tests/branch_pointer_base_test.clj @@ -173,6 +173,14 @@ (let [main-ids (set (vals (page-pointer-ids (:data (bfc/get-file th/*system* file-id)))))] (t/is (seq (remove main-ids pinned)))) + ;; the save took an automatic snapshot of pre-edit main, which names + ;; the same fragments; drop every snapshot but the base so the base + ;; is what keeps them alive + (let [base-id (:base-snapshot-id (th/db-get :file-branch {:id (:id branch)}))] + (th/db-exec! ["delete from file_data where file_id = ? and type = 'snapshot' and id <> ?" + file-id base-id]) + (th/db-exec! ["delete from file_change where file_id = ? and label is not null and id <> ?" + file-id base-id])) (t/is (true? (th/run-task! :file-gc {:file-id file-id}))) (t/is (every? (live-fragment-ids file-id) pinned))