Skip to content

feat(nav3): [Part 2] Add the built-in SerialName mapper - #6703

Open
0xadam-brown wants to merge 1 commit into
feat/nav3-serial-name-mappers-6from
feat/nav3-serial-name-mappers-7
Open

0xadam-brown wants to merge 1 commit into
feat/nav3-serial-name-mappers-6from
feat/nav3-serial-name-mappers-7

Conversation

@0xadam-brown

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

Copy link
Copy Markdown
Member

PR Stack (Nav3 Serial Name Mappers)

Former parts 1–3 merged into main as #6697, #6698, and #6699; preparatory refactors merged in #6749. Two other former parts merged separately as #6713 and #6714.


📜 Description

PR introduces the simpler of our two built-in BackStackEntryMappers, viz., SerialName. Apps can pass it to SentryNavEffect instead of maintaining a mapping for every nav destination. Names come from serialization descriptors. No entry properties are collected.

Serializer lookup depends on the host app’s types, serialization runtime, and R8 config. This PR adds compatibility probing, cached per-type lookup results, and diagnostic warnings.

Entries that can't be named remain in the recorded back stack as "/unknown"; a failure involving one app type does not disable naming for other types.

The SDK compiles and tests against kotlinx.serialization 1.7.3 without imposing that version on host apps. The floor lives in a separate version catalog so later R8 coverage can run automatically when it changes without running for every unrelated dependency bump.

💡 Motivation and Context

Apps that use kotlinx.serialization already give each serializable route a name that does not depend on its obfuscated runtime class name. Reusing that naming contract avoids requiring applications to write a mapper for every route type.

addresses: JAVA-787 (link)

⚠️ Callouts

The built-in mappers are currently properties and not methods. That follows Kotlin's convention of using properties for stable, cached values and lets callers pass a mapper directly to SentryNavEffect without needing to remember an instance themselves.

A method-based constructor is the obvious alternative, whether simply returning the current cached maps or creating customized versions based on caller-provided configs. That approach seemed a bit less idiomatic to me (and for now overdone) given our current use-cases, so I decided against it. But we could always introduce it in the future without breaking the current API.

...that said, chime in if you disagree!

💚 How did you test it?

  • Unit tests
  • R8 tests
  • New sample app facilities + manual clanker tests

📝 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

Continue with Part 3: Define bounded property encoding.

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

@github-actions

github-actions Bot commented Nov 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 801de33

@sentry

sentry Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: not classified

For commit 801de33.

The last run ended with status provider_error, so this pull request has no risk label.

@github-actions github-actions Bot removed the risk: medium PR risk score: medium label Nov 20, 2026
@0xadam-brown 0xadam-brown changed the title feat(nav3): [Nav3 Mappers 7] Add the SerialName mapper feat(nav3): [Part 7] Add the SerialName mapper Nov 20, 2026
Comment thread gradle/nav3.versions.toml
@@ -0,0 +1,15 @@
# Versions for sentry-android-navigation3's kotlinx.serialization compatibility checks, registered as

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.

⚠️ Note that I've created a new nav3.versions.toml file alongside our libs.versions.toml.

It lets changes to the min supported kotlinx.serialization version automatically trigger the new R8 emulator tests (introduced in a later PR – not sure what my clanker was up to w/r/t these PR splits, but whatevs).

Those tests deliberately ignore changes confined to libs.versions.toml, since otherwise Dependabot’s frequent dependency bumps would each start an emulator run. GitHub’s path filters match whole files, so keeping the floor in that shared catalog would also exclude the changes we do need to test.

My clanker told me multiple version catalogs is a common convention, but chime in if you have concerns.

Alternatives

  • Detect changes to the specific version entry in a CI job -> Would add workflow logic which was somewhat subtle and spread over both existing and new workflows.
  • Require a manual run whenever the floor version changes -> Relies on one of us remembering, and we almost certainly won't.

@0xadam-brown 0xadam-brown changed the title feat(nav3): [Part 7] Add the SerialName mapper feat(nav3): [Part 7] Add the built-in SerialName mapper Nov 20, 2026
@0xadam-brown
0xadam-brown marked this pull request as ready for review November 20, 2026 15:33
@0xadam-brown
0xadam-brown requested review from a team and adinauer as code owners November 20, 2026 15:33
@0xadam-brown
0xadam-brown requested review from markushi and runningcode and removed request for a team November 20, 2026 15:33

@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 added deep-dive PR needs a thorough review of design, behavior, and edge cases sanity-check PR needs a lightweight review for obvious issues and removed deep-dive PR needs a thorough review of design, behavior, and edge cases labels Nov 20, 2026

@runningcode runningcode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the use of kotlinx-serialization warrants a team discussion!

@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-mappers-6 branch from d03d53a to b5f3e56 Compare November 23, 2026 13:11
@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-mappers-7 branch from 8e69a38 to 3aa6d86 Compare November 23, 2026 13:11
@0xadam-brown 0xadam-brown changed the title feat(nav3): [Part 7] Add the built-in SerialName mapper feat(nav3): [Part 5] Add the built-in SerialName mapper Nov 23, 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.

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

There are 2 total unresolved issues (including 1 from previous review).

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 3aa6d86. Configure here.

@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-mappers-7 branch from 3aa6d86 to a145470 Compare November 23, 2026 14:28
@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-mappers-6 branch 2 times, most recently from 1d6fccd to fcdfd79 Compare November 23, 2026 15:34
@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-mappers-7 branch from a145470 to 37d6b32 Compare November 23, 2026 15:34
@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-mappers-6 branch from fcdfd79 to c5cc387 Compare November 24, 2026 10:21
@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-mappers-7 branch from 37d6b32 to 801de33 Compare November 24, 2026 10:21
@0xadam-brown 0xadam-brown changed the title feat(nav3): [Part 5] Add the built-in SerialName mapper feat(nav3): [Part 2] Add the built-in SerialName mapper Nov 24, 2026

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

sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants