Skip to content

Harden persistent download reliability - #2

Merged
EpiclyRaspberry merged 3 commits into
masterfrom
fix/pr1-download-reliability
Aug 5, 2026
Merged

Harden persistent download reliability#2
EpiclyRaspberry merged 3 commits into
masterfrom
fix/pr1-download-reliability

Conversation

@aShanki

@aShanki aShanki commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

Hardens Launchly's first-stage download reliability without mixing in the larger authentication, APK trust, installer, or release-pipeline redesigns.

  • use a dedicated persistent-download OkHttp client with no whole-call deadline while retaining connect/read-idle timeouts
  • require HTTPS artifact URLs, validate range responses strictly, and bound artifact count plus streamed bytes
  • preflight free storage while accounting for reusable finals and resumable partials
  • reset rejected, oversized, stale, and size-mismatched partial files so retries can restart cleanly
  • atomically promote exact-size completed partials after a crash instead of issuing an invalid end-of-file range request
  • invalidate cached APKs after every validator exception, including malformed-APK parser failures, and retry once when cached finals or partials were involved
  • await encrypted auth restoration before GPlay requests and before sign-in/sign-out/profile mutations
  • replace Room REPLACE with @Upsert so managed-version edits do not cascade-delete download records
  • allow Android 13+ downloads to start when notification permission is denied, with an explanatory snackbar
  • bump the release metadata to version 0.3.0 (versionCode 4)

Verification

Executed locally against Android SDK 35:

./gradlew --no-daemon clean testDebugUnitTest lintDebug assembleDebug assembleDebugAndroidTest :app:verifyReleaseArtifact

Results:

  • 21 JVM tests passed; 0 failures/errors/skips
  • debug APK assembled
  • debug Android-test APK assembled
  • unsigned release artifact verification passed
  • generated debug and release APK manifests report version 0.3.0 / code 4
  • lint: 0 errors, 15 existing dependency/version warnings
  • generated Room DAO uses an UPDATE ... WHERE id = ? adapter for existing managed-version rows rather than delete-and-insert replacement

The connected instrumented tests were compiled but not executed locally because no Android emulator/device is attached. The added Room regression test is included in the Android-test APK.

Review follow-ups handled

Two independent pre-commit reviews identified and this branch fixed:

  • malformed same-size APKs could throw parser exceptions outside ApkValidationException and evade cache invalidation
  • asynchronous auth restoration could overwrite a newer sign-in/sign-out operation
  • a crash after fully writing a partial APK but before its final move could trigger repeated HTTP 416 responses

Out of scope

SHA-256 verification, clean generation-specific staging, official Minecraft signer pinning/lineage, durable downgrade transactions, Ackpine upgrade, and CI/release hardening remain separate follow-up PRs.

@EpiclyRaspberry
EpiclyRaspberry merged commit e1415cb into master Aug 5, 2026
10 checks passed
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