From 9db40b3c8a9dd56e009376199e17ae558813a033 Mon Sep 17 00:00:00 2001 From: "detail-app[bot]" <180357370+detail-app[bot]@users.noreply.github.com> Date: Wed, 9 Sep 2026 19:15:34 +0000 Subject: [PATCH] chore: remove unused pruneCollectionsFileStrict method --- .../ingestion/IngestedFilePruneService.java | 21 ------- .../IngestedFilePruneServiceTest.java | 56 ------------------- 2 files changed, 77 deletions(-) diff --git a/src/main/java/com/williamcallahan/javachat/service/ingestion/IngestedFilePruneService.java b/src/main/java/com/williamcallahan/javachat/service/ingestion/IngestedFilePruneService.java index f771d990..4819d88c 100644 --- a/src/main/java/com/williamcallahan/javachat/service/ingestion/IngestedFilePruneService.java +++ b/src/main/java/com/williamcallahan/javachat/service/ingestion/IngestedFilePruneService.java @@ -67,27 +67,6 @@ public void pruneCollectionFileStrict( pruneFileStrict(List.of(collectionName), sourceUrl, previousFileRecord); } - /** - * Strictly prunes a file from every specified collection before deleting its local ingestion state. - * - *

Deferring local cleanup until every vector deletion succeeds preserves the marker needed to retry - * a partially completed prior-format marker prune.

- * - * @param collectionNames target Qdrant collection names - * @param sourceUrl authoritative URL key for file markers and vectors - * @param previousFileRecord previous file marker record, or {@code null} if unavailable - * @throws IOException when local marker or parsed-chunk cleanup fails - * @throws IllegalArgumentException when no collection names are provided or any name is blank - */ - public void pruneCollectionsFileStrict( - List collectionNames, String sourceUrl, FileIngestionRecord previousFileRecord) throws IOException { - Objects.requireNonNull(collectionNames, "collectionNames"); - if (collectionNames.isEmpty()) { - throw new IllegalArgumentException("At least one collection name is required for file pruning"); - } - pruneFileStrict(List.copyOf(collectionNames), sourceUrl, previousFileRecord); - } - /** * Removes obsolete local chunk state after a complete same-collection replacement was stored. * diff --git a/src/test/java/com/williamcallahan/javachat/service/ingestion/IngestedFilePruneServiceTest.java b/src/test/java/com/williamcallahan/javachat/service/ingestion/IngestedFilePruneServiceTest.java index 4278712e..6c1f142c 100644 --- a/src/test/java/com/williamcallahan/javachat/service/ingestion/IngestedFilePruneServiceTest.java +++ b/src/test/java/com/williamcallahan/javachat/service/ingestion/IngestedFilePruneServiceTest.java @@ -1,12 +1,9 @@ package com.williamcallahan.javachat.service.ingestion; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; @@ -25,12 +22,10 @@ import java.util.List; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.mockito.InOrder; /** Verifies strict multi-collection vector pruning preserves retryable local ingestion state. */ class IngestedFilePruneServiceTest { private static final int LEGACY_CHUNK_HASH_PREFIX_LENGTH = 12; - private static final String BOOKS_COLLECTION_NAME = "books-collection"; private static final String DOCS_COLLECTION_NAME = "docs-collection"; private static final String SOURCE_URL = "https://docs.example.com/reference/page.html"; private static final String REPLACEMENT_CHUNK_HASH = @@ -43,57 +38,6 @@ class IngestedFilePruneServiceTest { private static final String MARKERLESS_STALE_CHUNK_HASH = "fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210"; - @Test - void deletesEveryCollectionBeforeLocalIngestionState() throws IOException { - HybridVectorService hybridVectorService = mock(HybridVectorService.class); - LocalStoreService localStoreService = mock(LocalStoreService.class); - FileIngestionMarkerStore fileIngestionMarkerStore = mock(FileIngestionMarkerStore.class); - IngestedFilePruneService pruneService = new IngestedFilePruneService( - hybridVectorService, localStoreService, fileIngestionMarkerStore, mock(ContentHasher.class)); - FileIngestionRecord priorIngestionRecord = new FileIngestionRecord( - 123L, - 456L, - "fingerprint", - "extraction-v1", - BOOKS_COLLECTION_NAME, - List.of("first-hash", "second-hash")); - - pruneService.pruneCollectionsFileStrict( - List.of(BOOKS_COLLECTION_NAME, DOCS_COLLECTION_NAME), SOURCE_URL, priorIngestionRecord); - - InOrder pruneOrder = inOrder(hybridVectorService, localStoreService, fileIngestionMarkerStore); - pruneOrder.verify(hybridVectorService).deleteByUrl(BOOKS_COLLECTION_NAME, SOURCE_URL); - pruneOrder.verify(hybridVectorService).deleteByUrl(DOCS_COLLECTION_NAME, SOURCE_URL); - pruneOrder.verify(localStoreService).deleteChunkIngestionMarkers(priorIngestionRecord.chunkHashes()); - pruneOrder.verify(localStoreService).deleteParsedChunksForUrl(SOURCE_URL); - pruneOrder.verify(fileIngestionMarkerStore).deleteFileIngestionRecord(SOURCE_URL); - } - - @Test - void retainsLocalIngestionStateWhenACollectionDeleteFails() throws IOException { - HybridVectorService hybridVectorService = mock(HybridVectorService.class); - LocalStoreService localStoreService = mock(LocalStoreService.class); - FileIngestionMarkerStore fileIngestionMarkerStore = mock(FileIngestionMarkerStore.class); - IngestedFilePruneService pruneService = new IngestedFilePruneService( - hybridVectorService, localStoreService, fileIngestionMarkerStore, mock(ContentHasher.class)); - FileIngestionRecord priorIngestionRecord = new FileIngestionRecord( - 123L, 456L, "fingerprint", "extraction-v1", BOOKS_COLLECTION_NAME, List.of("first-hash")); - doThrow(new IllegalStateException("Qdrant delete failed")) - .when(hybridVectorService) - .deleteByUrl(DOCS_COLLECTION_NAME, SOURCE_URL); - - assertThrows( - IllegalStateException.class, - () -> pruneService.pruneCollectionsFileStrict( - List.of(BOOKS_COLLECTION_NAME, DOCS_COLLECTION_NAME), SOURCE_URL, priorIngestionRecord)); - - verify(hybridVectorService).deleteByUrl(BOOKS_COLLECTION_NAME, SOURCE_URL); - verify(hybridVectorService).deleteByUrl(DOCS_COLLECTION_NAME, SOURCE_URL); - verify(localStoreService, never()).deleteChunkIngestionMarkers(anyList()); - verify(localStoreService, never()).deleteParsedChunksForUrl(anyString()); - verify(fileIngestionMarkerStore, never()).deleteFileIngestionRecord(anyString()); - } - @Test void removesLegacyStaleParsedChunkWhenFullHashesShareStoredPrefix(@TempDir Path parsedChunkDirectory) throws IOException {