fix(android): Accept RegularFile in Gradle bundle task path guards#6320
Merged
Conversation
The Kotlin rewrite of the Gradle integration (sentry.gradle.kts) guarded bundle task path properties with `is Directory`, falling back to all-null otherwise. React Native's BundleHermesCTask declares `jsIntermediateSourceMapsDir` as a `RegularFileProperty`, so `.orNull` resolves to a `RegularFile`, the guard bails out, and source map upload is silently skipped with "Could not extract bundle task arguments". Accept both `Directory` and `RegularFile` in all three guards. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Contributor
Contributor
Author
|
@cursor review |
Contributor
Author
|
@sentry review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 308504e. Configure here.
📲 Install BuildsAndroid
|
Contributor
Android (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 44c8b3f+dirty | 414.20 ms | 457.28 ms | 43.08 ms |
| 37a2091+dirty | 407.82 ms | 441.22 ms | 33.40 ms |
| 580fb5c+dirty | 436.34 ms | 471.63 ms | 35.28 ms |
| 0bd8916+dirty | 412.77 ms | 451.31 ms | 38.54 ms |
| 5a010b7+dirty | 425.62 ms | 469.38 ms | 43.76 ms |
| 7d8c8bd+dirty | 417.45 ms | 462.10 ms | 44.65 ms |
| 5fe1c6c+dirty | 401.62 ms | 445.28 ms | 43.66 ms |
| 5b7e8a7+dirty | 418.55 ms | 488.46 ms | 69.91 ms |
| 6177334+dirty | 408.16 ms | 441.14 ms | 32.98 ms |
| b9bebee+dirty | 438.86 ms | 452.21 ms | 13.35 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 44c8b3f+dirty | 48.30 MiB | 53.46 MiB | 5.15 MiB |
| 37a2091+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 580fb5c+dirty | 49.74 MiB | 54.79 MiB | 5.05 MiB |
| 0bd8916+dirty | 48.30 MiB | 53.57 MiB | 5.26 MiB |
| 5a010b7+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 7d8c8bd+dirty | 48.30 MiB | 53.54 MiB | 5.23 MiB |
| 5fe1c6c+dirty | 43.75 MiB | 48.14 MiB | 4.39 MiB |
| 5b7e8a7+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 6177334+dirty | 48.30 MiB | 53.54 MiB | 5.23 MiB |
| b9bebee+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
Contributor
Android (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| a50b33d+dirty | 353.21 ms | 398.48 ms | 45.27 ms |
| 7d6fd3a+dirty | 435.06 ms | 458.78 ms | 23.72 ms |
| 37a2091+dirty | 429.71 ms | 477.00 ms | 47.29 ms |
| 580fb5c+dirty | 515.72 ms | 585.38 ms | 69.66 ms |
| 0bd8916+dirty | 400.15 ms | 442.72 ms | 42.57 ms |
| 5a010b7+dirty | 475.15 ms | 519.02 ms | 43.88 ms |
| 7d8c8bd+dirty | 406.06 ms | 460.88 ms | 54.81 ms |
| 890d145+dirty | 486.42 ms | 514.85 ms | 28.43 ms |
| 5b7e8a7+dirty | 601.58 ms | 634.98 ms | 33.40 ms |
| 6177334+dirty | 404.80 ms | 456.74 ms | 51.94 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| a50b33d+dirty | 43.94 MiB | 48.94 MiB | 5.00 MiB |
| 7d6fd3a+dirty | 43.94 MiB | 49.00 MiB | 5.06 MiB |
| 37a2091+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 580fb5c+dirty | 49.74 MiB | 54.79 MiB | 5.05 MiB |
| 0bd8916+dirty | 48.30 MiB | 53.57 MiB | 5.26 MiB |
| 5a010b7+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 7d8c8bd+dirty | 48.30 MiB | 53.54 MiB | 5.23 MiB |
| 890d145+dirty | 43.94 MiB | 49.00 MiB | 5.06 MiB |
| 5b7e8a7+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 6177334+dirty | 48.30 MiB | 53.54 MiB | 5.23 MiB |
antonis
commented
Jun 19, 2026
alwx
approved these changes
Jun 19, 2026
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.
📢 Type of change
📜 Description
The Kotlin rewrite of the Gradle integration (
sentry.gradle.kts, shipped in 8.14.0 via #6119) guards the bundle task path properties with a strictis org.gradle.api.file.Directorycheck inextractBundleTaskArguments, returning all-null otherwise:React Native's
BundleHermesCTaskdeclaresjsIntermediateSourceMapsDiras aRegularFileProperty(it holds a directory path butmkdirs()is called on it), so.orNullresolves to aRegularFile, theis Directorybranch is skipped, and the function returns all-null. The caller then logs[sentry] Could not extract bundle task arguments for '…'. Source maps will not be uploaded.and silently skips the upload.The legacy fallback (
extractBundleTaskArgumentsLegacy) can't rescue it because the modernBundleHermesCTaskis a plainDefaultTaskwith no command-lineargs. The previous Groovy script read the path untyped (props.jsIntermediateSourceMapsDir.get().asFile.absolutePath), which is why this only regressed with the Kotlin rewrite.This PR makes all three guards accept both
DirectoryandRegularFile.Scope note
The linked issue attributes this to RN 0.85, but
jsIntermediateSourceMapsDirhas been aRegularFilePropertyfor much longer — verified in RN 0.80.1 and 0.86.0. So the regression affects a wide range of RN versions on SDK 8.14.0+, not just 0.85.💡 Motivation and Context
Fixes #6319. Without source map upload, production Hermes stack traces are never symbolicated.
💚 How did you test it?
No automated test was added — the affected code lives in an
apply from:Gradle script, so its top-level functions aren't reachable from a unit test, and the only faithful coverage (Gradle TestKit applying the real script) is disproportionate infrastructure for a type-guard fix and isn't part of the current TS/Jest CI.Verification is manual: on a release Android build with a RN version whose
BundleHermesCTask.jsIntermediateSourceMapsDiris aRegularFileProperty(e.g. 0.80–0.86) andSENTRY_AUTH_TOKENset, confirmsentry-cli sourcemaps uploadruns and an artifact bundle with a matching Debug ID appears under Project → Settings → Source Maps, instead of the "Could not extract bundle task arguments" warning.📝 Checklist
sendDefaultPIIis enabled🔮 Next steps
Consider adding Gradle-level test coverage (e.g. TestKit) for
sentry.gradle.ktsto catch bundle-task extraction regressions in the future.🤖 Generated with Claude Code