Skip to content

feat(nav3): [Part 2] Add an argument source for encoding back stack entry properties via kotlinx.serialization - #6751

Open
0xadam-brown wants to merge 1 commit into
feat/nav3-serial-name-mappers-8from
feat/nav3-serial-name-mappers-argument-source
Open

0xadam-brown wants to merge 1 commit into
feat/nav3-serial-name-mappers-8from
feat/nav3-serial-name-mappers-argument-source

Conversation

@0xadam-brown

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

Copy link
Copy Markdown
Member

PR Stack (Nav3 SerialNameAndProperties Mapper)

This stack follows the SerialName stack (#6780) and is based on its last PR, #6783.


📜 Description

PR adds KotlinxArgumentSource, the ArgumentSource (see Part 1) that the built-in SerialNameAndProperties mapper (Part 3) uses to turn a back stack entry's kotlinx.serialization properties into Sentry arguments.

ArgumentSanitizer now lets arguments that are an ArgumentSource write themselves, and a source can drop its arguments without a warning when it has already reported the failure itself.

Nothing uses the source yet; Part 3 wires it into SerialNameAndProperties. It was split out of that PR to keep it reviewable.

💡 Motivation and Context

Implements the ArgumentSource discussed in #6705 that we need in order to extract properties from the host app's back stack (via kotlinx.serialization).

addresses: JAVA-787 (link)

💚 How did you test it?

  • Unit tests
  • Manual tests via the Nav3 sample app
  • Clanker stress 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: Add the built-in SerialNameAndProperties mapper.

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

#skip-changelog

@github-actions

github-actions Bot commented Nov 24, 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 81bf950

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit 81bf950.

Main concerns: data sent to Sentry, host performance, reach.

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

@sentry

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

@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-mappers-argument-source branch from 849c9d0 to ef7030c Compare December 1, 2026 01:31
@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-mappers-8 branch from f4a7b52 to d6095b5 Compare December 1, 2026 01:31
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Dec 1, 2026
@0xadam-brown 0xadam-brown changed the title feat(nav3): [Part 4] Add a lazily encoding argument source for kotlinx properties feat(nav3): [Part 2] Add a lazily encoding argument source for kotlinx properties Dec 1, 2026
@0xadam-brown
0xadam-brown marked this pull request as ready for review December 1, 2026 01:49
@0xadam-brown
0xadam-brown requested review from a team and adinauer as code owners December 1, 2026 01:49
@0xadam-brown
0xadam-brown requested review from markushi and runningcode and removed request for a team December 1, 2026 01:49
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Dec 1, 2026
Add KotlinxArgumentSource, the arguments the SerialNameAndProperties
mapper will return. It encodes an entry's properties only when they're
read or written, so an entry whose arguments the update's budget has
already ruled out isn't encoded at all. Read as a map, it encodes once and
caches the result; written to the sanitizer's sink, it encodes against
the update's shared budget.

ArgumentSanitizer now lets arguments that are an ArgumentSource write
themselves, and a source can drop its arguments without a warning when it
has reported the failure itself. Add the encoding_failed drop reason for
entries whose properties can't be encoded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@0xadam-brown 0xadam-brown changed the title feat(nav3): [Part 2] Add a lazily encoding argument source for kotlinx properties feat(nav3): [Part 2] Add an argument source for encoding back stack entry properties using kotlinx.serialization Dec 1, 2026
@0xadam-brown 0xadam-brown changed the title feat(nav3): [Part 2] Add an argument source for encoding back stack entry properties using kotlinx.serialization feat(nav3): [Part 2] Add an argument source for encoding back stack entry properties via kotlinx.serialization Dec 1, 2026
@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-mappers-argument-source branch from ef7030c to 81bf950 Compare December 1, 2026 10:01
@0xadam-brown
0xadam-brown force-pushed the feat/nav3-serial-name-mappers-8 branch from d6095b5 to 7e35dad Compare December 1, 2026 10:01
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Dec 1, 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.

LGTM! Just one comment below!

private val backStackEntry: Any,
private val serializer: KSerializer<Any>,
private val onFailure: (Throwable) -> Unit,
) : AbstractMap<String, Any?>(), ArgumentSource {

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.

So my clanker tells me that SentryBackStackEntry.equals and hashCode delegate to arguments. This means that comparing two entries or putting one in a HashSet now runs the app's serializers on whatever thread we're currently on.
The issue is that the java spec says that equals shouldn't have side effects!

My clanker thinks the code could be vastly simplified if we removed the laziness here.

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.

2 participants