Skip to content

perf(search): replace repeated result scans with indexed lookups - #1477

Draft
seonghobae wants to merge 13 commits into
bolt-optimize-search-layout-477240424295171920from
bolt-optimize-search-lookup-4875512306210218644
Draft

perf(search): replace repeated result scans with indexed lookups#1477
seonghobae wants to merge 13 commits into
bolt-optimize-search-layout-477240424295171920from
bolt-optimize-search-lookup-4875512306210218644

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Current authority

  • Parent lane: Draft perf(search): memoize active-result lookup #1504 bolt-optimize-search-layout-477240424295171920@9191ea02b69c08a1b12af36e4a825d5c5869b8e3
  • Exact head: d3687248894a1427f6614c186a963849ba7ac215
  • Ancestry from parent: ahead-only / behind 0, merge base = exact perf(search): memoize active-result lookup #1504 head
  • Effective child delta: exactly frontend/src/components/SearchLayout.tsx and frontend/src/components/SearchLayout.test.tsx
  • Lifecycle: Draft / mergeable / repository-owned exact-head workflow runs absent / independent approval absent

Scope

This child replaces the parent lane's memoized activeResult linear lookup and the telemetry findIndex with one useMemo-built id index. Building the index remains O(N) whenever filteredResults changes; subsequent lookups are expected-amortized O(1). No end-to-end or p95 latency improvement is claimed without current-head measurement.

The direct-develop parallel SearchLayout writer was already converted into the explicit #1504#1477 stack by ordinary two-parent commit 61fbe0fff26965c42661eb9d0bf7da7786ed0682; the parent regression remains inherited. The prior branch-local .jules/bolt.md delta is not part of the effective child scope.

Duplicate-id semantic repair

Fresh review revalidated the remaining finding: the indexed implementation used unconditional map.set(result.id, ...), making duplicate ids last-wins, whereas the replaced find/findIndex path was first-wins. That could change both the selected result and the telemetry rank.

  • RED 5966982f93fc72fecbd6e5b51767e5ecfb5ced67 adds a component regression with two different search records sharing id 303; the contract requires the first record to remain the authoritative detail and its opened event to retain top_1 rank.
  • A focused pre-fix algorithm harness against the preceding unconditional Map.set behavior reproduced the defect: the second record survived at index 1.
  • Causal fix d3687248894a1427f6614c186a963849ba7ac215 inserts only when the id is not already present, preserving the former first-match semantics for both active-result selection and rank lookup.
  • The same focused algorithm harness after the fix retains the first record at index 0.

The harness is narrow algorithm evidence, not execution of the Vitest component regression, browser/E2E, p95, whole frontend suite, coverage, or hosted GREEN. The Devin duplicate-id thread is resolved on this exact head after the source/test repair was re-read.

Evidence and owner path

Fresh repository-owned pull-request workflow lookup for exact head d3687248894a1427f6614c186a963849ba7ac215 returns 0 runs. This is a known stacked-base control-plane defect, not a reason to copy CI changes into this product branch: canonical Naruon owner PR #1562 codex/stacked-pr-workflow-triggers@bc91b36dec70c14e0cde526e2330638f5e0ce352 owns Application CI/Bandit/image activation for non-default PR bases and remains Draft behind prerequisite #1531. This PR must consume that protected-integrated owner repair rather than duplicate it or manufacture a no-op requeue commit.

Formal review inventory contains no qualifying independent post-last-push APPROVED review. Predecessor checks/reviews do not transfer to this head.

Keep Draft until this unchanged exact head has every then-live repository/organization required check terminal-success after the canonical stacked-base fix is integrated, zero valid unresolved current-head findings/threads, and the qualifying independent approval required by live governance. No self-approval, force-push, destructive rebase, dummy/no-op requeue, predecessor-evidence transfer, unsupported p95 claim, or gate weakening.

@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment thread frontend/src/components/SearchLayout.tsx
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

PR governance metadata gate is not ready for 6eeb27a29041a9dd8624b621e2cb8bd38884fb65:

  • 1 unresolved current review thread(s) remain.
  • Required check strix is FAILURE on the current head.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 92345c87-97f9-44cc-b866-badfd83d9152

📥 Commits

Reviewing files that changed from the base of the PR and between f3beb1c and 280b666.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • frontend/src/components/SearchLayout.tsx

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Important

Approval pending

CodeRabbit has no unresolved comments, but it has not reviewed the latest commit.

Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

SearchLayout now builds a memoized map for filtered search results. Active-result and result-index lookups use the map instead of repeated array scans. The project guidance documents this lookup pattern.

Changes

Search result lookup optimization

Layer / File(s) Summary
Build and use memoized result lookups
frontend/src/components/SearchLayout.tsx, .jules/bolt.md
SearchLayout builds a Map containing each result and its index. Active-result and opened-result lookups use the map. The effect dependency uses resultById. Guidance documents the pattern.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 280b6

The change replaces repeated result searches with a memoized ID lookup while preserving selection and ranking behavior. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: replacing repeated result scans with indexed lookups in search performance code.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt-optimize-search-lookup-4875512306210218644

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 27, 2026
@seonghobae

Copy link
Copy Markdown
Contributor Author

현재 head 2f6e83d719702144223ab7999882982b9cb88690은 최신 develop@042b0c70531b229af3acbd0421a2f23098d848b3을 비강제 merge해 기존 SearchLayout 최적화 delta를 보존했습니다. 이전 Strix 실패는 코드 finding이 아니라 STRIX_PROVIDER_UNAVAILABLE였으며 실패 job 재실행을 요청했습니다. restack 뒤 vitest run src/components/SearchLayout.test.tsx, 대상 ESLint, tsc --noEmit, diff 검사가 통과했습니다. 새 head Checks와 현재-head 리뷰는 별도 보호 증거로 다시 확인해야 합니다.

@google-labs-jules

Copy link
Copy Markdown
Contributor

현재 head 2f6e83d719702144223ab7999882982b9cb88690은 최신 develop@042b0c70531b229af3acbd0421a2f23098d848b3을 비강제 merge해 기존 SearchLayout 최적화 delta를 보존했습니다. 이전 Strix 실패는 코드 finding이 아니라 STRIX_PROVIDER_UNAVAILABLE였으며 실패 job 재실행을 요청했습니다. restack 뒤 vitest run src/components/SearchLayout.test.tsx, 대상 ESLint, tsc --noEmit, diff 검사가 통과했습니다. 새 head Checks와 현재-head 리뷰는 별도 보호 증거로 다시 확인해야 합니다.

확인했습니다. develop 브랜치의 최신 커밋을 반영한 상태에서 SearchLayout 최적화 코드가 유지된 것을 확인했으며, 알려주신 테스트(vitest, eslint, tsc --noEmit)가 통과했다는 점도 확인했습니다. 이전 Strix 실패가 인프라/API 일시적 오류(STRIX_PROVIDER_UNAVAILABLE)였으므로, 잡이 재실행되어 정상 통과하는지 모니터링하겠습니다.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Current-head repair: 2a03de1635be7dbfb6331a0ffe1973459c1f025f absorbs the acknowledgement ancestry without force-push while retaining the attachment security fix already present on develop. Effective delta remains 2 files / 17 additions / 3 deletions. Frontend: 51 files, 437 tests passed; TypeScript and diff checks passed.

@google-labs-jules

Copy link
Copy Markdown
Contributor

Current-head repair: 2a03de1635be7dbfb6331a0ffe1973459c1f025f absorbs the acknowledgement ancestry without force-push while retaining the attachment security fix already present on develop. Effective delta remains 2 files / 17 additions / 3 deletions. Frontend: 51 files, 437 tests passed; TypeScript and diff checks passed.

확인했습니다. current-head repair 과정에서 최신 보안 픽스들이 잘 유지되었고, 성능 최적화(SearchLayout O(N) 개선) delta도 그대로 보존된 것을 확인했습니다. 테스트(프론트엔드 테스트, TypeScript, diff 체크)가 모두 성공적으로 완료되었으므로 작업 내용은 완료된 상태로 판단됩니다. 감사합니다.

@seonghobae
seonghobae marked this pull request as draft September 5, 2026 20:44
@seonghobae
seonghobae changed the base branch from develop to bolt-optimize-search-layout-477240424295171920 September 5, 2026 20:46
@seonghobae seonghobae changed the title ⚡ Bolt: [성능 개선] SearchLayout O(N) 탐색 병목 현상 제거 perf(search): replace repeated result scans with indexed lookups Sep 5, 2026
@seonghobae seonghobae added type: maintenance Maintenance, build, dependency, or operational upkeep maintenance labels Sep 7, 2026 — with ChatGPT Codex Connector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance priority: medium Normal-priority or P2 work status: draft Draft pull request type: maintenance Maintenance, build, dependency, or operational upkeep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant