Skip to content

Fix search result consistency in PositionTracker#3802

Merged
iloveeclipse merged 2 commits intoeclipse-platform:masterfrom
vogella:fix-position-tracker-corruption
Mar 24, 2026
Merged

Fix search result consistency in PositionTracker#3802
iloveeclipse merged 2 commits intoeclipse-platform:masterfrom
vogella:fix-position-tracker-corruption

Conversation

@vogella
Copy link
Copy Markdown
Contributor

@vogella vogella commented Mar 20, 2026

This PR fixes ConcurrentSkipListSet corruption in AbstractTextSearchResult by ensuring matches are correctly re-indexed when mutated by PositionTracker. See #3796

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses sporadic search test failures by preventing AbstractTextSearchResult’s internal ConcurrentSkipListSet from becoming inconsistent when PositionTracker mutates Match offsets/lengths, ensuring matches are re-indexed correctly after document edits.

Changes:

  • Re-index mutated matches in PositionTracker.dirtyStateChanged() by removing and re-adding them to the owning AbstractTextSearchResult.
  • Add a regression test intended to reproduce/guard against match-set corruption after shifting many matches in a file.
  • Expand the test search scope to include *.txt and create a workspace file with many matches.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
bundles/org.eclipse.search/newsearch/org/eclipse/search2/internal/ui/text/PositionTracker.java Removes/re-adds matches when their offset/length changes so the ordered match set remains consistent.
tests/org.eclipse.search.tests/src/org/eclipse/search/tests/filesearch/PositionTrackerTest.java Adds a new regression test and workspace setup to generate a file with many matches and validate match removal after reindexing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 20, 2026

Test Results

   851 files   -     1     851 suites   - 1   41m 56s ⏱️ - 15m 58s
 7 868 tests +    1   7 625 ✅ +    1  243 💤 ±  0  0 ❌ ±0 
18 595 runs   - 1 532  18 105 ✅  - 1 366  490 💤  - 166  0 ❌ ±0 

Results for commit 2f7f85f. ± Comparison against base commit 1446276.

♻️ This comment has been updated with latest results.

@vogella vogella force-pushed the fix-position-tracker-corruption branch from b895edd to 7f5854f Compare March 20, 2026 12:18
@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Mar 20, 2026

@iloveeclipse pls review

The rest of the copilot feedback was not valuable AFAICT

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Mar 23, 2026

@iloveeclipse fine to merge?

@iloveeclipse
Copy link
Copy Markdown
Member

fine to merge?

There are few comments from copilot, if they are irrelevant, please resolve them, if they are relevant, please fix.
I will try to check this PR today.

@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Mar 23, 2026

I think the were irrelevent

@iloveeclipse
Copy link
Copy Markdown
Member

I think the were irrelevent

Please go over PR and "resolve conversation" for all opened comments which are irrelevant.

@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Mar 23, 2026

I think the were irrelevent

Please go over PR and "resolve conversation" for all opened comments which are irrelevant.

Done, FYI https://developers.google.com/gemini-code-assist/docs/review-repo-code results IMHO in way better reviews than Copilot, at least 1-2 months ago then I compared both. So in case you experimenting with automatic code reviews, I suggest you give Gemini code review a try.

@iloveeclipse
Copy link
Copy Markdown
Member

So in case you experimenting with automatic code reviews, I suggest you give Gemini code review a try.

I just use whatever is available for me & for github, and as of today it's Copilot only.
Also I'm not experimenting, Copilot offloads me & save my time, Copilot usualy gives a good initial review of PR's.

Beside this, I don't plan to use other IDE's for Eclipse work now, as using Eclipse allows me to test what we produce ("eat your own dog food").

@iloveeclipse
Copy link
Copy Markdown
Member

iloveeclipse commented Mar 23, 2026

Just looking at the commit message, can you please update it by following some basic rules:

  1. Short (ideally < 80 characters) commit title
  2. After a new line description of the actual change (problem & solution explained), if this a regression, ideally including offending commit or PR, like 300659d / Search View: Performance issues on remove and sort #3733 in this case.
  3. Last line referring the issue fixed, like here it would be Fixes https://github.com/eclipse-platform/eclipse.platform.ui/issues/3796

If you wonder why this matters - it saves reviewer & maintainer time. In this case I had to search which commit was related, which code was originally changed, why the other place was not updated etc. Later we might need to do exact same to fix this PR :-)

@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Mar 23, 2026

So in case you experimenting with automatic code reviews, I suggest you give Gemini code review a try.

I just use whatever is available for me & for github, and as of today it's Copilot only.
Also I'm not experimenting, Copilot offloads me & save my time, Copilot usualy gives a good initial review of PR's.

Beside this, I don't plan to use other IDE's for Eclipse work now, as using Eclipse allows me to test what we produce ("eat your own dog food").

Gemini code review is not another ide it provides feedback on pr

@vogella vogella force-pushed the fix-position-tracker-corruption branch from 7f5854f to fdec281 Compare March 23, 2026 12:55
@vogella
Copy link
Copy Markdown
Contributor Author

vogella commented Mar 23, 2026

Commit message updated

Copy link
Copy Markdown
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

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

The code change is functionally OK, but we should refactor it a bit & add few comments in different places for later.

vogella and others added 2 commits March 24, 2026 09:28
When PositionTracker updates match offsets/lengths in
dirtyStateChanged(), mutating matches in-place corrupts the
ConcurrentSkipListSet ordering introduced in 300659d /
Search View: Performance issues on remove and sort eclipse-platform#3733.

Fix by removing and re-adding matches whose offset or length
changed, so the set re-indexes them correctly.

Fixes eclipse-platform#3796
- added `updateMatch(Match match, Position pos)` to manage the `Match`
changes
- Refactored `PositionTracker` & `AbstractTextSearchResult`
- Added javadoc comments where needed

See eclipse-platform#3796
@iloveeclipse iloveeclipse force-pushed the fix-position-tracker-corruption branch from fdec281 to 2f7f85f Compare March 24, 2026 10:42
@iloveeclipse iloveeclipse linked an issue Mar 24, 2026 that may be closed by this pull request
@iloveeclipse iloveeclipse merged commit b4e388f into eclipse-platform:master Mar 24, 2026
21 of 22 checks passed
@vogella vogella deleted the fix-position-tracker-corruption branch March 24, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SearchResultPageTest.testTableNavigation fail sporadically

4 participants