fix: prepare reinstall artifacts before removing apps

Merged
TH
3h ago
+222-55

Summary

Prepare Apple and Android replacement artifacts before uninstalling the existing app. An archive that cannot be unpacked now fails while the app and its data remain installed. Successful reinstall still creates fresh app state.

The 10-file change preserves cache invalidation, cancellation, hosted installers and cleanup. Invalid app bundles, corrupt APKs or later installation failures can still leave the app removed. No validator or rollback is added.

Closes #4516. Closes #4517. Refs #4368.

Validation

Tested 9d7993318de5d202ecb7c653ff099baca1f43e8f against ddbfc855661fa9d29b8c836057b7f5b099bcad44:

  • Exact pnpm check:affected --run --head <sha> --json passed: 11 checks passed, 8 named skips, 1 provider deduplication. Full unit: 19,771 passed/10 skipped; related: 390 passed.
  • 37 Apple deployment tests and the targeted typed no-app IPA provider case passed. The fixture detects the original destructive order; restored controls pass. The post-prepare cancellation case detects a skipped-cleanup mutant.
  • Separate Apple and Android original-production experiments detected destructive ordering. Owned Android 15/API 35 and iOS 27.0 native runs at production-identical 88bfc202 retained saved markers after bad-archive failures and cleared them after valid reinstall. Owned resources were cleaned up.
  • Independent combined source review found no defects. Later review corrections are test-only.

CI is green at this head (21 successful checks, 1 skipped); no review threads are open. Historical provider timeout causes remain unproven. Native cancellation and arbitrary invalid APK/app-bundle protection are not claimed.

Validation evidence.