Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(vectordb): accept WGS-84 boundary coordinates in parse_geo_point (#3671)
bianbiandashen0c16a4e478f2
diff --git a/openviking/storage/vectordb/utils/data_processor.py b/openviking/storage/vectordb/utils/data_processor.pyindex bea3e5de8..f69ccf670 100644--- a/openviking/storage/vectordb/utils/data_processor.py+++ b/openviking/storage/vectordb/utils/data_processor.py@@ -260,10 +260,10 @@ class DataProcessor:lat = float(parts[1].strip())except ValueError as exc:raise ValueError("geo_point lon/lat must be float") from exc- if not (-180.0 < lon < 180.0):- raise ValueError("geo_point longitude out of range (-180, 180)")- if not (-90.0 < lat < 90.0):- raise ValueError("geo_point latitude out of range (-90, 90)")+ if not (-180.0 <= lon <= 180.0):+ raise ValueError("geo_point longitude out of range [-180, 180]")+ if not (-90.0 <= lat <= 90.0):+ raise ValueError("geo_point latitude out of range [-90, 90]")return lon, latdef parse_radius(self, value: Any) -> float:diff --git a/tests/vectordb/test_geo_point_boundary.py b/tests/vectordb/test_geo_point_boundary.pynew file mode 100644index 000000000..c49e6e1da--- /dev/null+++ b/tests/vectordb/test_geo_point_boundary.py@@ -0,0 +1,40 @@+"""Regression test: parse_geo_point must accept valid WGS-84 boundary coordinates.++The geographic standard defines a *closed* interval for both axes:+ longitude ∈ [-180, 180] (includes the antimeridian / International Date Line)+ latitude ∈ [ -90, 90] (includes the North and South Poles)++Using strict inequalities (< instead of <=) incorrectly rejects these+legal endpoints, breaking both writes (boundary-coordinate resources cannot+be indexed) and geo_range queries centred on poles or the date line.+"""++import pytest++from openviking.storage.vectordb.utils.data_processor import DataProcessor++_PROCESSOR = DataProcessor({"geo": {"FieldType": "geo_point"}})+++ "coord, expected",+ [+ ("0,90", (0.0, 90.0)), # North Pole+ ("0,-90", (0.0, -90.0)), # South Pole+ ("180,0", (180.0, 0.0)), # antimeridian east+ ("-180,0", (-180.0, 0.0)), # antimeridian west+ ],+)+def test_geo_point_accepts_valid_boundary_coordinates(coord, expected):+ """Boundary values are valid WGS-84 coordinates and must not raise."""+ assert _PROCESSOR.parse_geo_point(coord) == expected+++ "coord",+ ["181,0", "-181,0", "0,91", "0,-91"],+)+def test_geo_point_rejects_out_of_range_coordinates(coord):+ """Values strictly outside the valid range must still raise ValueError."""+ with pytest.raises(ValueError):+ _PROCESSOR.parse_geo_point(coord)