SVS-VAMANA `compression` does not survive `IndexSchema.to_dict()`, breaking YAML round-trips and migration planning
Maintainer thường phản hồi trong vòng 5 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Bắt đầu trong redisvl/schema/fields.py tại CompressionType và BaseVectorFieldAttributes, sau đó đọc model_to_dict trong redisvl/utils/utils.py, đoạn này chuyển các giá trị enum thành chữ thường. Thêm tra cứu enum không phân biệt chữ hoa chữ thường, sau đó kiểm tra đường đi round-trip YAML trong IndexSchema.to_yaml()/from_yaml() và đường đi MigrationPlanner.merge_patch() được nêu trong issue. Hoàn tất nghĩa là mọi giá trị nén đều sống sót qua to_yaml() rồi from_yaml(), merge_patch() hoạt động với một trường vector đã nén hiện có, và đầu vào đúng chính xác chữ hoa chữ thường vẫn tạo ra giá trị chuẩn cho FT.CREATE.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
IndexSchema.to_dict() writes an SVS-VAMANA field's compression in lower case, but IndexSchema.from_dict() accepts only the exact-case value, so a schema with compression cannot be read back from its own output. to_yaml() followed by from_yaml() fails for every CompressionType, and MigrationPlanner.merge_patch() fails for any index that already uses compression, even when the patch does not touch the vector field.
Reproduction
Measured on main at 6a81e13b with Python 3.13.9:
from redisvl.schema import IndexSchema
schema = IndexSchema.from_dict({
"index": {"name": "a", "prefix": "a"},
"fields": [{
"name": "v",
"type": "vector",
"attrs": {"algorithm": "svs-vamana", "dims": 8, "compression": "LVQ8"},
}],
})
schema.to_dict()["fields"][0]["attrs"]["compression"] # 'lvq8'
schema.to_yaml("schema.yaml")
IndexSchema.from_yaml("schema.yaml")
# ValidationError: attrs.compression
# Input should be 'LVQ4', 'LVQ4x4', 'LVQ4x8', 'LVQ8', 'LeanVec4x8' or 'LeanVec8x8'
# [type=enum, input_value='lvq8', input_type=str]
All six values fail the same way: LVQ4, LVQ4x4, LVQ4x8, LVQ8, LeanVec4x8 and LeanVec8x8.
The migration planner hits the same error. Adding a numeric field to an index whose vector field uses LVQ8 raises it from MigrationPlanner().merge_patch(source_schema, patch), because merge_patch rebuilds the target schema with IndexSchema.from_dict(source_schema.to_dict()). AsyncMigrationPlanner calls the same merge_patch. Post-migration validation should fail the same way, since redisvl/migration/validation.py passes target_index.schema.to_dict() to canonicalize_schema, which calls IndexSchema.from_dict() on it; that follows from the code and has not been reproduced.
Cause
model_to_dict in redisvl/utils/utils.py serialises every enum as item.value.lower(). That is harmless for algorithm, datatype and distance_metric, because BaseVectorFieldAttributes.uppercase_strings in redisvl/schema/fields.py upper-cases them on input. compression has no such validator, and its values are mixed case, so the lower-cased output no longer matches any member.
Proposed fix
Make CompressionType accept its values case-insensitively, with a _missing_ classmethod that returns the member whose value matches ignoring case. Checked in isolation with pydantic 2.13: a model field typed with such an enum accepts "lvq8" and "LeanVec4x8" and still rejects unknown values. That keeps to_dict() output in the same lower-case convention as the other vector attributes, and it also loads YAML files that to_yaml() has already written in lower case, which a fix confined to the output side would leave unreadable. The case mapping in redisvl/migration/wizard.py, which exists to turn user input into the exact member value, can then be simplified.
Acceptance
IndexSchema.from_yaml()loads the output ofto_yaml()for everyCompressionType, with a regression test that fails before the fix.MigrationPlanner.merge_patch()succeeds for a source index that uses compression, with a regression test.- Explicit exact-case values such as
"LeanVec4x8"continue to work, and FT.CREATE still sends the canonical value.
- Ngôn ngữ chính
- Python
- Star
- 433
- Fork
- 120
- Merge trung bình
- 7 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 28
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của redis/redis-vl-python
-
RedisVL warnings are never shown when the application has not configured loggingCó thể đã có người làm @hippi345 đã nhận 9 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
redis/redis-vl-python#786 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
exists() depends on exact FT.INFO error wording; an unrecognised "missing index" message makes create() never create the index (regression from #672)Có thể đã có người làm @Yarmoluk đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
redis/redis-vl-python#773 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Vector field with index_missing=True cannot be createdCó thể đã có người làm @RaphaelFakhri đã nhận 19 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
redis/redis-vl-python#770 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
SearchIndex.drop_keys does not validate cluster hash-tag co-location (inconsistent with drop_documents)Có thể đã có người làm @Hashim1999164 đã nhận 18 ngày trước. Đang mởbug good first issue index
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
redis/redis-vl-python#601 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
redis/redis-vl-python#300 ·
Maintainer thường phản hồi trong vòng 5 ngày
Tất cả issue của redis/redis-vl-python
Issue tương tự
-
area/test type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Clodmony/starship-coop#70 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
punitarani/fli#270 ·
-
🐛 Bug 🔔 Pending processing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
jumpserver/jumpserver#17980 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
community enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Claiming namespace `prodmetrics`Đang mởnamespace
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
EclipseFdn/open-vsx.org#15341 ·
Maintainer thường phản hồi trong vòng 1 ngày