RI-8162: load sample vector set#5934
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
| } catch { | ||
| dispatch(addMessageNotification(loadSampleDatasetFailedNotification())) | ||
| } | ||
| } |
There was a problem hiding this comment.
Button not disabled during async preflight check
Medium Severity
The submitSampleDataset function performs an async checkVec2WordExists call before invoking loadSampleDataset. The button's disabled/loading state is driven by isLoadingSampleDataset, which only becomes true once loadSampleDataset starts executing. During the preflight checkVec2WordExists network call, the button remains fully clickable, allowing repeated clicks to spawn concurrent submissions that could both pass the existence check and trigger duplicate bulk imports. The analogous useCreateIndexFlow in vector-search avoids this by setting a local loading state at the very start of its async flow.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 98c5472. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a38f7ef. Configure here.
Add an optional `keyNameDisabled` prop on AddKeyCommonFields that ORs into the existing `loading` gate on the key-name TextInput, and hoist a matching `keyNameDisabled` state in the parent AddKey form so subforms can lock the input from the outside (used by the upcoming vector-set "Load sample dataset" flow).
New presentational component that renders the two-column "Preview + Info" panel for the bundled vec2word dataset (three example entries on the left, dataset metadata on the right). All data is hardcoded per the spec. Co-locates the `vec2word` collection-name constant, the already-loaded / failure toast factories, and a `checkVec2WordExists` helper that issues a single KEY_INFO request and returns whether the key is already present in the connected database. Component is not yet consumed; wiring lands in a follow-up commit.
Render the LoadSampleDataset panel in place of the manual element form when the user selects "Load sample dataset" mode, and branch the submit handler so it pre-flights with `checkVec2WordExists` then calls `useLoadData.load(_, 'vec2word')` instead of `addVectorSetKey`. On success: close the dialog. On existing key: surface the info toast. On failure: surface the danger toast. The component drives the parent-owned key-name input via the new `setKeyName` / `setKeyNameDisabled` callbacks — Sample mode populates 'vec2word' and locks the input, Manual / unmount-from-Sample clears + unlocks it.
Remove the `disabled: true` flag from the Sample populate-mode option so the user can actually select it. With the integration from the previous commit, clicking it now swaps the form to the LoadSampleDataset panel, auto-fills the key name, locks the input, and routes submit through the bulk-actions import endpoint.
…n checks The action creator is a plain slice reducer (not a thunk), so we don't need to mock the module to assert it was dispatched — `mockedStore` already records every dispatched action. Inspect the actions list for the expected `notifications/addMessageNotification` payload instead, removing one of the four jest.mock setups at the top of the spec. The three remaining mocks are kept: - `addVectorSetKey` (thunk — needs synthetic action so we can assert args) - `useLoadData` (hook — needs controllable resolve/reject) - `checkVec2WordExists` (helper — needs controllable resolve true/false)
The KEY_INFO pre-flight only verifies that a key with the target name exists — not that it holds the bundled sample dataset. The previous "Sample dataset already loaded" title overstated what we know. Use a generic "Key already exists" instead and rename the helper to match (`loadSampleDatasetAlreadyExistsNotification` → `keyAlreadyExistsNotification`).
a38f7ef to
b13f3c8
Compare
…ta load After a successful bulk-import of the vec2word dataset, dispatch `loadKeys()` so the Browser key list refreshes and the new key shows up immediately (matching how the default sample-data flow behaves on a blank database). Also dispatch a green success toast — "Sample dataset loaded" — so the user gets explicit confirmation rather than just the Add Key panel closing silently.
Title: "Sample dataset loaded" → "Sample vector set added"
Body: "The 'vec2word' vector set is ready to query."
→ "The 'vec2word' sample vector set has been successfully added."
Code Coverage - Frontend unit tests
Test suite run success6964 tests passing in 802 suites. Report generated by 🧪jest coverage report action from baf9448 |
`loadKeys` is a reducer that only flips `state.loading = true` — without
a paired `loadKeysSuccess` it leaves the Browser progress bar stuck on.
Switch to `addKeyIntoList({ key, keyType: KeyTypes.VectorSet })`, the
same primitive `addTypedKey` uses for every manual key creation. It's
filter/search/view-aware, prepends the new key into the in-memory list
synchronously, and never triggers a fetch — no spinner, instant.


What
vec2word, and locks it.useLoadDatahook hitsPOST /bulk-actions/import/vector-collectionwith{ collectionName: "vec2word" }— same path bikes/movies use. Pre-flights with aKEY_INFOcheck so an already-loadedvec2wordshows an info toast instead of re-running VADD.keyNameDisabledprop onAddKeyCommonFieldsso subforms can lock the parent-owned key-name input from the outside.Testing
vec2word, input locks, preview + info panel renders.vec2wordvector set; inredis-cli,VCARD vec2word→100,VEMB vec2word king→ 300 floats.Note
Medium Risk
Adds a new sample-dataset creation path that triggers bulk import API calls and modifies Add Key form state, which could affect key creation UX and list refresh behavior if edge cases or API errors occur.
Overview
Enables a new "Load sample dataset" mode when creating a
Vector Setkey, swapping the manual element-entry form for a preview/info panel and auto-setting the key name to the fixedvec2wordvalue.Submitting in sample mode now preflights for an existing
vec2wordkey, runs the bulk import viauseLoadData, splices the created key into the browser key list, and shows success/info/error toasts; manual mode continues to dispatchaddVectorSetKey.Adds a
keyNameDisabledcapability toAddKeyCommonFieldsso subforms (Vector Set sample mode) can lock the shared key-name input, plus related styling and expanded test coverage for the new flows.Reviewed by Cursor Bugbot for commit baf9448. Bugbot is set up for automated code reviews on this repo. Configure here.