fix: expand to nearest Maven module group to prevent OOM#57
Open
aviadshiber wants to merge 2 commits intomainfrom
Open
fix: expand to nearest Maven module group to prevent OOM#57aviadshiber wants to merge 2 commits intomainfrom
aviadshiber wants to merge 2 commits intomainfrom
Conversation
Expanding jdtls to the full IDE workspace root (e.g. products/ with 248 modules) caused OutOfMemoryError: Java heap space during indexing. _find_maven_group_root() walks up from the initial module to the nearest ancestor whose pom.xml contains <modules>, giving a tight cross-module scope (typically 5-20 sibling modules) instead of the entire monorepo. Falls back to the workspace root only when no intermediate multi-module parent exists. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Address code review findings on _find_maven_group_root: - Resolve both paths before walking to prevent symlink-based boundary escapes (security reviewer finding: lexical Path equality could let a symlinked initial_module escape workspace_root to /) - Add is_relative_to guard so containment is enforced, not assumed - Rename expansion_path → group_root_path for clarity - Clarify docstring: note that initial_module itself is intentionally skipped (we want its parent group), and that paths are resolved Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
expand_full_workspace()was expanding jdtls to the full IDE workspace root (products/, 248 modules), causingOutOfMemoryError: Java heap spacefollowed bytextDocument/definitiontimeouts_find_maven_group_root()helper walks up from the initial module to the nearest ancestor whosepom.xmlcontains<modules>, bounding the index to a module group (typically 5-20 modules)Root cause from logs
For the
productsmonorepo:products/pom.xmlhas 248 modules. The fix scopes toproducts/editorial-management/(17 modules) instead.Test plan
test_expand_uses_maven_group_root_not_workspace_root— expands to group POM level, not IDE roottest_expand_falls_back_to_workspace_root_when_no_group_pom— flat layout falls back correctly🤖 Generated with Claude Code