Repository navigation
ref(nav3): [Part 1] Share bounded argument conversion - #6702
0xadam-brown wants to merge 1 commit into
Conversation
PR risk: mediumFor commit Main concerns: data sent to Sentry, host performance, reach. This label is a hint for reviewers, not an approval. |
📲 Install BuildsAndroid
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d03d53a. Configure here.
d03d53a to
b5f3e56
Compare
00922da to
dda2831
Compare
b5f3e56 to
1d6fccd
Compare
1d6fccd to
fcdfd79
Compare
dda2831 to
a119f33
Compare
fcdfd79 to
c5cc387
Compare
| private fun drop(drop: DropArguments): SanitizedArguments { | ||
| if (drop.reason.exhaustsUpdateBudget) { | ||
| dropReason = drop.reason | ||
| } | ||
| } | ||
|
|
||
| private fun exit(container: Any) { | ||
| activeContainers.remove(container) | ||
| } | ||
|
|
||
| /** | ||
| * Control-flow signal to abort sanitization of the current subtree. Internal to | ||
| * [ArgumentSanitizer]. | ||
| * | ||
| * [reason] distinguishes entry-local drops from update-wide budget exhaustion. Overrides | ||
| * [fillInStackTrace] to skip stack-trace capture. | ||
| */ | ||
| private class DropSubtree(val warning: String, val reason: ArgumentDropReason) : | ||
| RuntimeException() { | ||
| override fun fillInStackTrace(): Throwable = this | ||
| } | ||
|
|
||
| companion object { | ||
|
|
||
| const val MAX_CHARACTER_WARNING = | ||
| "Nav3 back stack update exceeded the argument character limit. Dropping arguments for " + | ||
| "this and older entries." | ||
|
|
||
| const val MAX_COUNT_WARNING = | ||
| "Nav3 back stack update exceeded the argument value limit. Dropping arguments for this " + | ||
| "and older entries." | ||
|
|
||
| const val STRUCTURE_WARNING = | ||
| "Nav3 argument sanitization failed (possibly cyclic or too deeply nested). Dropping this " + | ||
| "entry's arguments." | ||
| drop.warning?.let { logger.log(WARNING, it) } | ||
| return SanitizedArguments(emptyMap(), drop.reason) | ||
| } | ||
| } |
There was a problem hiding this comment.
Catch parameter drop shadows the handler and fails compilation
In sanitizeEntry, the DropArguments catch parameter shadows the drop handler, so drop(sink.failure ?: drop) attempts to invoke the exception value and prevents the module from compiling. Rename the catch parameter or qualify the handler call.
Evidence
BackStackConverter.convert()reachesArgumentSanitizer.sanitizeEntry()for mapped arguments.- In
sanitizeEntry(), the catch parameter nameddropis in scope at the calldrop(sink.failure ?: drop). - The handler is a separate member function,
private fun drop(drop: DropArguments), andDropArgumentshas noinvokeoperator; the catch call therefore fails compilation.
Identified by Warden · code-review · L53-F55

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
ArgumentSource<>ArgumentSinkpair 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:
BackStackEntryMapper; orBackStackEntryMapper.SerialNameorBackStackEntryMapper.SerialNameAndProperties).As mentioned above, the new
ArgumentSourceandArgumentSinktypes let custom and built-in mappers apply different processing procedures, while sending the outputs of both through the shared sink pipeline. (Later PRs will take advantage of the source's ability to apply different processing policies).Here are the moving parts:
addresses: JAVA-787 (link)
💚 How did you test it?
Nav3 release build and unit tests passed. Repository-wide
make format api, Spotless checks, ABI validation, and Detekt passed.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Continue with Part 2: Add the built-in SerialName mapper.
#skip-changelog