Skip to content

feat(android-nav3): [Android Nav3 4] Introduce SentryNavEffect - #6132

Open
0xadam-brown wants to merge 2 commits into
feat/sentry-nav3-effect-3-observerfrom
feat/sentry-nav3-effect-4-effect
Open

0xadam-brown wants to merge 2 commits into
feat/sentry-nav3-effect-3-observerfrom
feat/sentry-nav3-effect-4-effect

Conversation

@0xadam-brown

@0xadam-brown 0xadam-brown commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

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

SentryNavEffect is 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?

  • Unit tests
  • Manually via the (forthcoming) Nav3 sample app, including performance tests and macrobenchmarks
  • API compatibility verified against Google's official nav3 recipes.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

  • Nav3 sample app
  • Expose all ApiStatus.Experimental APIs publicly + add module README + CHANGELOG entry
  • sentry-docs instructions

#skip-changelog

⚠️ Merge this PR using a merge commit (not squash). This PR should merge into the observer branch first, then flow back down the chain.

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 8751079

@sentry

sentry Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.57.0 (1) release

⚙️ sentry-android Build Distribution Settings

@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-3-observer branch from 729cbc7 to a0704f7 Compare September 18, 2026 11:00
@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-4-effect branch from 0111382 to f841761 Compare September 18, 2026 11:00

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread sentry-android-navigation3/build.gradle.kts
@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-3-observer branch from a0704f7 to 6a2c118 Compare September 18, 2026 11:28
@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-4-effect branch 2 times, most recently from 20d0b21 to e1498fd Compare September 18, 2026 12:22
@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-3-observer branch from 9e615c3 to 7e1db9e Compare September 18, 2026 12:38
@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-4-effect branch from e1498fd to cffd83e Compare September 18, 2026 12:38
@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-4-effect branch from cffd83e to ef33ec7 Compare September 18, 2026 13:08
@ApiStatus.Experimental
@Composable
@Suppress("FunctionNaming")
internal fun <T : Any> SentryNavEffect(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

@0xadam-brown 0xadam-brown added the deep-dive PR needs a thorough review of design, behavior, and edge cases label Sep 18, 2026
@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-3-observer branch from 56bd4d4 to fee0b6c Compare September 24, 2026 08:10
@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-4-effect branch from 95e9b22 to 33771ca Compare September 24, 2026 08:10
@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-3-observer branch from fee0b6c to acf57d4 Compare September 24, 2026 08:18
@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-4-effect branch from 33771ca to 337d586 Compare September 24, 2026 08:18
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.
@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-3-observer branch from acf57d4 to b0cf97d Compare September 24, 2026 16:33
@0xadam-brown
0xadam-brown force-pushed the feat/sentry-nav3-effect-4-effect branch from 337d586 to 8751079 Compare September 24, 2026 16:33
options: SentryNavOptions = SentryNavOptions(),
scopes: IScopes,
) {
val routeResolvers = rememberUpdatedState(RouteResolvers(nameExtractor, argumentsExtractor))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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:56
  • sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/BackStackObserverTest.kt:99
  • sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/RouteTranslator.kt:18
  • sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/BackStackObserver.kt:61

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deep-dive PR needs a thorough review of design, behavior, and edge cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant