Skip to content

fix(release): preserve runtime contracts and verify optimized artifacts - #1106

Merged
ashwkun merged 4 commits into
masterfrom
one/release-worker-construction
Oct 9, 2026
Merged

ashwkun merged 4 commits into
masterfrom
one/release-worker-construction

Conversation

@ashwkun

@ashwkun ashwkun commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Summary

Optimized releases could post a new-episode alert but fail before WorkManager started its download or artwork-hydration job because an input-merger constructor was removed. Preserve runtime reflection contracts explicitly and check the actual optimized APK and app bundle before publication.

Motivation

Debug and JVM release tests use classes before R8 optimization, so they cannot detect missing runtime constructors, erased reflection metadata or removed resources in the shipped app.

What changed

  • Retain WorkManager input-merger and worker constructors, persisted names and permanent component aliases.
  • Replace blanket package keeps with scoped Retrofit, Gson, serializer and storage contracts; enable resource shrinking with explicit retention of dynamic artwork, the Android Auto font and notification chimes.
  • Include the debug App Check SDK only in debug builds, preserving Play Integrity in release and warning/error diagnostics.
  • Add an optional unsigned optimized-release preflight and guard both signed publication paths. Verify constructors, JSON field names and generic types, TypeTokens, Retrofit annotations, dynamic serializers, manifest providers, Room implementations and dynamic resources in APK/AAB artifacts.
  • Add regression coverage for removed constructors, generic erasure, missing or corrupted resources, development-only components and publication wiring.
  • Document a scoped maintainer exception for explicitly authorized status-check bypasses; review requirements continue to apply.

Behavior & compatibility

  • Existing worker/service identities, JSON field names, databases, notification channels, FCM payloads, deep links and public RSS identifiers are preserved.
  • Notification and auto-download preferences, cloud-restore cutoffs and download eligibility are unchanged.
  • Resource retention includes both custom notification sounds without resetting channels or user settings.
  • Failed artifact checks stop publication and retain diagnostics. Device testing remains necessary for SDK behavior and background-delivery timing.

Impact

  • user-impact-critical
  • user-impact-high
  • user-impact-medium
  • user-impact-low
  • no-user-impact
  • backend-change

Listener impact

Fixes a release-build issue that could prevent automatic and Smart downloads from starting. The optimized app package is smaller while retaining its artwork, fonts and notification sounds.

Release copy

CHANGELOG.md

Fixed

  • Preserve WorkManager input-merger constructors in optimized releases so one-time download and notification-hydration work can start.

Changed

  • Replace blanket R8 keeps with scoped reflection and storage contracts, enable resource shrinking with dynamic-resource retention, and exclude the debug App Check SDK from release builds.

Added

  • Validate optimized APK and app bundle contracts before publication, with an optional manual preflight and fast PR regression coverage for constructors, JSON metadata, serializers, providers and dynamically loaded resources.

README What's New / Upcoming

Critical

  • Fixed a release-build issue that could prevent automatic and Smart downloads from starting.

Improvements

  • Smaller app download while retaining artwork, fonts and notification sounds.

Test plan

  • Hermetic Python suite: 58 tests passed, including missing constructor, erased generic-field metadata and corrupted sound-payload regressions.
  • Debug JVM suites, architecture/dependency checks and coverage verification passed locally.
  • Detekt, ktlint and Android release lint passed locally.
  • Signed APK/AAB passed optimized-artifact validation locally; the unsigned CI build path was also exercised during the audit.
  • Signed release installed: Home and show details load, manual download starts, and a new-episode notification plays its custom sound.
  • Remote CI and reviews on this PR.
  • Required checks are green before merge, or a maintainer explicitly authorized a check bypass for this PR.

Notes

  • Local comparison after retaining both chimes: APK 30.0 MB → 24.2 MB (19.2% smaller); DEX 17.0 MB → 12.9 MB (23.9% smaller). Startup speed and memory usage were not benchmarked.
  • Live automatic-download execution for an episode published after cloud restore remains a device QA step; the tests used existing episodes, whose eligibility rules are unchanged.
  • Full optimized-artifact validation is mandatory before publication and available as a manual preflight. PR CI runs fast hermetic regression tests without an additional optimized build. Repository protection settings are unchanged.

@ashwkun ashwkun added the user-impact-critical Critical listener-facing fix — leads README/changelog; PR release-copy used verbatim label Oct 9, 2026
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: boxcreate/boxlore/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 78bc482c-72de-4e6b-bf4d-7ae56d9a8811

📥 Commits

Reviewing files that changed from the base of the PR and between 13b7131 and 6582260.


📒 Files selected for processing (25)
  • .github/PULL_REQUEST_TEMPLATE.md
  • .github/scripts/release_classfile.py
  • .github/scripts/release_dex.py
  • .github/scripts/release_verification.init.gradle
  • .github/scripts/test_release_contracts.py
  • .github/scripts/verify_release_contracts.py
  • .github/workflows/changelog-on-merge.yml
  • .github/workflows/release-contracts.yml
  • AGENTS.md
  • ARCHITECTURE.md
  • app/README.md
  • app/build.gradle.kts
  • app/dependencies/releaseRuntimeClasspath.txt
  • app/proguard-rules.pro
  • app/src/debug/java/cx/aswin/boxlore/AppCheckProviderInstaller.kt
  • app/src/main/java/cx/aswin/boxlore/BoxLoreApplication.kt
  • app/src/main/res/raw/boxlore_resource_keep.xml
  • app/src/release/java/cx/aswin/boxlore/AppCheckProviderInstaller.kt
  • core/catalog/README.md
  • core/database/README.md
  • core/model/README.md
  • core/network/README.md
  • core/ranking/README.md
  • docs/TESTING.md
  • scripts/README.md

💤 Files with no reviewable changes (1)
  • app/dependencies/releaseRuntimeClasspath.txt

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.



📝 Summary

Summary by CodeRabbit

  • Release Reliability
    • Added automated checks for optimized APK and app bundle contents, including app components, data models, APIs, and required resources. Release workflows retain diagnostic reports when checks fail.
    • Release builds now shrink resources while preserving resources needed for onboarding, notifications, and other app features.
  • Security
    • The App Check debug provider is limited to debug builds; release builds use Play Integrity.
  • Documentation
    • Added guidance on release validation and device testing, including checks for upgrades, data compatibility, playback, and widgets.
  • Workflow
    • A maintainer may authorize bypassing required checks for a specific PR, with remaining checks and known risks reported first.

Walkthrough

The PR enables narrower release optimization, adds checks for class, DEX, and resource contracts in optimized APK/AAB artifacts, and integrates those checks into pull-request and publication workflows. It also updates merge guidance for a maintainer-authorized required-check bypass.

Changes

Optimized release contracts

Layer / File(s) Summary
Release optimization and variant setup
ARCHITECTURE.md, app/build.gradle.kts, app/dependencies/releaseRuntimeClasspath.txt, app/proguard-rules.pro, app/src/.../AppCheckProviderInstaller.kt, app/src/main/java/cx/aswin/boxlore/BoxLoreApplication.kt, app/src/main/res/raw/boxlore_resource_keep.xml
Release builds enable resource shrinking and use targeted keep rules and resource declarations. The debug App Check provider is debug-only, and variant-specific helpers install the debug or Play Integrity provider.
Class-file and DEX readers
.github/scripts/release_classfile.py, .github/scripts/release_dex.py
New parsers read project class metadata and DEX data, inspect archive entries, and apply R8 mappings.
Optimized artifact validation
.github/scripts/verify_release_contracts.py
The verifier checks runtime, reflection, serializer, manifest, and resource contracts in optimized artifacts. It reports failures and can write a JSON report.
Workflow integration and validation coverage
.github/scripts/test_release_contracts.py, .github/scripts/release_verification.init.gradle, .github/workflows/*, app/README.md, core/*/README.md, docs/TESTING.md, scripts/README.md
Pull-request and publication workflows build and verify release artifacts and retain diagnostics. Tests cover contract and parser checks; documentation describes validation commands, coverage, and device-testing limits.

Required-check bypass guidance

Layer / File(s) Summary
Specific-PR bypass instructions
.github/PULL_REQUEST_TEMPLATE.md, AGENTS.md, docs/TESTING.md
Required checks remain the default. A maintainer may authorize a bypass for a specific PR after remaining checks and known risks are reported.

Priority: ⬆️ High

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

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant ReleaseContractsWorkflow
  participant GradleReleaseBuild
  participant verify_release_contracts.py
  participant APK_AAB
  participant DiagnosticsArtifact
  ReleaseContractsWorkflow->>GradleReleaseBuild: build optimized APK and AAB
  GradleReleaseBuild->>APK_AAB: produce release artifacts
  ReleaseContractsWorkflow->>verify_release_contracts.py: verify artifacts and write report
  verify_release_contracts.py->>APK_AAB: inspect packaged contracts
  verify_release_contracts.py->>ReleaseContractsWorkflow: return validation result
  ReleaseContractsWorkflow->>DiagnosticsArtifact: upload report and mapping diagnostics
Loading

Merge Risk: ⚪ Minimal · up to 65822

No confirmed issue currently prevents merging after the usual release checks.

Pre-merge checks | Passed 8 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 4.62% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 65 functions across 8 files. (16 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (8 passed)
Check name Status Explanation
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.
Unresolved Review Threads Passed No unresolved review threads are present. The supplied review data reports no CodeRabbit review threads and zero actionable findings in the current review.
Architecture Compliance Passed No architecture violation is introduced. The PR changes no feature or core production source; the only main-source change is App Check provider selection in :app, where PostHog remains in the allowed …
Module Readme Updated Passed The PR changes one production Kotlin file under the covered paths: app/src/main/java/cx/aswin/boxlore/BoxLoreApplication.kt. The matching app/README.md is also modified in the same PR. No `core/<m…
Jvm Tests For Changed Logic Passed PASS: The PR does not add or substantially change an engine, repository, ViewModel, or pure helper under logic/. Its only Kotlin production change moves the existing App Check provider selection fro…
Title check Passed The title follows the required Conventional Commits format, uses the allowed type fix, uses the release scope, describes the release-contract changes, uses imperative wording, and is 71 characters…
Description check Passed The description clearly explains the release-build issue, the optimized-artifact validation changes, the compatibility constraints, and the test plan. It is directly related to the changeset.

Full details: Docstring Coverage

Explanation

Docstring coverage is 4.62% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 65 functions across 8 files. (16 skipped: 16 unsupported.)



✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

  • 🛠️ update changelog

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@ashwkun
ashwkun merged commit 77238c0 into master Oct 9, 2026
9 of 10 checks passed
@ashwkun
ashwkun deleted the one/release-worker-construction branch October 9, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

user-impact-critical Critical listener-facing fix — leads README/changelog; PR release-copy used verbatim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant