# HAC-24 Add Key Frontend Date: 2026-03-31 UTC Owner: Senior Frontend Engineer Issue: `HAC-24` Phase: `desktop-v1.1` candidate ## Context - `HAC-24` covers the frontend slice for Add Key only. - The checked-out repo now exposes the Add Key backend and Tauri bridge contract: - function: `create_value` - request fields: `connection`, `key`, `value`, `ttl_millis` - duplicate-key error code: `already_exists` - result payload: `record` - The frontend must not expand beyond string-only creation or add destructive follow-up actions. ## UI Decisions - Add a visible `Add key` entry in the key-browser header rather than burying the flow in the utility rail or inspector. - Keep the create surface in a dialog so active connection and DB remain visible while the form stays bounded. - Scope the form to: - key name - string value - optional TTL in milliseconds - On success, focus the browser on the created key name so the new record is immediately visible and inspectable without reconnecting. - Preserve typed form state on failure, including validation failure, duplicate-name failure, or an unexpected bridge regression. ## Implemented Frontend Slice 1. Added `apps/desktop/src/lib/add-key-draft.ts` plus focused tests for: - key-name validation - optional TTL parsing - duplicate-name detection for demo mode - demo key-record creation 2. Extended the shared notice layer with: - `already_exists` - `key_create` so create-path validation and duplicate failures stay on the same operator-notice surface as the rest of the shell. 3. Added an `Add key` dialog to `apps/desktop/src/App.tsx` that: - keeps connection and DB context visible - exposes string-only copy and optional TTL input - supports browser-demo creation with immediate browser/inspector refresh - targets the live command `create_redis_value` - preserves form state if a bridge error prevents create completion ## Verification - `pnpm --filter @redis-gui/desktop test` -> pass (8 files / 29 tests) - `pnpm run desktop:build` -> pass - `cargo test -p redis-core` -> pass (20 tests, including Add Key create and duplicate-path coverage) - `pnpm run desktop:tauri:build` -> pass (`.deb` and `.rpm` bundles emitted) ## Remaining Risk - This environment still cannot launch a visible Tauri window, so final GUI-level Add Key smoke evidence remains a QA follow-up rather than a blocker on the implemented frontend slice.