SVS-VAMANA `compression` does not survive `IndexSchema.to_dict()`, breaking YAML round-trips and migration planning
メンテナーはふだん 5 日以内に返信
評価
調査の方向性
redisvl/schema/fields.py の CompressionType と BaseVectorFieldAttributes から始め、次に redisvl/utils/utils.py の model_to_dict を読んでください。これは enum 値を小文字に変換します。大文字と小文字を区別しない enum 検索を追加し、次に IndexSchema.to_yaml()/from_yaml() の YAML ラウンドトリップ経路と、issue で示されている MigrationPlanner.merge_patch() 経路を確認してください。完了条件は、すべての圧縮値が to_yaml() の後に from_yaml() を通過し、merge_patch() が既存の圧縮ベクトルフィールドで動作し、正確な大文字と小文字の入力が FT.CREATE の正規値を引き続き生成することです。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 432
- フォーク
- 116
- 平均マージ
- 8日 1時間
- マージ済み PR(30日)
- 29
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
redis/redis-vl-python のほかの issue
-
RedisVL warnings are never shown when the application has not configured logging対応中かも @hippi345 が 8 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
redis/redis-vl-python#786 ·
メンテナーはふだん 5 日以内に返信
-
exists() depends on exact FT.INFO error wording; an unrecognised "missing index" message makes create() never create the index (regression from #672)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
redis/redis-vl-python#773 · コメント 1 件 ·
メンテナーはふだん 5 日以内に返信
-
Vector field with index_missing=True cannot be created対応中かも @RaphaelFakhri が 18 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
redis/redis-vl-python#770 ·
メンテナーはふだん 5 日以内に返信
-
SearchIndex.drop_keys does not validate cluster hash-tag co-location (inconsistent with drop_documents)対応中かも @Hashim1999164 が 17 日前に担当しました。 オープンbug good first issue index
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
redis/redis-vl-python#601 ·
メンテナーはふだん 5 日以内に返信
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
redis/redis-vl-python#300 ·
メンテナーはふだん 5 日以内に返信
redis/redis-vl-python の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
area:docs documentation effort:M ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
mczielinski/ob-analytics#423 ·
メンテナーはふだん 1 日以内に返信
-
infra
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
vllm-project/vllm-ascend#21033 ·
メンテナーはふだん 1 日以内に返信