You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
false positive migrations detection dependent on encoding #647
a connection without decoded_responses=True (and maybe with different charset) will create false positive migrations, because of distinct types, i.e. bytes and str for stored_hash and current_hash respectively.
I guess that a default encoding schema for bytes responses would suffice, or a user warning.
m=Migrator()
# should migrateassertlen(m.migrations) ==0m.detect_migrations()
assertlen(m.migrations) >0# run, m.run()
# reset migrations because migrator does not m.migrations= []
# already migrated, should not have migrations after detectionm.detect_migrations()
assertlen(m.migrations) ==0# raises
(for true positive migration checks, you can easily verify that the above code does not raise, if you change to decode_responses=True, there will be no error. Remember of course to wipe out whatever was written into the db)
@ivanbelenky - it's pretty clear to me that redis om python seems to depend on the decode_resposnes flag being True. As we are trying to default it to true here
The hash digests produced by the indexes assume that the string it gets back from redis is decoded into UTF-8, and when it isn't, it doesn't compare correctly.
Do you need decode_resposnes set to False? If so, why?
In my particular case it comes to reutilizing Redis objects defined in django project-wide settings, this connections are set with decode_responses=False.
"Pretty clear" + "seems to be" ~ strikes me as an oxymoronic statement.
I am unsure about other parts of this project where dependance on this flag is critical. Can you provide an example and or guidance on how to find one?
if a strict dependence on decoded response exists, this should be enforced and/or warned appropriately. False positive migrations is happening undercover otherwise. Would you agree?
Activity
slorello89 commentedon Oct 30, 2024
Can you provide a reproduction of a case where a model in Redis displays a false positive change?
ivanbelenky commentedon Oct 31, 2024
Sure thing @slorello89, forgot about that
Having the following model, define a database with undecoded responses
and then just try to migrate that model
(for true positive migration checks, you can easily verify that the above code does not raise, if you change to
decode_responses=True, there will be no error. Remember of course to wipe out whatever was written into the db)ivanbelenky commentedon Nov 22, 2024
@slorello89 any update with regards to this?
slorello89 commentedon Nov 25, 2024
@ivanbelenky - it's pretty clear to me that redis om python seems to depend on the
decode_resposnesflag being True. As we are trying to default it to true hereThe hash digests produced by the indexes assume that the string it gets back from redis is decoded into UTF-8, and when it isn't, it doesn't compare correctly.
Do you need
decode_resposnesset toFalse? If so, why?ivanbelenky commentedon Dec 2, 2024
Thanks @slorello89 for your answer.
In my particular case it comes to reutilizing
Redisobjects defined indjangoproject-wide settings, this connections are set withdecode_responses=False."Pretty clear" + "seems to be" ~ strikes me as an oxymoronic statement.
ivanbelenky commentedon Apr 5, 2025
Ive seen more activity on the repo @slorello89 wondering if this is going to be merged.
@XChikuX
abrookins commentedon Apr 9, 2025
Closing after merging #664