Skip to content

feat(controller): rootfs projection via RootfsViewModel + offline gating#7

Merged
luisguzman-adfa merged 2 commits into
mainfrom
feat/deploy-projection-rootfs-viewmodel
Jun 18, 2026
Merged

feat(controller): rootfs projection via RootfsViewModel + offline gating#7
luisguzman-adfa merged 2 commits into
mainfrom
feat/deploy-projection-rootfs-viewmodel

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

Summary

Continues the rootfs Clean Architecture slice (#6). Two related changes to the install screen's storage projection:

  1. Strangler step — the projection UI now consumes the OS rootfs size from the presentation layer (RootfsViewModel) instead of having InstallationPlanner resolve it.
  2. Offline handling — the install button is gated on connectivity, the projection is labelled as estimated when it falls back, and the live network fetch is skipped when offline. Closes the "connectivity gating" tech-debt item.

The radial gauge (MultiResourceGaugeView) and its segment math were intentionally left untouched.

Changes

  • InstallationPlanner: extracted computeProjection(); added a calculateProjectedSize(..., osSizeGb, ...) overload for the UI path. Legacy overload retained for the non-UI install flow.
  • DeployFragment: creates/observes RootfsViewModel; recalculateProjection() triggers load(tier, abi, attemptLive) and onRootfsSizeResolved() completes the projection. The hasInternet flag gates the install button and the estimated caption.
  • GetRootfsSizeUseCase / RootfsViewModel: new attemptLive overload (offline falls back directly, no network wait).
  • Layout: added txt_offline_estimate caption (hidden by default).
  • Strings: install_btn_no_connection, install_msg_no_connection, install_offline_estimated (en + es).
  • Tests: GetRootfsSizeUseCaseTest.skipsLiveWhenOffline().
  • Docs: design map (CLAUDE.md) + progress log (TECH_DEBT_PLAN.md); added a "Working in parallel" coordination section to CLAUDE.md.

Testing

  • ./gradlew :app:testDebugUnitTest (domain/use-case JVM tests, incl. the new offline test).
  • ./gradlew :app:assembleDebug — compiles; verified on device.
  • Manual: install screen in airplane mode → button shows "No connection", "Estimated sizes (offline)" appears, sizes resolve instantly; reconnect → button returns to "Install" and the caption disappears.

Notes

  • Architecture follows CLAUDE.md: domain pure JVM; presentation depends only on domain; dependencies wired by hand via RootfsViewModelFactory. The gauge was left untouched.
  • Follow-up (optional): remove the legacy resolveOsSizeGb path once the install flow no longer needs it.

Prepare InstallationPlanner so the projection UI can supply the OS rootfs
size from the presentation layer.

- Extract the projection math (maps + Kiwix) into a private computeProjection().
- Add a calculateProjectedSize(..., osSizeGb, ...) overload for the UI path.
- Keep the legacy overload (resolveOsSizeGb) for the non-UI install flow, which
  only needs the resolved companion-data filename.
Continue the rootfs Clean Architecture slice (#6). The install storage
projection now resolves the OS size through the presentation layer, and the
install screen handles the offline state. The radial gauge is left untouched.

- DeployFragment observes RootfsViewModel and feeds the resolved OS size (live,
  with offline fallback) into the projection instead of going through
  InstallationPlanner.resolveOsSizeGb().
- Offline: disable the install button ("No connection") with a snackbar on tap,
  show an "Estimated sizes (offline)" caption when the size is a fallback, and
  skip the live fetch via a new attemptLive flag on GetRootfsSizeUseCase /
  RootfsViewModel (avoids the ~6s timeout). Addresses the connectivity-gating
  tech-debt item.
- Add strings (en + es), a unit test (skipsLiveWhenOffline), and update
  CLAUDE.md (design map + new "Working in parallel" section) and
  controller/docs/TECH_DEBT_PLAN.md.
@luisguzman-adfa luisguzman-adfa merged commit 2546d5a into main Jun 18, 2026
2 checks passed
@luisguzman-adfa luisguzman-adfa deleted the feat/deploy-projection-rootfs-viewmodel branch June 18, 2026 18:55
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