Skip to content

fix(redis): read a key from the key browser even when its name ends in :* - #1946

Merged
cevheri merged 1 commit into
mainfrom
fix/redis-key-ending-in-prefix-glob
Oct 24, 2026
Merged

cevheri merged 1 commit into
mainfrom
fix/redis-key-ending-in-prefix-glob

Conversation

@cevheri

@cevheri cevheri commented Oct 24, 2026

Copy link
Copy Markdown
Member

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 (prefixGroup in src/lib/query-generators.ts). A real string key named cache:*, which a Redis key name may be, therefore generated SCAN 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: onOpenKey passes it through handleTableClick as GeneratorScope.namesKey. So cache:* opens on GET cache:* (or HGETALL, LRANGE and so on by type), while the schema tree's cache:* 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:*:b and cache:x, and diffed the other engines' generated statements against main.

…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

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sonarqubecloud

Copy link
Copy Markdown

@cevheri
cevheri merged commit 1d5f63b into main Oct 24, 2026
39 checks passed
@cevheri
cevheri deleted the fix/redis-key-ending-in-prefix-glob branch October 24, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant