Skip to content

[codex] Fix scratch storage promotion and add coverage gate#94

Merged
stozo04 merged 3 commits into
mainfrom
codex/fix-scratch-storage-coverage
Jun 30, 2026
Merged

[codex] Fix scratch storage promotion and add coverage gate#94
stozo04 merged 3 commits into
mainfrom
codex/fix-scratch-storage-coverage

Conversation

@stozo04

@stozo04 stozo04 commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Move active capture/import scratch files from cacheDir/scratch to filesDir/scratch so user-visible in-flight videos are not stored as cache-evictable data.
  • Keep reverse-preview derived cache files under cacheDir/scratch/reversed, and prune new active scratch, legacy cache scratch, and reverse cache paths.
  • Add a ViewModel save-in-progress guard to ignore duplicate Save taps while promotion/enqueue/render is already active.
  • Add Crashlytics source_exists keys so future events distinguish missing files from real zero-byte files.
  • Add JaCoCo JVM/Robolectric coverage reporting plus a 90% ViewModel coverage gate wired into :app:check.

Root Cause

Crashlytics showed promoteScratchToRaw() failing before render enqueue because Kotlin File.copyTo() could not find the scratch source file under cacheDir/scratch/raw_<uuid>.mp4. This is not the intentional post-render cleanup path: the worker only discards scratch and deletes the persisted raw after render succeeds. The source file was missing before WorkManager render enqueue.

The artifact proves the active scratch was missing at promotion time. Cache eviction is the storage-design risk this PR removes by moving active user work out of cacheDir; the fix also keeps explicit app deletion paths auditable.

Validation

  • :app:testDebugUnitTest passed.
  • :app:jacocoDebugUnitTestReport passed.
  • :app:jacocoDebugViewModelCoverageVerification passed.
  • :app:check passed.
  • git diff --check passed.

Coverage from the generated JaCoCo XML:

  • Full app instruction coverage: 15.89%.
  • Full app line coverage: 21.61%.
  • ViewModel gate instruction coverage: 90.73%.
  • ViewModel gate line coverage: 91.90%.

Known Gaps

  • Instrumented tests were not run because the only local Android target was emulator-5554 offline.
  • Whole-app 90% coverage is not gated yet because current JVM tests do not cover large UI/media/hardware paths. The full report is generated so that debt is visible while the ViewModel state-machine layer is enforced at 90%.

stozo04 and others added 3 commits June 30, 2026 09:41
Play rollout for PR #94 scratch storage promotion fix (Crashlytics 8fe3ece9).

Co-authored-by: Cursor <cursoragent@cursor.com>
Photo Picker on Android 14 often ignores Download/; sweep-prep now also
pushes and media-scans the canonical fixture under DCIM/Camera when SDK ≤ 34.

Co-authored-by: Cursor <cursoragent@cursor.com>
@stozo04 stozo04 marked this pull request as ready for review June 30, 2026 17:53
@stozo04 stozo04 merged commit 9d6d6ea into main Jun 30, 2026
2 checks passed
@stozo04 stozo04 deleted the codex/fix-scratch-storage-coverage branch June 30, 2026 17:53
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