fix(compose): Publish the foundation-layout floor SentryTraced needs - #6071
Draft
runningcode wants to merge 2 commits into
Draft
fix(compose): Publish the foundation-layout floor SentryTraced needs#6071runningcode wants to merge 2 commits into
runningcode wants to merge 2 commits into
Conversation
SentryTraced calls Box, an inline composable, so BoxKt.maybeCachedBoxMeasurePolicy
ends up baked into sentry-compose's own bytecode. That method only exists from
foundation-layout 1.7.0, yet androidMain reaches the class transitively through
compileOnly(material3), so the published metadata named no compose dependency at
all. A consumer resolving foundation-layout 1.6.x got a NoSuchMethodError with
nothing to warn them.
Publish a dependency constraint rather than a dependency, so apps that never touch
SentryTraced are not pulled onto compose.
Our own build had the same skew. The catalog asked for 1.6.3 while the unit test
runtime only reached 1.7.0 by way of an unrelated androidx constraint on
foundation ("prevents a regression in Overscroll"), one that navigation 2.4.2's
request for 1.0.1 was quietly losing to. Raise the catalog to 1.7.0 and navigation
to 2.8.0, the first release that stops asking for compose 1.0.1, so the resolved
version is the one we declare. The androidUnitTest foundation dependency added in
#6057 only existed to drag that constraint onto the test graph.
📲 Install BuildsAndroid
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
SentryTracedcallsBox, an inline composable, soBoxKt.maybeCachedBoxMeasurePolicyis baked intosentry-compose's own bytecode:That method only exists from
foundation-layout1.7.0 (1.6.3 hasrememberBoxMeasurePolicy, 1.5.4 also hasboxMeasurePolicy). ButandroidMainreaches the class transitively throughcompileOnly(material3), so the published POM declares no compose dependency at all - onlysentry,sentry-android-navigationandlifecycle-common-java8.This PR:
foundation-layout:1.7.0fromsentry-compose. A constraint rather than a dependency, so apps that never touchSentryTracedare not pulled onto compose. It lands in both the GMM (releaseApiElements-publishedandreleaseRuntimeElements-published) and the POM as<dependencyManagement>.androidxCompose1.6.3 -> 1.7.0 so the catalog states the version we actually resolve.androidxNavigation2.4.2 -> 2.8.0, the first release that stops requesting compose1.0.1.implementation(libs.androidx.compose.foundation)fromsentry-compose'sandroidUnitTest, added in fix(compose): Stop SentryTraced from reusing stale parent spans #6057 purely to drag the androidx constraint onto the test graph. The tests only useandroidx.compose.foundation.layout.*.One limit worth knowing: a consumer that
strictlypinsfoundation-layoutbelow 1.7.0 still wins (Gradle reports it as "By ancestor") and is back to aNoSuchMethodError. Nothing publishable can override a root-level strict pin. The constraint covers plain version requests, which is the case that actually bites. The POM's<dependencyManagement>entry is likewise decorative for Maven consumers, since Maven does not inherit dependency management from a transitive dependency's POM — not a concern for Android consumers, who are all on Gradle.💡 Motivation and Context
A consumer resolving
foundation-layout1.6.x hitsNoSuchMethodErrorat runtime, with nothing in our metadata to warn them.Our own build had the same latent skew - three versions across three classpaths of one module:
releaseCompileClasspathreleaseUnitTestCompileClasspathreleaseUnitTestRuntimeClasspathThe catalog's 1.6.3 was only a request, and it kept losing. The runtime 1.7.0 came from an unrelated androidx constraint published by
compose-uionfoundation(reason: "prevents a regression in Overscroll"), which lives inreleaseRuntimeElements-publishedonly - hence runtime lifted, compile did not.foundation-layoutthen followed via the atomic-group constraint. That accident is what keptSentryTracedTestgreen; nothing in our build asked for it, andnavigation:2.4.2's request for1.0.1was pushing the other way.dependencyInsightnow names our own reason instead:1.7.0 is a truthful floor: every
foundation-layoutsymbol the built AAR references (maybeCachedBoxMeasurePolicy,rowMeasurePolicy,SpacerKt.Spacer,Arrangement,BoxScopeInstance,RowScopeInstance) resolves against the 1.7.0 jar with matching descriptors, even though the main compile classpath is still 1.8.1 viamaterial3:1.4.0.💚 How did you test it?
Unit tests for
sentry-compose,sentry-android-navigation,sentry-android-coreandsentry-android-replay; assembled the Android sample and both UI-test apps against the new navigation and compose versions; lint and detekt onsentry-compose.apiDumpproduced no changes.Published to
mavenLocaland resolved from a throwaway AGP 9.2.1 consumer with two build types and two product flavors, to confirm the constraint behaves per-variant:freeImplementation1.6.3 /paidImplementation1.8.1androidx.composeon the graph; constraint inertstrictly("1.6.3")The published variants carry no
BuildTypeAttror flavor attributes, so a consumer'sdebugand flavored variants all match the single publishedreleasevariant and pick up the constraint.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
The main compile classpath still resolves
foundation-layout1.8.1 throughmaterial3:1.4.0while we declare a 1.7.0 floor. That is safe today, but a Compose BOM would collapseandroidxCompose,material3,material-iconsandui-test-junit4into one number and remove the class of problem - out of scope here.