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): enforce the UINT16 length contract for list<string> elements (#3681)
bianbiandashenef577033b581
diff --git a/openviking/storage/vectordb/store/bytes_row.py b/openviking/storage/vectordb/store/bytes_row.pyindex cd9f2ad00..73011924e 100644--- a/openviking/storage/vectordb/store/bytes_row.py+++ b/openviking/storage/vectordb/store/bytes_row.py@@ -213,6 +213,10 @@ class _PyBytesRow:for item in value:bytes_item = item.encode("utf-8")bytes_item_len = len(bytes_item)+ if bytes_item_len > STRING_MAX_UINT16_LENGTH:+ raise ValueError(+ f"string element in list field '{field_meta.name}' exceeds 65535 bytes"+ )var_fmt_list.append("H")var_val_list.append(bytes_item_len)var_fmt_list.append(f"{bytes_item_len}s")diff --git a/tests/vectordb/test_bytes_row.py b/tests/vectordb/test_bytes_row.pyindex 394dcccae..8b197e2f1 100644--- a/tests/vectordb/test_bytes_row.py+++ b/tests/vectordb/test_bytes_row.py@@ -125,6 +125,22 @@ class TestBytesRow(unittest.TestCase):with self.assertRaisesRegex(ValueError, "text.*exceeds 65535 bytes"):py_row.serialize({"text": text})+ def test_oversized_list_string_element_serialization_raises(self):+ # A list<string> element uses the same UINT16 length prefix as a scalar+ # string, so it must reject >65535-byte elements with the same clean,+ # field-attributed ValueError — not a raw struct.error from deep inside+ # struct.pack_into.+ py_schema = _PySchema(+ [{"name": "tags", "data_type": _PyFieldType.list_string, "id": 0}]+ )+ py_row = _PyBytesRow(py_schema)+ with self.assertRaisesRegex(ValueError, "tags.*exceeds 65535 bytes"):+ py_row.serialize({"tags": ["x" * 65536, "ok"]})++ # A list of in-bounds strings (including multibyte) still round-trips.+ blob = py_row.serialize({"tags": ["hello", "世界"]})+ self.assertEqual(py_row.deserialize_field(blob, "tags"), ["hello", "世界"])+def test_binary_data(self):@serializable@dataclass