Repository navigation
perf: preserve matching General settings sections during search - #23177
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughGeneralPane now uses SettingsSectionStack to render visible settings sections with stable keys. Added tests cover section retention during search edits, explicit refresh, hide and reopen behavior, autosave drafts, release-picker visibility, and pending version results. Added an experimental reliability gate with test evidence and promotion criteria. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Matching General settings sections retain their state during search changes, while genuinely hidden sections refresh when reopened. No merge-blocking issue is established. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The settings search now keeps matching sections open instead of resetting them. Existing controls for saving settings and choosing updates remain in place, and no new security issue was established. Review coverage is incomplete, so the risk is assessed as low rather than minimal. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Stable wrapper keys in
GeneralPane— the visible-sections list now keys each wrapper bysection.keyinstead of positionalindex, so a section that remains matched keeps its component identity and local state when an earlier result disappears. - Type-narrowing filter —
.filter(Boolean)became.filter((section) => section !== null)so the array narrows enough to readsection.key; the TS 7 inferred type predicate covers this. GeneralPane.section-lifetime.test.tsx— a new happy-dom component test that mounts the realGeneralPanewith@/storeand the updater API mocked, pinning read counts, explicit refresh, draft retention, release-picker lifetime, and unmounted-section result exclusion.- Reliability gate —
settings.general-section-lifetimeregistered as experimental / partial protection, scoped to macOS.
I independently reproduced the red/green split: reverting only key={section.key} to key={index} fails 4 of the 6 cases, matching the PR's claim, and the gate manifest checker plus oxlint pass on the changed files.
ℹ️ Same positional-key remount pattern still exists in sibling settings panes
This PR correctly fixes GeneralPane, but three sibling panes render search-filtered section lists with the identical key={index} + .filter(Boolean) shape, so they retain the same latent remount-on-filter behavior this PR is fixing. Flagging only as a follow-up scope question — no change requested here.
Technical details
# Sibling panes with positional section keys
## Affected sites
- `src/renderer/src/components/settings/TerminalPane.tsx:290` — `visibleSections.map((section, index) => <div key={index} …>)`, sections already carry keys (`windows-shell`, `rendering`, `pane-interaction`).
- `src/renderer/src/components/settings/AccountsPane.tsx:388` — same `key={index}` wrapper over render-function sections (several without their own key).
- `src/renderer/src/components/settings/RepositoryPane.tsx:419` — same pattern.
## Required outcome
None for this PR. If the same section-lifetime guarantee is wanted there, each wrapper needs a stable per-section key and a narrowing filter.
## Open questions for the human
- Is `GeneralPane` intentionally first, or should the sibling panes be tracked for the same fix?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Since the prior pullfrog review (2c486e4b07), the only new commit (c31bd34bb1) refactors how General builds its section list:
- Extracted
SettingsSectionStack— the keyed wrapper loop (stablekey={section.key}, leadingSeparator,space-y-6/space-y-8) moved into a new shared component so other settings panes can adopt the same section-lifetime guarantee. - Routed
GeneralPanethrough it — the section array is now passed raw asReactElement | nulland the null filter moved inside the component;hasPrecedingSectionsusesvisibleSections.some((section) => section !== null). - Updated the section-lifetime test — the retained-section oracle now asserts DOM-node identity plus non-growing version/refresh counts instead of absolute counts, and a new case pins store-published remote update state reaching a retained section.
- Refreshed the gate manifest —
settings.general-section-lifetimeoracle/evidence/knownGaps updated; still 127 gates.
I re-ran the focused suite (7 pass), the gate manifest check (127 gates), and check:code-quality:changed (0 findings across all six scans, design system included).
ℹ️ Shared stack extracted for reuse, but only General consumes it
The new component is the intended home for the stable-key fix, yet TerminalPane, AccountsPane, and RepositoryPane still keep their own key={index} wrapper loops — notably RepositoryPane's space-y-8 matches the currently unexercised spacing="group" variant. Is migrating those panes the planned follow-up, or is the shared extraction scoped to General for now?
Technical details
# Shared SettingsSectionStack adoption
## Affected sites
- `src/renderer/src/components/settings/TerminalPane.tsx:290` — `visibleSections.map((section, index) => <div key={index} …>)` with `space-y-6`.
- `src/renderer/src/components/settings/AccountsPane.tsx:388` — same `key={index}` wrapper.
- `src/renderer/src/components/settings/RepositoryPane.tsx:419` — same pattern with `space-y-8`, i.e. the `spacing="group"` case.
## Required outcome
None for this PR. Confirm whether the sibling panes are the intended consumers of `SettingsSectionStack`; if so, verify every section element there carries its own key before switching away from positional keys.
## Open questions for the human
- Is the shared extraction deliberately General-only for now, with sibling adoption tracked separately?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…tionStack Replaces the pane-local index-keyed wrapper with the shared SettingsSectionStack so the search-stable identity rule lives in one place, and restates the read-count oracles as node identity plus non-growing read counts. Adds coverage that store-published remote update state still reaches a section that no longer remounts.
c31bd34 to
cf35c91
Compare

ELI5
Searching General settings keeps each section open while it still matches, so typing no longer repeatedly reloads Updates or resets its local controls.
What Changed
Outer section wrappers now use the stable keys their sections already have. Previously, filtering an earlier result changed later wrapper positions and remounted the contents.
Counts come from actual GeneralPane and update components with synthetic store/API boundaries. They measure renderer request admissions, not backend network savings or packaged responsiveness.
Why
Preserving component identity removes repeated mount work without adding a cache or timer. Refreshing on every matching search would retain the waste. This deliberately changes state lifetime, so it is a separate trade-off PR.
Linked Issue
Fixes #23176
Visual Proof
Actual GeneralPane and autosave controls, canonical CSS, synthetic settings, hidden Electron on macOS. Other sections are inert in this visual fixture. The query changes programmatically while the draft remains uncommitted; ordinary clicking search would normally blur and commit first. This demonstrates section lifetime, not ordinary mouse-search draft loss.
Before query change:
After matching query:
After actually hiding and reopening the section:
Testing
ORCA_BACKGROUND_LAUNCH=1 pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/settings/GeneralPane.section-lifetime.test.tsx: 6 pass; original source 4 fail / 2 controls pass. Author related coverage: 62 tests / 12 suites. Independent permanent rerun: 6 pass; three additional pending-version, error-context and live-store cases pass versus original 2 fail / 1 control. Web typecheck, scoped lint/format, changed-code quality across 183 files and reliability-manifest validation pass.Tests ran on macOS with Windows runtime flags simulated. Native Linux/Windows, live paired hosts and physical update/install behavior are not tested. Full lint/build and broader platform coverage remain to CI.
AI Disclosure
Review
Independent review approved the frozen two-file change. Merge risk is low to moderate: the production diff is small, but retained section state changes user behavior.
Reliability invariant
settings.general-section-lifetime: matching sections retain their owner/state; real removal releases it and reloads on return. New experimental gate checks read counts, explicit refresh, draft override by saved settings and late-version exclusion. CI soak and physical provider evidence remain gaps. Test failures identify the affected read count or lifetime assertion.Agent skill upstream boundary
Notes
Negative user-facing trade-off: matching search no longer incidentally refreshes app version, remote update status or CLI discovery. Existing explicit checks, external store updates and genuine hide/reopen remain; no bounded automatic freshness deadline is added. Drafts, release-picker reveal, pending saves and error context persist until their own transition or an actual hide.
No new settings write, polling, subprocess, cache, Git command, host routing or wire field. Local/daemon PTY and mobile execution are unaffected; SSH/WSL/remote-runtime execution ownership remains unchanged. No CPU, heap or whole-app latency claim.
Checklist