fix(personal): require vector capture metadata
This commit is contained in:
+4
-3
@@ -93,6 +93,9 @@ public class PersonalVectorStore {
|
||||
if (point == null || point.spaceId() <= 0 || point.itemId() <= 0 || point.fragmentId() <= 0) {
|
||||
throw new IllegalArgumentException("PERSONAL_VECTOR_POINT_INVALID");
|
||||
}
|
||||
if (point.capturedAt() == null) {
|
||||
throw new IllegalArgumentException("PERSONAL_VECTOR_CAPTURED_AT_REQUIRED");
|
||||
}
|
||||
ArrayNode vector = parseVector(vectorJson);
|
||||
setOrValidateDimension(vector.size());
|
||||
|
||||
@@ -103,9 +106,7 @@ public class PersonalVectorStore {
|
||||
payload.put("item_id", point.itemId());
|
||||
payload.put("fragment_id", point.fragmentId());
|
||||
payload.put("source", point.source() == null ? "" : point.source());
|
||||
if (point.capturedAt() != null) {
|
||||
payload.put("captured_at", point.capturedAt().toString());
|
||||
}
|
||||
payload.put("captured_at", point.capturedAt().toString());
|
||||
ObjectNode qdrantPoint = objectMapper.createObjectNode();
|
||||
qdrantPoint.put("id", point.fragmentId());
|
||||
qdrantPoint.set("vector", vector);
|
||||
|
||||
+15
@@ -56,9 +56,24 @@ class PersonalVectorStoreTest {
|
||||
assertEquals(11, point.path("payload").path("space_id").asLong());
|
||||
assertEquals(12, point.path("payload").path("item_id").asLong());
|
||||
assertEquals(13, point.path("payload").path("fragment_id").asLong());
|
||||
assertEquals("2026-07-01T09:00", point.path("payload").path("captured_at").asText());
|
||||
assertFalse(point.path("payload").has("content"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsMissingCaptureMetadataBeforeHttp() {
|
||||
List<PersonalVectorStore.TransportRequest> seen = new ArrayList<>();
|
||||
PersonalVectorStore store = fixture(seen, request -> ok("{}"));
|
||||
PersonalOwner owner = new PersonalOwner("t", 1, null);
|
||||
var point = new PersonalVectorStore.VectorPoint(1, 2, 3, "file", null);
|
||||
|
||||
IllegalArgumentException error = assertThrows(IllegalArgumentException.class,
|
||||
() -> store.upsert(owner, point, "[1,2]"));
|
||||
|
||||
assertEquals("PERSONAL_VECTOR_CAPTURED_AT_REQUIRED", error.getMessage());
|
||||
assertTrue(seen.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void collectionCreationAndPayloadIndexesAreStable() throws Exception {
|
||||
List<PersonalVectorStore.TransportRequest> seen = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user