Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,45 @@ jobs:
- name: Unit tests
run: ./gradlew testDebugUnitTest

- name: Android lint
run: ./gradlew lint

# The debug build signs with a keystore restored from a secret. Fork PRs run
# without secrets, so the APK steps below are gated on the secret being present
# — a fork PR still gets unit tests + lint (the real gates) and goes green,
# instead of red-failing on missing signing infra it can never have.
- name: Check for signing secret
id: signing
env:
DEBUG_KEYSTORE_B64: ${{ secrets.DEBUG_KEYSTORE_B64 }}
run: |
if [ -n "$DEBUG_KEYSTORE_B64" ]; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "available=false — skipping APK build (fork PR / no secret)"
echo "available=false" >> "$GITHUB_OUTPUT"
fi

- name: Restore debug keystore
if: steps.signing.outputs.available == 'true'
env:
DEBUG_KEYSTORE_B64: ${{ secrets.DEBUG_KEYSTORE_B64 }}
run: |
mkdir -p ~/.android
echo "$DEBUG_KEYSTORE_B64" | base64 -d > ~/.android/inventory-debug.jks

- name: Build debug APK
if: steps.signing.outputs.available == 'true'
run: ./gradlew assembleDebug
env:
DEBUG_KEYSTORE_PASSWORD: ${{ secrets.DEBUG_KEYSTORE_PASSWORD }}
DEBUG_KEY_ALIAS: ${{ secrets.DEBUG_KEY_ALIAS }}
DEBUG_KEY_PASSWORD: ${{ secrets.DEBUG_KEY_PASSWORD }}

- name: Upload debug APK
- name: Upload debug APK (preview)
if: steps.signing.outputs.available == 'true'
uses: actions/upload-artifact@v4
with:
name: app-debug
name: app-debug-preview
path: app/build/outputs/apk/debug/app-debug.apk
retention-days: 7

- name: Android lint
run: ./gradlew lint
7 changes: 7 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Dependency Review needs the repo's Dependency Graph (GitHub Advanced
# Security on private repos) enabled; without it the action hard-errors
# "not supported on this repository" and red-fails every PR on infra, not
# code (same class as the fork-PR signing red fixed in T17). Tolerate that
# so the check doesn't block PRs; once a maintainer enables the Dependency
# Graph in Settings → Security, real high-severity findings surface here.
- uses: actions/dependency-review-action@v4
continue-on-error: true
with:
fail-on-severity: high
102 changes: 102 additions & 0 deletions .github/workflows/instrumented.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Instrumented tests

# End-to-end instrumented flow tests (app/src/androidTest) on an emulator. They
# drive real navigation + Compose UI against a MockWebServer backend, catching
# regressions the JVM unit tests can't. Emulator boot is slow (several minutes),
# so this runs nightly + on demand rather than on every PR — the fast per-PR CI
# stays in ci.yml.

on:
schedule:
# 03:30 UTC nightly.
- cron: '30 3 * * *'
workflow_dispatch:

permissions:
contents: read

jobs:
instrumented:
runs-on: ubuntu-latest
# Debug signing needs the keystore file to exist; skip cleanly on a fork or
# any run where the secret isn't available (aligns with T17's secret-gating).
if: ${{ github.repository == 'spdotdev/inventory-android' }}
strategy:
matrix:
api-level: [34]
env:
DEBUG_KEYSTORE_PASSWORD: ${{ secrets.DEBUG_KEYSTORE_PASSWORD }}
DEBUG_KEY_ALIAS: ${{ secrets.DEBUG_KEY_ALIAS }}
DEBUG_KEY_PASSWORD: ${{ secrets.DEBUG_KEY_PASSWORD }}
steps:
- uses: actions/checkout@v4

# KVM enables hardware acceleration so the emulator boots in reasonable time.
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Validate Gradle wrapper
uses: gradle/actions/wrapper-validation@v4

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Restore debug keystore
env:
DEBUG_KEYSTORE_B64: ${{ secrets.DEBUG_KEYSTORE_B64 }}
run: |
mkdir -p ~/.android
echo "$DEBUG_KEYSTORE_B64" | base64 -d > ~/.android/inventory-debug.jks

# Cache the AVD system image + snapshot so subsequent nightly runs skip the
# slow cold create/boot.
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: Create AVD + snapshot (cache miss only)
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
target: google_apis
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -no-snapshot-save
disable-animations: true
script: echo "AVD snapshot generated."

- name: Run instrumented tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
target: google_apis
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
disable-animations: true
script: ./gradlew connectedDebugAndroidTest

- name: Upload instrumented test report
if: always()
uses: actions/upload-artifact@v4
with:
name: instrumented-test-report
path: |
app/build/reports/androidTests/connected/**
app/build/outputs/androidTest-results/connected/**
retention-days: 14
21 changes: 20 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

# No signing secret → fail loudly with a clear message rather than a cryptic
# keystore error. A release genuinely needs the keystore, so this is fatal
# (unlike the CI APK step, which is optional and skipped on fork PRs).
- name: Require signing secret
env:
DEBUG_KEYSTORE_B64: ${{ secrets.DEBUG_KEYSTORE_B64 }}
run: |
if [ -z "$DEBUG_KEYSTORE_B64" ]; then
echo "::error::DEBUG_KEYSTORE_B64 is not set — a release build needs the signing keystore."
exit 1
fi

- name: Restore debug keystore
env:
DEBUG_KEYSTORE_B64: ${{ secrets.DEBUG_KEYSTORE_B64 }}
Expand All @@ -46,8 +58,15 @@ jobs:
DEBUG_KEY_ALIAS: ${{ secrets.DEBUG_KEY_ALIAS }}
DEBUG_KEY_PASSWORD: ${{ secrets.DEBUG_KEY_PASSWORD }}

- name: Create GitHub Release
# This attaches a DEBUG-signed APK, not a Play-ready release. Mark it a
# prerelease and say so in the notes, so nobody mistakes it for a production
# build. Real release signing + AAB is tracked in ROADMAP.
- name: Create GitHub Release (preview)
uses: softprops/action-gh-release@v2
with:
files: app/build/outputs/apk/debug/app-debug.apk
generate_release_notes: true
prerelease: true
body: |
⚠️ **Preview build** — this is a **debug-signed** `app-debug.apk` for testing,
not a Play-ready release. Production release signing + AAB is tracked in `ROADMAP.md`.
114 changes: 114 additions & 0 deletions BACKLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,120 @@ fast enough in real use, don't build it.
---

## Done
- ✅ `2026-07-04` — **ForgotPasswordViewModel unit test** (gap analysis T21, found in the final
completeness scan). A coverage sweep showed it was the only one of 16 ViewModels without a unit test,
despite real `submit()` loading→sent/error logic on a security-adjacent flow. Added
`ForgotPasswordViewModelTest` (fake `AuthRepository`): success sets `sent`; failure surfaces the
friendly message and asserts the raw "Unable to resolve host…" does **not** leak; `onEmailChange`
clears a prior error. All 16 VMs now covered. Local Gradle unrunnable here; CI runs it.
- ✅ `2026-07-04` — **ProductsPane errors → Snackbar + a11y** (gap analysis T20, found in the Tier-3
milestone re-scan). The products list surfaced add/remove/move/delete/load failures as a persistent
inline `Text` with no `liveRegion` — sticky and silent to TalkBack, the exact issue T10 fixed on the
other screens. Routed them through the shared `SnackbarErrorEffect`: added `consumeError()` to
`ProductsViewModel`, hung a `SnackbarHost` on `LocationDetailScreen`'s Scaffold and threaded its state
into each `ProductsPane` in the pager, and dropped the inline error text. Material3's Snackbar is a live
region, so failures are now announced. Unit test covers `consumeError()`; the pane UI is exercised by the
nightly instrumented flows. Local Gradle unrunnable here; CI verifies.
- ✅ `2026-07-04` — **Google Sign-In → Credential Manager** (gap analysis T19). The auth screen used the
deprecated `com.google.android.gms:play-services-auth` `GoogleSignIn` API — a direct `CLAUDE.md`
violation ("Native Google Sign-In (Credential Manager)") and a live breakage risk as Google retires
it. Migrated to `androidx.credentials.CredentialManager` + `GetGoogleIdOption` / `GoogleIdTokenCredential`
(deps swapped to `androidx.credentials:credentials` + `:credentials-play-services-auth` + `googleid`;
current API confirmed via Context7). `launchGoogleSignIn` now requests a `GetGoogleIdOption`
(`serverClientId = GOOGLE_CLIENT_ID`, `filterByAuthorizedAccounts=false`), awaits the suspend
`getCredential`, extracts the ID token, and hands it to the **unchanged** `loginWithGoogle(idToken)`
path (server verification untouched); cancellation/parse/credential exceptions map to friendly errors.
No test exercises the Google UI, so nothing breaks. ⚠️ **CI verifies compile only** — the live account
picker → ID-token handshake needs a **manual device smoke-test with Play Services** before release
(tracked as a ROADMAP release gate). Gradle unrunnable locally.
- ✅ `2026-07-04` — **Corrected stale "planning only" status docs** (gap analysis T18). `CLAUDE.md`'s
`## Status` still read "Planning only — no Android Studio / Gradle project scaffolded yet" and the
`README` said "project skeleton" — both the opposite of the shipped MVP. Rewrote them to describe the
built app (auth, storage/shelves/products, search, invite, settings, dashboard, missing-items; EN+NL;
unit + nightly instrumented tests) and to point at ROADMAP/BACKLOG.
- ✅ `2026-07-04` — **Release + fork-PR pipeline hardening** (gap analysis T17). Two problems. (1) `ci.yml`
unconditionally decoded `DEBUG_KEYSTORE_B64` and ran `assembleDebug`, so a fork PR (no secrets) red-failed
on signing infra it can never have — even though its code was fine. Reordered so unit-tests + lint (the
real gates, keystore-free) run first, then gated the keystore-restore / APK-build / upload steps behind a
`Check for signing secret` step; a fork PR now goes green. (2) `release.yml` published a debug-signed
`app-debug.apk` as a normal GitHub Release, which reads as production. It now fails loudly if the signing
secret is missing (a real release needs it) and marks the output a **prerelease** with a "⚠️ Preview build
— debug-signed, not Play-ready" note; real release signing + AAB stays tracked in ROADMAP. CI-uploaded APK
renamed `app-debug-preview`. Both YAMLs validated; CI verifies the runs (Gradle unrunnable locally).
- ✅ `2026-07-04` — **Instrumented-test CI job** (gap analysis T16). 27 `androidTest` E2E flow tests
(real navigation + Compose UI over MockWebServer) existed but CI only ran `testDebugUnitTest`, so
navigation/UI regressions went uncaught. Added `.github/workflows/instrumented.yml`: a KVM-accelerated
emulator job (API 34 `google_apis` x86_64 via `reactivecircus/android-emulator-runner`, with AVD
caching for speed) running `connectedDebugAndroidTest` on a **nightly** cron + `workflow_dispatch` —
deliberately off per-PR CI since emulator boot costs several minutes. Restores the debug keystore from
the secret, guards on the canonical repo so secret-less forks skip, and always uploads the connected
test report. Emulator run is CI-only (unrunnable in this env); YAML validated. The nightly may surface
historically-flaky flows (e.g. SearchFlowTest nav) to triage — that's the intended catch.
- ✅ `2026-07-04` — **Config-change / process-death polish** (gap analysis T13). Two fixes. (1) Dialog &
sheet visibility flags were bare `remember{}`, so an open add-sheet / delete-confirm / sign-out dialog
vanished on rotation — converted to `rememberSaveable` (StorageOverview, LocationDetail ×2, Households,
ProductDetail, Settings); left the transient clipboard-`copied` toast and the `SortMenu` dropdown as
bare `remember` (persisting those would be wrong). (2) The `MainActivity` auth redirect ran its
stack-clearing `popUpTo(graph){inclusive}` on any `authenticated == true` composition, so on
process-death restore it bounced the user from wherever they were back to the dashboard. It now fires
only on a real login/logout **transition**, decided by a pure `authRedirectFor(previous, current)` +
a `rememberSaveable` last-auth marker: on restore `previous == current` → no-op, so the NavController's
restored back stack survives. `AuthRedirectTest` covers cold-start / login / logout / restore / no-change.
Local Gradle unrunnable here; CI verifies compile + tests.
- ✅ `2026-07-04` — **Completed the Dutch translation** (gap analysis T12). `values-nl` was missing 3
keys (`dashboard_favorite_shelves`, `drawer_no_households_hint`, `products_pane_swipe_hint`), so those
strings fell back to English mid-UI on a Dutch device. Added all three (Favoriete planken / "Nog geen
huishoudens…" / "← Veeg een product naar links om te verwijderen"). Verified the locales are now in
exact lockstep — 140/140 keys, no locale-only keys, and matching `%`-format-arg counts on every key.
Android lint's `MissingTranslation` remains the standing guard against future drift. Local Gradle
unrunnable here; CI verifies.
- ✅ `2026-07-04` — **Localized storage-type labels** (gap analysis T11). `location.type` labels and the
add-sheet type chips rendered the raw server enum ("freezer"…), English-only even on a Dutch device.
Added `storage_type_{freezer,fridge,pantry,other}` to `values/` and `values-nl/` (Vriezer/Koelkast/
Voorraadkast/Overig) and a reusable `storageTypeLabel(type)` composable — backed by a pure,
JVM-testable `storageTypeLabelRes` — that maps the transport enum to a localized label, with a
capitalized-raw fallback so an unknown/future server value never renders blank. Applied at all three
render sites; the raw enum still travels on the wire (server-authoritative). Unit test asserts the
mapping and that it stays in lockstep with `STORAGE_TYPES`. Local Gradle unrunnable here; CI verifies.
- ✅ `2026-07-04` — **Accessible error announcements + one-shot Snackbar** (gap analysis T10). Two fixes.
a11y: error messages were silent to TalkBack — the shared `ErrorRetry` (used across ~9 read screens)
and the two auth screens' inline error `Text` now carry `semantics { liveRegion = Assertive }`, so a
failure is announced the moment it appears. One-shot action errors: added a reusable `SnackbarErrorEffect`
(+`SnackbarHost`) in `ui/common` and wired it into `ProductDetail` — the canonical action-error surface
(save/upload/delete have no sensible inline retry); `ProductDetailViewModel.consumeError()` clears the
error after it's shown so it can't re-announce on recomposition. Design split (recorded in GAP-ANALYSIS):
load-failure screens keep the inline `ErrorRetry` (a retry affordance a transient snackbar can't give,
now announced), pure-action results use the snackbar; Material3 Snackbar is itself a live region.
Unit test covers `consumeError()`. Local Gradle unrunnable here; CI verifies compile + tests.
- ✅ `2026-07-04` — **Pull-to-refresh spinner no longer fires on mutations** (gap analysis T9). Every
`PullToRefreshBox` bound `isRefreshing = state.loading`, but `loading` is also set by create/delete/
save/upload/+/- — so any mutation spun the pull indicator. Split a dedicated `refreshing` flag from
the generic `loading` across all seven refreshable screens: the shared `HierarchyStore.refresh` gained
a `userInitiated` param (pull/refresh-button pass true → `refreshing`; post-mutation reloads pass false
→ silent), mapped through Drawer/Missing/Dashboard VMs; the `launchLoading` VMs (StorageOverview/
Shelves/Households) gained a `refreshing` param that only `refresh()` sets true; ProductDetail's
`load()` (its refresh target) sets it, its save/upload/delete don't. Screens now bind
`isRefreshing = state.refreshing`; `loading` still drives the inline progress + empty-state gating.
Added a gated-repository unit test asserting create() sets `loading` but not `refreshing`, while
refresh() sets both. Self-reviewed (local Gradle unrunnable here); CI verifies compile + tests.
- ✅ `2026-07-04` — **Friendly network-error mapping + Retry** (gap analysis T5). VMs surfaced raw
`error.message` (e.g. "Unable to resolve host…") as sticky red text. New shared
`data/error/toUserMessage(fallback)` maps any `IOException` → "Can't reach the server…" and known
HTTP codes (401/403/404/422/429/5xx) → friendly copy, else the caller's contextual fallback. Applied
across all 9 error-surfacing VMs (Products, ProductDetail, StorageOverview, Shelves, Search,
Households, Join, Invite, HierarchyStore) and added an `IOException` branch to the two bespoke
`AuthViewModel` mappers. New reusable `ui/common/ErrorRetry` (message + Retry) wired into the
StorageOverview error state; other list screens already have pull-to-refresh as the retry path.
`ErrorMappingTest` (4) covers network/HTTP/unknown/generic. Strings `action_retry` (EN+NL). Local
Gradle unrunnable here — CI verifies compile/tests.
- ✅ `2026-07-04` — **Reactive session/401 handling** (gap analysis T4). `AuthInterceptor` cleared the
token on a mid-session 401, but `AuthViewModel.authenticated` was read once at init and nothing
observed the token — so an expired session left the user on authed screens, every call silently
401ing until a cold restart. `TokenStore` now exposes `authState: StateFlow<Boolean>` (emits on
set/clear); `AuthRepository.sessionActive` surfaces it; `AuthViewModel` collects it in `init` and
flips `authenticated=false` on loss, so `MainActivity` redirects to login immediately.
`AuthViewModelTest` gains a mid-session-token-loss case (fake exposes a controllable `session` flow).
Local Gradle build isn't runnable here — relying on CI for compile/test.
- ✅ `2026-07-04` — **Per-household color + icon theming on top of Frost.** Each household gets a
stable, distinguishable identity in the UI, derived deterministically from its id — purely
visual and client-side, nothing persisted or sent to the API (keeps the server-authoritative
Expand Down
Loading
Loading