RI-8294 Add nearby-elements context band to the array Search tab#6119
RI-8294 Add nearby-elements context band to the array Search tab#6119VaskoAtanasovRedis wants to merge 5 commits into
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f6f9010597
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…I-8294] Adds an opt-in "Context" option in the Search Options section (off by default): expanding a match shows ±N neighbouring elements, fetched via the existing ARGETRANGE endpoint into local component state so the View tab's slice is left untouched. The matched row is highlighted and the count is adjustable. Neighbour index math uses BigInt, clamped at 0 and capped at ARRAY_INDEX_MAX, so no negative or out-of-range index is ever requested. References: #RI-8294
f6f9010 to
f87e54e
Compare
The "Reset to defaults" button only reset the query hook's state; the SearchTab-owned Context toggle/count were left untouched, so a reset could leave rows expandable at the previous count. Restore them to their defaults on reset too. Addresses Codex review (P2) on PR #6119. References: #RI-8294
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 123f1adc13
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Two review findings on PR #6119: - Cursor: toggling Context off left an already-expanded match still rendering the neighbour band (and firing its fetch). Gate renderExpandedRow on context.enabled so the band unmounts when Context is disabled. - Codex: the SearchTab-owned context state was not reset on a key switch (the tab stays mounted across keys), so a new key inherited the previous key's toggle/count. Reset it on a real key change, mirroring useArraySearchQuery. References: #RI-8294
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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 c88af84. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c88af84b2d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…[RI-8294] A neighbour ARGETRANGE fetch for a previous ±N count could settle before the effect's deferred abort cleanup runs and overwrite the band with the wrong window. Track the latest requested window and ignore any response that no longer matches it. Addresses Cursor review (Medium) on PR #6119. References: #RI-8294
A fractional context count (e.g. 1.5) reached getNeighbourRange, where BigInt() throws on non-integers and broke the Search tab on expand. Round the count at the input, and defensively coerce it to a non-negative integer in getNeighbourRange so no bad value can throw. Addresses Codex review (P2) on PR #6119. References: #RI-8294

What
Adds the Context option to the array Search tab (Slice 4 of the ARGREP search vertical, parent RI-8221). It's opt-in via a toggle in the Search Options section (off by default): once enabled, expanding a result row shows ±N neighbouring elements around the match, with the matched row highlighted and the count adjustable.
ARGETRANGEendpoint into local component state — the View tab's array slice is left untouched.ARRAY_INDEX_MAX, so no negative or out-of-range index is ever requested (u64-as-string contract).ArrayDetailsTablegains optional row-expansion passthrough; the View / Aggregate tabs are unchanged (no expansion props → no expand affordance).(i)hint.Testing
yarn test— 200 array-details / slice / util tests pass, including: clamp-at-0, BigInt-exact-past-2^53, thunk writes nothing to the slice, off-by-default ⇒ no expand and no fetch, and refetch-on-count-change.yarn lintclean;yarn type-checkadds zero new errors.dev-array) → Search → run a query → expand Options, tick Context → expand a match to see the ±N band (matched row highlighted); toggle Context off → rows are no longer expandable.Closes #RI-8294
Note
Medium Risk
Adds on-demand ARGETRANGE fetches and row expansion only on Search; neighbour loads are isolated from the View slice with abort/clamp safeguards, but wrong range math could still stress large windows (capped at ±50).
Overview
Adds an opt-in Context control to the array Search tab so users can expand a match row and see ±N neighbouring elements (matched row highlighted), without changing ARGREP itself.
Search form & state: New
Contexttoggle and count (capped at 50) live in Options, separate from searchoptionsso they never appear in the command preview. The options panel is reorganized (Range + Context on one row, divider, then NOCASE / WITHVALUES / LIMIT) with per-control InfoHint tooltips.SearchTabowns context state (off by default), resets it on form reset and key switch, and only enables row expansion when Context is on.Table & neighbour fetch:
ArrayDetailsTableoptionally forwards row-expansion props to the sharedTable; View/Aggregate tabs omit them. Expanding a row rendersNeighbourBand, which calls a newfetchArrayNeighboursthunk (ARGETRANGE) into local state only (View-tabdata.elementsuntouched), with abort + stale-response guards. Index windows use newgetNeighbourRange(BigInt, clamped at 0 and max u64).Reviewed by Cursor Bugbot for commit cddfbfc. Bugbot is set up for automated code reviews on this repo. Configure here.