fix: replace accumulate-everything picker with page-based picker#243
Draft
bukinoshita wants to merge 2 commits intomainfrom
Draft
fix: replace accumulate-everything picker with page-based picker#243bukinoshita wants to merge 2 commits intomainfrom
bukinoshita wants to merge 2 commits intomainfrom
Conversation
Replace the unbounded allFetched accumulation pattern in pickId() with a page-based approach that only keeps the current page in memory. Key changes: - Replace 'Fetch more...' with 'Next page' / 'Previous page' navigation - Remove auto-fetch loop for filtered pickers with empty results - Only current page items are rendered as options (no unbounded growth) - Cursor history is tracked for page navigation without re-scanning - Filtered pickers show an info message instead of silently draining This prevents large accounts from experiencing hangs, high memory usage, and excessive API calls when using interactive pickers. Fixes: BU-617 Co-authored-by: Bu Kinoshita <bukinoshita@users.noreply.github.com>
Member
Author
|
@cubic-dev-ai can you review? |
Contributor
@bukinoshita I have started the AI code review. It will take a few minutes to complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the interactive picker hanging on large accounts by replacing the unbounded accumulate-everything pattern in
pickId()with a page-based approach.Problem
The
pickId()helper insrc/lib/prompts.tsaccumulated every fetched page into anallFetchedarray and:filteryielded zero matches (e.g.,broadcasts sendfiltering for drafts)Solution
Refactored
pickId()into a page-based picker that:allFetchedaccumulation)Next page →/← Previous pagenavigation instead ofFetch more...appendingChanges
src/lib/prompts.ts: Replaced the accumulate-and-refilter loop with a recursivefetchPagefunction that only processes one page at a timetests/lib/pick-id.test.ts: Added 11 comprehensive tests covering page selection, forward/backward navigation, filter behavior, cursor passing, and edge casesVerification
PickerConfigtype — all existing picker configs work unchangedLinear Issue: BU-617
Summary by cubic
Replaces the interactive ID picker with a page-based UI to prevent hangs on large accounts and cut memory/API usage. Addresses Linear BU-617 by removing the unbounded “accumulate everything” pattern in
pickId().PickerConfigtype; adds tests for navigation, filtering, cursor passing, and empty/optional states.Written for commit 198daf0. Summary will update on new commits.