-
Notifications
You must be signed in to change notification settings - Fork 110
stability: reduce string-search pressure on large files #741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
92e704a
stability: bound rendered string search payloads
yhs0602 b445252
stability: clip oversized analyzer string matches
yhs0602 aab6397
stability: bound string search scans for large files
yhs0602 abf02ce
stability: drop legacy serializable chooser fallback
yhs0602 31c8d19
stability: reset workspace state when opening projects
yhs0602 bff7925
cleanup: remove legacy string fragment layouts
yhs0602 2554d71
test: cover import recreate and cancel flows
yhs0602 c6010d2
ui: warn before bounded string search
yhs0602 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't map every truncation path to “Showing first 5000 results.”
accumulator.isTruncatedis flipped both when rows are dropped and when the render-char budget clips content, butbuildStringSearchNotice()renders both cases as a row-count limit. After the 32,768-char budget is exhausted, for example, the UI can show far fewer than 5,000 rows while still claiming only the first 5,000 are shown. This shape also leaves no way to surface analyzer-side 4,096-char clipping. Split count truncation from content clipping before building the notice.🧭 Suggested direction
class StringSearchResultAccumulator(private val maxResults: Int) { private val _results = mutableListOf<FoundString>() val results: List<FoundString> get() = _results - var isTruncated: Boolean = false + var resultCountTruncated: Boolean = false + private set + + var contentClipped: Boolean = false private set private var renderedChars: Int = 0 fun append(result: FoundString) { if (_results.size >= maxResults) { - isTruncated = true + resultCountTruncated = true return } val remainingChars = MAX_RENDERED_STRING_TOTAL_CHARS - renderedChars if (remainingChars <= 0) { - isTruncated = true + contentClipped = true return } val (displayResult, wasClipped) = clipFoundStringForRendering( result, minOf(MAX_RENDERED_STRING_CHARS, remainingChars) ) if (wasClipped) { - isTruncated = true + contentClipped = true } _results.add(displayResult) renderedChars += displayResult.string.length } } internal fun buildStringSearchNotice( input: StringSearchInput, - resultsTruncated: Boolean + resultCountTruncated: Boolean, + contentClipped: Boolean ): String? { val parts = mutableListOf<String>() if (input.isTruncated) { parts += "Searching strings in first ${input.bytes.size} bytes of ${input.originalSize} bytes" } - if (resultsTruncated) { + if (resultCountTruncated) { parts += "Showing first $MAX_RENDERED_STRING_RESULTS results." } + if (contentClipped) { + parts += "Some matches are shortened for display." + } return when { parts.isEmpty() -> null parts.size == 1 -> parts.single() else -> parts.joinToString(". ") } } - _notice.value = buildStringSearchNotice(input, accumulator.isTruncated) + _notice.value = buildStringSearchNotice( + input = input, + resultCountTruncated = accumulator.resultCountTruncated, + contentClipped = accumulator.contentClipped + )Also applies to: 99-117, 151-152
🤖 Prompt for AI Agents