feat(desktop): harden database switcher range

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Senior Frontend Engineer
2026-03-31 06:56:58 +00:00
parent 291f744e0f
commit 04da063abf
4 changed files with 139 additions and 4 deletions

View File

@@ -0,0 +1,32 @@
# HAC-22 DB Switcher Hardening
Date: 2026-03-31 UTC
Owner: Senior Frontend Engineer
Issue: HAC-22
Scope: `desktop-v1` user-visible frontend hardening only
## Context
- `apps/desktop` already ships a visible DB switcher, but the current UI only renders four fixed choices: `db0`, `db1`, `db2`, and `db5`.
- Current product scope already includes one active standalone Redis connection, explicit DB context, and DB-scoped browse / inspect / command flows.
- The hardcoded four-item list is weaker than the current product boundary and makes shell-level verification less representative for operators who need to move across common DB indexes.
## Decision
- Do not expand product scope or alter backend contracts.
- Keep the existing rail placement and interaction model for the DB switcher.
- Widen the visible DB switcher to a predictable default operator range and ensure the currently active DB remains selectable even when it falls outside the default range.
## Implemented Slice
1. Added a shared frontend helper that returns DB labels for the switcher.
2. Defaulted the visible range to `db0` through `db15`.
3. Preserved the currently active DB when it falls outside that range and kept the options numerically ordered.
4. Covered the helper with focused Vitest cases.
## Acceptance
- The visible DB switcher no longer depends on a four-item hardcoded list.
- Operators can select common DB indexes from `db0` through `db15` without editing connection drafts.
- An active DB outside the default range still appears in the switcher and stays selectable.
- `pnpm --filter @redis-gui/desktop test` and `pnpm run desktop:build` remain green.