Repository navigation
feat(nav3): [Part 2] Add the built-in SerialName mapper - #6703
0xadam-brown wants to merge 1 commit into
Conversation
|
📲 Install BuildsAndroid
|
PR risk: not classifiedFor commit The last run ended with status |
| @@ -0,0 +1,15 @@ | |||
| # Versions for sentry-android-navigation3's kotlinx.serialization compatibility checks, registered as | |||
There was a problem hiding this comment.
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.
runningcode
left a comment
There was a problem hiding this comment.
I think the use of kotlinx-serialization warrants a team discussion!
d03d53a to
b5f3e56
Compare
8e69a38 to
3aa6d86
Compare
There was a problem hiding this comment.
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).
❌ 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.
3aa6d86 to
a145470
Compare
1d6fccd to
fcdfd79
Compare
a145470 to
37d6b32
Compare
fcdfd79 to
c5cc387
Compare
37d6b32 to
801de33
Compare

PR Stack (Nav3 Serial Name Mappers)
Former parts 1–3 merged into
mainas #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 toSentryNavEffectinstead 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)
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?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Continue with Part 3: Define bounded property encoding.