feat(code-mappings): Handle Java monorepo source roots in auto-derivation task#112655
Merged
feat(code-mappings): Handle Java monorepo source roots in auto-derivation task#112655
Conversation
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 619ca2e. Configure here.
armenzg
approved these changes
Apr 10, 2026
| from collections.abc import Sequence | ||
|
|
||
| SLASH = "/" | ||
| JAVA_SOURCE_ROOT_MARKERS = ("src/main/java/", "src/main/kotlin/") |
Member
There was a problem hiding this comment.
As per convo with @romtsn , these are to cover the majority of cases.
| # e.g. com.foo.bar.Baz$handle$1, Baz.kt -> com/foo/bar/Baz.kt | ||
| "extract_filename_from_module": True, | ||
| "create_in_app_stack_trace_rules": True, | ||
| "source_roots_resolver": find_java_source_roots, |
Member
There was a problem hiding this comment.
I'm glad seeing this file still being a good source for declaring the configuration of each platform 🦾
| platform="java", | ||
| ) | ||
|
|
||
| assert sorted(code_mappings) == sorted( |
Member
There was a problem hiding this comment.
Interesting! We create multiple code mappings!
wedamija
pushed a commit
that referenced
this pull request
Apr 13, 2026
…tion task (#112655) ## Summary - derive Java/Kotlin source roots from repo tree structure so monorepo modules map to their package root instead of stopping at `src/main/java` or `src/main/kotlin` - allow multiple code mappings from the same repo when identical Java package paths exist in multiple subprojects - move the Java-specific helper logic into a dedicated utility module and add realistic monorepo coverage for GraphQL and OpenTelemetry layouts from [sentry-java](https://github.com/getsentry/sentry-java) ## Test Plan - `.venv/bin/pytest -svv --reuse-db tests/sentry/issues/auto_source_code_config/test_code_mapping.py tests/sentry/api/endpoints/issues/test_organization_derive_code_mappings.py tests/sentry/issues/auto_source_code_config/test_process_event.py` - `.venv/bin/pre-commit run --files src/sentry/issues/auto_source_code_config/code_mapping.py src/sentry/issues/auto_source_code_config/utils/java.py tests/sentry/issues/auto_source_code_config/test_code_mapping.py tests/sentry/api/endpoints/issues/test_organization_derive_code_mappings.py tests/sentry/issues/auto_source_code_config/test_process_event.py` ## Migration - no migration needed; `RepositoryProjectPathConfig` already uses `(project, stack_root, source_root)` and this PR only changes derivation logic plus an in-memory dedupe key
3 tasks
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
src/main/javaorsrc/main/kotlinTest Plan
.venv/bin/pytest -svv --reuse-db tests/sentry/issues/auto_source_code_config/test_code_mapping.py tests/sentry/api/endpoints/issues/test_organization_derive_code_mappings.py tests/sentry/issues/auto_source_code_config/test_process_event.py.venv/bin/pre-commit run --files src/sentry/issues/auto_source_code_config/code_mapping.py src/sentry/issues/auto_source_code_config/utils/java.py tests/sentry/issues/auto_source_code_config/test_code_mapping.py tests/sentry/api/endpoints/issues/test_organization_derive_code_mappings.py tests/sentry/issues/auto_source_code_config/test_process_event.pyMigration
RepositoryProjectPathConfigalready uses(project, stack_root, source_root)and this PR only changes derivation logic plus an in-memory dedupe key