[docs] KeepHerSafeApps: Round trip on the tablet, the page between Android's bars, review, gaps closed, lessons

This commit is contained in:
2026-11-17 22:22:36 +01:00
parent e262b8f295
commit d5f37b3149
13 changed files with 243 additions and 32 deletions
+1
View File
@@ -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) |
+2 -2
View File
@@ -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. |
+13 -9
View File
@@ -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) |
+3 -3
View File
@@ -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.
+11
View File
@@ -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.
+14
View File
@@ -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.
+15
View File
@@ -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).