[docs] TauriPlatforms: Four versions from one codebase on Tauri 2: CLAUDE.md, the roadmap's platform track, the analysis

This commit is contained in:
2026-11-17 18:45:36 +01:00
parent 22f55dc9fa
commit 3f95a1b37d
3 changed files with 256 additions and 16 deletions
+124
View File
@@ -0,0 +1,124 @@
# Four versions, one garden — the Tauri 2 shell
Status: built on `feature/tauri-platforms`, 2026-11-17. Decided by the author the same day: *"I need
also android apk version, desktop version, ios version and pwa version … based on the tauri2
framework."* CLAUDE.md §2 (*Four versions, one garden*), §3, §4, §8; ROADMAP *The platform track*.
Review: [`feature-tauri-platforms.md`](../reviews/feature-tauri-platforms.md).
## 1. Why and what, in the player's terms
Until now Rosea Domi was a page you open from a link and may add to the home screen. Now the same
garden also comes as an **app**: an Android app to install from a file (later from a store), a
desktop app for Windows (macOS and Linux once built on those systems), and an iOS app once there is
a Mac to build it on. The PWA stays as it is.
What the player meets is the same in all four: the same rose, the same words, the same sunset, the
same *Keep her safe*. Nothing asks for an account, nothing goes online. Differences they may notice:
- The app opens straight into the garden, with its own icon, without a browser around it.
- In the app there is never *A new version of the garden is ready*: a new version comes as a new app.
- A rose in the PWA and a rose in the app on the same phone are **two roses**. To carry one across,
*Keep her safe* saves her to a file and brings her back (on Android, see G-T4).
Why now and not in Phase 6: the shell needs no new feature, and an APK puts the Phase 1 spike on the
author's phone without any hosting (G0.13 is still open).
## 2. Technical architecture
```mermaid
flowchart LR
subgraph game["one Svelte 5 codebase"]
schema["packages/schema"] --- engine["packages/engine"]
engine --- ui["packages/ui"]
storage["packages/storage<br/>(IndexedDB)"] --- engine
content["packages/content"] --- schema
identity["packages/identity"] --- schema
app["apps/rosea<br/>App.svelte wiring"]
ui --> app
storage --> app
content --> app
identity --> app
end
app -->|"vite build<br/>(default mode)"| dist["apps/rosea/dist/<br/>base /Rosea/, service worker,<br/>manifest, &lt;meta&gt; CSP"]
app -->|"vite build --mode tauri"| distt["apps/rosea/dist-tauri/<br/>base /, no worker, no manifest,<br/>no &lt;meta&gt; CSP"]
dist --> pwa["PWA<br/>GitHub Pages"]
distt --> shell["apps/rosea-tauri/src-tauri<br/>tauri.conf.json (CSP, name, version)<br/>lib.rs: a window, nothing else"]
shell --> win["Windows<br/>WebView2 · NSIS"]
shell --> android["Android<br/>System WebView · APK<br/>(privacy patch on gen/)"]
shell --> ios["iOS<br/>WKWebView<br/>(macOS + Xcode only)"]
shell --> mac["macOS / Linux<br/>WKWebView / WebKitGTK"]
```
| # | Decision | Why |
|:--|:--|:--|
| D1 | **`apps/rosea-tauri/` with `src-tauri/` inside**, a workspace package `@rosea/tauri` holding the Tauri CLI and the scripts. Not Tauri's default `apps/rosea/src-tauri/`. | The Tauri 2 CLI finds `src-tauri/tauri.conf.json` below the folder it runs in, so this is its expected layout one level down. The PWA's package stays free of Rust and of the CLI; the shell is deletable; its only input is a built folder, the same seam the e2e suites test. |
| D2 | **Two builds of one game.** `vite build --mode tauri` (`build:shell`) → `apps/rosea/dist-tauri/`: base `/`; `vite-plugin-pwa` disabled (no worker, no manifest; `registerSW` becomes its no-op); no `<meta>` CSP; no source maps. One build-time constant, `__ROSEA_SHELL__`, read in `App.svelte` only. | Tauri serves the files at the root of its own origin; the files are already on the device, so a worker would only cache a second copy and could serve a stale game after an update; see D4 for the CSP. A separate folder means a shell build can never overwrite the PWA's and be deployed by mistake. Source maps would ship inside every installer. |
| D3 | **Name, identifier, version.** `productName` and the window title `Rosea Domi` (a test holds them equal to `PRODUCT_NAME`); identifier **`cz.mareknovak.domi.rosea`**, like Culina's `cz.mareknovak.domi.culina`; `version` read from `apps/rosea/package.json` (Tauri accepts a path to a `package.json`). | The name may change in one commit (CLAUDE.md preamble). The identifier may not, once an app has reached a player: Android and iOS treat a new identifier as a different app, which would leave the rose behind in the old one. One version for the game and the apps; Android refuses a lower version as a downgrade. |
| D4 | **The CSP comes from Tauri**, the same string as the PWA's `<meta>` (`apps/rosea/csp.ts`), held equal by the shell's test. | A page with both a `<meta>` policy and a header obeys both; Tauri adds hashes for what it injects only to its own header, so a `<meta>` copy would block that. One string in source, two delivery routes. |
| D5 | **The Rust side opens a window and does nothing else.** No command, no plugin, no `@tauri-apps/api` in the game, and no `capabilities/` folder, so the page is granted no IPC. | The game already works fully in a webview. Every plugin is a new path for bytes to leave the device; each is reviewed before it is added (notifications, Phase 6). |
| D6 | **Android privacy, applied to the generated project before every build** (`src/android-privacy.ts`, `scripts/android.ts`, run from `tauri.android.conf.json`'s `beforeBuildCommand`): no `INTERNET` permission; `allowBackup="false"` and rules excluding every domain from cloud backup and device transfer; WebView metrics opt-out and Safe Browsing off. **Verified on the built APK** with `aapt2`. | `gen/android` is regenerated by `tauri android init` and never committed. Amicitia measured on 2026-11-08 that Android System WebView sends an Autofill query to Google the moment a field takes focus, and that manifest switches do not stop it; only the missing permission does. Rosea has a field (*Where do you want your sunset?*). Auto Backup would copy the care log, the keys and the town to the player's cloud without their choosing. |
| D7 | **Windows: WebView2's own traffic switched off** with `additionalBrowserArgs` — Amicitia's measured list (DNS-over-HTTPS upgrade, SmartScreen, experimentation, Autofill server, background networking, component updates, sync, pings, phishing detection, DNS prefetch). | Amicitia measured WebView2 reaching Google, Cloudflare and Microsoft within seconds of opening with no request of its own. The flags are undocumented feature names; a runtime update can break them, so the measurement is repeated per release (G-T6). |
| D8 | **Icons are made at build time** from `apps/rosea/public/icon.svg` with `tauri icon` and never committed. | No raster images in git except art in `art/final/` (CLAUDE.md §5.2). The SVG is a placeholder until the art pipeline makes the real icon (G0.21). |
| D9 | **In the apps, the game counts as installed**: it asks `navigator.storage.persist()` after the first care, as an installed PWA does, and never shows the iOS hint to add the page to the home screen. | WKWebView's user agent says *iPhone*; without this, the iOS app would tell the player to install the app they are in. |
| D10 | **`useHttpsScheme: true`**: the game's origin is `https://tauri.localhost` on Windows and Android. | IndexedDB is per origin. Tauri warns that changing this value between releases moves the database and the app can no longer see the old one: it must be chosen before the first release and never changed. `https` is a secure context without relying on the `*.localhost` exception (WebCrypto makes the player's key). |
| D11 | **Per-platform bundle targets** in `tauri.{windows,macos,linux}.conf.json`: NSIS (current user) on Windows; `.app` and `.dmg` on macOS; `.deb` and AppImage on Linux. | One config would try to make targets the machine cannot (MSI needs WiX, a download). |
| D12 | **Commands**: `pnpm tauri:dev`, `tauri:build`, `tauri:android` (a debug APK for arm64, then `verify`), `tauri:ios` (refuses off macOS with the reason). No Android dev command yet. | An Android dev build needs `INTERNET` to reach the dev server and `adb reverse` to keep it on 127.0.0.1 (CLAUDE.md §5.7); not needed to test what exists. |
What did **not** change: every package; the PWA's build, base path, worker, manifest and `<meta>`
policy (the PWA's `dist/` is byte-for-byte the same apart from the build hash — checked in the review).
## 3. Risk analysis
Risk here means *a lonely person feeling worse*, *someone's location*, or *someone being reachable who
did not ask to be* (CLAUDE.md §5.1).
| Risk | Platform | Answer |
|:--|:--|:--|
| **The rose is lost** when the app is uninstalled, the phone is replaced, or the app's data is cleared. | all apps | Uninstalling an app deletes its data; Android Auto Backup is deliberately off (D6). *Keep her safe* is the way to move or keep her, and on Android saving a file is unproven (G-T4). Said plainly in this doc and in the review; the Letter may say it to the player later. |
| **The rose is lost to an origin change** (`useHttpsScheme`, identifier, scheme). | Windows, Android | D3, D10: both fixed before the first release, with a test each. CLAUDE.md §8 records both as *forever*. |
| **Two roses** for one player (PWA and app). | all | Expected and stated (§1). Nothing in the game counts or compares them. |
| **The webview phones home** — bytes leave without the player. | Android | No `INTERNET`: the kernel refuses any socket (D6). Proof: `aapt2` on the APK, `dumpsys package` on the tablet. |
| | Windows | `additionalBrowserArgs` (D7). Not measured for Rosea on this machine (G-T6). WebView2 itself is updated by Windows Update, outside the app. |
| | iOS / macOS | WKWebView has no telemetry switch to set; not measured (G-T1). |
| **Location leaves the device.** | all | The town stays in IndexedDB. No backup (Android), no network (Android), no plugin (all). |
| **An SDK that counts.** | all | No analytics, crash-reporting or ads library: `Cargo.toml` has `tauri` alone and a test keeps it so; the game has no new dependency. Tauri itself sends nothing. |
| **The Windows installer fetches WebView2** if it is missing (Tauri's default `downloadBootstrapper`). | Windows | A one-time download from Microsoft during installation, on a machine without WebView2 (Windows 10 and 11 ship it). Noted, not changed: an offline installer would embed ~150 MB. |
| **Reachability.** | all | Nothing new: no free text, no network, no IPC. |
| **A stale game after an update.** | apps | No service worker (D2): the game is the one inside the installed package. |
| **Guilt or dependence.** | all | The app adds no notification, badge or reminder. Notifications are Phase 6, with their own Soul review. |
## 4. Gap analysis
| Id | Gap | Designed solution / state |
|:--|:--|:--|
| G-T1 | **iOS** cannot be built on Windows. | Needs macOS with Xcode (and its command-line tools, CocoaPods not required by Tauri 2), the Rust targets `aarch64-apple-ios` and `aarch64-apple-ios-sim`, and an **Apple developer account**: a free Apple ID can sign for one's own device for 7 days; TestFlight and the App Store need the paid programme. Then `pnpm tauri:ios`. Unknown until measured there: where WKWebView keeps IndexedDB, whether iOS purges it for an unused app, and whether `<a download>` saves her file. **Open.** |
| G-T2 | **macOS and Linux desktop builds** are not built. | Each on its own system: `pnpm tauri:build` (`.app`/`.dmg`; `.deb`/AppImage). macOS outside the App Store also needs signing and notarisation with a paid account, or Gatekeeper warns. **Open.** |
| G-T3 | **Release signing** for Android (a keystore) and Windows (a code-signing certificate). | Debug builds only today. The keystore and its passwords never enter the repository (CLAUDE.md §5.2). Phase 6. **Open.** |
| G-T4 | **Saving her to a file inside an app.** The game saves through `<a download>` on a blob URL. | Android WebView and WKWebView do not save blob downloads by default. Measured on the tablet: see the review. If it does nothing, the design is a small Rust command behind the dialog plugin (`tauri-plugin-dialog` save, write the file), the first plugin, reviewed for network access; or the Android share sheet. **Open** until measured and built. |
| G-T5 | **Bringing her back from a file** (`<input type="file">`) inside the apps. | Android WebView needs the app to answer the file chooser; Tauri's Android activity does. Measured on the tablet: see the review. |
| G-T6 | **WebView2's traffic not measured for Rosea.** | Amicitia's `watch-desktop-network.ps1` approach: run the built exe, list its connections. Before the first desktop release. **Open.** |
| G-T7 | **No CI** builds the apps (G0.22). | Builds by hand on this machine; never committed. |
| G-T8 | **Storage eviction in WebView2 and Android WebView** is predicted, not measured. | `persist()` is asked after the first care (D9). Measure what `persisted()` answers in each webview (review). |
| G-T9 | **The icon is the PWA's placeholder.** | G0.21; the art pipeline. Android adaptive icons need a foreground layer then. |
## 5. Verification matrix
| Case | Kind | Where |
|:--|:--|:--|
| Name and window title equal `PRODUCT_NAME`; identifier is `cz.mareknovak.domi.rosea`; version read from `apps/rosea/package.json`, which exists | unit | `apps/rosea-tauri/test/config.test.ts` |
| Tauri's CSP equals `apps/rosea/csp.ts`; the shell's dev server and build point at `dev:shell` / `build:shell` and `dist-tauri`, dev on 127.0.0.1 | unit | same |
| `useHttpsScheme` is `true` (the origin is forever) | unit | same |
| WebView2's privacy flags are all in `additionalBrowserArgs` | unit | same |
| `Cargo.toml` depends on `tauri` alone; no `capabilities/` folder | unit | same |
| The Android build runs the privacy patch before the game's build | unit | same |
| Patch on Tauri's stock manifest: `INTERNET` gone, three attributes set, both meta-data present; a second run changes nothing; CRLF kept; an unexpected shape throws | unit | `apps/rosea-tauri/test/android-privacy.test.ts` |
| `manifestProblems` names each missing piece on the stock manifest and none on the patched one | unit | same |
| The committed rule files exclude every domain everywhere; a file missing one, or including something, is caught | unit | same |
| `apkProblems` on real `aapt2` output: the patched APK passes; a stock one (INTERNET, backup on) fails with names | unit | same |
| `vite build --mode tauri`: no worker, no `registerSW` script, no manifest, no `<meta>` CSP, assets under `/assets/`, `__ROSEA_SHELL__` replaced | integration | `apps/rosea-tauri/test/shell-build.test.ts` |
| The PWA build is unchanged: `<meta>` CSP, worker, manifest scope `/Rosea/` | e2e | `e2e/` (existing suites) |
| Windows: the release `.exe` opens the garden; water her; close; open again; she is still watered | manual + script | review (Playwright over WebView2's debugging port on 127.0.0.1) |
| Android: the debug APK installs on the WAVE 10C (Android 16), opens the garden, water her, force-stop, open again: still watered; the app has no `INTERNET` (offline by construction) | device | review (`adb`, Playwright over the WebView's DevTools socket) |
| The APK asks for no permission, sets `allowBackup=false`, metrics and Safe Browsing off | artefact | `pnpm tauri:android` → `android.ts verify` (aapt2) |
| `pnpm tauri:ios` on Windows refuses with the reason and builds nothing | manual | review |
| iOS, macOS, Linux | — | not possible here (G-T1, G-T2) |
+103 -12
View File
@@ -20,14 +20,19 @@ For the engineering picture read [`.agents/GAP_ANALYSIS.md`](.agents/GAP_ANALYSI
> always **Rosea Domi** in public, and *Domi* never appears alone. In source the name lives in exactly > always **Rosea Domi** in public, and *Domi* never appears alone. In source the name lives in exactly
> three places — `packages/schema/src/constants.ts`, `apps/rosea/index.html` and the web manifest — > three places — `packages/schema/src/constants.ts`, `apps/rosea/index.html` and the web manifest —
> plus the `@rosea/*` package scope and the IndexedDB database name, which change together with them. > plus the `@rosea/*` package scope and the IndexedDB database name, which change together with them.
> Renaming must stay a one-commit operation until the name is confirmed. > The app shell adds a fourth: `apps/rosea-tauri/src-tauri/tauri.conf.json` (`productName`, window
> title), which the shell's test holds equal to the constants (§2, *Four versions*).
> Renaming must stay a one-commit operation until the name is confirmed. The bundle identifier is
> the exception: once an APK or installer reaches a player it cannot change without making a
> second, separate app, so it is chosen once, before the first release (§8).
--- ---
## 1. What this project is ## 1. What this project is
**Rosea Domi** is a small web game, installable as a PWA, about a living rose, a fox, and the time we **Rosea Domi** is a small game about a living rose, a fox, and the time we give to people. It ships
give to people. It belongs to the Domi ecosystem and is linked from the parent mode of Panda Domi; the as **four versions from one Svelte codebase** — a PWA, an Android app, an iOS app and a desktop app
(§2, *Four versions*). It belongs to the Domi ecosystem and is linked from the parent mode of Panda Domi; the
fox is a quiet nod to Ulfík the red panda (they look alike — an Easter egg, never an explanation). fox is a quiet nod to Ulfík the red panda (they look alike — an Easter egg, never an explanation).
It is made **for lonely people**, and the word *loneliness* never appears anywhere in the product. It is made **for lonely people**, and the word *loneliness* never appears anywhere in the product.
@@ -141,7 +146,13 @@ packages/
ui/ # Svelte components + tokens + copy/. No business logic. ui/ # Svelte components + tokens + copy/. No business logic.
apps/ apps/
rosea/ # the PWA (Svelte 5 + Vite + workbox) -> @rosea/app rosea/ # the game (Svelte 5 + Vite + workbox) -> @rosea/app. Built twice:
# dist/ the PWA, under /Rosea/, with its service worker
# 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, capabilities/
android/ # what must survive `tauri android init` (gen/ is never committed)
scripts/ # icons from apps/rosea/public/icon.svg; the Android privacy patch
services/ services/
lucerna/ # OPTIONAL discovery service (Phase 4), Rust (Axum) + SQLite. lucerna/ # OPTIONAL discovery service (Phase 4), Rust (Axum) + SQLite.
@@ -179,6 +190,7 @@ apps/rosea ──► packages/ui ──► packages/engine ──► packages/sc
└───────► packages/identity ──► packages/schema └───────► packages/identity ──► packages/schema
services/lucerna ──► packages/schema (trace shape only, via generated JSON Schema) services/lucerna ──► packages/schema (trace shape only, via generated JSON Schema)
tools/art-prep ──► art/manifest.json, packages/content, packages/schema (never imported by the app) tools/art-prep ──► art/manifest.json, packages/content, packages/schema (never imported by the app)
apps/rosea-tauri ──► apps/rosea's BUILT output (dist-tauri/) only — no package, no source file
``` ```
- `packages/engine` is pure. Time and randomness are parameters. This is what makes growth, taming and - `packages/engine` is pure. Time and randomness are parameters. This is what makes growth, taming and
@@ -186,6 +198,10 @@ tools/art-prep ──► art/manifest.json, packages/content, packages/schema
- `apps/rosea` contains zero growth, taming or sky logic. It renders what the engine returns. - `apps/rosea` contains zero growth, taming or sky logic. It renders what the engine returns.
- `services/lucerna` must be deletable. If removing it breaks the rose, the planets, the fox, friends - `services/lucerna` must be deletable. If removing it breaks the rose, the planets, the fox, friends
or the sunset, the shared sky has stopped being optional and that is a **blocker**. or the sunset, the shared sky has stopped being optional and that is a **blocker**.
- `apps/rosea-tauri` must be deletable too: removing it leaves the PWA whole. The game never asks
which shell it is in except through one build-time constant, `__ROSEA_SHELL__` (`'web'` or
`'tauri'`), read in `apps/rosea/src/App.svelte` only, for wiring (no service worker; the app counts
as installed). No package ever reads it.
### Why Svelte, and where Rust earns its place ### Why Svelte, and where Rust earns its place
@@ -194,12 +210,41 @@ Web first is the decision: the game must run from a link, on any phone, with no
- **`services/lucerna`** — a small, long-running, internet-facing service. Rust (Axum) gives memory - **`services/lucerna`** — a small, long-running, internet-facing service. Rust (Axum) gives memory
safety and a tiny footprint on a home server. Its contract is the JSON Schema in `packages/schema`. safety and a tiny footprint on a home server. Its contract is the JSON Schema in `packages/schema`.
- **A Tauri 2 shell, later (Phase 6)** — same Svelte code, packaged for Android and iOS, matching the - **A Tauri 2 shell, now (the platform track)** — same Svelte code, packaged for Android, iOS and the
ecosystem's move to Tauri. Its main gift is **local notifications without a server** (see the desktop, matching the ecosystem's move to Tauri. Its later gift (Phase 6) is **local notifications
notification trap in §8). without a server** (see the notification trap in §8).
- **Not** a Rust UI framework (Leptos, Dioxus, Yew) and **not** Rust→WASM for the sunset or star - **Not** a Rust UI framework (Leptos, Dioxus, Yew) and **not** Rust→WASM for the sunset or star
maths: both are small and fast in TypeScript. WASM enters only with a measurement that says it must. maths: both are small and fast in TypeScript. WASM enters only with a measurement that says it must.
### Four versions, one garden — decided by the author, 2026-11-17
| Version | Made from | Runs in | Where it can be built |
|:--|:--|:--|:--|
| **PWA** | `apps/rosea` → `dist/` | any browser; GitHub Pages under `/Rosea/` | any machine |
| **Android** (APK) | `apps/rosea-tauri` → `pnpm tauri:android` | Android System WebView | Windows, macOS or Linux with the Android SDK, NDK 27, JDK 17 and the Rust Android targets |
| **Desktop** | `apps/rosea-tauri` → `pnpm tauri:build` | WebView2 (Windows), WKWebView (macOS), WebKitGTK (Linux) | each on its own OS: an NSIS installer on Windows; `.app`/`.dmg` on macOS; `.deb`/AppImage on Linux |
| **iOS** | `apps/rosea-tauri` → `pnpm tauri:ios` | WKWebView | **macOS with Xcode only**, and an Apple developer account to put it on a phone |
- **One codebase.** The same Svelte 5 app, the same packages, the same IndexedDB code in all four.
The shell adds a window around the built game and nothing else: no Tauri command, no plugin, no
`@tauri-apps/api` in the game. Each plugin that arrives later (notifications in Phase 6) is reviewed
for network access before it is added, as in Amicitia.
- **Layout: `apps/rosea-tauri/src-tauri/`.** The Tauri 2 CLI looks for `src-tauri/tauri.conf.json`
below the folder it runs in, so this is the layout it expects, one level down. Not Tauri's default
`apps/rosea/src-tauri/`: that would put Rust and the Tauri CLI into the PWA's package. Here the shell
is deletable, and its only input is a built folder — the same seam the e2e suites test
(`tauri-platforms.md` D1).
- **The shell's build of the game** (`vite build --mode tauri`, into `apps/rosea/dist-tauri/`): base `/`,
because Tauri serves the files at the root of its own origin; **no service worker and no web
manifest**, because the files are already on the device and a store or installer brings updates;
the content-security policy delivered by Tauri (`app.security.csp`), the same string as the PWA's
`<meta>` policy, held equal by a test (§8).
- **The non-negotiable properties hold in all four.** Local-first, anonymous, no free text, never
counting people, nothing written outside IndexedDB, no analytics — in any SDK either: the shell
links no analytics, crash-reporting or ads library, and the webviews' own reporting is switched off
where the platform allows it (§8, *the webview phones home*). The Android app asks for **no
`INTERNET` permission** while Rosea has no network feature, so the kernel refuses it any socket.
--- ---
## 3. Commands ## 3. Commands
@@ -226,12 +271,26 @@ pnpm art:board # prompts + stand-ins -> tools/art-prep
pnpm art:accept <id> <file> # an accepted picture -> art/final/*.webp, sheets cut pnpm art:accept <id> <file> # an accepted picture -> art/final/*.webp, sheets cut
tsx scripts/build-places.ts <folder> # rebuilds the town list from downloaded Natural Earth + tzdb (by hand) tsx scripts/build-places.ts <folder> # rebuilds the town list from downloaded Natural Earth + tzdb (by hand)
# The Tauri 2 shell (apps/rosea-tauri) — each builds the game for the shell first (dist-tauri/):
pnpm tauri:dev # desktop window on the Vite dev server, 127.0.0.1:5173
pnpm tauri:build # desktop release: on Windows an NSIS installer and the .exe
# needs Rust (MSVC), WebView2, VS Build Tools; macOS/Linux on their own OS
pnpm tauri:android # Android debug APK (universal); needs ANDROID_HOME, NDK 27, JDK 17,
# the four Rust Android targets. Install: adb install -r <apk>
pnpm tauri:ios # macOS + Xcode only — refuses elsewhere with the reason (§8)
pnpm --filter @rosea/tauri test # the shell's tests: config (CSP, name, origin), privacy patch, shell build
tsx e2e/apps/check-garden.ts desktop # the built .exe: water her, close, reopen, still watered (temp data folder)
tsx e2e/apps/check-garden.ts android # the installed APK on the device over adb; `pm clear`s the TEST app first
# Not yet — they arrive with their first feature: # Not yet — they arrive with their first feature:
cargo test --manifest-path services/lucerna/Cargo.toml # Phase 4 onward cargo test --manifest-path services/lucerna/Cargo.toml # Phase 4 onward
``` ```
The build's base path is `/Rosea/` (GitHub Pages' project sub-path); `ROSEA_BASE=/x/` overrides it The build's base path is `/Rosea/` (GitHub Pages' project sub-path); `ROSEA_BASE=/x/` overrides it
for the build and for both Playwright suites together. for the build and for both Playwright suites together. `pnpm --filter @rosea/app build:shell` builds
the shell's copy instead (`--mode tauri`: base `/`, into `dist-tauri/`); the `tauri:*` commands run it.
`pnpm tauri:android` ends by reading the built APK with `aapt2` and fails if it asks for any
permission or allows backup (`tauri-platforms.md` D6).
> **The `pnpm test` trap, imported from Aeterna.** Exit code 0 says the command succeeded, not that > **The `pnpm test` trap, imported from Aeterna.** Exit code 0 says the command succeeded, not that
> tests ran. A filter that matched nothing and a green run look identical. **Quote the counts per > tests ran. A filter that matched nothing and a green run look identical. **Quote the counts per
@@ -261,7 +320,22 @@ replaying `events` through the engine. A number that cannot be derived from the
`derived`. `derived`.
**Nothing else is written anywhere.** No cookies, no `localStorage`, no analytics of any kind, no **Nothing else is written anywhere.** No cookies, no `localStorage`, no analytics of any kind, no
third-party origin, no fonts or images from a CDN. third-party origin, no fonts or images from a CDN. This holds in the shell too: `localStorage` and
`sessionStorage` stay forbidden there, and the Rust side writes no file of its own.
**Where IndexedDB lives in each version** (the webview owns the folder; Rosea writes only its
database there — the webview keeps its own caches beside it):
| Version | Where the `rosea` database is |
|:--|:--|
| PWA | the browser profile, per origin; evictable (§8) |
| Windows | WebView2's user data folder: `%LOCALAPPDATA%\<identifier>\EBWebView\` |
| Android | the app's private data: `/data/data/<identifier>/app_webview/` — no Auto Backup, no device transfer (`tauri-platforms.md` D6) |
| macOS / iOS | WKWebView's website data in the app's container (`Library/WebKit/`) *(predicted)* |
| Linux | WebKitGTK's data dir under `~/.local/share/<identifier>/` *(predicted)* |
A rose made in the PWA and the same player's Android app are **two roses** until the player carries
one across with *Keep her safe* (save to a file, bring her back). Nothing syncs them.
**On `services/lucerna`, only when the player has opted in to the shared sky (Phase 4):** an anonymous **On `services/lucerna`, only when the player has opted in to the shared sky (Phase 4):** an anonymous
trace id, a coarse geocell (~1 km), a day bucket (never a timestamp finer than a day), and the gesture trace id, a coarse geocell (~1 km), a day bucket (never a timestamp finer than a day), and the gesture
@@ -314,6 +388,8 @@ Format : [<Package>] <FeatureName>: <one-line description>
Example: [engine] RoseGrowth: Grow from total days of care, never from consecutive days Example: [engine] RoseGrowth: Grow from total days of care, never from consecutive days
Remote : GitHub (primary) — branch main; mirrored to gitea.marek-novak.cz, as in Panda Domi Remote : GitHub (primary) — branch main; mirrored to gitea.marek-novak.cz, as in Panda Domi
Deploy : GitHub Actions builds apps/rosea and publishes it to GitHub Pages on every merge to main Deploy : GitHub Actions builds apps/rosea and publishes it to GitHub Pages on every merge to main
Apps : the APK and the desktop installer are built by hand on this machine until CI can (G0.22);
never committed. Release signing keys never enter the repository (§5.3's token rule)
``` ```
PRs are opened and merged on GitHub. The Gitea mirror is a backup and must stay in sync — after every PRs are opened and merged on GitHub. The Gitea mirror is a backup and must stay in sync — after every
@@ -361,7 +437,10 @@ repository, a review document or command output.
### 5.4 The deployed bundle is the only thing the player sees ### 5.4 The deployed bundle is the only thing the player sees
The player opens an installed PWA served from a precached shell. Source changes are invisible until The player opens an installed PWA served from a precached shell. Source changes are invisible until
the app is rebuilt, the service worker's bytes change, and the client picks up the new worker. When the app is rebuilt, the service worker's bytes change, and the client picks up the new worker. In the
Android, iOS and desktop apps the game is inside the package: a change reaches a player only with a
new APK or installer, which must carry a higher version (`apps/rosea/package.json`, read by
`tauri.conf.json`) or Android refuses it as a downgrade. When
reporting a fix, **say whether the bundle was rebuilt and redeployed**. If a change is deliberately reporting a fix, **say whether the bundle was rebuilt and redeployed**. If a change is deliberately
invisible (a refactor, a library update), say so explicitly — a fresh build that looks identical is invisible (a refactor, a library update), say so explicitly — a fresh build that looks identical is
otherwise indistinguishable from a stale one. *(Imported from NoAlgoTube and Aeterna, where it otherwise indistinguishable from a stale one. *(Imported from NoAlgoTube and Aeterna, where it
@@ -413,7 +492,10 @@ happened twice.)*
### 5.7 A test run leaves the machine as it found it ### 5.7 A test run leaves the machine as it found it
Nothing binds to anything but `127.0.0.1`. Every browser a test starts is closed in `finally`. Do not Nothing binds to anything but `127.0.0.1` — the shell's dev server and a webview's debugging port
included; a phone reaches the dev server through `adb reverse`, never through `--host`. Every browser
a test starts is closed in `finally`, and so is every app a test launches (the desktop `.exe`, the
app on the tablet: `am force-stop`). Do not
start a full run above ~80% CPU. *(Imported from Ludus and Aeterna.)* **Enforced, not trusted:** start a full run above ~80% CPU. *(Imported from Ludus and Aeterna.)* **Enforced, not trusted:**
`pnpm test`, `test:e2e` and `test:offline` first run `pnpm guard:cpu`, which waits up to three minutes `pnpm test`, `test:e2e` and `test:offline` first run `pnpm guard:cpu`, which waits up to three minutes
for the machine to calm and then refuses (`tools/cpu-guard`, lessons/process.md). A dedicated machine for the machine to calm and then refuses (`tools/cpu-guard`, lessons/process.md). A dedicated machine
@@ -494,7 +576,7 @@ No timestamp finer than a day, no precise location, no free text, no link to the
| Trap | Why it bites | | Trap | Why it bites |
|:--|:--| |:--|:--|
| **A PWA cannot schedule a local notification** *(predicted — verify first)* | The sunset invitation is time-based. A web app generally cannot fire a notification at a set time while closed without a **push server** sending it, and a push server that knows when someone's sunset is knows roughly where they are. On iOS, web push works only for a site added to the home screen. **Decided in Phase 0 (2026-11-01):** in-app sunset only for the web build — no push server — and local notifications through the Tauri shell later (Phase 6). | | **A PWA cannot schedule a local notification** *(predicted — verify first)* | The sunset invitation is time-based. A web app generally cannot fire a notification at a set time while closed without a **push server** sending it, and a push server that knows when someone's sunset is knows roughly where they are. On iOS, web push works only for a site added to the home screen. **Decided in Phase 0 (2026-11-01):** in-app sunset only for the web build — no push server — and local notifications through the Tauri shell later (Phase 6). The shell exists since 2026-11-17; its notification plugin is still Phase 6. |
| **Polar day and polar night** *(measured 2026-11-01)* | Above the Arctic Circle the sun does not set in summer or rise in winter. "Every day at sunset" has no answer there. Measured: the almanac has no rise or set in Tromsø on 21 June and no events at all on 21 December. `engine/sun` returns `polar-day` or `polar-night` and a gentle moment for each (the lowest light; noon twilight) — `.agents/features/sun.md` D4. | | **Polar day and polar night** *(measured 2026-11-01)* | Above the Arctic Circle the sun does not set in summer or rise in winter. "Every day at sunset" has no answer there. Measured: the almanac has no rise or set in Tromsø on 21 June and no events at all on 21 December. `engine/sun` returns `polar-day` or `polar-night` and a gentle moment for each (the lowest light; noon twilight) — `.agents/features/sun.md` D4. |
| **DST and the local day** *(measured 2026-11-01)* | Sunset jumps an hour twice a year under a player who did nothing: Prague's is 18:28 on 28 March and 19:29 on the 29th, while the sun moved one minute. A day boundary computed in UTC records Monday-evening care as Tuesday's. One module computes the day; the sun works in instants. | | **DST and the local day** *(measured 2026-11-01)* | Sunset jumps an hour twice a year under a player who did nothing: Prague's is 18:28 on 28 March and 19:29 on the 29th, while the sun moved one minute. A day boundary computed in UTC records Monday-evening care as Tuesday's. One module computes the day; the sun works in instants. |
| **Comfort becomes wallpaper** | The same words every day stop meaning anything. Comfort words are occasional; the real trace of a real person is constant. Track repetition in tests. | | **Comfort becomes wallpaper** | The same words every day stop meaning anything. Comfort words are occasional; the real trace of a real person is constant. Track repetition in tests. |
@@ -515,6 +597,14 @@ No timestamp finer than a day, no precise location, no free text, no link to the
| **Pages hosts files, not services** | `services/lucerna` cannot live on Pages. It runs on Mark's own server (Phase 4), and the app must work fully without it. | | **Pages hosts files, not services** | `services/lucerna` cannot live on Pages. It runs on Mark's own server (Phase 4), and the app must work fully without it. |
| **`pnpm test` exits 0 having run nothing** | Quote counts per package. | | **`pnpm test` exits 0 having run nothing** | Quote counts per package. |
| **Playwright against the dev server** | It never registers the service worker and has never reproduced a caching bug. | | **Playwright against the dev server** | It never registers the service worker and has never reproduced a caching bug. |
| **Base path in the shell** *(predicted)* | 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/` opens a blank window. The shell's copy is built with base `/` into its own folder, so the two can never be mixed up. |
| **A service worker inside a webview** *(predicted)* | 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. |
| **Two content-security policies** *(predicted)* | 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. |
| **IndexedDB eviction in a webview** *(predicted)* | 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()` is asked in the shell as in an installed PWA; *Keep her safe* stays the real defence — and on Android and iOS saving a file through `<a download>` does nothing (measure; `tauri-platforms.md` G-T4). |
| **The webview phones home** *(measured in Amicitia, 2026-11-08; predicted here)* | 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** *(predicted)* | 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. |
| **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. |
--- ---
@@ -531,4 +621,5 @@ No timestamp finer than a day, no precise location, no free text, no link to the
| Add or edit hope sentences | Agents propose in `content/candidates/`; the author verifies with `pnpm library:verify`. Then `pnpm validate:library` | | Add or edit hope sentences | Agents propose in `content/candidates/`; the author verifies with `pnpm library:verify`. Then `pnpm validate:library` |
| Change what friends can send each other | `packages/schema` §6.1 — and re-read §5.6 rule 1 | | Change what friends can send each other | `packages/schema` §6.1 — and re-read §5.6 rule 1 |
| Change the shared sky | `services/lucerna/` — and re-read §4 and §5.6 rules 6–7 | | Change the shared sky | `services/lucerna/` — and re-read §4 and §5.6 rules 6–7 |
| Build the Android, iOS or desktop app | `apps/rosea-tauri/`, then `.agents/features/tauri-platforms.md` and the shell traps in §8 |
| Understand a past decision | `.agents/features/*.md`, `git log`, `.agents/reviews/*.md` | | Understand a past decision | `.agents/features/*.md`, `git log`, `.agents/reviews/*.md` |
+29 -4
View File
@@ -51,8 +51,9 @@ parameter. `packages/content` holds the hope library and its validator. `package
module that opens IndexedDB, `packages/identity` the only one that holds keys, `packages/sync` the only module that opens IndexedDB, `packages/identity` the only one that holds keys, `packages/sync` the only
one that talks to friends (WebRTC, Phase 3). `apps/rosea` is a **Svelte 5 + Vite PWA** — web first, one that talks to friends (WebRTC, Phase 3). `apps/rosea` is a **Svelte 5 + Vite PWA** — web first,
from a link, no store — built by GitHub Actions and hosted on **GitHub Pages**, with a Gitea mirror. **Rust** is used where it earns its place: `services/lucerna`, the optional from a link, no store — built by GitHub Actions and hosted on **GitHub Pages**, with a Gitea mirror. **Rust** is used where it earns its place: `services/lucerna`, the optional
anonymous discovery service (Axum + SQLite, Phase 4), and later a **Tauri 2** shell for Android and iOS anonymous discovery service (Axum + SQLite, Phase 4), and a **Tauri 2** shell (`apps/rosea-tauri`) that
that gives local notifications without a server (Phase 6). All player state is an append-only event log; packages the same game as an Android app, an iOS app and a desktop app — the platform track below, from
2026-11-17; its local notifications without a server come in Phase 6. All player state is an append-only event log;
every visible thing is a pure function of it. every visible thing is a pure function of it.
--- ---
@@ -96,7 +97,8 @@ automatic checks, Claude's review, Mark's approval — into `art/final/`.
**Out of scope:** planets, fox, friends, any server. **Out of scope:** planets, fox, friends, any server.
**Gate — the spike's real question.** Mark plays it daily for two weeks on his phone. Then: *did he go **Gate — the spike's real question.** Mark plays it daily for two weeks on his phone (the Android
app from the platform track lets this start before the PWA is hosted). Then: *did he go
and look at the real sunset without the game nagging him, and did the rose make him want to come back?* and look at the real sunset without the game nagging him, and did the rose make him want to come back?*
Yes on both is a go. Yes only on the second means a pleasant toy, not Rosea. No on both is a clean stop. Yes on both is a go. Yes only on the second means a pleasant toy, not Rosea. No on both is a clean stop.
@@ -150,9 +152,31 @@ errors.
**Gate:** a share image leaves the device containing nothing that identifies the player or anyone **Gate:** a share image leaves the device containing nothing that identifies the player or anyone
else. else.
### The platform track — four versions · from 2026-11-17, beside the phases
*Decided by the author 2026-11-17:* Rosea Domi ships as **four versions from one Svelte codebase** —
the PWA, an Android APK, an iOS app and a desktop app (Windows first; macOS and Linux when built on
those systems). The three apps come from one **Tauri 2** shell, `apps/rosea-tauri`, which wraps the
built game and adds nothing to it. This used to wait for Phase 6; it starts now, because the shell needs
no new feature and an APK puts the Phase 1 spike on a phone without any hosting. Analysis:
[`.agents/features/tauri-platforms.md`](../.agents/features/tauri-platforms.md).
- The shell, a Windows desktop build and an Android debug APK, built on Mark's Windows machine and run
on a real Android tablet.
- The same privacy in every version: no network permission on Android while Rosea has no network
feature, no cloud backup of the garden, the webviews' own reporting off, no SDK that counts anything.
- **iOS** needs a Mac with Xcode and an Apple developer account. It waits for one; nothing in the
code stops it.
- macOS and Linux desktop builds, each on its own system; signed release builds; CI for the apps (G0.22).
**Gate:** in each version that exists, the garden opens with the network off, a watered rose is still
watered after the app is closed and opened again, and the app sends nothing.
### Phase 6 — Stores and money · ongoing ### Phase 6 — Stores and money · ongoing
- Tauri 2 shell for Android and iOS: local sunset notifications without a server. - Store listings: Google Play, the App Store, perhaps the Microsoft Store — their texts pass
`lint:copy` like every other word.
- Local sunset notifications through the shell's notification plugin, without a server.
- Monetisation — **not decided** (§6). Constraints already set: tending others is always free; no - Monetisation — **not decided** (§6). Constraints already set: tending others is always free; no
ads, no subscription-only, no sale of data. ads, no subscription-only, no sale of data.
@@ -166,6 +190,7 @@ else.
| **Cold start** | Phases 3–5 need people; Mark will have few players for months. | Phases 1–2 must stand alone; the fox's path to people comes after the game is already worth playing. | | **Cold start** | Phases 3–5 need people; Mark will have few players for months. | Phases 1–2 must stand alone; the fox's path to people comes after the game is already worth playing. |
| **Content volume** | 365 sourced sentences and many planets is a lot of careful work. | Start with 60 sentences; library grows by tradition; the validator keeps quality. | | **Content volume** | 365 sourced sentences and many planets is a lot of careful work. | Start with 60 sentences; library grows by tradition; the validator keeps quality. |
| **Web notifications** | The sunset invitation may need a push server on the web, with a privacy cost. | Decided in Phase 0; the Tauri shell later removes the server. | | **Web notifications** | The sunset invitation may need a push server on the web, with a privacy cost. | Decided in Phase 0; the Tauri shell later removes the server. |
| **Four versions, one author** | Every platform has its own traps (webviews that phone home, cloud backups, evictable storage), and iOS needs a Mac. | One codebase; the shell adds a window and nothing else; one test suite for the game, the shell's own checks for its config; iOS waits for a Mac rather than being half-done. |
| **Copyright** | The book and Tolkien are protected; a too-close image or line is a legal problem. | Forbidden-names lint; likeness check in the art pipeline; ideas only. | | **Copyright** | The book and Tolkien are protected; a too-close image or line is a legal problem. | Forbidden-names lint; likeness check in the art pipeline; ideas only. |
| **Medical-device scope** | Wellbeing claims can pull the app under medical rules. | Forbidden words in all copy, store text included. | | **Medical-device scope** | Wellbeing claims can pull the app under medical rules. | Forbidden words in all copy, store text included. |
| **Safety around strangers** | Lonely people are the people a scammer looks for. | No free text, ever; consent ladder; group meetings in public only. | | **Safety around strangers** | Lonely people are the people a scammer looks for. | No free text, ever; consent ladder; group meetings in public only. |