Skip to content

Don't preload container files under Robolectric - #1964

Open
jeremybernstein wants to merge 1 commit into
utkarshdalal:masterfrom
jeremybernstein:jb/fix-robolectric-container-preload
Open

jeremybernstein wants to merge 1 commit into
utkarshdalal:masterfrom
jeremybernstein:jb/fix-robolectric-container-preload

Conversation

@jeremybernstein

@jeremybernstein jeremybernstein commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Description

PluviaApp.onCreate starts preloadAllContainerFiles in the background. Robolectric boots a fresh app with a fresh filesDir for every test, so on the modern flavor every Robolectric test re-downloads every container archive. Measured locally: two test classes (30 tests) downloaded 31 archives, at least 1.2 GB, in 53 s. Across the suite this fills the CI runner's disk ("No space left on device" during Run unit tests (modern)) and saturates the network, and the modern test step timing out at 30 minutes on several recent PRs is consistent with it.

Fix: skip the preload when Build.FINGERPRINT == "robolectric". The preload is only a warm-up; code that needs a container file already fetches it on demand through ensureContainerFileAvailable, so tests that need one still get it, whether run alone or in a full sweep. With the fix the same two classes download nothing in the background and run in 21 s. A full modern-flavor sweep (1,236 tests) finishes in 8.5 minutes with exactly one container download: the one ContainerFilesDownloaderTest makes on purpose.

Recording

n/a (infrastructure)

Type of Change

  • Bug fix
  • Performance / stability improvement
  • Compatibility improvements
  • Other (requires prior approval)

Checklist

  • If I have access to #code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.
  • This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
  • I have attached a recording of the change.
  • I have read and agree to the contribution guidelines in CONTRIBUTING.md.

Summary by cubic

Skips the background container preload under Robolectric so test runs no longer re-download every container archive per test. Robolectric boots each test with a fresh filesDir, so the old warm-up downloaded gigabytes per run and filled CI runner disks; tests that need a container file still fetch it on demand.

  • A 30-test run dropped from 31 background downloads (~1.2 GB, 53 s) to zero (21 s).

Written for commit 307ac9c. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Improved test-environment behavior by preventing unnecessary background container preloading during simulated app runs.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 99d2cdf3-60cc-4c4f-8c7e-f0263902ac61

📥 Commits

Reviewing files that changed from the base of the PR and between 3bbe3f6 and 307ac9c.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: f365f4f1-78e6-4303-96ac-d61535201da8

📥 Commits

Reviewing files that changed from the base of the PR and between 88a60ef and 3bbe3f6.

📒 Files selected for processing (1)
  • app/src/main/java/app/gamenative/PluviaApp.kt

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

PluviaApp.onCreate now skips container file preloading under Robolectric. Other runtimes continue to start the preload operation asynchronously.

Changes

Robolectric preload handling

Layer / File(s) Summary
Conditional container preloading
app/src/main/java/app/gamenative/PluviaApp.kt
Robolectric no longer starts background container file preloading. Other runtimes retain asynchronous preloading.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: disabling container-file preloading under Robolectric.
Description check ✅ Passed The description explains the cause, implementation, impact, measurements, test behavior, and rationale. It follows the required sections. The recording is marked as not applicable for an infrastructur…
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
🧪 Generate unit tests (beta)
  • Create a new PR

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.

Robolectric boots a fresh app with a fresh filesDir for every test, so on the modern flavor the
background preload re-downloaded every container archive per test: gigabytes per suite run,
enough to fill a CI runner's disk. code that needs a container file still fetches it on demand.
@jeremybernstein
jeremybernstein force-pushed the jb/fix-robolectric-container-preload branch from 3bbe3f6 to 307ac9c Compare September 21, 2026 06:44
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