Repository navigation
feat(redis): keys as tables — lists, sets, sorted sets, streams and JSON documents - #552
Merged
Merged
Conversation
# Conflicts: # apps/e2e/scripts/run-all.mjs # apps/web/src/frontend/features/sql-editor/components/ResultsPanel.tsx
…rule From the simplify review of this branch: - Keyspace reader: the four collection types are one table (columns, length, chunks, indexed), so a new type is one entry. Reads are sized to the page (LRANGE/XRANGE no longer fetch 500 to show 20), sampling reads every prefix's keys together with the types already known (one TYPE per key), and the prefix SELECT reads a SCAN batch at once through takePage, which also bounds a WHERE that matches nothing at MAX_SCAN keys. - readKey returns the key's type, so UPDATE asks TYPE once. - needsSessionPassword: the one copy of "ask for a password first", replacing 12 hand-written copies (and a test that mirrored a stale one). - isSubsetDialect derives from the registry (a known engine with no SQL dialect) instead of a hand-kept list; the subset parser reuses splitTopLevel and splitTop instead of two more scanners. - Force-migrate refuses a target without SQL DDL: a Redis target reached resolveDialect, which answers Db2. - The explorer decides "can create a table" itself and hides all three create entry points and the blueprint for Redis, not just the header. - e2e: helpers/redis.ts seeds through one redis-cli --pipe per database; redis-browse folded into redis-editor; openDataPeek can wait for rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… time Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: b675247b-b927-43be-b009-7a1384114700) |
Contributor
Test IDsAdded (4)
|
| import { useSqlEditorStore } from '@/features/sql-editor/state'; | ||
| import { useAuthStore } from '@/platform/authStore'; | ||
| import { PROVIDER_SETTINGS, connectionNeedsSecret } from '@/shared/lib/provider-settings'; | ||
| import { PROVIDER_SETTINGS, needsSessionPassword } from '@/shared/lib/provider-settings'; |
| import { useSyncStore } from '@/features/compare'; | ||
| import { useSqlEditorStore } from '@/features/sql-editor/state'; | ||
| import { PROVIDER_SETTINGS, connectionNeedsSecret } from '@/shared/lib/provider-settings'; | ||
| import { PROVIDER_SETTINGS, needsSessionPassword } from '@/shared/lib/provider-settings'; |
| import { useAuthStore } from '@/platform/authStore'; | ||
| import type { IndexInfo, TableSchema } from '@/shared/lib/types'; | ||
| import { PROVIDER_SETTINGS, connectionNeedsSecret } from '@/shared/lib/provider-settings'; | ||
| import { PROVIDER_SETTINGS, needsSessionPassword } from '@/shared/lib/provider-settings'; |
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.
What this adds
Redis in the SQL editor reads like the rest of the app.
usersforusers:*) is a table, and a list, set, sorted set or stream key is a table of its own. Each comes with a type badge. The listing is from a bounded SCAN sample and says when it is partial.{ id, type }.SELECT * FROM (…) LIMIT …, which the Redis translator refused with "Unsupported clause". The page now goes onto the statement itself (pageSubsetSelect). The same fix applies to MongoDB.needsSessionPassword.Simplify and review pass (2026-10-25)
Four reviewers looked at reuse, simplification, efficiency and altitude.
splitTopLevel/splitTop.isSubsetDialectis derived from the registry instead of a hand-kept list.helpers/redis.tsseeds through oneredis-cli --pipeper database.redis-browseis folded intoredis-editor.openDataPeekcan wait for rows on a read-only peek.Tests
redis.it.test.tspasses 19/19 against the dev container (node-redis 6.3.0).redis-editor.test.tspasses 21/21. It covers basic SQL, every built-in sample, Compare data with Data migrate, the schema explorer, and Data peek with the row editor.eslint .and the security lint are clean. Unit suite: 6517 pass. The 2 failures are the known timing flakes (code-cell-execute,migration-filelinear time); neither file is touched here.Not in this PR
requirepass, saved without its password, is not prompted. The rule keys on the username, so that password stays saved on the connection. An explicit "No password" sign-in choice is on the board.🤖 Generated with Claude Code
Note
Medium Risk
Touches SQL execution, connection auth gating, and a large Redis adapter/keyspace surface; behavior changes for Mongo paging and password prompts, but guarded by extensive unit/integration/e2e tests.
Overview
Redis (and MongoDB subset paging) in the SQL editor — keyspaces appear in the schema explorer with store-type badges; lists, sets, sorted sets, streams, and JSON documents render as queryable rows, not stub
{ id, type }rows. A new Redis schema provider andredis.keyspacelayer power browsing and SQL execution; hash-only writes stay enforced with explicit errors for collections and JSON.Paging and errors — subset dialects no longer use a nested
SELECT * FROM (…) AS fox_page; the server appendsLIMIT/OFFSETviapageSubsetSelect, and Redis/Mongo statement failures surface without a misleading “Paging failed” wrapper. MongoDB OFFSET paging and emptylimit(0)pages are fixed similarly.Auth UX —
needsSessionPasswordcentralizes when the UI must prompt (passwordless Redis/Mongo when no username; Redis with ACL user still needs a secret). Compare retest gates and editor destination selection use this helper.Explorer / DDL guardrails — New table / blueprint actions hide for engines without SQL DDL (Redis, MongoDB). Subset explorers insert bare table names and column refs without aliases.
History & migrate — Schema capture, force-migrate, and related routes refuse Redis/Mongo before loading a sampled keyspace as a version or emitting wrong DDL.
E2E —
redis-editor.test.ts(dockerredis-clihelper) exercises SQL, samples, compare/migrate, explorer, and data peek; test IDs on grid/run/result errors support assertions.Parser hardening — SQL subset gains quoted dotted table names, parenthesized WHERE (Data peek), stricter predicate/column rules, and semicolon-safe
autoAliasSelectColumns.Reviewed by Cursor Bugbot for commit 90416f7. Bugbot is set up for automated code reviews on this repo. Configure here.