Skip to content

Add consent-gated Android Sentry runtime init#96

Merged
Just-Insane merged 39 commits into
mainfrom
codex/sentry-android-runtime
Jul 9, 2026
Merged

Add consent-gated Android Sentry runtime init#96
Just-Insane merged 39 commits into
mainfrom
codex/sentry-android-runtime

Conversation

@Just-Insane

Copy link
Copy Markdown
Contributor

Summary

  • add the Sentry Android runtime SDK dependency and build-time DSN/env/release fields
  • disable Sentry Android provider auto-init and initialize SentryAndroid from a new CharmApplication only after persisted observability opt-in
  • document the initial Android crash/ANR scope and why Mobile Vitals stay disabled pending a same-session native consent bridge

Verification

  • git diff --check
  • ./node_modules/.bin/tsc --noEmit
  • ./node_modules/.bin/oxfmt --check .
  • ./node_modules/.bin/oxlint . (passes with existing warnings)
  • ./node_modules/.bin/vite build

Android build notes:

  • ./node_modules/.bin/tauri android build --debug --apk --target aarch64 --ci --config '{"build":{"beforeBuildCommand":""}}' progressed into Android Rust compilation, then failed before Gradle/Kotlin on local OpenSSL cross-compilation because aarch64-linux-android-ranlib is not on PATH.
  • ./gradlew :app:compileDebugKotlin -x rustBuildDebug is also blocked locally before app Kotlin compilation because the only installed JDK is OpenJDK 25.0.2, which this Gradle/Kotlin DSL toolchain rejects while configuring buildSrc.

Related to #87.

@Just-Insane Just-Insane marked this pull request as ready for review July 8, 2026 19:38
Copilot AI review requested due to automatic review settings July 8, 2026 19:38
Comment thread src-tauri/gen/android/app/src/main/java/social/cloudhub/charm/CharmApplication.kt Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db8b439609

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src-tauri/gen/android/app/src/main/java/social/cloudhub/charm/CharmApplication.kt Outdated
Comment thread src-tauri/gen/android/app/build.gradle.kts
Comment thread src-tauri/gen/android/app/src/main/java/social/cloudhub/charm/CharmApplication.kt Outdated

Copilot AI 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.

Pull request overview

This PR adds consent-gated Sentry Android runtime initialization so the Android SDK only starts after a persisted observability opt-in is present, while explicitly disabling Sentry’s auto-init ContentProvider path.

Changes:

  • Introduces an Android Application subclass (CharmApplication) that initializes SentryAndroid only when a build-time DSN is present and observability.json indicates sentryEnabled: true.
  • Updates the Android manifest to disable/remove Sentry provider auto-init and wire up the new CharmApplication.
  • Adds Android build-time BuildConfig fields for DSN/environment/release and documents the Android runtime scope/limitations in SENTRY.md.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src-tauri/gen/android/app/src/main/java/social/cloudhub/charm/CharmApplication.kt Adds consent-gated runtime Sentry Android initialization and a beforeSend re-check.
src-tauri/gen/android/app/src/main/AndroidManifest.xml Disables Sentry auto-init providers and sets the app Application class.
src-tauri/gen/android/app/build.gradle.kts Adds Sentry Android dependency and build-time BuildConfig DSN/env/release fields.
SENTRY.md Documents Android runtime initialization behavior and current scope (crash/ANR, no Mobile Vitals).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src-tauri/gen/android/app/build.gradle.kts Outdated
@Just-Insane Just-Insane enabled auto-merge July 8, 2026 20:05
Copilot AI review requested due to automatic review settings July 8, 2026 20:57
Comment thread src-tauri/gen/android/app/src/main/java/social/cloudhub/charm/CharmApplication.kt Outdated

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac01ae01d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/sentry-release-artifacts.yml Outdated
Comment thread .github/workflows/sentry-release-artifacts.yml Outdated
Copilot AI review requested due to automatic review settings July 8, 2026 21:15

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/sentry-release-artifacts.yml Outdated
Copilot AI review requested due to automatic review settings July 8, 2026 21:25
Comment thread .github/workflows/sentry-release-artifacts.yml Outdated

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

.github/workflows/sentry-release-artifacts.yml:59

  • The frontend build expects VITE_SENTRY_DSN (see src/observability/instrument.ts), but this step now sets SENTRY_DSN instead. Since the prior "Configure Sentry release upload" step does not export VITE_SENTRY_DSN into $GITHUB_ENV, the release build will run without a DSN embedded and Sentry will be disabled at runtime.
        env:
          SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
          SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
          SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
          VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}

Copilot AI review requested due to automatic review settings July 8, 2026 21:32
Comment thread src-tauri/gen/android/app/src/main/java/social/cloudhub/charm/CharmApplication.kt Outdated

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread src-tauri/gen/android/app/src/main/java/social/cloudhub/charm/CharmApplication.kt Outdated

Copilot AI 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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src-tauri/gen/android/app/src/main/AndroidManifest.xml Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f3968bf4a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/observability/persistence.ts Outdated
Copilot AI review requested due to automatic review settings July 9, 2026 00:34

Copilot AI 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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 9, 2026 00:39

Copilot AI 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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread SENTRY.md Outdated
Copilot AI review requested due to automatic review settings July 9, 2026 00:46

Copilot AI 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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src/observability/persistence.ts
Copilot AI review requested due to automatic review settings July 9, 2026 00:54

Copilot AI 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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings July 9, 2026 01:01

Copilot AI 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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src-tauri/gen/android/app/src/main/java/social/cloudhub/charm/CharmApplication.kt Outdated
Copilot AI review requested due to automatic review settings July 9, 2026 01:08

Copilot AI 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.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread src-tauri/gen/android/app/src/main/AndroidManifest.xml
Comment thread src-tauri/gen/android/app/src/main/AndroidManifest.xml
@Just-Insane Just-Insane force-pushed the codex/sentry-android-runtime branch from 9e48392 to b1550ba Compare July 9, 2026 01:40

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b1550ba67f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +129 to +132
} catch (error) {
if (isTauri()) {
console.warn("Failed to persist observability settings to the Tauri store", error);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don't report Android opt-out success after store save failure

When Android Sentry has already initialized and the user turns error monitoring off, the only native consent signal in this commit is the persisted observability.json watched by CharmApplication; there is no native IPC update here. If store.set() or store.save() rejects, this catch only logs and lets the settings mutation resolve, so the UI proceeds to close the WebView client while Android's in-memory sentryConsentEnabled remains true from the old file and native crashes/ANRs can still be sent despite the opt-out. Please fail/rollback this opt-out path or update the native gate before reporting success.

Useful? React with 👍 / 👎.

Comment on lines +57 to +59
if (path == null) {
sentryConsentEnabled = false
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Ignore null observer paths instead of disabling consent

Because this observer is attached to the whole app-data/filesDir directory, Android's documented null-path callbacks for the watched directory itself are not evidence that observability.json was deleted or changed. In that scenario this branch flips the consent cache to false, so an opted-in Android session silently drops all later Sentry events until another settings write restores the cache; ignore null/non-store paths or re-read the actual store instead of treating them as opt-out.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants