orca icon indicating copy to clipboard operation
orca copied to clipboard

fix: pr-bug-scan validated finding from #2051

Open buf0-bot[bot] opened this issue 6 months ago • 0 comments

Automated fix-PR from pr-bug-scan for parent #2051.

Fixer status: FIXED_WITH_CODE_PROOF Summary: Eagerly add deep-link target to mountedSectionIds when setting pendingNavSectionRef so neededSectionIds recomputes to include it before the jump effect scrolls/flashes. Blocked proof link: src/renderer/src/components/settings/Settings.tsx:606-617 (neededSectionIds useMemo + mount effect): the cached Set now includes the pending target because mountedSectionIds is updated synchronously alongside pendingNavSectionRef.current at the two assignment sites (~line 363 and ~line 899), so isSectionMounted at Settings.tsx:1181-1183 returns true on the same render the jump effect fires. Typecheck: skipped

Proof (from validator)

  • C1 — proof_type: code_analysis
    • trigger: User clicks 'Open Computer Use' inside BrowserPane, invoking openComputerUseFromBrowser; or app dispatches a settingsNavigationTarget for a non-eager pane while search is empty.
    • observable: For ~1 frame the user sees the Computer Use card scrolled into view with the flash highlight animation but with an empty body; the pane content appears immediately after on the next paint.
    • path:
      • src/renderer/src/components/settings/Settings.tsx:925-936 openComputerUseFromBrowser sets pendingNavSectionRef.current='computer-use' and bumps pendingNavRequestTick
      • src/renderer/src/components/settings/Settings.tsx:606-617 neededSectionIds useMemo deps are [activeSectionId, mountedSectionIds, navSections, settingsSearchQuery, visibleSectionIds] — none change on the tick bump, so the cached Set without 'computer-use' is returned (pendingNavSectionRef is a ref, not a dep)
      • src/renderer/src/components/settings/Settings.tsx:619-631 the setMountedSectionIds effect doesn't add 'computer-use' because neededSectionIds is referentially the cached value
      • src/renderer/src/components/settings/Settings.tsx:782-793 the jump effect fires (its deps include pendingNavRequestTick), calls scrollSectionIntoView + flashSectionHighlight on the section whose body is still gated by isSectionMounted=false at Settings.tsx:1181-1183 ( rendered as null)
      • setActiveSectionId('computer-use') then triggers a follow-up render in which neededSectionIds recomputes (activeSectionId is now in deps) and includes 'computer-use', and ComputerUsePane finally mounts

Generated by pr-bug-scan (proof-machine architecture). Human approval required before merge.

buf0-bot[bot] avatar May 16 '26 19:05 buf0-bot[bot]