formatting

This commit is contained in:
2026-07-21 00:57:48 +02:00
parent 444ce804ed
commit 29027d4515
4 changed files with 21 additions and 20 deletions
@@ -43,7 +43,8 @@ public class HomeboxItemClient {
* @param query optional keyword filter; {@code null} returns all items for the page * @param query optional keyword filter; {@code null} returns all items for the page
* @param pageable page number and size to request * @param pageable page number and size to request
* @return the mapped page of items along with the resolved connection ID * @return the mapped page of items along with the resolved connection ID
* @throws com.vaessl.app.exception.ConnectionNotFoundException if no matching connection is stored * @throws com.vaessl.app.exception.ConnectionNotFoundException if no matching connection is
* stored
* @throws com.vaessl.app.exception.RemoteApiException if Homebox returns an empty response body * @throws com.vaessl.app.exception.RemoteApiException if Homebox returns an empty response body
*/ */
public HomeboxItemPage hbResponse(ConnectionIdentifiable connection, String query, public HomeboxItemPage hbResponse(ConnectionIdentifiable connection, String query,
@@ -14,10 +14,10 @@ import com.vaessl.app.vector.EmbeddingService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
/** /**
* Pages through the full Homebox catalog and re-indexes it into the vector store. * Pages through the full Homebox catalog and re-indexes it into the vector store. Item IDs are
* Item IDs are collected across all pages before {@link EmbeddingService#deleteStaleVectorEntries} * collected across all pages before {@link EmbeddingService#deleteStaleVectorEntries} is called
* is called once at the end, rather than after each page: deleting per page would treat every * once at the end, rather than after each page: deleting per page would treat every item outside
* item outside the current page as stale, wiping out entries from pages already synced. * the current page as stale, wiping out entries from pages already synced.
*/ */
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
@@ -12,9 +12,9 @@ import com.vaessl.app.shared.ServiceItem;
import com.vaessl.app.shared.ServiceType; import com.vaessl.app.shared.ServiceType;
/** /**
* Embeds {@link ServiceItem}s into the shared vector store and prunes entries that no longer * Embeds {@link ServiceItem}s into the shared vector store and prunes entries that no longer exist
* exist upstream. Kept stateless (no instance fields besides {@code vectorStore}) since this is * upstream. Kept stateless (no instance fields besides {@code vectorStore}) since this is a
* a singleton bean shared across concurrent sync runs; callers own the per-sync ID accumulator. * singleton bean shared across concurrent sync runs; callers own the per-sync ID accumulator.
*/ */
@Service @Service
public class EmbeddingService { public class EmbeddingService {
@@ -92,10 +92,10 @@ public class EmbeddingService {
} }
/** /**
* Deletes every vector for {@code connectionId} whose item ID is not in * Deletes every vector for {@code connectionId} whose item ID is not in {@code currentItemIds},
* {@code currentItemIds}, then clears the accumulator. Must be called once, after every page * then clears the accumulator. Must be called once, after every page for this sync run has gone
* for this sync run has gone through {@link #vectorizeData}, not per page — otherwise items * through {@link #vectorizeData}, not per page — otherwise items from pages other than the most
* from pages other than the most recent one would look stale and get deleted too. * recent one would look stale and get deleted too.
* *
* @param connectionId the connection to prune stale vectors for * @param connectionId the connection to prune stale vectors for
* @param currentItemIds every item ID seen across the full sync run; cleared after this call * @param currentItemIds every item ID seen across the full sync run; cleared after this call
@@ -26,9 +26,9 @@ import com.github.tomakehurst.wiremock.junit5.WireMockTest;
import jakarta.servlet.http.Cookie; import jakarta.servlet.http.Cookie;
/** /**
* Integration tests for {@code POST /api/search}, verifying the session-gated * Integration tests for {@code POST /api/search}, verifying the session-gated contract and request
* contract and request validation against a mocked Homebox backend (via WireMock) * validation against a mocked Homebox backend (via WireMock) and a real Spring MVC dispatch chain
* and a real Spring MVC dispatch chain (via {@link MockMvc}). * (via {@link MockMvc}).
*/ */
@SpringBootTest @SpringBootTest
@AutoConfigureMockMvc @AutoConfigureMockMvc
@@ -45,12 +45,12 @@ class SearchControllerTest {
private static final String SEARCH_REQUEST = SEARCH.getValue(); private static final String SEARCH_REQUEST = SEARCH.getValue();
/** /**
* Logs in against a stubbed Homebox instance, then performs a keyword search using * Logs in against a stubbed Homebox instance, then performs a keyword search using the
* the resulting session cookie. Expects {@code 200 OK} with the mocked item mapped * resulting session cookie. Expects {@code 200 OK} with the mocked item mapped into the paged
* into the paged response body. * response body.
* *
* @param wm WireMock runtime info, injected by {@link WireMockTest}, used to point * @param wm WireMock runtime info, injected by {@link WireMockTest}, used to point the client
* the client at the stub server * at the stub server
*/ */
@Test @Test
void shouldReturnListOfQueriedHomeboxItems(WireMockRuntimeInfo wm) throws Exception { void shouldReturnListOfQueriedHomeboxItems(WireMockRuntimeInfo wm) throws Exception {