[docs] KeepHerSafeApps: Round trip on the tablet, the page between Android's bars, review, gaps closed, lessons
This commit is contained in:
@@ -5,6 +5,7 @@ One row per feature, with its analysis document (CLAUDE.md §5.1). Gaps live in
|
||||
|
||||
| Feature | Phase | Status | Analysis | Review |
|
||||
|:--|:--|:--|:--|:--|
|
||||
| Keep her safe in the apps: true words, Android's own save screen, the page kept between the system bars | Platform track | Merged to `main` 2026-11-17; built on this machine, not distributed. Closes G-T4 and, on Android, G-T5 | [keep-her-safe-apps.md](features/keep-her-safe-apps.md) | [feature-keep-her-safe-apps.md](reviews/feature-keep-her-safe-apps.md) |
|
||||
| Four versions, one garden: the Tauri 2 shell (`apps/rosea-tauri`) for Android, iOS and desktop beside the PWA; a Windows build and an Android debug APK run on the tablet | Platform track | Merged to `main` 2026-11-17; built on this machine, not distributed. iOS needs a Mac (G-T1); *Keep her safe* in the apps is a release blocker (G-T4) | [tauri-platforms.md](features/tauri-platforms.md) | [feature-tauri-platforms.md](reviews/feature-tauri-platforms.md) |
|
||||
| Workspace, contracts, gates, PWA shell | 0 | Merged to `main` 2026-11-01 (`d11d242`); built, not deployed. Phase 0 gate still open | [phase0-workspace.md](features/phase0-workspace.md) | [feature-phase0-workspace.md](reviews/feature-phase0-workspace.md) |
|
||||
| Roadmap and gameplay docs, read against the code | 0 | Merged 2026-11-01; Q1–Q7 answered by the author | — | [docs-roadmap-gameplay.md](reviews/docs-roadmap-gameplay.md) |
|
||||
|
||||
@@ -77,8 +77,8 @@ Svelte codebase, the apps through a Tauri 2 shell. Analysis:
|
||||
| G-T1 | iOS | Open. Needs macOS + Xcode, the iOS Rust targets, an Apple developer account. `pnpm tauri:ios` refuses elsewhere. |
|
||||
| G-T2 | macOS and Linux desktop builds | Open. Each on its own system; macOS signing/notarisation. |
|
||||
| G-T3 | Release signing (Android keystore, Windows certificate); AAB; stores | Open. Phase 6. Keys never in the repository. |
|
||||
| G-T4 | **Keep her safe inside the apps — release blocker** | Open. Measured: *Save her to a file* does nothing on Android; the words say *this browser*; `persist()` is always `false`. Needs app copy and a working save (first plugin). No app reaches a player before this closes. |
|
||||
| G-T5 | Bringing her back from a file inside the apps | Open. The Android file picker opens; no round trip seen. |
|
||||
| ~~G-T4~~ | ~~Keep her safe inside the apps — release blocker~~ | Closed 2026-11-17 on `feature/keep-her-safe-apps`: the apps say *She lives in this app, on this device, until the app is removed…* and ask no browser; Android saves through its own save screen by a narrow Kotlin bridge (no plugin, no IPC, no permission) and says *She is in that file now.*; Windows downloads. Seen on the tablet (2 of 2) and on Windows (3 of 3); 572 unit tests; every drill caught after one test was tightened. |
|
||||
| ~~G-T5~~ | ~~Bringing her back from a file inside the apps~~ | Closed on Android 2026-11-17: the round trip on the tablet, *Everything in that file is already here.* Windows not driven. |
|
||||
| G-T6 | WebView2's own traffic not measured for Rosea | Open. Flags from Amicitia's measurement are set; measure before a desktop release. |
|
||||
| G-T7 | No CI for the apps | Open. With G0.22. |
|
||||
| G-T8 | Webview storage eviction | Partly measured: `persist()` is `false` in WebView2 and Android WebView. Pressure eviction of app storage not measured. G-T4 is the answer either way. |
|
||||
|
||||
@@ -45,6 +45,7 @@ flowchart LR
|
||||
| A3 | **The bridge takes only what a rose file is**: a name like `rose-2026-11-17.json` and text up to 8 MB; anything else is refused before the picker opens. One save at a time. | The interface is reachable by any script in the page; the page is our own and has no network, but the bridge stays as narrow as the job. |
|
||||
| A4 | **The answer comes back as a window event** (`rosea-file-saved`, `true` or `false`), dispatched by `evaluateJavascript`; `saveFile` returns a promise of it. The garden says *She is in that file now.* only on `true`. | The player sees the system screen close; without a word they cannot know whether it worked. A cancelled save is the player's choice and is not commented on. |
|
||||
| A5 | `MainActivity.kt` lives in `apps/rosea-tauri/android/java/` and is copied over the generated one by `scripts/android.ts apply`; `check` refuses an APK build without it. The bridge class carries `@Keep` so a minified release build cannot strip it. | `gen/` is never committed (D6 in tauri-platforms.md). |
|
||||
| A7 | **The page is kept between Android's system bars**, which show the garden's paper (light or dark with the system). Added after the tablet's screenshot showed the clock over the title and the navigation bar over *Bring her back from a file*. | Tauri's stock activity draws edge to edge, and the WebView does not reliably report the bars as `env(safe-area-inset-*)` (Culina measured the same). The colours are `--paper` from `tokens.css`, held equal by a test. |
|
||||
| A6 | Windows keeps `<a download>`: WebView2 saves to *Downloads* and shows its own download flyout (measured in the platform review). | It works; the browser's own feedback is the confirmation there, as in the PWA. |
|
||||
|
||||
## 3. Risk analysis
|
||||
@@ -60,18 +61,21 @@ flowchart LR
|
||||
|
||||
## 4. Gap analysis
|
||||
|
||||
Closes G-T4 for Android and Windows. G-T5 (bringing her back) is closed only by a round trip seen on
|
||||
the device. iOS stays G-T1: WKWebView will need its own save (a share sheet or a document picker).
|
||||
Closes G-T4 for Android and Windows, and G-T5 on Android: the round trip (save through Android's
|
||||
screen, bring her back from that file) passed on the tablet twice, 2026-11-17. Bringing her back on
|
||||
Windows was not driven. iOS stays G-T1: WKWebView will need its own save (a share sheet or a document picker).
|
||||
|
||||
## 5. Verification matrix
|
||||
|
||||
| Case | Kind | Where |
|
||||
|:--|:--|:--|
|
||||
| In an app: the app sentence, no *Ask*, `persisted()` never asked | unit | `packages/ui/test/keep-safe.test.ts` |
|
||||
| In a browser: the browser sentences as before | unit | same, and the existing e2e |
|
||||
| `saveFile` answering `true` → *She is in that file now.*; `false` or nothing → silence | unit | same |
|
||||
| The bridge's name and size rules | unit | `apps/rosea-tauri/test/android-bridge.test.ts` (reads the Kotlin source's constants) and the Kotlin itself |
|
||||
| `android.ts check` refuses a project without Rosea's `MainActivity` | unit | `apps/rosea-tauri/test/android-privacy.test.ts` |
|
||||
| In an app: the app sentence, no *Ask*, no install hint, `persisted()` and `persist()` never called | unit | `packages/ui/test/rose.test.ts` |
|
||||
| The app words never speak of a browser | unit | same |
|
||||
| In a browser: the browser sentences as before | unit | same (existing cases) and the e2e suite |
|
||||
| `saveFile` answering `true` → *She is in that file now.*; `false` → the word goes; a browser download → nothing said | unit | same |
|
||||
| The bridge's contract with the game: package = identifier, interface name `roseaFile`, event `rosea-file-saved` with `.detail === true`, the file-name rule accepts `rose-<day>.json` and refuses five wrong names, `@Keep` on the class and method, no permission asked | unit (reads both sources) | `apps/rosea-tauri/test/android-bridge.test.ts` |
|
||||
| The size limit (8 MB) and one-save-at-a-time | — | Kotlin only, not tested off the device |
|
||||
| `android.ts check` refuses a project with Tauri's own `MainActivity` | script | seen: exit 1, then 0 after `apply` (review) |
|
||||
| The APK still asks for no permission | artefact | `pnpm tauri:android` → aapt2 |
|
||||
| Android: save opens the system screen, a file is written, the garden says so; bring her back from that file | device | review (tablet) |
|
||||
| Windows: save downloads the file | device | `e2e/apps/check-garden.ts desktop` |
|
||||
| Windows: the app words; *Save her to a file* starts a download | device | `e2e/apps/check-garden.ts desktop` |
|
||||
| Android: the app words; save through Android's screen, *She is in that file now.*; bring her back from that file, *Everything in that file is already here.*; the file removed afterwards | device | `e2e/apps/check-garden.ts android` (uiautomator presses the system screens) |
|
||||
|
||||
@@ -11,10 +11,10 @@ and **how to apply it**.
|
||||
| [`design.md`](design.md) | 1 | Wording, silence, empty states. |
|
||||
| [`art.md`](art.md) | 3 | The image pipeline. |
|
||||
| [`code.md`](code.md) | 4 | TypeScript, Svelte, async ordering, Rust. |
|
||||
| [`technical.md`](technical.md) | 9 | The browser and the build as platforms. |
|
||||
| [`testing.md`](testing.md) | 15 | What makes a test worth having, and how a passing test lies. |
|
||||
| [`technical.md`](technical.md) | 10 | The browser and the build as platforms. |
|
||||
| [`testing.md`](testing.md) | 16 | What makes a test worth having, and how a passing test lies. |
|
||||
| `privacy.md` | none yet | What could leave the device or make a person findable. (The geocell finding is in the review, not here: it was caught before it cost anything.) |
|
||||
| [`process.md`](process.md) | 4 | Workflow, commits, credentials, honesty about what shipped. |
|
||||
| [`process.md`](process.md) | 5 | Workflow, commits, credentials, honesty about what shipped. |
|
||||
|
||||
A file is created with its first real entry. An empty lessons file only looks like
|
||||
knowledge.
|
||||
|
||||
@@ -59,3 +59,14 @@ On Windows the interpreter also chooses line endings.
|
||||
|
||||
**How to apply it.** Edit source files with the edit tool. When a script is needed, write
|
||||
it to a file first (the scratchpad), then run the file.
|
||||
|
||||
## Git Bash rewrites Android paths
|
||||
|
||||
**What happened.** On 2026-11-17 `adb shell ls -l /sdcard/Download/…` typed in Git Bash answered
|
||||
`ls: C:/Program: No such file or directory`: MSYS turned `/sdcard/…` into
|
||||
`C:/Program Files/Git/sdcard/…` before adb saw it.
|
||||
|
||||
**Why it bit.** The rewrite is silent and the error looks like the device's.
|
||||
|
||||
**How to apply it.** Prefix hand-typed adb commands with `MSYS_NO_PATHCONV=1`, or pass arguments from
|
||||
Node (`spawnSync`), which the shell does not touch.
|
||||
|
||||
@@ -124,3 +124,17 @@ a permission a library adds.
|
||||
**How to apply it.** Check permissions, backup flags and WebView switches on the APK and on the
|
||||
installed package, and name each allowed exception precisely (this package's own receiver guard,
|
||||
not any app's).
|
||||
|
||||
## Tauri's Android activity draws under the system bars
|
||||
|
||||
**What happened.** The first screenshot of the Android app on the tablet (2026-11-17) showed the clock
|
||||
over the title and the navigation bar over *Bring her back from a file*. Tauri's generated
|
||||
`MainActivity` calls `enableEdgeToEdge()`, and Android WebView does not reliably report the bars to
|
||||
the page as `env(safe-area-inset-*)` (Culina found the same on an emulator).
|
||||
|
||||
**Why it bit.** Every test before it read the page, not the screen: the button was there, enabled and
|
||||
clickable by script, and hidden from a finger.
|
||||
|
||||
**How to apply it.** Look at a screenshot of every new platform before calling it done. Keep the page
|
||||
between the bars in the activity (padding from `WindowInsetsCompat`), paint the bars with the page's
|
||||
own background, and carry the activity in `apps/rosea-tauri/android/java/` because `gen/` is regenerated.
|
||||
|
||||
@@ -212,3 +212,18 @@ happens first (the setup fails). On a shared device, a leftover is somebody else
|
||||
clean-up tolerate half-done setup (`page?.close()`, `browser?.close()`); retry connections that
|
||||
race a cold start (the script tries for 30 s). After every device run, check: `pidof` the app is
|
||||
empty, `reverse --list` and `forward --list` are empty.
|
||||
|
||||
## When a hand-run probe passes and the check fails, the check is the bug
|
||||
|
||||
**What happened.** On 2026-11-17 the Android round trip (`e2e/apps/check-garden.ts`) failed three
|
||||
times at *Bring her back from a file*, while a probe doing the same steps by hand passed. Two
|
||||
differences, both in the check: it tapped the picker while the screen was still sliding in, and it
|
||||
matched nodes by description too, so it tapped DocumentsUI's *Preview the file …* button, which
|
||||
comes before the file's own name in the tree.
|
||||
|
||||
**Why it bit.** A check that drives someone else's screen (Android's picker) carries assumptions
|
||||
about that screen. When it fails, the app is the first suspect, and the check's own guesses are not.
|
||||
|
||||
**How to apply it.** When a device check fails, do the steps once by hand with screenshots before
|
||||
changing the app. On a system screen, match the exact visible text, and tap only a node that stands
|
||||
still across two readings.
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
# Review — `feature/keep-her-safe-apps`
|
||||
|
||||
Adversarial self-review (CLAUDE.md §5.3). Analysis: [`features/keep-her-safe-apps.md`](../features/keep-her-safe-apps.md).
|
||||
Reviewed 2026-11-17 on Windows 10, Node 22.23.4, Tauri CLI 2.12.5, WebView2 157; the Android tablet is
|
||||
the WAVE 10C (Android 16, WebView 140). Closes the release blocker G-T4 found in
|
||||
[`feature-tauri-platforms.md`](feature-tauri-platforms.md) finding 1. No PR: the only remote is Gitea.
|
||||
|
||||
## What changed for the player
|
||||
|
||||
- **In the Android and Windows apps**, *Keep her safe* says *She lives in this app, on this device,
|
||||
until the app is removed. A saved file keeps her anywhere.* The browser sentences, *Ask the browser
|
||||
to keep her* and the iPhone install hint are gone there; `persist()` is no longer asked.
|
||||
- **On Android**, *Save her to a file* opens Android's own save screen. When the file is written the
|
||||
garden says *She is in that file now.*; a player who steps back hears nothing.
|
||||
- **The PWA is unchanged** (its words, its download; the e2e suite still passes).
|
||||
|
||||
## Gates
|
||||
|
||||
Run on the branch head (based on `main` 0b72ae0, with the planet garden), 2026-11-17:
|
||||
|
||||
| Gate | Result |
|
||||
|:--|:--|
|
||||
| `pnpm lint`, `pnpm typecheck` | 0 problems (svelte-check: 0 errors, 0 warnings, after finding 5) |
|
||||
| `pnpm lint:copy` | 0 problems |
|
||||
| `pnpm validate:library` | 13 of 13 fixtures rejected; 78 candidates |
|
||||
| `pnpm test` (guard waited 28 s at 100 %, then started at 42 %; rerun after findings 10–12 at 71 %) | **572 passed**: identity 5, schema 19, cpu-guard 13, content 88, storage 70, art-prep 63, engine 179, **tauri 47** (+7), **ui 88** (+4 here) |
|
||||
| `pnpm test:e2e` | 26 passed |
|
||||
| `pnpm test:offline` | 1 passed |
|
||||
| `pnpm tauri:android` | built; Kotlin compiled; `aapt2`: still no permission, no backup |
|
||||
| `pnpm tauri:build` + `check-garden.ts desktop` | **3 of 3 passed**: the app's words shown, no browser words; *Save her to a file* started a download (`rose-2026-11-17.json`, cancelled by the check) |
|
||||
| `check-garden.ts android` (WAVE 10C over Wi-Fi adb, unlocked by the author) | **2 of 2 passed after the fixes** (findings 10–12): opened, watered, force-stopped, reopened, still watered; the app's words; *Save her to a file* → Android's save screen → *She is in that file now.*; *Bring her back from a file* → Android's picker → *Everything in that file is already here.*; the test file removed from `Download`, the app stopped. Earlier runs: 1 failed on the adb server, 3 on findings 11 and 12. |
|
||||
|
||||
**The app changed** (CLAUDE.md §5.4): the apps' *Keep her safe*. Rebuilt; **not deployed or
|
||||
distributed** (G0.13; the apps exist on this machine only).
|
||||
|
||||
## Bug drills
|
||||
|
||||
| Put back | Result |
|
||||
|:--|:--|
|
||||
| `KeepSafe` ignores where she lives (browser words in the app) | CAUGHT |
|
||||
| The app still asks the browser to keep her | CAUGHT |
|
||||
| *She is in that file now.* said whatever the answer | CAUGHT |
|
||||
| The app words speak of a browser | CAUGHT |
|
||||
| The Kotlin interface renamed (`roseFile`) | CAUGHT |
|
||||
| The Kotlin answers on another event | CAUGHT |
|
||||
| The file-name rule lets any `.json` through | CAUGHT (by *accepts the file name the garden gives … and nothing else*) |
|
||||
| `@Keep` dropped from the bridge class | CAUGHT |
|
||||
| The game takes any answer but `false` as success | CAUGHT |
|
||||
| `android.ts check` with Tauri's own `MainActivity` | CAUGHT (exit 1; `apply` puts Rosea's back, exit 0) |
|
||||
| The page no longer kept between the bars (listener renamed; padding dropped) | CAUGHT, both — after the first test **missed** the renamed call (it matched a substring; tightened to the exact call and padding) |
|
||||
| The bars' paper drifts from `tokens.css` | CAUGHT |
|
||||
|
||||
**Not drilled, and nothing off the device would catch it:** the 8 MB limit and one save at a time
|
||||
(Kotlin only); `evaluateJavascript` being blocked by the page's CSP (only the device run shows the
|
||||
answer arriving).
|
||||
|
||||
## Findings
|
||||
|
||||
| # | Area | Finding | Resolution |
|
||||
|:--|:--|:--|:--|
|
||||
| 1 | **Soul** | The release blocker itself: words of fear and a remedy that did nothing (G-T4). | Fixed: true words in the apps, a working save on Android, a quiet confirmation. |
|
||||
| 2 | Soul | Should a cancelled save say something (*Nothing was saved.*)? | No: stepping back is the player's choice; commenting on it would scold. The earlier *saved* word is cleared, so nothing false stays on screen. |
|
||||
| 3 | Privacy | The bridge is a JavaScript interface any script in the WebView could call. | Only the game's page runs there (no network, `'self'` CSP). The bridge accepts only `rose-YYYY-MM-DD.json` and up to 8 MB, and can only open a screen the player must confirm. |
|
||||
| 4 | Privacy | The player may choose a cloud folder in Android's save screen. | Their choice, made in the system's own screen; the file never holds the town (keep-her-safe.md K4). The game still has no `INTERNET`. |
|
||||
| 5 | Correctness | svelte-check warned that `inApp` read `wiring` once (`state_referenced_locally`). | `$derived`; 0 warnings. |
|
||||
| 6 | Test honesty | The desktop check failed twice reading *Her numbers* after the restart: it pressed before her care had been read back (the planet garden made the first paint earlier). | The check waits for her picture, then presses until the button says it is open, never pressing an open one; then 3 of 3 passed. |
|
||||
| 7 | Correctness | Two quick taps on *Save* while Android's screen opens. | The game returns the same pending promise; Kotlin ignores a second call while busy. Not tried on the device. |
|
||||
| 8 | Scope | iOS (WKWebView) will need its own save. | G-T1; noted in the analysis. |
|
||||
| 9 | Process | The tablet was asleep behind a secure lock when the device check was due. | Waited for the author to unlock it; nothing was bypassed. |
|
||||
| 10 | **Design** | Seen on the tablet's screenshot: the app drew **under Android's system bars** — the clock over the title, the navigation bar over *Bring her back from a file*. Tauri's stock activity turns edge-to-edge on and leaves the page under the bars. | Rosea's `MainActivity` keeps the page between the bars and paints them with the garden's paper, light or dark with the system (as Culina does); a test holds the colours equal to `tokens.css`; seen fixed on the tablet (dark theme). |
|
||||
| 11 | Test honesty | The check tapped the picker's file while the screen was still sliding in. | It taps only a node that stands still across two readings. |
|
||||
| 12 | Test honesty | The check matched a node by its description too, and DocumentsUI's *Preview the file …* button comes first: it opened a preview, not the file, and the check failed for a reason that was the check's own. | The file is chosen by its own text only. Found by a probe that did the steps by hand and succeeded. |
|
||||
| 13 | Process | Git Bash rewrites `/sdcard/…` arguments to Windows paths for `adb shell` typed by hand. | `MSYS_NO_PATHCONV=1` for hand-typed adb; the check passes arguments from Node and is not affected. Lesson in process.md. |
|
||||
| 14 | Process | The USB link hung `adb install`; the same tablet was reachable over Wi-Fi adb (another session's connection on the shared adb server). | Installed and checked over Wi-Fi; nothing in the other session's state was changed. |
|
||||
|
||||
## Correctness
|
||||
|
||||
- **Second run**: `android.ts apply` copies the activity each time; `check` compares bytes.
|
||||
- **App closed mid-save**: the file is written on Android's side only after the player presses Save;
|
||||
if the app dies before the answer, the promise never resolves and the garden simply says nothing
|
||||
(the next visit is fresh). Not tried.
|
||||
- **Two tabs**: an app has one window.
|
||||
|
||||
## Reachability, offline
|
||||
|
||||
Nothing reaches anyone. The save and the picker work with no network (the app has none).
|
||||
|
||||
## What was NOT verified
|
||||
|
||||
- iOS, macOS, Linux.
|
||||
- A minified release APK (the `@Keep` is checked in source only).
|
||||
- Saving to a cloud folder or a memory card; Android versions other than 16.
|
||||
- Bringing back a file made on *another* device (the round trip used the same tablet, so it answered *already here*; the merge itself is storage's, tested in keep-her-safe.md).
|
||||
- The light theme's bars on the tablet (seen in the dark theme only; the colour is tested).
|
||||
- Bringing her back on Windows (WebView2's file dialog was not driven).
|
||||
@@ -157,7 +157,8 @@ apps/
|
||||
# dist-tauri/ for the shell: base /, no service worker, no manifest
|
||||
rosea-tauri/ # the Tauri 2 shell -> @rosea/tauri. Wraps apps/rosea/dist-tauri/; imports no package
|
||||
src-tauri/ # Rust (a window and nothing else), tauri.conf.json; no capabilities/, so no IPC
|
||||
android/ # what must survive `tauri android init` (gen/ is never committed)
|
||||
android/ # what must survive `tauri android init` (gen/ is never committed): the backup rules,
|
||||
# and MainActivity.kt (the save bridge; the page kept between the system bars)
|
||||
scripts/ # icons from apps/rosea/public/icon.svg; the Android privacy patch
|
||||
|
||||
services/
|
||||
@@ -609,9 +610,10 @@ No timestamp finer than a day, no precise location, no free text, no link to the
|
||||
| **Base path in the shell** *(measured 2026-11-17)* | The PWA lives under `/Rosea/`; Tauri serves the game at the root of its own origin (`https://tauri.localhost/` on Windows and Android with `useHttpsScheme`, `tauri://localhost/` on macOS and iOS). A shell build with base `/Rosea/` would ask for `/Rosea/assets/…` and open a blank window. The shell's copy is built with base `/` into its own folder, so the two can never be mixed up; measured: the garden opens at `https://tauri.localhost/` on Windows and on Android. |
|
||||
| **A service worker inside a webview** *(answered 2026-11-17)* | Inside Tauri the files are already on the device; a worker would cache a second copy, could serve a stale game after an app update, and *A new version of the garden is ready* would offer a refresh that fetches nothing. The shell's build has no worker and no manifest: `vite-plugin-pwa` is disabled there and `registerSW` is its no-op. Measured: no registration in either app. |
|
||||
| **Two content-security policies** *(conflict predicted; the answer measured 2026-11-17)* | The PWA carries its policy in a `<meta>` tag (Pages sends no headers). Tauri can deliver its own policy and adds hashes for the scripts it injects; a page with **both** obeys both, and the `<meta>` would block what Tauri adds. So the shell's build has no `<meta>` policy and Tauri delivers the same string, held equal by `apps/rosea-tauri` test. Measured: no CSP violation and no request outside the origin, on Windows and on Android. |
|
||||
| **IndexedDB eviction in a webview** *(partly measured 2026-11-17)* | WebView2 and Android WebView are Chromium: best-effort storage can be cleared under disk pressure, and an app's data is wiped on uninstall (the Windows uninstaller offers to delete app data). WKWebView on iOS may purge website data of an app that is not used. `persist()` answers `false` in WebView2 and in Android WebView (measured). *Keep her safe* is the real defence — and on Android saving a file through `<a download>` **does nothing** (measured on the tablet), while the words still speak of *this browser*: a release blocker (`tauri-platforms.md` G-T4). |
|
||||
| **IndexedDB eviction in a webview** *(partly measured 2026-11-17)* | WebView2 and Android WebView are Chromium: best-effort storage can be cleared under disk pressure, and an app's data is wiped on uninstall (the Windows uninstaller offers to delete app data). WKWebView on iOS may purge website data of an app that is not used. `persist()` answers `false` in WebView2 and in Android WebView (measured). *Keep her safe* is the real defence. In the apps it speaks of the app, not a browser, and on Android it saves through Android's own save screen, because `<a download>` does nothing in Android WebView (measured; `keep-her-safe-apps.md`). |
|
||||
| **The webview phones home** *(measured in Amicitia, 2026-11-08; here: Android closed by construction, Windows unmeasured)* | A webview talks to its maker on its own: WebView2 to Microsoft and DNS-over-HTTPS providers, Android WebView to Google's metrics and an Autofill server as soon as a field takes focus. Desktop: `additionalBrowserArgs` switches these off (undocumented feature names a runtime update can break). Android: no `INTERNET` permission at all while Rosea has no network feature, plus metrics and Safe Browsing off in the manifest, applied by a committed patch because `gen/` is regenerated. Measure on every release build. |
|
||||
| **Auto Backup sends the garden to a cloud** *(answered 2026-11-17)* | A stock Tauri Android manifest lets Android copy the app's data — the care log, the keys, the chosen town — to the player's cloud backup, without the player choosing it. The patch sets `allowBackup="false"` and excludes every domain from cloud backup and device transfer; *Keep her safe* is how a rose moves. Measured: the installed package carries no `ALLOW_BACKUP` flag and no `INTERNET` permission (`dumpsys package`); `pnpm tauri:android` checks the APK itself with `aapt2`. |
|
||||
| **Android draws under the system bars** *(measured 2026-11-17)* | Tauri's stock activity turns edge-to-edge on, and the WebView does not reliably report the bars as `env(safe-area-inset-*)`: the clock sat over the title, the navigation bar over a button. Rosea's own `MainActivity` (`apps/rosea-tauri/android/java/`, copied into `gen/` by `android.ts`) keeps the page between the bars and paints them with `--paper`. |
|
||||
| **iOS cannot be built on Windows** *(known)* | `tauri ios init` and every iOS build need macOS and Xcode; installing on a phone needs an Apple developer account (free for one's own device, paid for TestFlight and the App Store). `pnpm tauri:ios` refuses on Windows with this reason. |
|
||||
| **The bundle identifier and the origin are forever** | An Android `applicationId` or iOS bundle id cannot change after a release without becoming a different app: the old one keeps the player's rose, the new one starts empty. Chosen once (`cz.mareknovak.domi.rosea`), before the first release, even though the product name may still change. The same holds for `useHttpsScheme` (`true`): flipping it changes the webview's origin, and IndexedDB is per origin, so the rose is left behind. The shell's test pins both. |
|
||||
|
||||
|
||||
+10
-3
@@ -133,13 +133,20 @@ Rewritten at the end of each session (CLAUDE.md §5.1).
|
||||
(`pnpm tauri:build`) and an **Android debug APK** (`pnpm tauri:android`) were built here; both
|
||||
passed the garden check (watered, closed, reopened, still watered; nothing outside the origin).
|
||||
The APK asks for no permission, not even `INTERNET`, and allows no backup (checked on the APK and
|
||||
on the tablet). **iOS needs a Mac** (G-T1). **No app goes to a player yet:** inside the apps
|
||||
*Keep her safe* speaks of *this browser*, and on Android saving to a file does nothing (G-T4,
|
||||
a release blocker). The debug APK and installer are build output on this machine, not committed:
|
||||
on the tablet). **iOS needs a Mac** (G-T1). *Keep her safe* in the apps was a release blocker
|
||||
(G-T4); it is closed, see the next entry. The debug APK and installer are build output on this
|
||||
machine, not committed:
|
||||
`apps/rosea-tauri/src-tauri/gen/android/app/build/outputs/apk/universal/debug/` and
|
||||
`apps/rosea-tauri/src-tauri/target/release/bundle/nsis/`. Analysis:
|
||||
[`.agents/features/tauri-platforms.md`](.agents/features/tauri-platforms.md). Review:
|
||||
[`.agents/reviews/feature-tauri-platforms.md`](.agents/reviews/feature-tauri-platforms.md).
|
||||
- **Keep her safe in the apps (2026-11-17):** merged to `main`; closes the release blocker G-T4.
|
||||
In the apps she *lives in this app, on this device, until the app is removed*; no browser is
|
||||
asked. On Android *Save her to a file* opens Android's own save screen (a small Kotlin bridge in
|
||||
`apps/rosea-tauri/android/java/MainActivity.kt`; no plugin, no permission) and the garden says
|
||||
*She is in that file now.*; bringing her back from that file works. The page now stays between
|
||||
Android's system bars. Seen on the tablet and on Windows. Review:
|
||||
[`.agents/reviews/feature-keep-her-safe-apps.md`](.agents/reviews/feature-keep-her-safe-apps.md).
|
||||
- **Phase 1 is built in code.** What remains of it is the author's: verified sentences (the petal
|
||||
appears with them), hosting (G0.13), and the gate itself — two weeks of daily play on a phone.
|
||||
|
||||
|
||||
@@ -6,12 +6,17 @@ package cz.mareknovak.domi.rosea
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.webkit.JavascriptInterface
|
||||
import android.webkit.WebView
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.annotation.Keep
|
||||
import androidx.core.graphics.Insets
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
|
||||
class MainActivity : TauriActivity() {
|
||||
private var webView: WebView? = null
|
||||
@@ -20,6 +25,31 @@ class MainActivity : TauriActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
enableEdgeToEdge()
|
||||
super.onCreate(savedInstanceState)
|
||||
// Tauri's activity draws edge to edge, and the WebView does not reliably report the bars as
|
||||
// env(safe-area-inset-*): the clock sat over the title and the navigation bar over *Bring her
|
||||
// back from a file* (keep-her-safe-apps review). So the page is kept between the bars, and
|
||||
// the bars show the garden's own paper, light or dark as the system is.
|
||||
paintBehindBars()
|
||||
val bars = WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()
|
||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content)) { view, insets ->
|
||||
val inset = insets.getInsets(bars)
|
||||
view.setPadding(inset.left, inset.top, inset.right, inset.bottom)
|
||||
WindowInsetsCompat.Builder(insets)
|
||||
.setInsets(WindowInsetsCompat.Type.systemBars(), Insets.NONE)
|
||||
.setInsets(WindowInsetsCompat.Type.displayCutout(), Insets.NONE)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
// The manifest lets the activity live through a theme change (uiMode), so the paint follows it here.
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
paintBehindBars()
|
||||
}
|
||||
|
||||
private fun paintBehindBars() {
|
||||
val night = (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES
|
||||
window.decorView.setBackgroundColor(Color.parseColor(if (night) PAPER_DARK else PAPER))
|
||||
}
|
||||
|
||||
// *Save her to a file*: Android WebView does nothing with a blob download, so the game asks
|
||||
@@ -83,5 +113,8 @@ class MainActivity : TauriActivity() {
|
||||
private const val TAG = "RoseaFile"
|
||||
private val NAME = Regex("^rose-\\d{4}-\\d{2}-\\d{2}\\.json$")
|
||||
private const val MAX_CHARS = 8 * 1024 * 1024
|
||||
// --paper in packages/ui/src/tokens.css, light and dark; a test holds them equal.
|
||||
private const val PAPER = "#fbf6f1"
|
||||
private const val PAPER_DARK = "#1d1819"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,17 @@ describe('the Android save bridge', () => {
|
||||
expect(kotlin).toMatch(/@JavascriptInterface\s+fun save\(name: String, text: String\)/);
|
||||
});
|
||||
|
||||
it("paints behind the system bars with the garden's own paper, light and dark", () => {
|
||||
const tokens = readFileSync(join(HERE, '..', '..', '..', 'packages', 'ui', 'src', 'tokens.css'), 'utf8');
|
||||
const papers = [...tokens.matchAll(/--paper:\s*(#[0-9a-f]{6})/gi)].map((m) => m[1]!.toLowerCase());
|
||||
expect(papers).toHaveLength(2);
|
||||
expect(/PAPER = "(#[0-9a-f]{6})"/i.exec(kotlin)?.[1]?.toLowerCase()).toBe(papers[0]);
|
||||
expect(/PAPER_DARK = "(#[0-9a-f]{6})"/i.exec(kotlin)?.[1]?.toLowerCase()).toBe(papers[1]);
|
||||
// A source check only; the proof is the tablet's screenshot (review). Exact call and padding:
|
||||
expect(kotlin).toMatch(/ViewCompat\.setOnApplyWindowInsetsListener\(findViewById\(android\.R\.id\.content\)\)/);
|
||||
expect(kotlin).toMatch(/view\.setPadding\(inset\.left, inset\.top, inset\.right, inset\.bottom\)/);
|
||||
});
|
||||
|
||||
it('asks Android for nothing: the save screen needs no permission', () => {
|
||||
// Asking at run time or naming one; the APK check (aapt2) refuses any declared in the manifest.
|
||||
expect(kotlin).not.toMatch(/requestPermissions\(|Manifest\.permission|checkSelfPermission/);
|
||||
|
||||
+31
-13
@@ -95,10 +95,7 @@ async function secondVisit(page: Page): Promise<void> {
|
||||
await expect(page.getByRole('img', { name: /^The rose/ })).toBeVisible({ timeout: 20_000 });
|
||||
const numbers = page.getByRole('button', { name: en.rose.numbers });
|
||||
await expect(async () => {
|
||||
if ((await numbers.getAttribute('aria-expanded')) !== 'true') {
|
||||
await numbers.focus();
|
||||
await numbers.press('Enter');
|
||||
}
|
||||
if ((await numbers.getAttribute('aria-expanded')) !== 'true') await press(numbers);
|
||||
await expect(numbers).toHaveAttribute('aria-expanded', 'true', { timeout: 1_000 });
|
||||
}).toPass({ timeout: 15_000 });
|
||||
await expect(page.locator('#rose-numbers')).toContainText(`${en.rose.daysOfCare}1`);
|
||||
@@ -106,9 +103,22 @@ async function secondVisit(page: Page): Promise<void> {
|
||||
report['afterRestart'] = 'still watered: 1 day of care, the care log kept';
|
||||
}
|
||||
|
||||
/**
|
||||
* Presses a button from the keyboard. On the tablet a pointer click waits for the button to stop
|
||||
* moving, and the planet keeps it moving (review); Enter is a real activation, as for a keyboard player.
|
||||
*/
|
||||
async function press(button: ReturnType<Page['getByRole']>): Promise<void> {
|
||||
await button.focus();
|
||||
await button.press('Enter');
|
||||
}
|
||||
|
||||
/** Opens *Keep her safe* and checks the app's own words (keep-her-safe-apps.md A1). */
|
||||
async function openKeepSafe(page: Page): Promise<void> {
|
||||
await page.getByRole('button', { name: en.rose.safe.title }).click();
|
||||
const title = page.getByRole('button', { name: en.rose.safe.title });
|
||||
await expect(async () => {
|
||||
if ((await title.getAttribute('aria-expanded')) !== 'true') await press(title);
|
||||
await expect(title).toHaveAttribute('aria-expanded', 'true', { timeout: 1_000 });
|
||||
}).toPass({ timeout: 15_000 });
|
||||
await expect(page.getByText(en.rose.safe.app)).toBeVisible();
|
||||
for (const browserWords of [en.rose.safe.mayClear, en.rose.safe.unknown, en.rose.safe.kept, en.rose.safe.ask]) {
|
||||
await expect(page.getByText(browserWords)).toHaveCount(0);
|
||||
@@ -120,7 +130,7 @@ async function openKeepSafe(page: Page): Promise<void> {
|
||||
async function desktopSave(page: Page): Promise<void> {
|
||||
await openKeepSafe(page);
|
||||
const download = page.waitForEvent('download', { timeout: 10_000 });
|
||||
await page.getByRole('button', { name: en.rose.safe.save }).click();
|
||||
await press(page.getByRole('button', { name: en.rose.safe.save }));
|
||||
const d = await download;
|
||||
report['saveToFile'] = `a download started: ${d.suggestedFilename()} (cancelled by the check)`;
|
||||
await d.cancel();
|
||||
@@ -144,18 +154,24 @@ function screenNodes(adb: (...args: string[]) => string): UiNode[] {
|
||||
return nodes;
|
||||
}
|
||||
|
||||
/** Taps the first node on Android's own screen that matches, waiting up to `ms` for it. */
|
||||
/**
|
||||
* Taps the first node on Android's own screen that matches, waiting up to `ms` for it. Only once
|
||||
* it stands still: a system screen slides in, and a tap read from the first frame landed where the
|
||||
* file had been a moment before (keep-her-safe-apps review).
|
||||
*/
|
||||
async function tapSystem(adb: (...args: string[]) => string, match: (n: UiNode) => boolean, what: string, ms = 20_000): Promise<void> {
|
||||
const until = Date.now() + ms;
|
||||
let last: UiNode | undefined;
|
||||
while (Date.now() < until) {
|
||||
const node = screenNodes(adb).find(match);
|
||||
if (node) {
|
||||
if (node && last && node.cx === last.cx && node.cy === last.cy) {
|
||||
adb('shell', 'input', 'tap', String(node.cx), String(node.cy));
|
||||
return;
|
||||
}
|
||||
last = node;
|
||||
await new Promise((r) => setTimeout(r, 700));
|
||||
}
|
||||
throw new Error(`Android's screen never showed ${what}`);
|
||||
throw new Error(`Android's screen never showed ${what}, still`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,14 +190,16 @@ async function androidRoundTrip(page: Page, adb: (...args: string[]) => string):
|
||||
const existed = before.split(/\s+/).includes(name);
|
||||
if (existed) throw new Error(`/sdcard/Download/${name} is already on the tablet; the check will not overwrite a file it did not make`);
|
||||
try {
|
||||
await page.getByRole('button', { name: en.rose.safe.save }).click();
|
||||
await press(page.getByRole('button', { name: en.rose.safe.save }));
|
||||
await tapSystem(adb, (n) => /^save$/i.test(n.text), "the save screen's Save button");
|
||||
await expect(page.getByText(en.rose.safe.saved)).toBeVisible({ timeout: 15_000 });
|
||||
await expect(page.locator('.safe [role="status"]')).toHaveText(en.rose.safe.saved, { timeout: 15_000 });
|
||||
report['saveToFile'] = `Android's save screen; the garden said: ${en.rose.safe.saved}`;
|
||||
|
||||
await page.locator('input[type="file"]').click({ force: true });
|
||||
await tapSystem(adb, (n) => n.text === name || n.desc.includes(name), `the file ${name} in the picker`);
|
||||
await expect(page.getByText(en.rose.safe.alreadyHere)).toBeVisible({ timeout: 15_000 });
|
||||
// By its own text only: a card's preview button is described as "Preview the file …" and comes first.
|
||||
await tapSystem(adb, (n) => n.text === name, `the file ${name} in the picker`);
|
||||
// Read from Keep her safe's own status line: it may be below the fold on a small screen.
|
||||
await expect(page.locator('.safe [role="status"]')).toHaveText(en.rose.safe.alreadyHere, { timeout: 15_000 });
|
||||
report['bringBack'] = `chose ${name} in Android's picker; the garden said: ${en.rose.safe.alreadyHere}`;
|
||||
} finally {
|
||||
const after = adb('shell', 'ls', '/sdcard/Download/').split(/\s+/);
|
||||
|
||||
Reference in New Issue
Block a user