Skip to content

feat(sample): [Nav3 Lifecycle 5] Add Nav3 lifecycle scenarios to sample app - #6309

Merged
0xadam-brown merged 4 commits into
feat/sentry-nav-effect-lifecyclefrom
feat/part-5-sentry-nav-effect-lifecycle
Oct 23, 2026
Merged

0xadam-brown merged 4 commits into
feat/sentry-nav-effect-lifecyclefrom
feat/part-5-sentry-nav-effect-lifecycle

Conversation

@0xadam-brown

@0xadam-brown 0xadam-brown commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

PR Stack (Nav3 Lifecycle)


📜 Description

Add runnable Navigation 3 sample flows for applications with multiple Activities and multiple Fragments, each hosting its own SentryNavEffect.

The sample records a shared navigation transaction history, labels transactions by Activity, and provides scenarios for Activity handoffs, Fragment replacement, dialogs, and ViewPager pages.

💡 Motivation and Context

These scenarios make the lifecycle behavior introduced by the stack directly observable and provide a practical harness for manual verification and future debugging.

addresses: JAVA-785

💚 How did you test it?

  • Had my clanker perform lots of manual testing

📝 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

Merge the stack from Part 1 through Part 5 using merge commits, then squash-merge the collection PR into main.

#skip-changelog

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

@linear-code

linear-code Bot commented Oct 20, 2026

Copy link
Copy Markdown

JAVA-274

@github-actions

github-actions Bot commented Oct 20, 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 91d6d32

@sentry

sentry Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@0xadam-brown
0xadam-brown marked this pull request as ready for review October 20, 2026 15:31
@0xadam-brown 0xadam-brown changed the title feat(sample): [Nav3 Lifecycle 5] Add multi-root scenarios feat(sample): [Nav3 Lifecycle 5] Add Nav3 lifecycle scenarios to sample app Oct 20, 2026
@0xadam-brown 0xadam-brown added the ship-it PR is ready to merge from a reviewer perspective label Oct 20, 2026

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

Stale Bugbot comment from a previous run.

@0xadam-brown
0xadam-brown force-pushed the feat/part-5-sentry-nav-effect-lifecycle branch from 7039fb1 to 8530b8d Compare October 21, 2026 11:27
@0xadam-brown
0xadam-brown force-pushed the feat/part-4-sentry-nav-effect-lifecycle branch from f24236a to 810739e Compare October 21, 2026 11:27
@0xadam-brown
0xadam-brown force-pushed the feat/part-5-sentry-nav-effect-lifecycle branch from 8530b8d to 8fefcab Compare October 22, 2026 08:25
@0xadam-brown
0xadam-brown force-pushed the feat/part-4-sentry-nav-effect-lifecycle branch 2 times, most recently from 3f72d2a to fbef142 Compare October 22, 2026 10:11
@0xadam-brown
0xadam-brown force-pushed the feat/part-5-sentry-nav-effect-lifecycle branch from 8fefcab to 604ace1 Compare October 22, 2026 10:11
@0xadam-brown
0xadam-brown force-pushed the feat/part-4-sentry-nav-effect-lifecycle branch from fbef142 to b306729 Compare October 22, 2026 12:14
@0xadam-brown
0xadam-brown force-pushed the feat/part-5-sentry-nav-effect-lifecycle branch from 604ace1 to bfd5a9f Compare October 22, 2026 12:14
@0xadam-brown
0xadam-brown force-pushed the feat/part-5-sentry-nav-effect-lifecycle branch from bfd5a9f to 4b32d48 Compare October 23, 2026 06:23
@0xadam-brown
0xadam-brown force-pushed the feat/part-4-sentry-nav-effect-lifecycle branch from b306729 to efc6686 Compare October 23, 2026 06:26
@0xadam-brown
0xadam-brown force-pushed the feat/part-5-sentry-nav-effect-lifecycle branch from 4b32d48 to b86ffdb Compare October 23, 2026 06:27
Base automatically changed from feat/part-4-sentry-nav-effect-lifecycle to feat/sentry-nav-effect-lifecycle October 23, 2026 06:29
@0xadam-brown
0xadam-brown force-pushed the feat/part-5-sentry-nav-effect-lifecycle branch from b86ffdb to 253cdc2 Compare October 23, 2026 06:32

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

Stale Bugbot comment from a previous run.

0xadam-brown and others added 3 commits October 23, 2026 11:53
Add runnable multi-Activity and multi-Fragment Navigation 3 scenarios with shared transaction history so lifecycle handoffs can be exercised in the Android sample.\n\nRefs JAVA-274
Crash only after the first Checkout composition is applied so the navigation transaction and scenario tags are available for attribution. Apply the scenario tag directly to the scope transaction to keep history filtering robust.

Refs JAVA-274
Co-Authored-By: OpenAI Codex <noreply@openai.com>
Coordinator methods run inside IScopes.configureScope, which already
catches anything a scope call throws. Replace the try/finally blocks in
unregisterCandidate and transferLeaseTo with ordering: update the
coordinator's bookkeeping before calling into the scope, so it stays
consistent if a scope call throws.
@0xadam-brown
0xadam-brown force-pushed the feat/part-5-sentry-nav-effect-lifecycle branch from 4d56945 to 8c65675 Compare October 23, 2026 09:53
@0xadam-brown

Copy link
Copy Markdown
Member Author

Rebased on an updated target + added 8c65675 in response to @romtsn's comment here. Otherwise unchanged.

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

Stale Bugbot comment from a previous run.

Prevent covered Navigation 3 roots from retagging the transaction owned by the current leaseholder. Preserve initial Activity UI-load tagging and cover both ownership paths with regression tests.

Refs JAVA-785
Co-Authored-By: OpenAI Codex <noreply@openai.com>
@0xadam-brown
0xadam-brown merged commit e495908 into feat/sentry-nav-effect-lifecycle Oct 23, 2026
20 checks passed
@0xadam-brown
0xadam-brown deleted the feat/part-5-sentry-nav-effect-lifecycle branch October 23, 2026 11:12

@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 2 potential issues.

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 91d6d32. Configure here.

activeTransaction.setTag(NAV3_SCENARIO_TAG, scenario.label)
activeTransaction.setTag(NAVIGATION_SAMPLE_SCENARIO_TAG, scenario.label)
activeTransaction.setTag(NAVIGATION_SAMPLE_ACTIVITY_TAG, hostName)
activeTransaction.setTag(NAVIGATION_SAMPLE_SESSION_TAG, sessionId)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Covered roots can retag transactions

Medium Severity

The new ownership check treats a matching /${route.routeName} as proof this root owns the current transaction. A covered root that stays composed (ViewPager neighbor, paused Activity) still reruns this SideEffect on recomposition, and if it happens to show the same destination it overwrites sample_navigation_activity on the leaseholder's transaction.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 91d6d32. Configure here.

activeTransaction.getTag(NAVIGATION_SAMPLE_ACTIVITY_TAG) == null
if (!ownsNavigationTransaction && !ownsUiLoadTransaction) {
return
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Custom transactions drop from history

Low Severity

tagNavigationSampleTransaction now returns unless the scope transaction is this route's nav transaction or an untagged ui.load. Custom-scenario transactions use names like custom.productlist_screen, so they no longer receive sample_navigation_session and the history listener drops them.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 91d6d32. Configure here.

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

Labels

ship-it PR is ready to merge from a reviewer perspective

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants