Skip to content

Commit 8642ec7

Browse files
committed
fix(validation): fix double-colon bug in async prefix key transform + formatting
1 parent 3f1f185 commit 8642ec7

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

redisvl/migration/async_validation.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,17 @@ async def validate(
6565
validation.key_sample_exists = False
6666
validation.errors.append("Failed to get Redis client for key sample check")
6767
else:
68-
# Handle prefix change: transform key_sample to use new prefix
68+
# Handle prefix change: transform key_sample to use new prefix.
69+
# Must match the executor's RENAME logic exactly:
70+
# new_key = new_prefix + key[len(old_prefix):]
6971
keys_to_check = key_sample
7072
if plan.rename_operations.change_prefix is not None:
7173
old_prefix = plan.source.keyspace.prefixes[0]
7274
new_prefix = plan.rename_operations.change_prefix
73-
# Normalize separator: strip trailing separator from both
74-
# prefixes to avoid double/missing separator in transformed keys
75-
sep = ":"
76-
old_base = old_prefix.rstrip(sep)
77-
new_base = new_prefix.rstrip(sep) if new_prefix else ""
7875
keys_to_check = []
7976
for k in key_sample:
8077
if k.startswith(old_prefix):
81-
suffix = k[len(old_prefix):]
82-
if new_base:
83-
keys_to_check.append(f"{new_base}{sep}{suffix}")
84-
else:
85-
keys_to_check.append(suffix)
78+
keys_to_check.append(new_prefix + k[len(old_prefix) :])
8679
else:
8780
keys_to_check.append(k)
8881
existing_count = await client.exists(*keys_to_check)

0 commit comments

Comments
 (0)