Skip to content

ref(nav3): [Part 6] Share bounded argument conversion - #6702

Draft
0xadam-brown wants to merge 2 commits into
feat/nav3-serial-name-mappers-5from
feat/nav3-serial-name-mappers-6
Draft

0xadam-brown wants to merge 2 commits into
feat/nav3-serial-name-mappers-5from
feat/nav3-serial-name-mappers-6

Conversation

@0xadam-brown

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

Copy link
Copy Markdown
Member

PR Stack (Nav3 Serial Name Mappers)


📜 Description

PR introduces the ArgumentSource <> ArgumentSink pair that lets us support differentiated processing on the source side (the host app's logic vs built-in mapper logic) but uniform processing on the sink side (argument pruning, protecting against constraint violation, and argument tree materialization). Absent that pair, we'd have to duplicate the latter for our built-in mappers, causing them to processing the argument tree twice.

💡 Motivation and Context

With Nav3, host apps manage their own nav back stack, which they implement as a list of arbitrarily typed entries. In order to be displayed in Sentry, each of those entries has to be mapped to a Sentry name (e.g., ProductDetailScreen) and zero or more arguments (e.g., productId). There are two ways for host apps to provide us with those mappings:

  1. via a custom BackStackEntryMapper; or
  2. via one of the own built-in mappers introduced by this PR stack (viz., BackStackEntryMapper.SerialName or BackStackEntryMapper.SerialNameAndProperties).

As mentioned above, the new ArgumentSink and ArgumentSource types let custom and built-in mappers apply different processing procedures, while sending the outputs of both through the shared sink pipeline. (Fyi, we accept custom mapper output as-is, but we filter built-in mapper properties through Sentry's sensitive denylist.)

Here are the moving parts:

                    ArgumentSource
       Custom mapper              Built-in mappers
  ┌────────────────────┐        ┌──────────────────┐
  │ HostArgumentSource │        │ KotlinxArguments │
  │  (plain host map)  │        │ (drives encoder) │
  └────────┬───────────┘        └────────┬─────────┘
           │                             │ via
           │        KotlinxPropertiesEncoder + SensitiveKeyFilter
           │                             │
           └──────────────┬──────────────┘
                          ▼
          ┌───────────────────────────────┐
          │         ArgumentSink          │
          └───────────────────────────────┘
                          ▲  sole impl
          ┌───────────────┴───────────────┐
          │      TreeArgumentWriter       │
          │                               │           ┌────────────────┐
          │   Enforce + materialize:      │ spends ──▶│ ArgumentBudget │
          │   • builds the argument tree  │           └────────────────┘
          │   • prevents constraint       │           ┌────────────────┐
          │      violation (e.g., cycles) │ throws ──▶│ DropArguments  │
          └───────────────────────────────┘           └────────────────┘

  Note: BackStackConverter.ArgumentSanitizer owns the ArgumentBudget and
  selects the ArgumentSource based on what the host app provides.

addresses: JAVA-787 (link)

💚 How did you test it?

Nav3 release build and all 561 unit tests passed. Repository-wide make format api, Spotless checks, ABI validation, and Detekt passed.

📝 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 PR 7: Add the SerialName 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 20, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit d03d53a.

Main concerns: data sent to Sentry, dependencies customers inherit, reach.

Rules that block low also fired:

  • R1: code was truncated, omitted or a reduced context was used: sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/internal/backstack/TreeArgumentWriterTest.kt
  • R6: build or release configuration changed: sentry-android-navigation3/build.gradle.kts

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

@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 20, 2026
@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.0 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 20, 2026
@0xadam-brown 0xadam-brown changed the title ref(nav3): [Nav3 Mappers 6] Share bounded argument conversion ref(nav3): [Part 6] Share bounded argument conversion Nov 20, 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