Repository navigation
fix(redis): read a key from the key browser even when its name ends in :* - #1946
Merged
Merged
Conversation
…n :* The Redis generator treats every name ending in ":*" as a prefix group, so a real key named "cache:*" opened from the key browser ran "SCAN 0 MATCH cache:* COUNT 50" instead of reading the key. The key browser now says the path names a key, through handleTableClick and GeneratorScope.namesKey, so "cache:*" opens on "GET cache:*" while the tree's "cache:*" row still scans. The tab's origin records the mark, and tab reuse compares it, only where it changes the generated statement. Every other key reads the same with or without it, so the tree and the key browser keep sharing one tab for it, as do tabs saved before the mark existed.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



A Redis key whose name ends in
:*was scanned instead of read when opened from the key browser.The Redis generator treats every name ending in
:*as a prefix group (prefixGroupinsrc/lib/query-generators.ts). A real string key namedcache:*, which a Redis key name may be, therefore generatedSCAN 0 MATCH cache:* COUNT 50. Its tab listed other keys instead of reading this one.The key browser now says the path names a key:
onOpenKeypasses it throughhandleTableClickasGeneratorScope.namesKey. Socache:*opens onGET cache:*(orHGETALL,LRANGEand so on by type), while the schema tree'scache:*group row still scans. Only the Redis arm reads the flag. Generated statements for 42 other engine types are unchanged.The tab's origin records the mark, and tab reuse compares it, only where the mark changes the generated statement. Every other key reads the same either way, so the tree and the key browser keep sharing one tab for it, as do tabs saved before this change.
Tests were written first and failed on main. They cover the generator, the tab manager (including tree, key browser, tree on a plain key giving one tab) and the Studio wiring. docs/providers/redis.md says how the key browser opens a key. The full suite passes at 100% line coverage. An independent check probed every Redis type for
cache:*,*,a:*:bandcache:x, and diffed the other engines' generated statements against main.