Skip to content

test(nav3): [Part 5] Verify the SerialName mapper under R8 - #6783

Draft
0xadam-brown wants to merge 1 commit into
feat/nav3-serial-name-stack-4from
feat/nav3-serial-name-stack-5
Draft

0xadam-brown wants to merge 1 commit into
feat/nav3-serial-name-stack-4from
feat/nav3-serial-name-stack-5

Conversation

@0xadam-brown

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

Copy link
Copy Markdown
Member

PR Stack (Nav3 SerialName Mapper)

This stack replaces the SerialName half of #6696. SerialNameAndProperties will follow in its own stack.


📜 Description

Adds nav3-backstack-entry-mapper-r8-check, a small app in sentry-android-integration-tests that maps representative back stack keys with BackStackEntryMapper.SerialName in an R8-minified release build and reports PASS or FAIL for each. It runs on an emulator or device via:

./scripts/test-nav3-backstack-entry-mapper-r8.sh   # or: make runNav3BackStackEntryMapperR8Test

The script builds the app against the kotlinx.serialization floor (1.7.3) in R8 full and compat mode (plus any versions in NAV3_EXTRA_KOTLINX_VERSIONS), installs each APK, and reads the results from logcat.

The app checks:

  • Names: objects, data classes, sealed types, enums (including constants with bodies), value classes, private top-level and nested types, a class with a custom serializer, and /unknown for keys that can't be named (String, non-@Serializable classes, generic classes).
  • Named companion objects: /unknown at the floor, as the KDoc says, since kotlinx.serialization's own R8 rules only cover them from 1.10.0 on. Also, that the keep rules our Troubleshooting docs tell apps to add fix it.
  • R8 ran: a representative class was renamed.
  • The compatibility probe was conclusive: the app initializes Sentry with a logger that records the mapper's messages, and fails if the probe was inconclusive or failed, or the mapper couldn't be created. An inconclusive probe leaves names right but can't detect an incompatible kotlinx.serialization version. A positive control checks that the logger receives the mapper's messages at all.

💡 Motivation and Context

SerialName relies on R8 keeping @Serializable annotations, generated serializer() methods, companion objects, and INSTANCE fields, as kotlinx.serialization's consumer rules do. Unit tests run unminified, so they can't catch a release build that names screens differently from a debug build. The SDK is minified by apps' R8, so the only way to check it is to build an app.

This check has already caught one bug: at the floor in R8 full mode, the probe's own object fixture lost its INSTANCE field, so the probe was silently inconclusive. Part 2 now keeps the fixture with a scoped consumer rule.

addresses: JAVA-787 (link)

💚 How did you test it?

Ran the script on an emulator (API 36). Every check passes in R8 full and compat mode at 1.7.3, and in full mode at 1.13.0.

📝 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

Part 6 runs this check in CI.

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit ba7a24b.

The model rated this change low. It was raised to medium because:

  • R6: build or release configuration changed: Makefile, scripts/test-nav3-backstack-entry-mapper-r8.sh, sentry-android-integration-tests/nav3-backstack-entry-mapper-r8-check/build.gradle.kts, sentry-android-integration-tests/nav3-backstack-entry-mapper-r8-check/proguard-rules.pro, sentry-android-integration-tests/settings.gradle.kts

This label is a hint for reviewers, not an approval.

@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-stack-5 branch from c765b6c to 9f1998f Compare November 25, 2026 15:34
@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-stack-4 branch from 13ed74a to 37996b3 Compare November 25, 2026 15:34
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 25, 2026
@sentry

sentry Bot commented Nov 25, 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

Add nav3-backstack-entry-mapper-r8-check, an app that maps representative back stack keys with
BackStackEntryMapper.SerialName in an R8-minified release build and reports whether each name is
right, and scripts/test-nav3-backstack-entry-mapper-r8.sh, which builds it against the
kotlinx.serialization floor in R8 full and compat mode, and optionally other versions, and runs it
on a booted emulator or device.

Besides names, the app checks that R8 renamed classes, and, through a logger that records the
mapper's messages, that the compatibility probe was conclusive.
@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-stack-4 branch from 37996b3 to cd7e549 Compare November 25, 2026 16:31
@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-stack-5 branch from 9f1998f to ba7a24b Compare November 25, 2026 16:31
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 25, 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

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant