Skip to content

feat(android): integrate Lumen Crash SDK and upgrade all dependencies - #5

Merged
Chloemlla merged 4 commits into
mainfrom
feat/lumen-crash-sdk-and-deps
Aug 13, 2026
Merged

feat(android): integrate Lumen Crash SDK and upgrade all dependencies#5
Chloemlla merged 4 commits into
mainfrom
feat/lumen-crash-sdk-and-deps

Conversation

@Chloemlla

@Chloemlla Chloemlla commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Integrate com.chloemlla.lumen:lumen-crash for crash reporting + startup ANR protection, resolving the latest release dynamically (never hardcoded):
    • android/settings.gradle.kts: stage SDK artifacts in android/local-maven, gate GitHub Packages repo behind non-empty gpr.user/gpr.key
    • android/app/build.gradle.kts: version resolution chain lumenCrashVersion property → LUMEN_CRASH_VERSION env → lumen-crash.resolved.version file → error
    • new .github/scripts/fetch-lumen-crash-sdk.py: fetch latest non-draft lumen-crash-v* release assets into local-maven with sha256 validation
    • CI resolves/stages the SDK before unit tests, lint, and release build; policy script updated
    • Runtime: enable ANR + startup-hang watchdogs, call markStartupComplete() after first frame
  • Upgrade all Android deps to latest stable: AGP 8.13.2→9.3.1, Compose BOM 2024.12.01→2026.08.00, core-ktx 1.19.0, lifecycle 2.11.0, security-crypto 1.1.0, credentials 1.6.0, googleid 1.2.0, play-services-auth 21.6.0, okhttp 5.4.0, mmkv 2.4.1, camera 1.6.1, org.json 20260719. AGP 9 enables built-in Kotlin (KGP 2.2.10) so org.jetbrains.kotlin.android plugin is dropped.

Test plan

  • gradle testProductionDebugUnitTest passes in CI
  • gradle lintProductionDebug passes in CI
  • gradle assembleProductionRelease assembleLegacyRelease builds in CI
  • Policy checks pass (fetch script, local-maven, env wiring)

Summary by CodeRabbit

  • 新功能
    • 集成并升级 Lumen Crash SDK,支持自动解析、缓存和校验版本。
    • 新增应用启动完成标记,并启用 ANR 与启动卡顿监控。
  • 改进
    • 更新 Android 构建工具及多项核心依赖,提升构建稳定性与兼容性。
    • 优化 SDK 版本配置和本地资源管理,构建过程缺少有效版本时会明确失败。
  • 文档
    • 补充 Lumen Crash SDK 的集成方式、版本来源及配置说明。

Adopt com.chloemlla.lumen:lumen-crash for crash reporting and startup ANR
protection, resolving the latest release instead of hardcoding a version:

- settings.gradle.kts: stage SDK artifacts in android/local-maven and gate the
  GitHub Packages repo behind non-empty gpr.user/gpr.key credentials
- app/build.gradle.kts: resolve lumenCrashVersion via gradle property ->
  LUMEN_CRASH_VERSION env -> lumen-crash.resolved.version file -> error
- .github/scripts/fetch-lumen-crash-sdk.py: fetch the latest non-draft
  lumen-crash-v* release from Chloemlla/Project-Lumen into local-maven with
  sha256 checksum validation
- workflow: resolve/stage the SDK before unit tests, lint, and release build
- policy script: assert the new dependency line, fetch script, and env wiring
- runtime: enable ANR + startup-hang watchdogs and mark startup complete
  after the first rendered frame
- docs: document the SDK integration in android/README.md
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Chloemlla, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 103 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 85629fb5-672d-4e27-8345-2d7cf66d130c

📥 Commits

Reviewing files that changed from the base of the PR and between 123801c and 2b1c4a8.

📒 Files selected for processing (2)
  • android/build.gradle.kts
  • android/settings.gradle.kts
📝 Walkthrough

Walkthrough

新增 Lumen Crash SDK 的版本解析和 Maven artifact 暂存流程。Android 构建从 Gradle 属性、环境变量或解析文件读取版本。CI 传递该版本并执行策略校验。应用新增启动完成、ANR 和启动卡顿监控配置。

Changes

Lumen Crash SDK 集成

Layer / File(s) Summary
SDK 版本解析与资源暂存
.github/scripts/fetch-lumen-crash-sdk.py
脚本解析最新或指定 release,下载并缓存 Maven artifacts,校验 SHA-256,并写入 lumen-crash.resolved.version
Gradle 仓库与版本集成
android/build.gradle.kts, android/settings.gradle.kts, android/app/build.gradle.kts, android/.gitignore
Android 构建使用本地 Maven 仓库和解析版本。GitHub Packages 仅在凭据完整时注册。AGP、Compose、AndroidX、网络、CameraX、MMKV 和测试依赖升级。
应用启动与运行时监控
android/app/src/main/java/com/chloemlla/synapse/mobile/MainActivity.kt, android/app/src/main/java/com/chloemlla/synapse/mobile/SynapseApplication.kt, android/README.md
首帧绘制后调用 LumenCrash.markStartupComplete()。应用启用 ANR watchdog 和启动卡顿 watchdog。README 增加集成说明。
CI 注入与策略校验
.github/workflows/synapse-android.yml, .github/scripts/validate-synapse-android-policy.py
CI 获取 SDK 并设置 LUMEN_CRASH_VERSION。测试、lint 和 release APK 构建使用该环境变量。策略脚本检查 SDK 获取、仓库、版本和工作流配置。

Estimated code review effort: 4 (Complex) | ~45 minutes

Mergeability Score: 🔴 Critical · up to 12380

The Android build currently cannot configure because the repository credential condition is not valid Kotlin, and the SDK staging flow can continue with missing or mismatched checksums, potentially using an unverified artifact. Merge should be blocked until the build configuration and checksum validation are corrected.

Sequence Diagram(s)

sequenceDiagram
  participant CI
  participant GitHub
  participant FetchScript
  participant Gradle
  CI->>FetchScript: 执行 SDK 获取脚本
  FetchScript->>GitHub: 获取 release 和 Maven artifacts
  FetchScript->>CI: 写入 LUMEN_CRASH_VERSION
  CI->>Gradle: 传递 LUMEN_CRASH_VERSION
  Gradle->>Gradle: 解析依赖并构建 Android 目标
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了 Lumen Crash SDK 集成和 Android 依赖升级这两项主要变更。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/lumen-crash-sdk-and-deps

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- AGP 8.13.2 -> 9.3.1; Compose BOM 2024.12.01 -> 2026.08.00
- AGP 9 enables built-in Kotlin (KGP 2.2.10), so drop the
  org.jetbrains.kotlin.android plugin and the kotlin.jvmToolchain helper
  (jvmTarget follows compileOptions, already VERSION_21)
- core-ktx 1.19.0, lifecycle 2.11.0, security-crypto 1.1.0,
  credentials 1.6.0, googleid 1.2.0, play-services-auth 21.6.0,
  okhttp 5.4.0, mmkv 2.4.1, camera 1.6.1, org.json 20260719

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/scripts/fetch-lumen-crash-sdk.py:
- Around line 81-85: Update the checksum validation in the download/verification
flow to fail immediately when checksums.get(path.name) is missing or
sha256_hex(path.read_bytes()) differs from the expected value, instead of
printing warnings. In the checksum-file handling around the version-processing
logic and checksum output, use a version-specific directory or filename so
releases cannot reuse the shared local-maven/checksums.txt.

In `@android/settings.gradle.kts`:
- Around line 12-17: 在 settings.gradle.kts 的仓库配置中,将 LumenCrashLocal 放到
mavenCentral() 之前,或用 exclusiveContent 将 com.chloemlla.lumen 固定到该本地仓库;同时将 gprUser
和 gprKey 的凭据条件改为 Kotlin 支持的显式非空判断,确保配置可编译。

Apply the same fix in `@android/settings.gradle.kts` at line 20.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7c6492ae-1523-44dc-a545-eb56990e6d00

📥 Commits

Reviewing files that changed from the base of the PR and between 740775c and 123801c.

📒 Files selected for processing (10)
  • .github/scripts/fetch-lumen-crash-sdk.py
  • .github/scripts/validate-synapse-android-policy.py
  • .github/workflows/synapse-android.yml
  • android/.gitignore
  • android/README.md
  • android/app/build.gradle.kts
  • android/app/src/main/java/com/chloemlla/synapse/mobile/MainActivity.kt
  • android/app/src/main/java/com/chloemlla/synapse/mobile/SynapseApplication.kt
  • android/build.gradle.kts
  • android/settings.gradle.kts
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Build signed release APK
🧰 Additional context used
🪛 ast-grep (0.45.1)
.github/scripts/fetch-lumen-crash-sdk.py

[warning] 42-42: Request-controlled URL passed to urlopen; validate against an allowlist to prevent SSRF.
Context: urllib.request.urlopen(request, timeout=60)
Note: [CWE-918] Server-Side Request Forgery (SSRF).

(urlopen-unsanitized-data)

🪛 GitHub Actions: Build Synapse Android / 0_Build signed release APK.txt
android/settings.gradle.kts

[error] 16-16: Gradle script compilation failed during 'gradle testProductionDebugUnitTest --no-daemon --warning-mode all': unresolved reference 'resolve' in 'layout.settingsDirectory.resolve("local-maven")'.


[error] 20-20: Gradle script compilation failed: 'gprUser && gprKey' uses String values as Boolean conditions; both conditions have a type mismatch.

🪛 GitHub Actions: Build Synapse Android / Build signed release APK
android/settings.gradle.kts

[error] 16-16: Gradle script compilation failed in 'gradle testProductionDebugUnitTest --no-daemon --warning-mode all': unresolved reference 'resolve' in 'layout.settingsDirectory.resolve("local-maven")'.


[error] 20-20: Gradle script compilation failed: 'gprUser && gprKey' uses String values where Boolean operands are required.

🪛 LanguageTool
android/README.md

[uncategorized] ~30-~30: The official name of this software platform is spelled with a capital “H”.
Context: ...rt UI). The version is never hardcoded: .github/scripts/fetch-lumen-crash-sdk.py resol...

(GITHUB)

🪛 Ruff (0.16.1)
.github/scripts/fetch-lumen-crash-sdk.py

[error] 42-42: Audit URL open for permitted schemes. Allowing use of file: or custom schemes is often unexpected.

(S310)


[error] 43-43: Audit URL open for permitted schemes. Allowing use of file: or custom schemes is often unexpected.

(S310)


[warning] 45-46: try-except within a loop incurs performance overhead

(PERF203)

🔇 Additional comments (8)
android/build.gradle.kts (1)

2-4: LGTM!

android/app/build.gradle.kts (1)

5-6: LGTM!

Also applies to: 154-194

android/.gitignore (1)

7-9: LGTM!

android/app/src/main/java/com/chloemlla/synapse/mobile/MainActivity.kt (1)

11-20: LGTM!

Also applies to: 58-61

android/app/src/main/java/com/chloemlla/synapse/mobile/SynapseApplication.kt (1)

56-60: LGTM!

android/README.md (1)

26-33: LGTM!

.github/scripts/validate-synapse-android-policy.py (1)

56-66: LGTM!

.github/workflows/synapse-android.yml (1)

48-53: 🩺 Stability & Availability

无需更换暂存步骤的令牌

Chloemlla/Project-Lumen 是公开仓库,release 资产可公开下载。暂存步骤使用 secrets.GITHUB_TOKEN 可以访问这些资产。

			> Likely an incorrect or invalid review comment.

Comment on lines +81 to +85
expected = checksums.get(path.name)
if expected is None:
print(f"warning: no checksum entry for {path.name}", file=sys.stderr)
elif sha256_hex(path.read_bytes()) != expected:
print(f"warning: sha256 mismatch for {path.name}", file=sys.stderr)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

对校验和失败进行硬失败,并按版本保存校验和文件。

Line 83 和 Line 85 只输出警告,因此缺失或不匹配的 SHA-256 不会阻止构建使用已下载的 AAR。
Line 105 还会复用所有版本共享的 local-maven/checksums.txt。解析第二个 release 时,旧校验和文件通常不包含新文件名,脚本只输出警告并写入新版本。
请在缺少条目或哈希不匹配时抛出错误,并将校验和文件存储在版本专属目录中。

Also applies to: 104-107

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/fetch-lumen-crash-sdk.py around lines 81 - 85, Update the
checksum validation in the download/verification flow to fail immediately when
checksums.get(path.name) is missing or sha256_hex(path.read_bytes()) differs
from the expected value, instead of printing warnings. In the checksum-file
handling around the version-processing logic and checksum output, use a
version-specific directory or filename so releases cannot reuse the shared
local-maven/checksums.txt.

Comment thread android/settings.gradle.kts
AGP 9's built-in Kotlin bundles KGP 2.2.10, whose compiler can only read
metadata up to 2.3.0. The lumen-crash SDK (0.1.0-a76cae4d) is compiled with
Kotlin 2.4.0 (kotlin-stdlib 2.4.10), so the metadata mismatch broke the whole
app module with Unresolved reference / Incompatible classes errors.

Raise the built-in Kotlin compiler to 2.4.10 by declaring the higher KGP on
the build classpath (the documented AGP 9 override mechanism) and bump the
org.jetbrains.kotlin.plugin.compose version to match (2.4.10). org.jetbrains.
kotlin.android is intentionally not applied: it is incompatible with the AGP 9
DSL when built-in Kotlin is enabled.
@Chloemlla
Chloemlla merged commit 5100cf7 into main Aug 13, 2026
3 checks passed
@Chloemlla
Chloemlla deleted the feat/lumen-crash-sdk-and-deps branch August 13, 2026 05:08
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.

1 participant