Skip to content

feat(cli): Write io.sentry.data-collection.user-info in the Android wizard - #2807

Merged
antonis merged 1 commit into
mainfrom
feat/android-wizard-data-collection
Dec 3, 2026
Merged

antonis merged 1 commit into
mainfrom
feat/android-wizard-data-collection

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

This comes from testing sentry wizard android on fresh Android Studio projects, where the wizard writes the deprecated io.sentry.send-default-pii into AndroidManifest.xml (getsentry/sentry-java#6797). sentry-java deprecated sendDefaultPii in 8.59.0, to be removed in 9.0, in favor of dataCollection, whose io.sentry.data-collection.* manifest keys arrived in 8.58.0. With any data-collection key set, the SDK applies the new defaults (user info, cookies with a deny list, HTTP bodies, database query data), so io.sentry.data-collection.user-info=true collects what send-default-pii=true does. SDKs before 8.58.0 silently ignore it.

When each key is written

io.sentry.data-collection.user-info, only when both hold:

  • The wizard added the Sentry Android Gradle Plugin in this run, at the release registry's version, and that version is 6.23.0 or later (the first that installs sentry-android 8.58.0; 6.28.0 installs 8.66.0). If the registry can't be reached, the template's 3.12.0 is written, so this doesn't hold.
  • The app declares no io.sentry:sentry-android, sentry-android-core or sentry-bom older than 8.58.0, in its build.gradle(.kts) or in gradle/libs.versions.toml. The plugin doesn't install the SDK when one is declared. A versionless SDK counts only next to a sentry-bom with a readable version.

io.sentry.send-default-pii otherwise, which works on every 8.x SDK with a deprecation warning: the project already had the plugin (version unknown), a declared SDK is older than 8.58.0, or a declared version can't be read (a variable, a BOM version from a property, a dynamic or rich version, map notation, a version.ref with no [versions] entry).

The comment above the key now says what it collects and links the dataCollection docs. The manifest-user-info-key telemetry tag records which key was written. addGradlePlugin's GradlePluginResult gains addedVersion (the plugin version it wrote, or undefined) so the manifest step knows whether the wizard added the plugin. The [libraries] and [versions] reading lives in version-catalog.ts next to the [plugins] reader (readCatalogLibraries), sharing its line, comment and key parsing.

Open question: catalog entries count whether or not the app module uses them, so an unused old entry falls back to send-default-pii. Should only entries the app references (libs.<alias> or a bundle) count?

via Antonis Lilis.

--

View Session [Sentry]

@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Dec 2, 2026 9:38pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Dec 2, 2026 9:38pm UTC

Request Review

@antonis antonis 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.

The logic matches what we wanted, and FIRST_DATA_COLLECTION_PLUGIN_VERSION = "6.23.0" is right: plugin 6.22.0 installs sentry 8.56.0, and 6.23.0 installs 8.58.0. This PR conflicts with two others, so it should merge after them:

  • #2805 changed addGradlePlugin to return GradlePluginResult (pluginAdded, gradleCheck, gradleOutput). After it merges, add addedVersion to that type instead of replacing it with synced, and keep #2805's handling of a failed ./gradlew.
  • #2804 adds packages/cli/src/lib/wizard/android/version-catalog.ts, which reads the catalog's [plugins] table. Move this PR's [versions] and [libraries] reading (catalogSdks) into that module and share its comment and key parsing, so the repo has one reader for libs.versions.toml, not two.

Once #2804 and #2805 merge: rebase onto main, make those changes, update the tests, and run pnpm run typecheck && pnpm run lint && pnpm run test.

@sentry-junior

sentry-junior Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Will do. #2804 and #2805 are both still open. Once both merge, I'll rebase onto main and make two changes:

Then I'll update the tests, run pnpm run typecheck && pnpm run lint && pnpm run test, and push.

… the SDK reads it

The Android wizard writes io.sentry.data-collection.user-info instead of
the deprecated io.sentry.send-default-pii when it added the Sentry
Android Gradle plugin itself, at 6.23.0 or later, and the app declares no
sentry-android, sentry-android-core or sentry-bom older than 8.58.0 or
with an unreadable version. Otherwise it keeps writing send-default-pii.

GradlePluginResult gains addedVersion for the manifest step, and
version-catalog.ts reads [libraries] and [versions] next to [plugins].
A manifest-user-info-key telemetry tag records which key was written.

Refs getsentry/sentry-java#6797

Co-Authored-By: Antonis Lilis <antonis.lilis@sentry.io>
@antonis
antonis marked this pull request as ready for review December 3, 2026 07:50
@antonis
antonis added this pull request to the merge queue Dec 3, 2026
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Dec 3, 2026
Merged via the queue into main with commit 719b8e8 Dec 3, 2026
33 checks passed
@antonis
antonis deleted the feat/android-wizard-data-collection branch December 3, 2026 07:55

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – cli — c51aab60 Deployed Dec 2, 2026 by vercel[bot]
Preview – sentry-local — c51aab60 Deployed Dec 2, 2026 by vercel[bot]
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