feat(android-nav3): [Android Nav3 4] Introduce SentryNavEffect - #6132
0xadam-brown wants to merge 2 commits into
Conversation
|
📲 Install BuildsAndroid
|
729cbc7 to
a0704f7
Compare
0111382 to
f841761
Compare
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 f841761. Configure here.
a0704f7 to
6a2c118
Compare
20d0b21 to
e1498fd
Compare
9e615c3 to
7e1db9e
Compare
e1498fd to
cffd83e
Compare
cffd83e to
ef33ec7
Compare
| @ApiStatus.Experimental | ||
| @Composable | ||
| @Suppress("FunctionNaming") | ||
| internal fun <T : Any> SentryNavEffect( |
There was a problem hiding this comment.
This will be the main public API for our Nav3 integration – at least for milestone 1. (Milestone 1 aims at Nav2 parity, including support of navigation where each entry in the back stack is interpreted as the currently visible screen).
Marked as experimental b/c this will be made public in a follow-on to the current PR stack.
56bd4d4 to
fee0b6c
Compare
95e9b22 to
33771ca
Compare
fee0b6c to
acf57d4
Compare
33771ca to
337d586
Compare
Add the Compose-facing abstraction that binds Navigation 3 back stack changes to the observer layer. This establishes the integration’s primary API shape while keeping it internal until the rest of the sequence is ready to expose it.
…ffectTest setLogger(logger) resolved to SentryOptions.getLogger() via the apply receiver, setting the logger to its own default rather than a mock. Nothing asserts on the logger, so the line was misleading dead code.
acf57d4 to
b0cf97d
Compare
337d586 to
8751079
Compare
| options: SentryNavOptions = SentryNavOptions(), | ||
| scopes: IScopes, | ||
| ) { | ||
| val routeResolvers = rememberUpdatedState(RouteResolvers(nameExtractor, argumentsExtractor)) |
There was a problem hiding this comment.
Bug: The code references an undefined type RouteResolvers instead of the existing RouteExtractors, which will cause a compilation error due to an incomplete rename.
Severity: CRITICAL
Suggested Fix
Rename all usages of the undefined type RouteResolvers to the correct type RouteExtractors. This change is required in SentryNavEffect.kt, BackStackObserver.kt, and BackStackObserverTest.kt to resolve the compilation error.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location:
sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/SentryNavEffect.kt#L100
Potential issue: The code references an undefined type `RouteResolvers` in several
places, including `SentryNavEffect.kt`, `BackStackObserver.kt`, and
`BackStackObserverTest.kt`. No such class or typealias exists in the module. The
intended type is likely `RouteExtractors`, which is defined. This discrepancy leads to a
type mismatch where `BackStackObserver` attempts to pass an object of the non-existent
`RouteResolvers` type to `RouteTranslator`, which expects `RouteExtractors`. This will
result in a compilation error.
Also affects:
sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/BackStackObserver.kt:56sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackObserverTest.kt:99sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/RouteTranslator.kt:18sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/BackStackObserver.kt:61

PR Stack (Android Nav3)
📜 Description
Introduce
SentryNavEffect, the Compose-facing abstraction for Android Nav3. This is the key abstraction for milestone 1 of our Nav3 support. (Milestone 1 aims at parity with Nav2, including support of navigation where each entry in the back stack is interpreted as the currently visible screen).This PR connects the observer layer from #6131 to Compose lifecycle and recomposition behavior.
💡 Motivation and Context
SentryNavEffectis the key abstraction this integration presents to host apps. Keeping it in its own PR makes the public-facing shape and lifecycle model reviewable on their own, even while the symbol remains internal for now.addresses: JAVA-274
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
ApiStatus.ExperimentalAPIs publicly + add module README + CHANGELOG entry#skip-changelog