Compare commits

...

9 Commits

Author SHA1 Message Date
mnovak 7cd7dda0c0 [repo] AndroidReleaseApk: The phone target through Fabrica's queue (reset uninstall, maxMinutes, the e2e pipeline's phone step), the release APK built and verified with caches on D:, rosea-android named as Custos's gap 2026-11-21 08:53:49 +01:00
mnovak 9b8eb7036d [repo] FabricaRelease: Merge Rosea released and updated through Fabrica: pipelines, the Aula page's words and pictures, the APK signed in Custos, domi-rosea:// from the installer, the phone target (PR #1) 2026-11-19 03:44:47 +01:00
mnovak 21d3cd1119 [repo] FabricaRelease: Review with every gate's counts, the numbers picture centred, handover and a lesson 2026-11-19 03:44:36 +01:00
mnovak 3a6f2ad6ee [repo] FabricaRelease: Lint the generated release notes before the page is made; fix escapes in the APK signing test 2026-11-19 02:11:31 +01:00
mnovak 0d37f91763 [repo] FabricaRelease: Rosea as a Fabrica app: the release and e2e pipelines, the Aula page's words and pictures, the version check, the APK signed in Custos, domi-rosea:// from the installer, the phone target 2026-11-19 01:38:53 +01:00
mnovak 185625e7fe [tauri] KeepHerSafeApps: Merge Keep her safe in the apps: true words, Android's own save screen, the page between the bars 2026-11-17 22:22:56 +01:00
mnovak d5f37b3149 [docs] KeepHerSafeApps: Round trip on the tablet, the page between Android's bars, review, gaps closed, lessons 2026-11-17 22:22:36 +01:00
mnovak e262b8f295 [tauri] KeepHerSafeApps: The device check reads the app's words, drives Android's save and pick screens, and waits for her before reading her numbers 2026-11-17 20:42:56 +01:00
mnovak 3c4463dbdd [tauri] KeepHerSafeApps: App words for Keep her safe, and Android's own save screen through a narrow bridge 2026-11-17 20:31:35 +01:00
53 changed files with 2272 additions and 51 deletions
+3
View File
@@ -5,6 +5,9 @@ One row per feature, with its analysis document (CLAUDE.md §5.1). Gaps live in
| Feature | Phase | Status | Analysis | Review | | Feature | Phase | Status | Analysis | Review |
|:--|:--|:--|:--|:--| |:--|:--|:--|:--|:--|
| Released through Fabrica: `.fabrica/` (app, release and e2e pipelines, tests, Aula pictures), the Aula page's words, the version check, the APK signed in Custos, `domi-rosea://open` from the installer, the showcase pictures on demo data, the phone target | Platform track | Merged to `main` (9b8eb70). Not published: the first release waits for the author (G-F1, G6.1) | [fabrica-release.md](features/fabrica-release.md) | [feature-fabrica-release.md](reviews/feature-fabrica-release.md) |
| The APK for a release, tested on the Wave 10 through the phone queue: `reset: uninstall`, `maxMinutes`, the e2e pipeline's `phone` step, the release APK built and verified | Platform track | On `feature/android-release-apk`. Blocked: the phone is not paired in Fabrica (G-F5); `rosea-android` does not exist (G-F7) | [android-release-apk.md](features/android-release-apk.md) | [feature-android-release-apk.md](reviews/feature-android-release-apk.md) |
| 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) | | 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) | | 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) | | 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) |
+16 -4
View File
@@ -77,14 +77,26 @@ Svelte codebase, the apps through a Tauri 2 shell. Analysis:
| ~~G-T0~~ | ~~No shell, no app on any platform~~ | Closed 2026-11-17 on `feature/tauri-platforms`: `apps/rosea-tauri`; Windows `.exe` + NSIS installer built and checked (watered, closed, reopened, still watered); Android debug APK verified with `aapt2` (no permission, no backup) and checked on the WAVE 10C, Android 16, offline by construction. 40 shell tests; 14 of 14 drills caught. | | ~~G-T0~~ | ~~No shell, no app on any platform~~ | Closed 2026-11-17 on `feature/tauri-platforms`: `apps/rosea-tauri`; Windows `.exe` + NSIS installer built and checked (watered, closed, reopened, still watered); Android debug APK verified with `aapt2` (no permission, no backup) and checked on the WAVE 10C, Android 16, offline by construction. 40 shell tests; 14 of 14 drills caught. |
| G-T1 | iOS | Open. Needs macOS + Xcode, the iOS Rust targets, an Apple developer account. `pnpm tauri:ios` refuses elsewhere. | | 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-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-T3 | Release signing (Android keystore, Windows certificate); AAB; stores | Narrowed 2026-11-19 on `feature/fabrica-release`: the release pipeline signs the installer with Custos's `domi-code-signing` and the APK with `rosea-android` through `custos-sign`; no key in the repository (`fabrica-release.md` F4). **Still open:** `rosea-android` does not exist and Custos (0.22.0 here, 0.24.0 too) will not make it: it is not in Custos's `ANDROID_APPS` (`android-release-apk.md` A6, G-F7); no signature made yet (the first release waits, G-F1); AAB and stores (Phase 6). |
| 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-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 | Open. The Android file picker opens; no round trip seen. | | ~~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-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-T7 | No CI for the apps | Narrowed 2026-11-19 on `feature/fabrica-release`: `.fabrica/artifex/release.yaml` builds both apps from a tag on Fabrica's Windows runner after every gate; `.fabrica/artifex/e2e.yaml` runs the web suite on the e2e runner. Still Mark's PC, and no run on a push yet (no webhook reaches the hub). |
| 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. | | 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. |
| G-T9 | The app icon is the placeholder | Open. With G0.21. | | G-T9 | The app icon is the placeholder | Open. With G0.21. |
## Fabrica — released and updated through Fabrica (`fabrica-release.md`)
| Id | Gap | Status / evidence |
|:--|:--|:--|
| G-F1 | The first release is not published | Open, **the author's decision**: the repository is public, so a Gitea release and the Aula page are a public release, which G6.1 holds back. The pipeline, the kit and the words are ready; the tag waits. |
| G-F2 | Canalis Part B: no capability is served | Open by decision (F6): no capability found that neither writes into her nor reads her; Canalis keys need Custos, which a player does not have. |
| G-F3 | No showcase videos | Open: Pensum `kkpy69`, once Fabrica docs/37 is on `main`. |
| G-F4 | `domi-rosea://` not seen working | Open: the hook is tested as text; no installer was run on this PC (it writes the real registry). |
| G-F5 | The `phone` target has not run | Narrowed 2026-11-21 (`android-release-apk.md`): `reset: uninstall`, `maxMinutes: 20`, and the e2e pipeline's `phone` step (`device: Wave 10`) puts it in the hub's queue. **Still open:** the Wave 10 is not paired in Fabrica (`fabrica devices list`: *connected (not paired in Fabrica)*), so the step cannot get its phone; pairing is the Fabrica session's. |
| G-F7 | No key signs the APK | Open (`android-release-apk.md` A6): `rosea-android` is not in Custos's `ANDROID_APPS`, so the release's `apk` step stops at `no_key`. Custos's change (or Mark's *Create Android key*), then the release. The unsigned release APK builds and verifies. |
| G-F6 | PWA updates have no host | Open with G0.13: the service worker and *Refresh* are built; nothing serves the PWA. |
## Phase 6 — Release ## Phase 6 — Release
| Id | Gap | Status / evidence | | Id | Gap | Status / evidence |
+103
View File
@@ -0,0 +1,103 @@
# The Android APK in a release, tested on the Wave 10 through Fabrica's phone queue
Branch `feature/android-release-apk`, 2026-11-21. Follows [`fabrica-release.md`](fabrica-release.md) (F1–F11), which
made Rosea a Fabrica app with no release yet.
## 1. Why and what, in the player's terms
Mark asked for every Domi app to ship its APK, tested at least once on a real phone first: *install, open, the first
screen shows, one real action*. For Rosea the real action is to water her, and the check that matters is that she is
still watered after the app is closed and opened again. A rose that forgets her care on a phone is the cruellest bug
this product could have (CLAUDE.md §8).
A player gets the APK from Rosea's Aula page once a release is published. Nothing about the game changes. This
branch changes how the APK is built, tested and released.
## 2. Technical architecture
```mermaid
flowchart LR
subgraph repo["Rosea (this repository)"]
game["apps/rosea → dist-tauri/"] --> shell["apps/rosea-tauri: tauri android build"]
shell --> debug["debug APK (WebView drivable)"]
shell --> unsigned["release APK, unsigned<br/>android.ts verify: no permission, no backup"]
spec["e2e/android/garden.android.ts"]
end
subgraph fabrica["Fabrica (Mark's PC and the hub)"]
e2e["e2e pipeline, runner windows-e2e<br/>step phone: device Wave 10"] --> lease["hub: phone queue lease"]
lease --> run["fabrica tests run --target phone<br/>reset uninstall, install, launch"]
rel["release pipeline: android → approve → apk"]
end
debug --> e2e
spec --> run
run --> phone(("Wave 10"))
unsigned --> rel
rel --> custos["Custos: custos-sign apk, key rosea-android"]
custos --> mini["minisign (domi-release), SHA256SUMS"]
```
- **A1. Two APKs, one game.** The phone test drives the **debug** APK. Only a debug build's WebView can be reached
over DevTools (Fabrica docs/22 part 5), and Tauri's `devtools` feature would make the *release* WebView drivable for
anyone with a cable, so the shipped APK never gets it. The two APKs carry the same `dist-tauri/` game, the same
manifest patch (no `INTERNET`, no backup) and the same `MainActivity`. They differ in the Rust profile and the
signing key. What the phone test cannot prove about the release APK is listed in §5.
- **A2. The phone only through the queue.** The `phone` step of `.fabrica/artifex/e2e.yaml` says `device: Wave 10`.
The hub queues the run for the phone, the runner sets `ANDROID_SERIAL` and `FABRICA_PHONE_LEASED`, and the nested
`fabrica tests run --target phone` uses that phone without a lease of its own (docs/35 part 4). The spec skips
unless Fabrica's environment is there, so it never reaches for a phone by itself.
- **A3. `reset: uninstall`, not the default `clear`.** The target installs the debug APK. A release build of Rosea
on the phone has another key and would refuse the install. `clear` would wipe its data and then fail anyway;
`uninstall` wipes the same data and installs fresh. The Wave 10 is the dedicated test phone (docs/35 part 5), and
no player's rose lives on it.
- **A4. `maxMinutes: 20`.** One test of about two minutes, plus install and launch. Twenty minutes frees the phone
for the next app if the run hangs, well under the 60-minute default.
- **A5. Caches off C:.** Both pipelines name `GRADLE_USER_HOME` on `D:\build\rosea\gradle` and the NDK
(`NDK_HOME`, which the Tauri CLI needs and this PC does not set). A local build also puts Cargo's target folder,
`TEMP` and `ANDROID_USER_HOME` under `D:\build\rosea`. The pipelines keep Cargo's target in the checkout, because
the installer's artifact glob is there.
- **A6. Signing: `rosea-android` does not exist, and Custos will not make it.** Custos creates an Android key on an
app's first release only for the apps in its `ANDROID_APPS` table (`apps/desktop/src-tauri/src/signing.rs`). In
0.24.0 that table holds Postea, Culina and Liber, and Mark's PC runs 0.22.0, which holds Postea only. Rosea's `apk`
step would stop at `no_key`, as Culina's and Liber's did on 2026-11-20. Two fixes exist, and both belong to
Custos and Mark, not to this repository: a Custos change that adds `rosea-android` (`CN=Rosea Domi`, only
`mnovak/Rosea`, pipeline `release`) and its install on this PC, or Mark's *Create Android key* by hand.
`fabrica-release.md` said "Custos makes the key on the first release". It was wrong, and is corrected here.
- **A7. The certificate is forever.** Once a player installs an APK signed with `rosea-android`, every update must
carry the same certificate (CLAUDE.md §8). The CN names the product, *Rosea Domi*, and the name is still provisional.
The key outlives a rename: a renamed app keeps the old CN, and no player sees it.
## 3. Risk analysis
| Risk | Where | Answer |
| :-- | :-- | :-- |
| A player's rose lost on the test phone | `reset: uninstall` | The Wave 10 is Fabrica's dedicated test phone (docs/35 part 5). The memory rule stands: Fabrica stops the app after the run, and the spec force-stops it in `finally` as well. |
| The release APK phones home | the APK | `android.ts verify` reads the built APK with `aapt2` and refuses any permission or backup flag. It runs in the release pipeline's `android` step and in every local build. |
| Someone made reachable | none | No network feature. The APK asks for no `INTERNET` permission, so the kernel refuses every socket. |
| A tester's place on the phone | the spec | The spec chooses *Not now*, so no town is ever chosen on the phone. |
| A release signed with a stand-in key | signing | The `apk` step names `rosea-android` only, through Custos, and refuses `CUSTOS_PIPE` (sign-apk.ts). There is no fallback to a debug or local keystore. A missing key stops the release. |
| An untested APK published | the release | The phone test is a pipeline of its own: phones are leased per run, and the release must not hold the phone for two hours. Until the e2e pipeline's `phone` step has passed on a commit, that commit is not tagged (process, §5). |
## 4. Gap analysis and the designed solution
| Gap | Solution here | Left open |
| :-- | :-- | :-- |
| The phone target did not say `reset` or `maxMinutes` (the old CLI refused them) | The installed CLI reads both now: a planted `reset: wipe-everything` is refused by `fabrica artifex check`. Written: `reset: uninstall`, `maxMinutes: 20`. | none |
| No pipeline put the phone run in the queue | `e2e.yaml` gains `apk` (`pnpm tauri:android`) and `phone` (`device: Wave 10`). | It has not run: the Wave 10 is not paired in Fabrica (below). |
| The release pipeline's Android step lacked the NDK and put Gradle on C: | `NDK_HOME` and `GRADLE_USER_HOME` in `release.yaml`'s env. | none |
| The release APK was never built | Built here with caches on D:, then checked by `android.ts verify` (§5). | Not signed (A6). |
| `rosea-android` | Named as Custos's change (A6). | **Custos's and Mark's.** |
| The Wave 10 is not paired in Fabrica | `fabrica devices list` shows `WAVE 10C connected (not paired in Fabrica)`. `pass::resolve` then finds no phone named *Wave 10*, and the step fails before it runs. | **The Fabrica session's** (Pipelines → Workshop → Devices → Pair a phone). |
| Publication | G6.1: the repository is public, so a release is public, and a legal check of the look comes first. | **Mark's** (`fabrica-release.md` F1). |
## 5. Verification matrix
| Case | Kind | How | Status |
| :-- | :-- | :-- | :-- |
| The release APK builds with every cache off C: | build | `pnpm tauri:android-release` | done 2026-11-21: 27 min from cold (Gradle 9.6.1 downloaded to D:), 5.60 MiB, arm64-v8a, versionCode 1000, sha256 4d52e9eca4cd2e56… (unsigned) |
| The release APK asks for no permission and allows no backup | build check | `android.ts verify <unsigned apk>` (aapt2) | done: verified; `aapt2 dump badging` shows no `debuggable` and only androidx's own `DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION` (the app's own signature permission, not a capability) |
| `reset` and `maxMinutes` are read, and a wrong `reset` is refused | config | `fabrica artifex check` with a planted value | done: refused with `targets[1].reset: clear, uninstall or keep` |
| The pipelines are valid | config | `fabrica artifex check` | done: 0 problems |
| Install, open, first screen, water, close, reopen, still watered | e2e, real phone | the e2e pipeline's `phone` step | **not run**: the phone is not paired in Fabrica |
| The spec never reaches for a phone outside the queue | e2e | `test.skip` without `FABRICA_TESTS_PACKAGE` and `ANDROID_SERIAL` | by construction |
| The signed APK verifies with `rosea-android`'s certificate | release | the `apk` step (custos-sign verifies with apksig) | **not run**: no key |
| What the debug test cannot prove about the release APK | manual | install the signed release APK on the Wave 10 once, water, close, reopen | after the key exists |
+196
View File
@@ -0,0 +1,196 @@
# Released through Fabrica: the release kit, the Aula page, updates, `domi-rosea://`, the showcase, the test targets
*Platform track.* Mark asked on 2026-11-19 that every Domi app be released and updated through Fabrica
(Fabrica `docs/36_app_onboarding.md`, the checklist this doc follows). This repository's CLAUDE.md wins
where the two disagree, and this doc says where they do.
## 1. Why and what, in the player's terms
Today a Rosea app reaches nobody: the Windows installer and the Android APK are build output on one
machine (G-T7, G0.22), and nothing tells an installed copy that a newer garden exists. After this
feature:
- **One release, built the same way every time.** A `vX.Y.Z` tag makes Fabrica's Windows runner run
every gate of §5.5 on a clean checkout, build the Windows installer and the Android APK, take the
pictures, and stop at Mark's Custos card. Only then is anything signed or published.
- **A page that shows her honestly.** The release carries what Aula needs for Rosea's page: a few
sentences, pictures of the built game on invented demo data (a rose tended for two weeks in an
invented garden), and the release notes. Nothing of Mark's own rose is ever in a picture.
- **Her next version arrives without a network feature in the game.** The apps still make no network
call of their own (§2, §8). The installed copy on Mark's PC moves to each release through Fabrica's
*Update all*; a player installs the next installer or APK over the old one, and her rose stays.
- **Other Domi apps can open the garden.** `domi-rosea://open` opens Rosea on Windows (Canalis
Part A). Nothing can reach into her: no other app can write into her care, read it, or send words.
**What this is not.** Not a public launch. Rosea's repository on Gitea is public, so a published
release and an Aula page are public too, and CLAUDE.md §8 and G6.1 say a legal check of the look
comes before any public release. This feature builds the release and the page; **publishing them is
Mark's decision** (F1).
## 2. Technical architecture
```mermaid
flowchart LR
tag["tag vX.Y.Z<br/>(Fabrica Deploy)"] --> hub["Fabrica hub"]
hub --> runner["Windows runner<br/>(Mark's PC)"]
subgraph repo["this repository at the tag"]
gates["pnpm lint · typecheck · test<br/>validate:library · lint:copy"]
build["turbo build: schema → engine/content/ui → @rosea/app"]
e2e["e2e + offline<br/>(built app, /Rosea/)"]
shots["pnpm aula:shots<br/>e2e/aula.spec.ts → e2e/aula/*.png"]
desktop["@rosea/tauri build:desktop<br/>NSIS installer + domi-rosea hook"]
android["@rosea/tauri build:android-release<br/>unsigned release APK, aapt2 verify"]
end
runner --> gates --> build --> e2e --> shots
build --> desktop
build --> android
shots --> kit["fabrica notes · aula shots · aula page"]
desktop --> approve{"Custos card<br/>(Mark)"}
android --> approve
kit --> approve
approve --> sign["Authenticode (domi-code-signing)<br/>APK (rosea-android, custos-sign)<br/>minisign (domi-release)"]
sign --> publish["Gitea release + signed SHA256SUMS"]
publish -. "only once Mark decides (F1)" .-> aula["Aula page /rosea/"]
publish --> update["Fabrica Update all<br/>(Mark's PC)"]
```
Packages and files:
| Piece | Where | Reads |
| :-- | :-- | :-- |
| The Fabrica app | `.fabrica/app.yaml` | — |
| The release pipeline | `.fabrica/artifex/release.yaml` | the repo at the tag |
| The e2e pipeline | `.fabrica/artifex/e2e.yaml` (`runner: windows-e2e`) | `.fabrica/tests.yaml` |
| The test targets | `.fabrica/tests.yaml`, `e2e/playwright.fabrica.config.ts`, `e2e/android/` | the built bundle; the debug APK |
| The pictures | `e2e/aula.spec.ts`, `e2e/playwright.aula.config.ts`, `.fabrica/aula.yaml` | the built bundle (PWA, `/Rosea/`) |
| The page's words | `AULA.md`, `.fabrica/aula/brief.md`, `.fabrica/notes/<version>.md` | — (checked by `lint:copy`) |
| The version check | `scripts/check-version.mjs` | the four version files |
| The scheme (Part A) | `apps/rosea-tauri/src-tauri/windows/hooks.nsh`, `tauri.windows.conf.json` | the installer only |
| The release APK | `apps/rosea-tauri/package.json` `build:android-release`, `scripts/android.ts` | the generated project |
The dependency direction of §2 is unchanged: no package gains an import, the game gains no code, the
shell gains no Rust, no crate and no plugin. Fabrica reads this repository; this repository imports
nothing of Fabrica's.
### Decisions
- **F1 — Built and signed, published only when Mark says.** The pipeline is complete: on the hub it
builds, signs after the card and publishes. Because the repository is public, the first `publish`
is a public release (G6.1). The tag is therefore made only after Mark answers. Until then the run is
made locally (`fabrica run release --step page`, which signs as a dry run). The Aula entry for the
server's `modules/aula.nix` is written down in the handover, not added.
- **F2 — One part, `desktop`; no `server` part.** The release pipeline makes both apps (Windows and
Android). The PWA's host is still the author's open question (G0.13: GitHub Pages under `/Rosea/`),
and a server part would be a NixOS module on the server, which is not this repository's to change.
When the PWA gets a host, a `server` part (or a Pages job) is added then.
- **F3 — Updates, the app's own way, with no network in the game.**
| Version | How an installed copy reaches the next release | Why not the other way |
| :-- | :-- | :-- |
| Windows | Fabrica *Update all* on Mark's PC (Fabrica docs/16): the signed `SHA256SUMS` checked against `domi-release`, the installer run with `/S /UPDATE` in place. A player runs the next installer over the old one (`installMode: currentUser`, same identifier): the WebView2 data folder, and so her rose, stays. | `tauri-plugin-updater` is a network feature and a plugin in the shell; §2 allows neither until one is reviewed for what it sends. An update check would tell a server, daily, that this person plays. No `latest.json` is published, so nothing waits for an updater that does not exist. |
| Android | The next APK, signed with the same `rosea-android` key and a higher `versionCode` (Tauri derives it from the version), installs over the old one and keeps her. A player gets it from the Aula page; the test phone gets each debug build from its `android` target. | An in-app check needs the `INTERNET` permission, which the APK must not ask for while Rosea has no network feature (§2; `android.ts verify` refuses any permission). |
| PWA | The service worker: a new bundle is a new worker, offered with *A new version of the garden is ready.* and *Refresh* (calm-refresh.md, G0.10). | Nothing to add here until it has a host (F2). |
| iOS | Not built (G-T1: needs a Mac). | — |
- **F4 — Signing through Custos only.** Authenticode with `domi-code-signing` for the installer;
the APK with `rosea-android` through `custos-sign apk` (corrected 2026-11-21, `android-release-apk.md` A6:
Custos does NOT make this key; it must be added to Custos's `ANDROID_APPS` or made by hand; a `run` step that names it in `keys:` so preflight checks it);
`domi-release` signs each file's minisign signature and `SHA256SUMS`. No key, password or token is
in the repository, a pipeline file or a log (G-T3). Each key's scope must name `mnovak/Rosea` exactly:
Mark's step in Custos, which `fabrica preflight rosea` names when it is missing.
- **F5 — `domi-rosea://open` from the installer (Canalis Part A).** The NSIS installer writes
`HKCU\Software\Classes\domi-rosea` (`URL Protocol`, `shell\open\command` = `"<exe>" "%1"`) after
install, and the uninstaller removes the key. **The installer, not every start**, because the shell is
a window and nothing else (§2): registering at start needs Rust code (a registry crate) in it. An
*Update all* or a reinstall runs the installer again in the install folder, so the command follows
the exe. The game ignores the URL: an open of `domi-rosea://…` opens the garden. If Rosea is already
open, a second window opens on the same data (no single-instance plugin, §2); two-tabs.md keeps both
windows true to the log. The app id is `rosea`, the identifier `cz.mareknovak.domi.rosea` is unchanged.
- **F6 — Canalis Part B is not done, and no capability is served.** Three reasons, each enough alone:
(1) a capability lets another program act on the player's garden, and §1 says *contributions only
add* and the care log holds only the player's own acts: a `rosea.care.*` capability would make a
number on screen that the player did not earn; (2) Canalis keys come from Custos (`custos_local`),
which a Rosea player does not have and must never need: Rosea's identity is its own anonymous
keypair (§1); (3) it would add Fundamentum crates, a server thread and IPC to a shell that has none.
So there is nothing to pin: Rosea has no Fundamentum crate, and `canalis-v1.1.0` does not apply.
Reopen with a capability that only *reads nothing and adds nothing* to her, if one is ever found.
- **F7 — The pictures come from the app's own Playwright run, on demo data the app itself made.**
`pnpm aula:shots` serves the built PWA, fixes the clock (Europe/Prague, 08:00 on fourteen
invented days in March 2026), answers the first open with the gardener's first look and the town
*Prague* (a public place, chosen from the bundled list; never a real player's town), waters her once
a day by the button as a player does, and photographs: the garden, the ring of care, her numbers,
the in-game sunset, *Keep her safe*, the first open, and the same garden on a phone's screen.
`.fabrica/aula.yaml` lists them as `file:` shots; `fabrica aula shots` checks and publishes them.
The PWA is built under `/Rosea/`, so Fabrica's own `web:` server (which serves at `/`) is not used.
**No iPhone pictures:** there is no iOS app yet (G-T1), and the PWA has no host to add to a Home
Screen (G0.13); a picture of an iPhone would show a version nobody can install.
- **F8 — Videos wait for Fabrica docs/37.** Until a `videos:` key is on Fabrica `main`, it fails
`fabrica aula shots`; the Pensum ticket `kkpy69` (*Showcase videos of the main flows for the Aula page*) holds the work.
- **F9 — Two test targets.** `.fabrica/tests.yaml`: `web` (the built PWA in a headless Chromium, the
`web` project of `e2e/playwright.fabrica.config.ts`, the same specs as `pnpm test:e2e`) and `phone`
(`kind: android`, `device: Wave 10`, the debug APK; the queue clears the app's data first, its default
`reset: clear`). `reset: uninstall` would let a debug build replace a release build, but the installed
Fabrica CLI (0.14.0) does not know `reset` or `maxMinutes` yet, so neither is written. The `android` project reaches the app's WebView with Playwright's
`_android` and waters her by the button. It runs **only through Fabrica's phone queue**
(`fabrica tests run --target phone`); `pnpm test:android` drives Chrome on a USB tablet and stays the
developer's own check of the PWA. `.fabrica/artifex/e2e.yaml` runs the `web` target on the e2e runner.
- **F10 — The version is in four files.** `package.json`, `apps/rosea/package.json` (which
`tauri.conf.json` reads), `apps/rosea-tauri/package.json` and `apps/rosea-tauri/src-tauri/Cargo.toml`.
`scripts/check-version.mjs <version>` prints each that differs in Fabrica's contract
(`<file> says <old>, the tag says <new>`), so *Deploy* bumps exactly those. The first release is
`v0.1.0`, the version every file has today.
- **F11 — The page's words are copy.** `AULA.md`, `.fabrica/aula/brief.md` and `.fabrica/notes/*.md`
are what a stranger reads about Rosea, like a store listing (§8). `lint:copy` scans them, so the
page never says *lonely*, never names the book, and makes no claim to heal anything. The release
notes `fabrica notes` writes from commit subjects are copy too: the release's `notes-copy` step runs
`lint:copy` over `target/notes/release-notes.md` before the page is made.
## 3. Risk analysis
Here risk means *a lonely person feeling worse*, *someone's location*, or *someone being reachable who
did not ask to be* (§5.1).
| Risk | Where | Answer |
| :-- | :-- | :-- |
| The page names the person it is for: *for lonely people* | `AULA.md`, the brief, the notes | They speak of the rose, the fox and the time we give to people, never of the reader's state. `lint:copy` scans all three (F11); a test of the script proves they are in its list. |
| The page promises comfort, or a cure | the same | No outcome is promised; the medical words are refused by `lint:copy`. |
| The book's look on a public page | the pictures (gardener, round planet, rose) | G6.1: not published until Mark decides (F1). The pictures are the code stand-ins, said plainly in the brief. |
| A real person's rose or town in a picture | `e2e/aula.spec.ts` | The demo rose is made by the test in a fresh browser profile; the town is a capital from the bundled list; the clock is invented. No file, no IndexedDB of a real profile is read. |
| An update check that tells a server who plays | the apps | None exists (F3). The apps still ask for no `INTERNET` permission and the shell links no plugin; `android.ts verify` and the shell's tests keep it so. |
| Auto Backup or a release build that carries debug flags | the release APK | `android.ts verify` runs on the release APK too (no permission, no backup); `custos-sign` refuses a debuggable APK. |
| Another program reaches into her | `domi-rosea://` | The URL only opens the window; its text is not read (F5). No capability is served (F6). |
| A web page opens Rosea | `domi-rosea://` | The browser asks first, as for any app link; the garden opens and does nothing else. |
| A signing key in the repository | the pipelines | Keys are Custos ids only; `custos-sign` holds no key material either (F4). |
| A release over a player's rose loses her | Windows, Android | Same identifier, same origin (`useHttpsScheme`, pinned by the shell's test), install over, never uninstall. On Android the same key; a debug and a release build cannot replace each other, so the test phone keeps debug builds only. |
| The phone is used outside the queue | the `phone` target | Only `fabrica tests run --target phone` runs the `android` project. The `android` project skips, saying why, without `FABRICA_TESTS_PACKAGE` and `ANDROID_SERIAL` (set by Fabrica). |
## 4. Gap analysis and the designed solution
| Gap | Before | After |
| :-- | :-- | :-- |
| G-T7 / G0.22: no CI for the apps | built by hand on this machine | built by Fabrica's runner from the tag; still on Mark's PC, but from a clean checkout and the same steps every time |
| G-T3: release signing keys | none | Custos only (F4) |
| No release, no page | — | the pipeline, the kit and the words; publishing is F1 |
| Installed copies never learn of a new version | — | F3 |
| No `domi-rosea://` | — | F5, Windows only |
| Nothing to show a stranger | — | F7, eight pictures |
| G0.23 (source maps) | maps in the PWA build | unchanged and still open: the installer embeds `dist-tauri/`, maps included; the source is public on Gitea already, so nothing new is exposed |
Not closed here: G6.1 (Mark's legal check), G0.13 (the PWA's host), G-T1 (iOS), Canalis Part B (F6),
the videos (F8).
## 5. Verification matrix
| Case | Unit | Integration | E2E / device | Manual |
| :-- | :-- | :-- | :-- | :-- |
| `check-version` passes with all four files equal, names each file that differs in the contract's words | `scripts/check-version.test.ts` | — | — | `node scripts/check-version.mjs 0.1.0` |
| `lint:copy` reads `AULA.md`, the brief and the notes; a forbidden word in any of them fails | `scripts/lint-copy.test.ts` | `pnpm lint:copy` | — | — |
| The pipelines and `tests.yaml` are valid | — | `fabrica artifex check` | — | `fabrica preflight rosea` |
| The NSIS hook registers and removes exactly `HKCU\Software\Classes\domi-rosea` with `"%1"` | `apps/rosea-tauri/test` (the hook's text and the config that names it) | `pnpm tauri:build` makes the installer | — | not run: installing writes Mark's real registry |
| The release APK has no permission and no backup | `android-privacy` tests (unchanged) | `build:android-release` ends with `android.ts verify` on it | — | — |
| The pictures: eight PNGs within Aula's limits, on demo data, the same on every run | — | `pnpm aula:shots`, then `fabrica aula shots` | `e2e/aula.spec.ts` | open them and look |
| The page | — | `fabrica aula brief`, `fabrica aula page` | — | read `aula-page.html` |
| The `web` target | — | `fabrica tests run --target web` | the e2e specs | — |
| The `phone` target: the WebView found, watered by the button, still watered after a restart | — | — | `e2e/android/garden.android.ts`, only through the phone queue | — |
| Bad weather: no `FABRICA_TESTS_PACKAGE` | — | — | the `android` project skips, saying why, before touching adb | — |
| A full release | — | `fabrica run release --step page` locally (signing dry-run) | — | the hub run, after F1 |
+81
View File
@@ -0,0 +1,81 @@
# Keep her safe, inside the apps (G-T4)
Status: built on `feature/keep-her-safe-apps`, 2026-11-17. Closes the release blocker found in
[`tauri-platforms.md`](tauri-platforms.md) G-T4 and, if a round trip is seen, G-T5. Builds on
[`keep-her-safe.md`](keep-her-safe.md). Review:
[`feature-keep-her-safe-apps.md`](../reviews/feature-keep-her-safe-apps.md).
## 1. Why and what, in the player's terms
*Keep her safe* is how a player makes sure their rose cannot be lost, and how she moves to another
device. In the browser it tells the truth about the browser. In the Android and desktop apps it
said the same words, and they were wrong there: *This browser may clear her if the garden is not
opened for a long time* — there is no browser, and an app's own storage is not cleared for being
left alone. It offered *Ask the browser to keep her*, which always answers no in an app. And on
Android, *Save her to a file* did nothing at all (measured on the tablet). A player was told she
might be lost, and the one remedy failed without a word.
Now, in the apps:
- She says where she lives, truly and calmly: *She lives in this app, on this device, until the app
is removed. A saved file keeps her anywhere.* No button that cannot work.
- *Save her to a file* opens Android's own *save* screen; the player chooses where (the phone, a
memory card, a cloud folder they already use). When the file is written, the garden says
*She is in that file now.* If they step back, nothing is said.
- *Bring her back from a file* opens Android's own file picker, as before.
The PWA is unchanged.
## 2. Technical architecture
```mermaid
flowchart LR
ks["packages/ui<br/>KeepSafe.svelte"] -->|"wiring.saveFile(name, text)<br/>wiring.keeping.where"| app["apps/rosea<br/>App.svelte"]
app -->|"PWA / Windows: &lt;a download&gt;"| browser["browser / WebView2 download"]
app -->|"Android: window.roseaFile.save(name, text)"| bridge["apps/rosea-tauri/android/java<br/>MainActivity.kt (copied into gen/)"]
bridge -->|"ACTION_CREATE_DOCUMENT"| saf["Android's save screen<br/>(Storage Access Framework)"]
saf -->|"uri"| bridge
bridge -->|"write, then event 'rosea-file-saved' (true|false)"| app
```
| # | Decision | Why |
|:--|:--|:--|
| A1 | **The words follow where she lives**: `RoseWiring.keeping.where` is `'browser'` or `'app'`, set in `App.svelte` from `__ROSEA_SHELL__`. In an app, `KeepSafe` shows `safe.app` and never asks `persist()`. | The words state facts about the platform; the platform decides which facts are true (lessons/design.md). The package chooses among its own words; the app only says where it is. |
| A2 | **Android saves through a small Kotlin bridge**, not a Tauri plugin: `MainActivity` adds one JavaScript interface, `roseaFile.save(name, text)`, which opens `ACTION_CREATE_DOCUMENT` through Tauri's own `launchActivityForResult` and writes the text to the chosen place. | No new dependency, no download, no IPC and no capability: the shell still grants the page nothing through Tauri. The Storage Access Framework needs **no permission** on any Android version (the APK check still demands none). A plugin (dialog + fs) would bring IPC, a capability, a CSP change and two packages for one file. iOS will need its own answer (G-T1). |
| 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
| Risk | Answer |
|:--|:--|
| **Fear**: words that say she may be lost. | Removed in the apps (A1). The new sentence says the one true condition (removing the app) and the remedy. |
| **A broken promise**: a save that does nothing. | Fixed on Android (A2) and confirmed to the player (A4). |
| **Location in the file.** | Unchanged: the file never holds the town (keep-her-safe.md K4). |
| **Bytes leaving the device.** | Only where the player chooses in Android's save screen. If they choose a cloud folder, that app uploads it — their choice, made in the system's own screen. The game still has no `INTERNET`. |
| **A script calling the bridge.** | Only the game's own page runs in the WebView (no network, `'self'` CSP). The bridge refuses any other name or a huge text, and it can only open a screen the player must confirm. |
| **Reachability, guilt, counting.** | None: nothing new reaches anyone or counts anything. |
## 4. Gap analysis
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*, 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 |
| 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. | | [`design.md`](design.md) | 1 | Wording, silence, empty states. |
| [`art.md`](art.md) | 3 | The image pipeline. | | [`art.md`](art.md) | 3 | The image pipeline. |
| [`code.md`](code.md) | 4 | TypeScript, Svelte, async ordering, Rust. | | [`code.md`](code.md) | 4 | TypeScript, Svelte, async ordering, Rust. |
| [`technical.md`](technical.md) | 9 | The browser and the build as platforms. | | [`technical.md`](technical.md) | 10 | The browser and the build as platforms. |
| [`testing.md`](testing.md) | 15 | What makes a test worth having, and how a passing test lies. | | [`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.) | | `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) | 6 | Workflow, commits, credentials, honesty about what shipped. |
A file is created with its first real entry. An empty lessons file only looks like A file is created with its first real entry. An empty lessons file only looks like
knowledge. knowledge.
+36
View File
@@ -59,3 +59,39 @@ 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 **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. 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.
## A bug drill restored with `git checkout` loses the work beside it
**What happened.** On 2026-11-19 (`feature/fabrica-release`) a drill edited `scripts/lint-copy.ts`
and restored it with `git checkout --`. That brought back the *committed* file and silently dropped an
uncommitted change in it (the release notes' entry). The diff showed it at once; it was re-applied.
**Why it bit.** `git checkout -- <file>` restores the index, not the file as it was a minute ago.
**How to apply it.** Commit before drilling, or copy the file aside and copy it back. Check
`git diff --stat` after every drill.
## A claim about another system's behaviour, written from its docs' general rule, was wrong for us
**What happened.** On 2026-11-19 `fabrica-release.md` F4 said "Custos makes `rosea-android` on the
first release". Custos does that only for the apps in its `ANDROID_APPS` table, and Rosea was never in
it (`apps/desktop/src-tauri/src/signing.rs`, read on 2026-11-21). The release would have stopped at
`no_key` after Mark's approval card. Culina and Liber hit exactly that on 2026-11-20.
**Why it bit.** The doc described what Custos does for Postea, and it read like a rule for every app.
Nothing in Rosea could test the claim: the step that would have failed runs only after a human approves.
**How to apply it.** When a step depends on another system doing something for us, find the line in
that system's source or config that names us, and cite it in the analysis. If no line names us,
write the claim as a gap, not as a fact.
+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 **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, installed package, and name each allowed exception precisely (this package's own receiver guard,
not any app's). 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 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 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. 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,84 @@
# Review: `feature/android-release-apk` (2026-11-21)
Analysis: [`../features/android-release-apk.md`](../features/android-release-apk.md). The brief was Mark's, relayed by
the Aula session: release each app's APK after the most basic e2e on the Wave 10, through Fabrica's phone queue.
## What changed
- `.fabrica/tests.yaml`: the `phone` target says `reset: uninstall` and `maxMinutes: 20`.
- `.fabrica/artifex/e2e.yaml`: new steps `apk` (`pnpm tauri:android`) and `phone` (`device: Wave 10`,
`fabrica tests run --target phone`); `GRADLE_USER_HOME` on D:, `NDK_HOME` named.
- `.fabrica/artifex/release.yaml`: the same two variables, and the header no longer claims Custos makes `rosea-android`.
- `e2e/android/garden.android.ts`: force-stops the app in `finally`.
- Docs: the analysis, G-T3 and G-F5 narrowed, G-F7 new, `fabrica-release.md` F4 corrected, the handover.
## Gates
See *Counts* at the end (filled in from the run of this branch).
Also run:
- `fabrica artifex check`: 2 pipelines, app.yaml, aula.yaml, tests.yaml and brief.md, 0 problems.
- **Drill:** `reset: wipe-everything` planted in tests.yaml was refused with
`targets[1].reset: clear (the app's data), uninstall or keep`, then restored by copy, not `git checkout`
(lessons/process.md).
- `fabrica tests list --target phone`: 1 test in 1 file.
- **The release APK:**
- `pnpm tauri:android-release` with Gradle, Cargo's target, TEMP and ANDROID_USER_HOME under `D:\build\rosea`: exit 0 in 27 min.
- `android.ts verify`: no permission asked, no backup, metrics and Safe Browsing off.
- `aapt2 dump badging`: `cz.mareknovak.domi.rosea`, versionCode 1000, versionName 0.1.0, arm64-v8a, not debuggable, 5.60 MiB, sha256 `4d52e9eca4cd2e56…`, unsigned.
## Findings
1. **The release pipeline does not require the phone test.** A tag can be released whose debug APK never passed on
the Wave 10. *Deferred, with the reason.* A `device:` step in `release` would queue the whole release for the
phone from the start, and the release runs on `windows`, not `windows-e2e` (docs/35 part 2). The gate is
process for now: no tag on a commit until the e2e pipeline's `phone` step has passed on it (analysis §3). A
pipeline `needs:` across pipelines would close it; Artifex has none today.
2. **The phone tests a debug APK, and the release is a different build.** *Accepted, and stated (A1).* Only a debug
WebView can be driven. The game bytes, the manifest patch and `MainActivity` are the same; the Rust profile and
the key differ. A manual check of the signed release APK on the phone is in the matrix, for after the key exists.
3. **`reset: uninstall` instead of the asked-for `clear`.** *Kept, with the reason (A3):* a release build on the
phone would otherwise block every debug run. It loses nothing more than `clear` would.
4. **`fabrica-release.md` F4 was wrong.** It said Custos makes `rosea-android` on the first release. Custos's
`ANDROID_APPS` table never named Rosea (0.22.0: Postea; 0.24.0: Postea, Culina, Liber). *Fixed* in F4, G-T3 and
the release.yaml header, and a lesson added (process.md). The release would have stopped at `no_key` after Mark's
card, as Culina's and Liber's did.
5. **The debug build in the e2e pipeline uses the default `ANDROID_USER_HOME`** (`%USERPROFILE%\.android` on C:).
Gradle writes `debug.keystore` there if it is missing. *Accepted:* adb's pairing keys live in that folder too
(docs/35 part 2), and moving it for the step could cut the runner off from the phone. It is one small file,
and it is already there.
6. **The pipelines keep Cargo's target in the checkout** (on F:, which is nearly full). *Accepted:* the
installer's artifact glob is relative to it. Only the local build here used D:.
7. **The new `finally` line was never run.** No run of the spec is possible outside the queue. *Not verified*:
typecheck and lint only.
8. **`fabrica devices list` did one reconnect pass** (adb `devices`, mDNS, `adb connect`), and `fabrica devices queue`
asked again for the pending Custos card 836209. Neither installs, starts or taps anything on the phone. Both are
stated here, so nobody reads "nothing touched the phone" as stronger than it is.
9. **The proposed certificate CN *Rosea Domi* outlives the working name** (A7). *For Mark and Custos to decide.*
## Soul, privacy, reachability, offline
- **Soul:** no player-facing change. Nothing can make a person feel worse.
- **Privacy:** the release APK asks for no `INTERNET` permission, has no backup, and has the WebView's metrics off
(verified on the built file). The phone spec chooses *Not now*, so no town is set on the phone.
- **Reachability:** none; there is no network.
- **Offline:** unchanged; the APK cannot reach a network at all.
## Not verified
- The `phone` step and the phone target never ran. The Wave 10 is `connected (not paired in Fabrica)`, and
pairing belongs to the Fabrica session.
- No signature was made. `rosea-android` does not exist (G-F7).
- No release, by G6.1 (G-F1).
- The e2e pipeline was never started on the hub.
## Counts (this branch, 2026-11-21)
- `pnpm test`: **608 passed** (cpu-guard 13, identity 5, schema 19, content 88, storage 70, art-prep 80, release 8,
engine 179, tauri 58, ui 88).
- `pnpm lint`, `pnpm typecheck`: clean. `pnpm lint:copy`: 30 files, 0 problems.
`pnpm validate:library`: 13 of 13 fixtures rejected.
- `pnpm test:e2e` and `test:offline` were **not rerun**. Nothing the browser runs changed: the only code change is
one line in the Android spec, which those suites do not include. Their last counts (26 and 1) are from
`feature/fabrica-release`, on the same game.
+162
View File
@@ -0,0 +1,162 @@
# Review — `feature/fabrica-release`
Adversarial self-review (CLAUDE.md §5.3). Analysis: [`features/fabrica-release.md`](../features/fabrica-release.md).
PR: https://gitea.marek-novak.cz/mnovak/Rosea/pulls/1 (the first PR on this repository).
Reviewed 2026-11-19 on Windows 10, Node 22.23.4, Fabrica CLI 0.14.0 (installed in `F:\Apps\Fabrica`),
while about twenty other sessions shared the machine: the CPU sat at 100 % for hours, so every run
below waited for the CPU guard (§5.7); none bypassed it.
## What changed for the player
Nothing in the game. The changes are around it:
- **The Windows installer** now also registers `domi-rosea://` for the user, and its uninstaller
removes it. Opening such an address opens the garden.
- **A release** can be made from a tag on Fabrica's runner, signed in Custos, with an Aula page. None
has been made: the first one waits for the author (G-F1, finding 1).
## Gates
Run on the branch head, 2026-11-19, each behind `pnpm guard:cpu` (it refused 6 times; each run waited):
| Gate | Result |
|:--|:--|
| `pnpm lint`, `pnpm typecheck` | 0 problems (svelte-check 0 errors, 0 warnings; 18 of 18 turbo tasks; root and `tools/release` tsc clean) |
| `pnpm lint:copy` | 29 files, 0 problems (now with `AULA.md`, the brief and the notes) |
| `pnpm validate:library` | 13 of 13 fixtures rejected; 78 candidates |
| `pnpm test` | **608 passed**: identity 5, cpu-guard 13, content 88, schema 19, **release 8** (new), art-prep 80, storage 70, ui 88, engine 179, **tauri 58** (+11). A first run under 100 % load timed out one engine test (10.5 s against 5 s; code untouched here) and stopped turbo; the rerun passed. |
| `pnpm test:e2e` | 26 passed. A first run under load timed out the two-profile *keep her safe* test (30 s); the rerun passed. |
| `pnpm test:offline` | 1 passed |
| `pnpm aula:shots` | 2 passed; 8 PNGs (1280 × 800 and 720 × 1600), looked at one by one |
| `fabrica artifex check` | 2 pipelines, app.yaml, aula.yaml, tests.yaml, brief: 0 problems |
| `fabrica aula brief` / `aula shots` / `aula page` / `notes` | the line, 2 paragraphs, 8 captions, 0 problems; 8 shots and `aula.json`; `aula-page.json` and `.html`; 28 changes, 0 copy problems |
| `fabrica tests list` | `web` 26 tests, `phone` 1 test |
| `fabrica preflight rosea --dir .` | 0 blockers, 2 warnings (Custos not checked: finding 2; pnpm's version unread) |
| `pnpm tauri:build` (target on D:) | `Rosea Domi_0.1.0_x64-setup.exe`, 1.31 MiB; the generated `installer.nsi` includes `hooks.nsh` and calls both hooks |
**The bundle** (CLAUDE.md §5.4): the game's code is unchanged, so the PWA bundle is the same; the
installer differs by the NSIS hook. Nothing was deployed or distributed.
## Bug drills
Each test was run with its bug put back, then the file restored by copy (never `git checkout`, see
finding 9):
| Put back | Result |
|:--|:--|
| The hook's command without `"%1"` | CAUGHT (`config.test.ts`) |
| The uninstaller keeps the `domi-rosea` key | CAUGHT (`config.test.ts`) |
| `check-version` forgets `apps/rosea/package.json` (the file the installer and APK read) | CAUGHT (2 tests) |
| `lint:copy` forgets the generated release notes | CAUGHT (`copy.test.ts`) |
| The APK's scope says `mnovak/rosea` | CAUGHT (`sign-apk.test.ts`) |
| `CUSTOS_PIPE` accepted (another Custos signs) | CAUGHT (`sign-apk.test.ts`) |
6 of 6.
## Findings
1. **Publishing is a public release, and G6.1 forbids one (blocker for the release, not the merge).**
The repository on Gitea is public (`private: false`, read anonymously), so a Fabrica `publish` and
the Aula page are public. CLAUDE.md §8 and G6.1: *a legal check of the look comes before any public
release*. **Deferred to the author:** asked through the session that started this one, with three
choices (publish now; make the repository private first; wait). Until then no tag is made. G-F1.
2. **Custos's side was not checked.** `fabrica preflight rosea --dir .` says 0 blockers, 2 warnings, but
the CLI has no `fabrica/` grant yet, so the keys and scopes were *not* checked. Expected blockers
before the first release, each Mark's step in Custos: `domi-code-signing` and `domi-release` must
name `mnovak/Rosea` in their scope; `rosea-android` does not exist (Custos makes it on the first
signature). Running preflight raised a Custos card to certify the Fabrica CLI (match code
836209): it was not retried. **Deferred:** Mark's Custos.
3. **The release's `pnpm test` refuses on a busy PC.** The runner is Mark's desktop, so the CPU guard
runs inside the release; at today's load it would wait three minutes and fail the step after the
install. **Kept:** §5.7 says a dedicated machine may set `ROSEA_CPU_MAX`, a busy desktop may not. A
refused release is re-run when the PC is calm (Fabrica: *Re-run*).
4. **The installed Fabrica CLI does not know `reset` or `maxMinutes`** (docs/35, on Fabrica `main`).
**Fixed:** left out of `tests.yaml`, which now passes `fabrica artifex check`; the reason is in the
file. With the queue's default `clear`, a release build on the phone would block the debug one; the
file says so.
5. **Generated release notes were not copy-checked.** `fabrica notes` writes commit subjects to a page
strangers read; a subject could carry a forbidden word. **Fixed:** `lint:copy` reads
`target/notes/release-notes.md` when it exists, and the release's `notes-copy` step runs before
`page`. Today's notes (28 changes): 0 problems.
6. **Two Custos cards per release.** Fabrica's approval and Authenticode share the run's card; the APK
is signed by `custos-sign` with its own run id (`rosea-v<version>`), so it is a second card (and on
the first release a *first signature* card). **Kept:** the pipeline gives a `run` step no run id to
pass; Postea does the same.
7. **`domi-rosea://` and a running Rosea.** Without a single-instance plugin a second window opens on
the same data. Two windows behave as two tabs (two-tabs.md), so nothing is lost or doubled; a
second window is still a surprise. **Kept**, by §2 (no plugin); written in F5.
8. **Shared Fabrica files.** `F:\Apps\Fabrica\data\workspace.yaml` and `deploy.json` were edited while
other sessions edit them too: Rosea was appended by a read-modify-write within one second, after
another session had added Amicitia and Liber. Both files were read back: every earlier entry is
still there. **Kept:** there is no lock to take.
9. **A drill restored a file with `git checkout` and lost an uncommitted change** (the notes entry in
`lint-copy.ts`). Found at once by the diff, re-applied and committed. **Fixed** the method: drills
now copy the file aside and back.
10. **Gates ran after the first commits, not before** (§5.5 asks for green before any commit). The
machine's load held every full run back for hours. **Fixed in order, not in time:** nothing is
merged before the gates above are green.
11. **The pictures are not the same on every run.** A fresh profile makes a fresh key, and her
weeds and fallen petals follow it, so the garden in two runs differs (weeds in one, none in the
other; water 40 % or 39 % with the hold's real timing). Each picture is still honest. **Kept**,
and Fabrica's `visual` step (docs/28) is not in the release: it would stop every release on a
difference nobody made. A fixed demo key would need a seam in `@rosea/identity`; not worth it now.
12. **Build output on F:.** F: was nearly full (18 GB free, about twenty sessions building). **Fixed
for this session:** Cargo's target and temporary files went to `D:\build\rosea`. The pipeline itself
builds in the runner's folder (`E:\fabrica-runner`). Gradle's home on the runner is its default,
on C:; not changed here (no Android build ran here).
## Soul
*Can this make a lonely person feel worse?* The words a stranger reads (`AULA.md`, the brief, the
notes) were read for guilt, comparison and promises: they say *nothing is lost by being away*,
*no streak resets, no reminders, no counting of anyone*, and call the version early and the pictures
stand-ins. No sentence names the reader's state or promises comfort. `lint:copy` passes on them. The
pictures show one invented rose tended for two weeks, with no number about anyone else. Looked; found
nothing beyond finding 1.
## Privacy
Every path by which a byte could leave the device: **none was added to the game.** No updater, no
plugin, no permission; `latest.json` is not published, so no future build can be pointed at one by
accident. The bytes this feature sends leave Mark's PC, not a player's: the pipeline's release to
Gitea, `fabrica preflight` to the hub and Custos. The pictures are taken on loopback in throwaway
profiles; both tests assert that no request left the test server's origin. The demo rose's file
carries no town (asserted).
## Reachability
`domi-rosea://` lets a local program or a web page (after the browser asks) open the garden. It
cannot pass anything in: the game reads no argument. No Canalis capability is served, so no other app
can reach into her (F6). Nobody becomes reachable.
## Offline
Unchanged: the game makes no request. The release pipeline runs `pnpm test:offline` before anything
is built for a player.
## Test honesty
The new tests fail with their bug put back (6 of 6, above). The `phone` target's spec has never run
(see *Not verified*), so it may be wrong in ways only a phone shows.
## Scope
In: the six onboarding items as they apply (F1–F11). Out: the release itself (finding 1), Canalis
Part B (F6), videos (F8, Pensum `kkpy69`), a `server` part (F2), iOS (G-T1).
## Not verified
- **No release and no signature**: no tag (finding 1). So no Custos card was answered, no
`SHA256SUMS` exists, the Aula page is not live, and `publish`, `sign`, `apk` and `minisign` have never
run. The hub run (`fabrica deploy rosea --part desktop`) has never run.
- **The Android release build** (`pnpm tauri:android-release`) was not run here: its Gradle home is on
C:, which this session may not use. Its only difference from the debug build that works is `--debug`
and the verified path; the first release run is its first build.
- **`domi-rosea://` on a real install**: the installer was built, not run (it writes the real registry).
- **The `phone` target**: never run. It must go through Fabrica's phone queue; the spec may need fixes
that only a phone shows (G-F5).
- **The `e2e` pipeline on the e2e runner**: not started (manual; it would compete with the release
sessions on this PC).
- **Fabrica's *Update all* over a Rosea install**: needs a signed release first.
- **WebView2's own traffic** (G-T6): still unmeasured for Rosea.
@@ -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).
+16
View File
@@ -0,0 +1,16 @@
# Rosea Domi declares itself to Fabrica (.agents/features/fabrica-release.md; Fabrica core docs/FORMATS.md,
# "Fabrica: the app"). One part: the release pipeline makes the Windows installer and the Android APK from one
# tag. No server part: the PWA's host is still the author's question (GAP_ANALYSIS G0.13), and a server part is
# a NixOS module on the server, not this repository's (F2). The colour is --rose.
# aula: true means the releases carry Aula's kit. The page appears on Aula only once the server's
# modules/aula.nix lists Rosea, and that waits for the author: the look's legal check comes before any public
# release (CLAUDE.md §8, GAP_ANALYSIS G6.1; fabrica-release.md F1).
name: Rosea
icon: flower
color: "#b4485e"
aula: true
tagPrefix: v
parts:
desktop:
pipeline: release
check: node scripts/check-version.mjs
+34
View File
@@ -0,0 +1,34 @@
# Rosea Domi: the e2e suites on this PC's e2e runner (fabrica-release.md F9, android-release-apk.md; Fabrica
# docs/20_tests.md, docs/31_runners_here.md, docs/35_phone_queue.md).
# web: the PWA built, then `fabrica tests run --target web` (Playwright headless against the BUILT bundle under
# /Rosea/), the records, traces and screenshots kept with the run.
# phone: the debug APK built, then `fabrica tests run --target phone` on the Wave 10. The step says `device:`, so
# the hub queues this run for the phone and the nested run uses the run's phone (FABRICA_PHONE_LEASED);
# no adb reaches the phone outside the queue. The run waits in the queue without holding a runner.
# Manual: no push webhook reaches the hub yet. Gradle's cache is on D: (never C:; F: is the crowded workspace).
name: e2e
on:
manual: true
runner: windows-e2e
env:
PLAYWRIGHT_BROWSERS_PATH: 'F:\ms-playwright'
GRADLE_USER_HOME: 'D:\build\rosea\gradle'
NDK_HOME: 'F:\Tools\Android\Sdk\ndk\27.1.12297006'
steps:
- id: install
run: pnpm install --frozen-lockfile
- id: build
needs: [install]
run: pnpm build
- id: web
needs: [build]
run: fabrica tests run --target web
artifacts: [".fabrica/runs/tests/**"]
- id: apk
needs: [install]
run: pnpm tauri:android
- id: phone
needs: [apk]
device: Wave 10
run: fabrica tests run --target phone
artifacts: [".fabrica/runs/tests/**"]
+108
View File
@@ -0,0 +1,108 @@
# Rosea Domi: one release, both apps (.agents/features/fabrica-release.md; Fabrica docs/36_app_onboarding.md).
# A `vX.Y.Z` tag (Fabrica: Apps → Rosea → Deploy, or `fabrica deploy rosea --part desktop`) is started on the hub.
# The Windows runner (the Fabrica app on Mark's PC, whose folder is on every step's PATH, so `fabrica` is its own
# CLI) runs every gate of CLAUDE.md §5.5 on a clean checkout, the e2e and offline suites against the BUILT PWA,
# takes the Aula pictures on demo data (e2e/aula.spec.ts), and builds the Windows installer and the Android APK.
# Nothing is signed before Mark's card. Then: Authenticode on the installer (domi-code-signing); the APK through
# custos-sign with rosea-android (NOT made by Custos on its own: android-release-apk.md A6, until then `no_key`); a minisign
# signature for each (domi-release); the release with SHA256SUMS signed by domi-release.
# No updater and no latest.json: the apps make no network call of their own (CLAUDE.md §2). Mark's PC updates
# through Fabrica's Update all; a player installs the next file over the old one (F3).
# The repository is public, so `publish` is a public release: the tag waits for the author (G6.1, F1).
# Playwright's browsers are in F:\ms-playwright (CLAUDE.md §3: never C:); nothing is downloaded during a release.
name: release
on:
tag: "v*"
manual: true
runner: windows
env:
PLAYWRIGHT_BROWSERS_PATH: 'F:\ms-playwright'
CUSTOS_SIGN_EXE: 'F:\Apps\Custos\custos-sign.exe'
# The Android build (android-release-apk.md): the Tauri CLI needs the NDK named; Gradle's cache on D:, never C:.
GRADLE_USER_HOME: 'D:\build\rosea\gradle'
NDK_HOME: 'F:\Tools\Android\Sdk\ndk\27.1.12297006'
steps:
- id: version
run: node scripts/check-version.mjs ${{ version }}
- id: install
run: pnpm install --frozen-lockfile
- id: lint
needs: [install]
run: pnpm lint
- id: typecheck
needs: [install]
run: pnpm typecheck
- id: test
needs: [install]
run: pnpm test
- id: library
needs: [install]
run: pnpm validate:library
- id: copy
needs: [install]
run: pnpm lint:copy
- id: e2e
needs: [lint, typecheck, test, library, copy]
run: pnpm test:e2e
- id: offline
needs: [e2e]
run: pnpm test:offline
- id: pictures
needs: [offline]
run: pnpm aula:shots
- id: desktop
needs: [offline]
run: pnpm tauri:build
artifacts: ["apps/rosea-tauri/src-tauri/target/release/bundle/nsis/*-setup.exe"]
- id: android
needs: [desktop]
run: pnpm tauri:android-release
- id: notes
run: fabrica notes
artifacts: ["target/notes/release-notes.md", "target/notes/release-notes.json"]
- id: notes-copy
needs: [notes, install]
run: pnpm lint:copy
- id: shots
needs: [pictures]
run: fabrica aula shots
artifacts: ["target/aula/aula-*.png", "target/aula/aula.json"]
- id: page
needs: [notes-copy, shots]
run: fabrica aula page
artifacts: ["target/aula/aula-page.json", "target/aula/aula-page.html"]
- id: approve
needs: [version, desktop, android, page]
approve: "Release Rosea ${{ tag }}?"
- id: sign
needs: [approve]
sign:
key: domi-code-signing
kind: authenticode
files: ["**/*-setup.exe"]
- id: apk
needs: [approve]
run: pnpm --filter @rosea/tauri sign:apk ${{ version }} ${{ commit }}
keys: [rosea-android]
artifacts: ["target/release/rosea-domi-*-arm64.apk"]
- id: minisign
needs: [sign, apk]
sign:
key: domi-release
kind: minisign
files: ["**/*-setup.exe", "**/rosea-domi-*-arm64.apk"]
- id: publish
needs: [minisign]
publish:
gitea-release: true
files:
- "**/*-setup.exe"
- "**/*-setup.exe.minisig"
- "**/rosea-domi-*-arm64.apk"
- "**/rosea-domi-*-arm64.apk.minisig"
- "target/aula/aula-*.png"
- "target/aula/aula.json"
- "target/aula/aula-page.json"
- "**/release-notes.md"
- "**/release-notes.json"
sums: domi-release
+39
View File
@@ -0,0 +1,39 @@
# Rosea's pictures for its Aula page (fabrica-release.md F7; Fabrica docs/19_web_shots.md). All are taken by the
# app's own Playwright run (`pnpm aula:shots`, e2e/aula.spec.ts) from the BUILT PWA on demo data the game itself
# made: an invented rose watered once a day for two weeks in March 2026, in Prague, with the gardener's first look.
# `fabrica aula shots` checks and publishes the files; it starts no browser of its own (the PWA lives under
# /Rosea/, and Fabrica's server serves at /). No iPhone pictures: there is no iOS app yet (G-T1).
size: [1280, 800]
shots:
- name: garden
title: Her planet after two weeks of care
section: In a browser or on Windows
file: e2e/aula/garden.png
- name: ring
title: What she needs today
section: In a browser or on Windows
file: e2e/aula/ring.png
- name: numbers
title: Her numbers
section: In a browser or on Windows
file: e2e/aula/numbers.png
- name: sunset
title: Move the chair
section: In a browser or on Windows
file: e2e/aula/sunset.png
- name: safe
title: Keep her safe
section: In a browser or on Windows
file: e2e/aula/safe.png
- name: first-open
title: Who tends her?
section: The first open
file: e2e/aula/first-open.png
- name: phone-garden
title: The garden on a phone
section: On a phone
file: e2e/aula/phone-garden.png
- name: phone-ring
title: What she needs, on a phone
section: On a phone
file: e2e/aula/phone-ring.png
+14
View File
@@ -0,0 +1,14 @@
A small game about a living rose, a fox, and the time we give to people. An early version.
You tend one rose on a round tiny planet of her own. Water her by feel, pull the weeds, gather her fallen petals, shade her from the wind. She grows from the days on which you cared for her, never from a streak, and when you are away she waits.
The garden follows the real sun of a town you choose. No account, nothing sent anywhere. The pictures are stand-ins drawn in code until the painted ones are ready.
- garden: Her planet after two weeks of care, with the gardener beside her and tonight's real sunset below.
- ring: A tap on her shows what she needs today.
- numbers: Her numbers: water, warmth, days of care and how she is.
- sunset: Move the chair: a quiet sunset in the garden, with nothing to press.
- safe: Keep her safe: save her to a file, and bring her back on any device.
- first-open: The first open: dress the gardener who tends her.
- phone-garden: The same garden on a phone.
- phone-ring: On a phone, what she needs is one tap away.
+9
View File
@@ -0,0 +1,9 @@
The first release of Rosea Domi, an early version: the rose, her planet and the gardener.
- Tend her by hand or by button: water by feel, pull weeds, gather petals, shade her from the wind, touch her gently.
- She grows from the days on which care helped, never from a streak, and waits when you are away.
- A gardener you dress at the first open, who walks round her planet to the work.
- The real sunset and sunrise of a town you choose, and a quiet sunset in the garden.
- Keep her safe: save her to a file and bring her back on any device.
- A Windows installer and an Android app. Nothing is sent anywhere; the Android app asks for no permission at all.
- The pictures are stand-ins drawn in code until the painted ones are ready.
@@ -0,0 +1,15 @@
---
id: kkpy69
title: Showcase videos of the main flows for the Aula page
status: todo
priority: normal
labels: [showcase, aula]
created: 2026-11-19T01:31:09+01:00
updated: 2026-11-19T01:31:09+01:00
doc: .agents/features/fabrica-release.md
---
Once Fabrica docs/37 (showcase videos: .fabrica/aula.yaml videos:, WebM <= 8 MiB, <= 60 s, <= 6 per release, published as target/aula/aula-<name>.webm under SHA256SUMS) is on Fabrica main, record short videos from e2e/aula.spec.ts on the same demo garden: watering by the can, the ring of care, moving the chair (the in-game sunset), keeping her safe in a file. Add them to aula.yaml videos: and to the release's publish files. Until then a videos: key fails fabrica aula shots (fabrica-release.md F8).
## Log
- 2026-11-19T01:31:09+01:00 mnovak: created
+24
View File
@@ -0,0 +1,24 @@
# Rosea Domi's Playwright targets (fabrica-release.md F9, android-release-apk.md; Fabrica docs/20_tests.md,
# docs/22_devices.md, docs/35_phone_queue.md). `fabrica tests run --target <name>`, or Tests in Fabrica.
# web: the BUILT PWA (build it first: `pnpm build`) in headless Chromium: the specs of `pnpm test:e2e`.
# phone: the Android debug APK on the Wave 10 test phone, only through Fabrica's phone queue (the e2e pipeline's
# `phone` step, or `fabrica tests run --target phone`). Build it first (`pnpm tauri:android`). A debug APK,
# because only a debug build's WebView can be driven (docs/22 part 5); the release APK is the same game.
# `reset: uninstall`: the app is installed fresh, so a release build of Rosea on the phone (another key)
# cannot block the run. Nothing of Rosea's on the test phone is kept: it holds no rose of anyone's.
dir: .
config: e2e/playwright.fabrica.config.ts
targets:
- name: web
kind: web
title: The garden in a browser
project: web
- name: phone
kind: android
title: The Android app on the test phone
project: android
device: Wave 10
package: cz.mareknovak.domi.rosea
reset: uninstall
maxMinutes: 20
apk: apps/rosea-tauri/src-tauri/gen/android/app/build/outputs/apk/universal/debug/app-universal-debug.apk
+3
View File
@@ -37,3 +37,6 @@ packages/schema/src/generated/
dist-tauri/ dist-tauri/
apps/rosea-tauri/src-tauri/gen/ apps/rosea-tauri/src-tauri/gen/
apps/rosea-tauri/src-tauri/icons/ apps/rosea-tauri/src-tauri/icons/
# The Aula pictures, taken by `pnpm aula:shots` (e2e/aula.spec.ts) and published by Fabrica, never committed
e2e/aula/
+45
View File
@@ -0,0 +1,45 @@
# Rosea Domi
*Rosea* (Latin: rose-coloured) is a small game about a living rose, a fox, and the time we give to
people. You tend one rose on a round tiny planet of her own. She grows from the days on which you
cared for her, never from a streak, and when you are away she waits.
**This is an early version.** The rose, her planet and the gardener are here; the fox, the other
planets, friends and the shared sky come later. The pictures are simple stand-ins drawn in code
until the painted ones are ready.
## What you do
- **Tend her by hand.** Tap her to see what she needs today. Tilt the watering can and stop when her
leaves lift: too much is as bad as too little. Pull the weeds, sweep up fallen petals, set the
windbreak against the wind. Every gesture also has a plain button, and works from the keyboard.
- **Choose who tends her.** At the first open you dress your gardener, a boy or a girl.
- **Watch the real sky.** Choose a town near you (or let the device's time zone guess), and the
garden names tonight's real sunset, and after it the real sunrise. *Move the chair* shows a quiet
sunset in the garden, half a minute with nothing to press, then says when the real one is.
- **Her numbers, one tap away.** Water, warmth, days of care and how she is, about her alone.
- **Keep her safe.** Save her to a file and bring her back on any device.
Nothing is lost by being away: no streak resets, no reminders, no counting of anyone.
## Private by construction
There is no account, no email and no password. Everything stays on your device: her care, your town,
your gardener. The game sends nothing anywhere and shows nothing from anywhere else. The Android app
does not even ask for the permission to use the internet.
## Installing
- **Windows:** run `Rosea Domi_<version>_x64-setup.exe`. It installs for you alone, with no
administrator rights.
- **Android:** install the `.apk` (Android 7 or newer). Your phone will ask you to allow installing
apps from where you downloaded it.
- **iPhone, macOS and Linux:** not yet.
Each file is signed: its SHA-256 is in `SHA256SUMS`, and `SHA256SUMS.minisig` is its signature.
## Updating
Install the newer file over the old one, the same way. Your rose stays: she lives with the app on
your device, and a newer version keeps her. Removing the app removes her too, so save her to a file
first (*Her numbers* → *Keep her safe* → *Save her to a file*).
+16 -2
View File
@@ -157,7 +157,8 @@ apps/
# dist-tauri/ for the shell: base /, no service worker, no manifest # 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 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 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 scripts/ # icons from apps/rosea/public/icon.svg; the Android privacy patch
services/ services/
@@ -204,6 +205,9 @@ apps/rosea-tauri ──► apps/rosea's BUILT output (dist-tauri/) only — no p
- `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**.
- `.fabrica/` is how Fabrica releases both apps (`fabrica-release.md`): it reads this repository and this
repository imports nothing of Fabrica's. The Windows installer also registers `domi-rosea://` for the
user (an NSIS hook, no Rust code): any such address opens the garden and nothing else.
- `apps/rosea-tauri` must be deletable too: removing it leaves the PWA whole. The game never asks - `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 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 `'tauri'`), read in `apps/rosea/src/App.svelte` only, for wiring (no service worker; the app counts
@@ -287,6 +291,15 @@ pnpm tauri:ios # macOS + Xcode only — refuses elsewh
pnpm --filter @rosea/tauri test # the shell's tests: config (CSP, name, origin), privacy patch, shell build 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 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 tsx e2e/apps/check-garden.ts android # the installed APK on the device over adb; `pm clear`s the TEST app first
pnpm tauri:android-release # the release APK (unsigned; verified with aapt2); Fabrica signs it in Custos
# Released through Fabrica (.fabrica/; .agents/features/fabrica-release.md):
node scripts/check-version.mjs <x.y.z> # the four version files agree; Fabrica's Deploy bumps what it names
pnpm aula:shots # builds, then the Aula pictures on demo data -> e2e/aula/*.png
fabrica artifex check # the pipelines, tests.yaml, aula.yaml and the brief
fabrica tests run --target web # the e2e specs as Fabrica's target (build first)
fabrica tests run --target phone # the debug APK on the test phone, ONLY through Fabrica's phone queue
fabrica deploy rosea --part desktop # a release: bump, tag, the hub's run, Mark's Custos cards. Public: G6.1 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
@@ -609,9 +622,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. | | **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. | | **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. | | **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. | | **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`. | | **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. | | **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. | | **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. |
+40 -4
View File
@@ -2,7 +2,36 @@
Rewritten at the end of each session (CLAUDE.md §5.1). Rewritten at the end of each session (CLAUDE.md §5.1).
## Last session — 2026-10-31 to 2026-11-17 ## Latest — 2026-11-21: the APK for a release, tested through the phone queue (blocked twice)
- **`feature/android-release-apk`**: the phone target says `reset: uninstall` and `maxMinutes: 20`; the e2e
pipeline gains `apk` and `phone` (`device: Wave 10`, so the hub queues it); both pipelines name the NDK and put
Gradle's cache on D:. Analysis: [`.agents/features/android-release-apk.md`](.agents/features/android-release-apk.md).
Review: [`.agents/reviews/feature-android-release-apk.md`](.agents/reviews/feature-android-release-apk.md).
- **Blocked on the phone:** the Wave 10 is not paired in Fabrica (`fabrica devices list`), so the `phone` step
cannot get it. Pairing is the Fabrica session's; nothing here drove the phone.
- **Blocked on the key:** `rosea-android` does not exist, and Custos will not make it, because it is not in Custos's
`ANDROID_APPS` (0.22.0 here, 0.24.0 too). This corrects `fabrica-release.md` F4. It needs a Custos change or
Mark's *Create Android key* (G-F7).
- **Still the author's:** publication (G6.1, G-F1).
## Earlier — 2026-11-19: released through Fabrica (built, not published)
- **Rosea is a Fabrica app** (`feature/fabrica-release`, PR mnovak/Rosea#1): `.fabrica/` (app, the
`release` and `e2e` pipelines, `tests.yaml` with `web` and `phone`, `aula.yaml`), `AULA.md`, the brief
and the 0.1.0 notes, `scripts/check-version.mjs`, the APK signed in Custos (`sign:apk`,
`rosea-android`), `domi-rosea://` from the installer, the pictures on demo data (`pnpm aula:shots`).
Analysis: [`.agents/features/fabrica-release.md`](.agents/features/fabrica-release.md). Review:
[`.agents/reviews/feature-fabrica-release.md`](.agents/reviews/feature-fabrica-release.md).
Rosea is in Fabrica's workspace and `deploy.json` on this PC.
- **No release was made.** The Gitea repository is public, so a release is public, and G6.1 comes
first. The author's choice is open (G-F1): publish anyway, make the repository private first, or wait.
- **Before the first release, in Custos (Mark):** `domi-code-signing` and `domi-release` scoped to
`mnovak/Rosea`; `rosea-android` is made by Custos on the first APK signature; back the vault up.
- **Not run:** the `phone` target (only through Fabrica's phone queue); no installer was run, so
`domi-rosea://` is tested as text only (G-F4).
## Earlier — 2026-10-31 to 2026-11-17
**Done.** **Done.**
@@ -133,13 +162,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 (`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). 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 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 on the tablet). **iOS needs a Mac** (G-T1). *Keep her safe* in the apps was a release blocker
*Keep her safe* speaks of *this browser*, and on Android saving to a file does nothing (G-T4, (G-T4); it is closed, see the next entry. The debug APK and installer are build output on this
a release blocker). The debug APK and installer are build output on this machine, not committed: machine, not committed:
`apps/rosea-tauri/src-tauri/gen/android/app/build/outputs/apk/universal/debug/` and `apps/rosea-tauri/src-tauri/gen/android/app/build/outputs/apk/universal/debug/` and
`apps/rosea-tauri/src-tauri/target/release/bundle/nsis/`. Analysis: `apps/rosea-tauri/src-tauri/target/release/bundle/nsis/`. Analysis:
[`.agents/features/tauri-platforms.md`](.agents/features/tauri-platforms.md). Review: [`.agents/features/tauri-platforms.md`](.agents/features/tauri-platforms.md). Review:
[`.agents/reviews/feature-tauri-platforms.md`](.agents/reviews/feature-tauri-platforms.md). [`.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 - **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. appears with them), hosting (G0.13), and the gate itself — two weeks of daily play on a phone.
@@ -0,0 +1,120 @@
package cz.mareknovak.domi.rosea
// Rosea's own MainActivity, copied over the one `tauri android init` generates by
// apps/rosea-tauri/scripts/android.ts (gen/ is never committed; `android.ts check` compares it).
// .agents/features/keep-her-safe-apps.md A2–A5.
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
private var busy = false
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
// here instead (window.roseaFile.save), and Android's own save screen lets the player choose
// where the file goes. No permission is needed for it on any Android version.
override fun onWebViewCreate(webView: WebView) {
this.webView = webView
webView.addJavascriptInterface(RoseFile(), "roseaFile")
}
/** Tells the game whether the file was written (A4): true, or false when the player stepped back. */
private fun answer(written: Boolean) {
busy = false
val view = webView ?: return
view.post {
view.evaluateJavascript("window.dispatchEvent(new CustomEvent('rosea-file-saved', { detail: $written }))", null)
}
}
@Keep
inner class RoseFile {
/** Only a rose file: its dated name and a bounded text (A3). One save at a time. */
@Keep
@JavascriptInterface
fun save(name: String, text: String) {
if (!NAME.matches(name) || text.length > MAX_CHARS) {
Log.w(TAG, "refused a file that is not a rose file: ${name.take(64)}, ${text.length} chars")
answer(false)
return
}
runOnUiThread {
if (busy) return@runOnUiThread
busy = true
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = "application/json"
putExtra(Intent.EXTRA_TITLE, name)
}
launchActivityForResult(intent) { result ->
val uri = result?.data?.data
if (result?.resultCode != Activity.RESULT_OK || uri == null) {
answer(false)
return@launchActivityForResult
}
val written = try {
contentResolver.openOutputStream(uri, "wt")?.use { out ->
out.write(text.toByteArray(Charsets.UTF_8))
true
} ?: false
} catch (error: Exception) {
Log.e(TAG, "the rose file could not be written", error)
false
}
answer(written)
}
}
}
}
companion object {
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"
}
}
+2
View File
@@ -8,6 +8,8 @@
"dev": "tsx scripts/icons.ts && tauri dev", "dev": "tsx scripts/icons.ts && tauri dev",
"build:desktop": "tsx scripts/icons.ts && tauri build", "build:desktop": "tsx scripts/icons.ts && tauri build",
"build:android": "tsx scripts/android.ts prepare && tauri android build --debug --apk --target aarch64 && tsx scripts/android.ts verify", "build:android": "tsx scripts/android.ts prepare && tauri android build --debug --apk --target aarch64 && tsx scripts/android.ts verify",
"build:android-release": "tsx scripts/android.ts prepare && tauri android build --apk --target aarch64 && tsx scripts/android.ts verify src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk",
"sign:apk": "tsx scripts/sign-apk.ts",
"build:ios": "tsx scripts/ios.ts", "build:ios": "tsx scripts/ios.ts",
"android:privacy": "tsx scripts/android.ts apply", "android:privacy": "tsx scripts/android.ts apply",
"android:verify": "tsx scripts/android.ts verify", "android:verify": "tsx scripts/android.ts verify",
+12 -2
View File
@@ -13,7 +13,7 @@
*/ */
import { spawnSync } from 'node:child_process'; import { spawnSync } from 'node:child_process';
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'; import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
import { join } from 'node:path'; import { dirname, join } from 'node:path';
import { apkProblems, manifestProblems, patchManifest, RULE_FILES, RULE_SECTIONS, ruleProblems } from '../src/android-privacy.js'; import { apkProblems, manifestProblems, patchManifest, RULE_FILES, RULE_SECTIONS, ruleProblems } from '../src/android-privacy.js';
import { PACKAGE, SRC_TAURI, tauri } from './tauri.js'; import { PACKAGE, SRC_TAURI, tauri } from './tauri.js';
@@ -22,6 +22,10 @@ const MANIFEST = join(MAIN, 'AndroidManifest.xml');
const RES_FROM = join(PACKAGE, 'android', 'res', 'xml'); const RES_FROM = join(PACKAGE, 'android', 'res', 'xml');
const RES_TO = join(MAIN, 'res', 'xml'); const RES_TO = join(MAIN, 'res', 'xml');
const OUTPUTS = join(SRC_TAURI, 'gen', 'android', 'app', 'build', 'outputs', 'apk'); const OUTPUTS = join(SRC_TAURI, 'gen', 'android', 'app', 'build', 'outputs', 'apk');
// Rosea's own MainActivity: the save bridge (keep-her-safe-apps.md A2, A5).
const IDENTIFIER = (JSON.parse(readFileSync(join(SRC_TAURI, 'tauri.conf.json'), 'utf8')) as { identifier: string }).identifier;
const ACTIVITY_FROM = join(PACKAGE, 'android', 'java', 'MainActivity.kt');
const ACTIVITY_TO = join(MAIN, 'java', ...IDENTIFIER.split('.'), 'MainActivity.kt');
function fail(problems: readonly string[]): never { function fail(problems: readonly string[]): never {
for (const p of problems) console.error(`android: ${p}`); for (const p of problems) console.error(`android: ${p}`);
@@ -36,6 +40,10 @@ function problems(): string[] {
if (!existsSync(at)) found.push(`res/xml/${f} is missing`); if (!existsSync(at)) found.push(`res/xml/${f} is missing`);
else if (readFileSync(at, 'utf8') !== readFileSync(join(RES_FROM, f), 'utf8')) found.push(`res/xml/${f} differs from android/res/xml/${f}`); else if (readFileSync(at, 'utf8') !== readFileSync(join(RES_FROM, f), 'utf8')) found.push(`res/xml/${f} differs from android/res/xml/${f}`);
} }
if (!existsSync(ACTIVITY_TO)) found.push(`no MainActivity.kt at ${ACTIVITY_TO}`);
else if (readFileSync(ACTIVITY_TO, 'utf8') !== readFileSync(ACTIVITY_FROM, 'utf8')) {
found.push("MainActivity.kt is not Rosea's (android/java/MainActivity.kt): no save bridge");
}
// The launcher icon is Rosea's, not the Tauri logo `init` put there (scripts/icons.ts). // The launcher icon is Rosea's, not the Tauri logo `init` put there (scripts/icons.ts).
const ours = join(SRC_TAURI, 'icons', 'android', 'mipmap-mdpi', 'ic_launcher.png'); const ours = join(SRC_TAURI, 'icons', 'android', 'mipmap-mdpi', 'ic_launcher.png');
const there = join(MAIN, 'res', 'mipmap-mdpi', 'ic_launcher.png'); const there = join(MAIN, 'res', 'mipmap-mdpi', 'ic_launcher.png');
@@ -55,12 +63,14 @@ function apply(): void {
const after = patchManifest(before); const after = patchManifest(before);
mkdirSync(RES_TO, { recursive: true }); mkdirSync(RES_TO, { recursive: true });
for (const f of RULE_FILES) copyFileSync(join(RES_FROM, f), join(RES_TO, f)); for (const f of RULE_FILES) copyFileSync(join(RES_FROM, f), join(RES_TO, f));
if (!existsSync(dirname(ACTIVITY_TO))) fail([`no generated activity folder ${dirname(ACTIVITY_TO)}; the identifier changed?`]);
copyFileSync(ACTIVITY_FROM, ACTIVITY_TO);
if (after !== before) writeFileSync(MANIFEST, after); if (after !== before) writeFileSync(MANIFEST, after);
const left = problems(); const left = problems();
if (left.length > 0) fail(left); if (left.length > 0) fail(left);
console.log( console.log(
`android: privacy ${after === before ? 'already in place' : 'applied'} ` + `android: privacy ${after === before ? 'already in place' : 'applied'} ` +
'(no INTERNET, no backup or transfer, WebView metrics and Safe Browsing off)' "(no INTERNET, no backup or transfer, WebView metrics and Safe Browsing off; Rosea's MainActivity)"
); );
} }
+26
View File
@@ -0,0 +1,26 @@
/**
* `pnpm --filter @rosea/tauri sign:apk <version> <commit>`: the release APK, signed in Custos
* (fabrica-release.md F4). Runs after the release's approval; Mark's card shows the match code
* custos-sign prints. Nothing is written unless custos-sign signs and verifies.
*/
import { spawnSync } from 'node:child_process';
import { existsSync, mkdirSync } from 'node:fs';
import { join } from 'node:path';
import { custosSign, signArgs, signedApkName, UNSIGNED_APK } from '../src/sign-apk.js';
import { PACKAGE, SRC_TAURI } from './tauri.js';
const [version = '', commit = ''] = process.argv.slice(2);
try {
const unsigned = join(SRC_TAURI, UNSIGNED_APK);
if (!existsSync(unsigned)) throw new Error(`no release APK at ${unsigned}; run 'pnpm tauri:android-release' first`);
const outDir = join(PACKAGE, '..', '..', 'target', 'release');
mkdirSync(outDir, { recursive: true });
const exe = custosSign(process.env, existsSync);
const args = signArgs({ version, commit, unsigned, out: join(outDir, signedApkName(version)) });
const run = spawnSync(exe, args, { stdio: 'inherit' });
if (run.error) throw run.error;
process.exit(run.status ?? 1);
} catch (e) {
console.error(`sign:apk: ${e instanceof Error ? e.message : String(e)}`);
process.exit(1);
}
@@ -1 +1,7 @@
{ "$schema": "https://schema.tauri.app/config/2", "bundle": { "targets": ["nsis"] } } {
"$schema": "https://schema.tauri.app/config/2",
"bundle": {
"targets": ["nsis"],
"windows": { "nsis": { "installerHooks": "./windows/hooks.nsh" } }
}
}
@@ -0,0 +1,16 @@
; Rosea Domi's installer hooks (.agents/features/fabrica-release.md F5; Fundamentum's Canalis, Part A).
; The installer registers domi-rosea://open for the current user, and the uninstaller removes it.
; Here and not at every start: the shell is a window and nothing else (CLAUDE.md §2), and a reinstall
; or Fabrica's Update all (/UPDATE in the same folder) runs this again, so the command follows the exe.
; The game reads no argument: any domi-rosea:// address opens the garden, and nothing else.
!macro NSIS_HOOK_POSTINSTALL
WriteRegStr HKCU "Software\Classes\domi-rosea" "" "URL:Rosea Domi"
WriteRegStr HKCU "Software\Classes\domi-rosea" "URL Protocol" ""
WriteRegStr HKCU "Software\Classes\domi-rosea\DefaultIcon" "" '"$INSTDIR\${MAINBINARYNAME}.exe",0'
WriteRegStr HKCU "Software\Classes\domi-rosea\shell\open\command" "" '"$INSTDIR\${MAINBINARYNAME}.exe" "%1"'
!macroend
!macro NSIS_HOOK_POSTUNINSTALL
DeleteRegKey HKCU "Software\Classes\domi-rosea"
!macroend
+54
View File
@@ -0,0 +1,54 @@
/**
* What the release asks custos-sign to do with the Android APK (fabrica-release.md F4). Kept
* apart from the script that runs it so the arguments can be tested without Custos.
*
* The key `rosea-android` lives in Custos only; custos-sign holds no key material either. Its
* scope is exactly `mnovak/Rosea`, the release pipeline, a tag (Custos makes the key on the first
* release, behind Mark's first-signature card).
*/
export const APK_KEY = 'rosea-android';
export const REPO = 'mnovak/Rosea';
/** Where Gradle leaves the release APK of `tauri android build --apk --target aarch64`, from src-tauri. */
export const UNSIGNED_APK = 'gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk';
/** The published APK's name: the app, the version, the one ABI it is built for. */
export const signedApkName = (version: string): string => `rosea-domi-${version}-arm64.apk`;
export interface SignRequest {
readonly version: string;
readonly commit: string;
readonly unsigned: string;
readonly out: string;
}
/** The arguments of `custos-sign apk`, or the reason they cannot be made. */
export function signArgs(r: SignRequest): string[] {
if (!/^\d+\.\d+\.\d+$/.test(r.version)) throw new Error(`not a version: ${r.version}`);
if (!/^[0-9a-f]{40}$/.test(r.commit)) throw new Error(`not a commit: ${r.commit}`);
return [
'apk', r.unsigned,
'--out', r.out,
'--key', APK_KEY,
'--repo', REPO,
'--pipeline', 'release',
'--commit', r.commit,
'--trigger', 'tag',
'--run', `rosea-v${r.version}`,
'--version', r.version,
'--step', 'apk'
];
}
/**
* Which custos-sign to run. `CUSTOS_SIGN_EXE` names it; when it names a file that is not there,
* the release refuses rather than run another one from PATH. `CUSTOS_PIPE` is refused: a signed
* run must reach Mark's Custos, never a test instance whose key is nobody's.
*/
export function custosSign(env: Readonly<Record<string, string | undefined>>, exists: (p: string) => boolean): string {
if (env['CUSTOS_PIPE']) throw new Error('CUSTOS_PIPE is set: the APK would be signed by another Custos than Mark\'s');
const named = env['CUSTOS_SIGN_EXE'];
if (named === undefined || named === '') return 'custos-sign.exe';
if (!exists(named)) throw new Error(`CUSTOS_SIGN_EXE names ${named}, which is not there`);
return named;
}
@@ -0,0 +1,69 @@
/**
* The save bridge's contract between the Kotlin side (android/java/MainActivity.kt) and the game
* (apps/rosea/src/App.svelte, packages/ui KeepSafe): keep-her-safe-apps.md A2–A5. A mismatch here
* fails silently on the device — the save screen never opens, or the garden never hears back —
* so the names are read from both sources and compared.
*/
import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';
const HERE = dirname(fileURLToPath(import.meta.url));
const kotlin = readFileSync(join(HERE, '..', 'android', 'java', 'MainActivity.kt'), 'utf8');
const app = readFileSync(join(HERE, '..', '..', 'rosea', 'src', 'App.svelte'), 'utf8');
const keepSafe = readFileSync(join(HERE, '..', '..', '..', 'packages', 'ui', 'src', 'rose', 'KeepSafe.svelte'), 'utf8');
const conf = JSON.parse(readFileSync(join(HERE, '..', 'src-tauri', 'tauri.conf.json'), 'utf8')) as { identifier: string };
const nameRule = new RegExp(/Regex\("(.+?)"\)/.exec(kotlin)?.[1]?.replaceAll('\\\\', '\\') ?? 'missing');
describe('the Android save bridge', () => {
it('lives in the package of the app it is copied into', () => {
expect(kotlin).toMatch(new RegExp(`^package ${conf.identifier.replaceAll('.', '\\.')}$`, 'm'));
expect(kotlin).toMatch(/class MainActivity : TauriActivity\(\)/);
});
it('is found by the game under the name it is registered with', () => {
const registered = /addJavascriptInterface\(RoseFile\(\), "(\w+)"\)/.exec(kotlin)?.[1];
expect(registered).toBe('roseaFile');
expect(app).toContain(`roseaFile?: { save(name: string, text: string): void }`);
expect(app).toContain('.roseaFile');
});
it('answers on the event the game listens for, with true or false', () => {
const event = /new CustomEvent\('([\w-]+)', \{ detail: \$written \}\)/.exec(kotlin)?.[1];
expect(event).toBe('rosea-file-saved');
expect(app.match(/'rosea-file-saved'/g)?.length).toBeGreaterThanOrEqual(2);
expect(app).toContain('.detail === true');
});
it("accepts the file name the garden gives (rose-<day>.json) and nothing else", () => {
expect(keepSafe).toContain('`rose-${today}.json`');
expect(nameRule.test('rose-2026-11-17.json')).toBe(true);
for (const wrong of ['rose.json', '../rose-2026-11-17.json', 'rose-2026-11-17.json.exe', 'rose-2026-11-17.apk', 'evil-2026-11-17.json']) {
expect(nameRule.test(wrong)).toBe(false);
}
});
it('keeps the bridge through a minified release build', () => {
expect(kotlin).toMatch(/@Keep\s+inner class RoseFile/);
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/);
expect(kotlin).toContain('Intent.ACTION_CREATE_DOCUMENT');
});
});
+39
View File
@@ -103,6 +103,45 @@ describe('tauri.conf.json', () => {
}); });
}); });
describe('domi-rosea://open, from the installer (fabrica-release.md F5)', () => {
const windows = JSON.parse(readFileSync(join(SRC_TAURI, 'tauri.windows.conf.json'), 'utf8')) as {
bundle: { windows?: { nsis?: { installerHooks?: string; installMode?: string } } };
};
const hooksPath = windows.bundle.windows?.nsis?.installerHooks ?? '';
const hooks = existsSync(join(SRC_TAURI, hooksPath)) ? readFileSync(join(SRC_TAURI, hooksPath), 'utf8') : '';
/** The NSIS statements of one macro, comments dropped. */
const macro = (name: string): string[] =>
(new RegExp(`!macro ${name}\\r?\\n([\\s\\S]*?)!macroend`).exec(hooks)?.[1] ?? '')
.split(/\r?\n/)
.map((l) => l.trim())
.filter((l) => l !== '' && !l.startsWith(';'));
it('the Windows installer runs the hooks file, and installs for the current user only', () => {
expect(hooksPath).toBe('./windows/hooks.nsh');
expect(hooks).not.toBe('');
const nsis = (conf.bundle as { windows?: { nsis?: { installMode?: string } } }).windows?.nsis;
expect(nsis?.installMode).toBe('currentUser');
});
it('registers exactly the domi-rosea scheme under HKCU, opening the installed exe with the address', () => {
expect(macro('NSIS_HOOK_POSTINSTALL')).toEqual([
'WriteRegStr HKCU "Software\\Classes\\domi-rosea" "" "URL:Rosea Domi"',
'WriteRegStr HKCU "Software\\Classes\\domi-rosea" "URL Protocol" ""',
`WriteRegStr HKCU "Software\\Classes\\domi-rosea\\DefaultIcon" "" '"$INSTDIR\\\${MAINBINARYNAME}.exe",0'`,
`WriteRegStr HKCU "Software\\Classes\\domi-rosea\\shell\\open\\command" "" '"$INSTDIR\\\${MAINBINARYNAME}.exe" "%1"'`
]);
});
it('the uninstaller removes that key and nothing else', () => {
expect(macro('NSIS_HOOK_POSTUNINSTALL')).toEqual(['DeleteRegKey HKCU "Software\\Classes\\domi-rosea"']);
});
it('writes nowhere else: no machine-wide key, no other hook', () => {
expect(hooks).not.toMatch(/HKLM|HKCR|HKEY_/);
expect([...hooks.matchAll(/!macro (\w+)/g)].map((m) => m[1])).toEqual(['NSIS_HOOK_POSTINSTALL', 'NSIS_HOOK_POSTUNINSTALL']);
});
});
describe('the Rust side (D5)', () => { describe('the Rust side (D5)', () => {
it('depends on tauri alone: no plugin, no SDK', () => { it('depends on tauri alone: no plugin, no SDK', () => {
const cargo = readFileSync(join(SRC_TAURI, 'Cargo.toml'), 'utf8'); const cargo = readFileSync(join(SRC_TAURI, 'Cargo.toml'), 'utf8');
+54
View File
@@ -0,0 +1,54 @@
/**
* The release APK is signed in Custos and nowhere else (fabrica-release.md F4): the arguments
* name the one key, the exact repository and a tag, and the script never falls back to another
* custos-sign or another Custos.
*/
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';
import { APK_KEY, custosSign, signArgs, signedApkName, UNSIGNED_APK } from '../src/sign-apk.js';
const COMMIT = 'a'.repeat(40);
const pkg = JSON.parse(readFileSync(join(fileURLToPath(new URL('..', import.meta.url)), 'package.json'), 'utf8')) as { scripts: Record<string, string> };
describe('signArgs', () => {
it('asks for rosea-android, scoped to mnovak/Rosea, the release pipeline and a tag', () => {
const args = signArgs({ version: '0.1.0', commit: COMMIT, unsigned: 'in.apk', out: 'out.apk' });
expect(args).toEqual([
'apk', 'in.apk', '--out', 'out.apk', '--key', 'rosea-android', '--repo', 'mnovak/Rosea', '--pipeline', 'release',
'--commit', COMMIT, '--trigger', 'tag', '--run', 'rosea-v0.1.0', '--version', '0.1.0', '--step', 'apk'
]);
expect(APK_KEY).toBe('rosea-android');
});
it('refuses a version or a commit that is not one', () => {
expect(() => signArgs({ version: 'v0.1.0', commit: COMMIT, unsigned: 'a', out: 'b' })).toThrow(/not a version/);
expect(() => signArgs({ version: '0.1.0', commit: 'HEAD', unsigned: 'a', out: 'b' })).toThrow(/not a commit/);
});
it('names the published APK by app, version and ABI', () => {
expect(signedApkName('0.1.0')).toBe('rosea-domi-0.1.0-arm64.apk');
});
it('signs the release build that android.ts verified, never the debug one', () => {
expect(UNSIGNED_APK).toContain('/release/');
expect(pkg.scripts['build:android-release']).toContain(`verify src-tauri/${UNSIGNED_APK}`);
expect(pkg.scripts['build:android-release']).not.toContain('--debug');
});
});
describe('custosSign', () => {
it('runs the custos-sign CUSTOS_SIGN_EXE names, else the one on PATH', () => {
expect(custosSign({ CUSTOS_SIGN_EXE: 'F:\\Apps\\Custos\\custos-sign.exe' }, () => true)).toBe('F:\\Apps\\Custos\\custos-sign.exe');
expect(custosSign({}, () => true)).toBe('custos-sign.exe');
});
it('refuses a named custos-sign that is not there, rather than another one', () => {
expect(() => custosSign({ CUSTOS_SIGN_EXE: 'X:\\nowhere.exe' }, () => false)).toThrow(/not there/);
});
it('refuses another Custos (CUSTOS_PIPE)', () => {
expect(() => custosSign({ CUSTOS_PIPE: '\\\\.\\pipe\\test' }, () => true)).toThrow(/CUSTOS_PIPE/);
});
});
+36 -5
View File
@@ -54,15 +54,17 @@
} }
// --- Keeping her (keep-her-safe.md) ------------------------------------- // --- Keeping her (keep-her-safe.md) -------------------------------------
// The Android, iOS and desktop apps are installed by being apps (tauri-platforms.md D9):
// they ask to keep the garden after the first care, as an installed PWA does, and never
// show the hint to add the page to the home screen. Keep her safe speaks of the app, not a
// browser (keep-her-safe-apps.md A1).
const inApp = __ROSEA_SHELL__ === 'tauri';
const browserStorage = typeof navigator !== 'undefined' ? navigator.storage : undefined; const browserStorage = typeof navigator !== 'undefined' ? navigator.storage : undefined;
const keeping: RoseWiring['keeping'] = { const keeping: RoseWiring['keeping'] = {
where: inApp ? 'app' : 'browser',
persisted: async () => (browserStorage?.persisted ? browserStorage.persisted() : null), persisted: async () => (browserStorage?.persisted ? browserStorage.persisted() : null),
persist: async () => (browserStorage?.persist ? browserStorage.persist() : null) persist: async () => (browserStorage?.persist ? browserStorage.persist() : null)
}; };
// The Android, iOS and desktop apps are installed by being apps (tauri-platforms.md D9):
// they ask to keep the garden after the first care, as an installed PWA does, and never
// show the hint to add the page to the home screen.
const inApp = __ROSEA_SHELL__ === 'tauri';
const installed = (): boolean => const installed = (): boolean =>
inApp || inApp ||
matchMedia('(display-mode: standalone)').matches || matchMedia('(display-mode: standalone)').matches ||
@@ -76,7 +78,36 @@
keeping.persist().catch((error: unknown) => console.error('keep: asking the browser to keep the garden failed', error)); keeping.persist().catch((error: unknown) => console.error('keep: asking the browser to keep the garden failed', error));
} }
function saveFile(name: string, text: string): void { /**
* Android's save screen, through the app's own bridge (keep-her-safe-apps.md A2): present
* only in the Android app, where `<a download>` does nothing. It answers with a window event,
* true when the file was written, false when the player stepped back (A4).
*/
const androidFile = inApp ? (window as Window & { roseaFile?: { save(name: string, text: string): void } }).roseaFile : undefined;
let saving: Promise<boolean> | undefined;
function saveFile(name: string, text: string): void | Promise<boolean> {
if (androidFile) {
// One save at a time: a second tap while the screen is open waits for the first answer.
if (saving) return saving;
saving = new Promise<boolean>((resolve) => {
const answer = (event: Event): void => {
window.removeEventListener('rosea-file-saved', answer);
saving = undefined;
resolve((event as CustomEvent<unknown>).detail === true);
};
window.addEventListener('rosea-file-saved', answer);
try {
androidFile.save(name, text);
} catch (error) {
console.error('keep: the app could not open the save screen', error);
window.removeEventListener('rosea-file-saved', answer);
saving = undefined;
resolve(false);
}
});
return saving;
}
// A file made here and handed over; nothing is sent anywhere. // A file made here and handed over; nothing is sent anywhere.
const url = URL.createObjectURL(new Blob([text], { type: 'application/json' })); const url = URL.createObjectURL(new Blob([text], { type: 'application/json' }));
const a = Object.assign(document.createElement('a'), { href: url, download: name }); const a = Object.assign(document.createElement('a'), { href: url, download: name });
+56
View File
@@ -0,0 +1,56 @@
import { _android as android, expect, test, type AndroidDevice, type Page } from '@playwright/test';
import { en } from '@rosea/ui/copy';
import { pastGardener, openRing } from '../garden.js';
import { storedCare } from '../stored.js';
/**
* The Android app on Fabrica's test phone (.agents/features/fabrica-release.md F9): the debug
* APK Fabrica installed, reached through its WebView with Playwright's own Android support
* (Fabrica docs/22_devices.md). Only `fabrica tests run --target phone` runs it: the phone is
* leased from Fabrica's queue, the app's data is cleared first, and Fabrica stops the app after.
* Watering is by the keyboard's Space held down: the same pour as a held finger (rose.md), and
* the one input a WebView reached over DevTools takes as a player's.
*/
const PKG = process.env['FABRICA_TESTS_PACKAGE'];
const SERIAL = process.env['ANDROID_SERIAL'];
test.skip(!PKG || !SERIAL, "runs only through Fabrica's phone queue: fabrica tests run --target phone");
async function garden(device: AndroidDevice): Promise<Page> {
const webView = await device.webView({ pkg: PKG! }, { timeout: 30_000 });
const page = await webView.page();
await expect(page.getByRole('heading', { level: 2, name: en.gardener.question }).or(page.getByRole('button', { name: en.rose.care }))).toBeVisible({
timeout: 30_000
});
return page;
}
test('the garden opens on the phone; she is watered, and still watered after the app is closed and opened', async () => {
test.setTimeout(240_000);
const device = (await android.devices()).find((d) => d.serial() === SERIAL);
expect(device, `no phone with the serial ${SERIAL} on adb`).toBeDefined();
try {
let page = await garden(device!);
await pastGardener(page);
// No town: the private choice, and it keeps the test free of any place.
await page.getByRole('button', { name: /^Not now/ }).click();
await openRing(page);
await page.getByRole('button', { name: en.rose.water }).focus();
await page.keyboard.down('Space');
await page.waitForTimeout(1500);
await page.keyboard.up('Space');
await expect(page.getByText(en.rose.says.thanks)).toBeVisible();
await storedCare(page, 1);
await device!.shell(`am force-stop ${PKG!}`);
await device!.shell(`monkey -p ${PKG!} -c android.intent.category.LAUNCHER 1`);
page = await garden(device!);
await page.getByRole('button', { name: en.rose.numbers }).click();
await expect(page.locator('#rose-numbers')).toContainText(`${en.rose.daysOfCare}1`);
} finally {
// Fabrica stops the app after the run too; the phone is never left with Rosea open (memory rule, 2026-11-17).
await device?.shell(`am force-stop ${PKG!}`).catch((e: unknown) => console.warn(`force-stop: ${String(e)}`));
await device?.close();
}
});
+125 -20
View File
@@ -81,37 +81,135 @@ async function firstVisit(page: Page): Promise<void> {
} }
/** After the app was closed and opened again: she is still watered. */ /** After the app was closed and opened again: she is still watered. */
/** On a failure, what the screen showed: a picture in the temporary folder, its path in the report. */
let lastPage: Page | undefined;
async function secondVisit(page: Page): Promise<void> { async function secondVisit(page: Page): Promise<void> {
lastPage = page;
await garden(page); await garden(page);
// By keyboard: on the tablet a pointer click once waited 30 s for the button to stop moving // By keyboard: on the tablet a pointer click once waited 30 s for the button to stop moving
// while the garden animated (review). Enter is a real activation, as for a keyboard player. // while the garden animated (review). Enter is a real activation, as for a keyboard player.
// Her picture first: the garden's heading comes before her care is read back, and a press in
// that moment was lost twice on the desktop (keep-her-safe-apps review). Then press until the
// button says it is open: a press is only repeated while it still says closed.
await expect(page.getByRole('img', { name: /^The rose/ })).toBeVisible({ timeout: 20_000 });
const numbers = page.getByRole('button', { name: en.rose.numbers }); const numbers = page.getByRole('button', { name: en.rose.numbers });
await numbers.focus(); await expect(async () => {
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`); await expect(page.locator('#rose-numbers')).toContainText(`${en.rose.daysOfCare}1`);
await storedCare(page, 1); await storedCare(page, 1);
report['afterRestart'] = 'still watered: 1 day of care, the care log kept'; report['afterRestart'] = 'still watered: 1 day of care, the care log kept';
} }
/** What *Save her to a file* does here (G-T4): a download event, or nothing. */ /**
async function trySave(page: Page): Promise<void> { * 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> {
const title = page.getByRole('button', { name: en.rose.safe.title }); const title = page.getByRole('button', { name: en.rose.safe.title });
if (!(await title.isVisible().catch(() => false))) { await expect(async () => {
report['saveToFile'] = 'Keep her safe not visible'; 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);
}
report['keepHerSafeWords'] = en.rose.safe.app;
}
/** Desktop: *Save her to a file* starts a WebView2 download (cancelled by the check). */
async function desktopSave(page: Page): Promise<void> {
await openKeepSafe(page);
const download = page.waitForEvent('download', { timeout: 10_000 });
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();
}
interface UiNode {
readonly text: string;
readonly desc: string;
readonly cx: number;
readonly cy: number;
}
/** The screen's accessibility nodes, through uiautomator, printed to stdout (no file left behind). */
function screenNodes(adb: (...args: string[]) => string): UiNode[] {
const xml = adb('exec-out', 'uiautomator', 'dump', '/dev/tty');
const nodes: UiNode[] = [];
for (const m of xml.matchAll(/<node [^>]*?text="([^"]*)"[^>]*?content-desc="([^"]*)"[^>]*?bounds="\[(\d+),(\d+)\]\[(\d+),(\d+)\]"/g)) {
const [x1, y1, x2, y2] = [m[3], m[4], m[5], m[6]].map(Number) as [number, number, number, number];
nodes.push({ text: m[1] ?? '', desc: m[2] ?? '', cx: Math.round((x1 + x2) / 2), cy: Math.round((y1 + y2) / 2) });
}
return nodes;
}
/**
* 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 && last && node.cx === last.cx && node.cy === last.cy) {
adb('shell', 'input', 'tap', String(node.cx), String(node.cy));
return; return;
} }
await title.click(); last = node;
const save = page.getByRole('button', { name: en.rose.safe.save }); await new Promise((r) => setTimeout(r, 700));
await expect(save).toBeVisible(); }
const download = page.waitForEvent('download', { timeout: 5_000 }).then( throw new Error(`Android's screen never showed ${what}, still`);
async (d) => { }
await d.cancel();
return `a download started: ${d.suggestedFilename()} (cancelled by the check)`; /**
}, * Android: the round trip (keep-her-safe-apps.md §5). *Save her to a file* opens Android's save
() => 'nothing happened within 5 s' * screen; the check presses its Save; the garden says she is in that file. Then *Bring her back
); * from a file* opens the picker; the check chooses that file; the garden says everything in it is
await save.click(); * already here. The file is removed from the tablet afterwards if this run made it.
report['saveToFile'] = await download; */
async function androidRoundTrip(page: Page, adb: (...args: string[]) => string): Promise<void> {
await openKeepSafe(page);
const name = `rose-${await page.evaluate(() => {
const d = new Date();
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
})}.json`;
const before = adb('shell', 'ls', '/sdcard/Download/');
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 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.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 });
// 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+/);
if (after.includes(name)) {
adb('shell', 'rm', `/sdcard/Download/${name}`);
report['cleanedUp'] = `/sdcard/Download/${name}`;
} else {
report['cleanedUp'] = `nothing at /sdcard/Download/${name} (saved elsewhere, or not saved)`;
}
}
} }
async function desktop(exe: string): Promise<void> { async function desktop(exe: string): Promise<void> {
@@ -153,7 +251,7 @@ async function desktop(exe: string): Promise<void> {
app = start(); app = start();
session = await attach(); session = await attach();
await secondVisit(session.page); await secondVisit(session.page);
await trySave(session.page); await desktopSave(session.page);
await session.close(); await session.close();
report['dataFolder'] = data; report['dataFolder'] = data;
} finally { } finally {
@@ -203,7 +301,7 @@ async function androidDevice(serial: string | undefined): Promise<void> {
await new Promise((r) => setTimeout(r, 1500)); await new Promise((r) => setTimeout(r, 1500));
session = await open(); session = await open();
await secondVisit(session.page); await secondVisit(session.page);
await trySave(session.page); await androidRoundTrip(session.page, adb);
} finally { } finally {
adb('shell', 'am', 'force-stop', PACKAGE_ID); adb('shell', 'am', 'force-stop', PACKAGE_ID);
await session?.close().catch((error: unknown) => console.error('check-garden: closing the device handle failed', error)); await session?.close().catch((error: unknown) => console.error('check-garden: closing the device handle failed', error));
@@ -222,6 +320,13 @@ try {
console.log(JSON.stringify(report, null, 2)); console.log(JSON.stringify(report, null, 2));
console.log(`check-garden ${target}: PASSED`); console.log(`check-garden ${target}: PASSED`);
} catch (error) { } catch (error) {
if (lastPage) {
const shot = join(tmpdir(), `rosea-check-${target ?? 'unknown'}-failure.png`);
await lastPage.screenshot({ path: shot }).then(
() => (report['failureScreenshot'] = shot),
(e: unknown) => (report['failureScreenshot'] = `could not take one: ${String(e)}`)
);
}
console.log(JSON.stringify(report, null, 2)); console.log(JSON.stringify(report, null, 2));
console.error(`check-garden ${target}: FAILED — ${(error as Error).message}`); console.error(`check-garden ${target}: FAILED — ${(error as Error).message}`);
process.exitCode = 1; process.exitCode = 1;
+164
View File
@@ -0,0 +1,164 @@
import { mkdirSync } from 'node:fs';
import { readFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { expect, test, type Browser, type BrowserContext, type Page } from '@playwright/test';
import { en } from '@rosea/ui/copy';
import { openRing, pastGardener } from './garden.js';
import { startStaticServer, type StaticServer } from './static-server.js';
import { storedCare, storedTown } from './stored.js';
/**
* The pictures for Rosea's Aula page (.agents/features/fabrica-release.md F7), taken from the
* BUILT PWA. The demo garden is made by the game itself, as a player makes one: the first look
* of the gardener, the town Prague, and two weeks of watering, once each morning, in an invented
* March. No file, profile or town of a real player is read. `.fabrica/aula.yaml` lists the files;
* `fabrica aula shots` checks and publishes them.
*/
const OUT = fileURLToPath(new URL('./aula/', import.meta.url));
const ZONE = 'Europe/Prague';
const DAYS = 14;
/** 08:00 in Prague on day `n` of March 2026 (CET, before the clocks change on the 29th). */
const morning = (n: number): number => Date.parse(`2026-03-${String(n).padStart(2, '0')}T08:00:00+01:00`);
const LAST = morning(DAYS + 1);
let server: StaticServer;
test.beforeAll(async () => {
mkdirSync(OUT, { recursive: true });
server = await startStaticServer();
});
test.afterAll(async () => {
await server.close();
});
/** Holds Water with the mouse, as a player holds it with a finger, until she thanks them. */
async function water(page: Page): Promise<void> {
await openRing(page);
await page.getByRole('button', { name: en.rose.water }).hover();
await page.mouse.down();
await page.waitForTimeout(1500);
await page.mouse.up();
await expect(page.getByText(en.rose.says.thanks)).toBeVisible();
}
async function shot(page: Page, name: string): Promise<void> {
await page.screenshot({ path: `${OUT}${name}.png`, animations: 'disabled', caret: 'hide' });
}
/** Every request the page makes, to prove the pictures were taken with nothing from elsewhere. */
function watch(page: Page): string[] {
const requests: string[] = [];
page.on('request', (r) => requests.push(r.url()));
return requests;
}
async function chooseGardenerAndTown(page: Page): Promise<void> {
await pastGardener(page);
await page.getByRole('searchbox', { name: en.sunset.searchLabel }).fill('prague');
await page.getByRole('button', { name: /^Prague/ }).first().click();
await storedTown(page, 'Prague');
}
async function newContext(browser: Browser, phone: boolean): Promise<BrowserContext> {
const common = { timezoneId: ZONE, locale: 'en-US', colorScheme: 'light' as const, reducedMotion: 'reduce' as const };
return phone
? browser.newContext({
...common,
viewport: { width: 360, height: 800 },
deviceScaleFactor: 2,
isMobile: true,
hasTouch: true,
userAgent: 'Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Mobile Safari/537.36'
})
: browser.newContext({ ...common, viewport: { width: 1280, height: 800 }, deviceScaleFactor: 1 });
}
test.describe.configure({ mode: 'serial', timeout: 300_000 });
let saved = '';
test('two weeks in an invented garden, photographed on a desktop', async ({ browser }) => {
const context = await newContext(browser, false);
try {
const page = await context.newPage();
const requests = watch(page);
await page.clock.install({ time: morning(1) });
await page.goto(server.url);
await expect(page.getByRole('heading', { level: 2, name: en.gardener.question })).toBeVisible({ timeout: 20_000 });
await shot(page, 'first-open');
await chooseGardenerAndTown(page);
for (let day = 1; day <= DAYS; day += 1) {
if (day > 1) {
await page.clock.setSystemTime(morning(day));
await page.reload();
await expect(page.getByRole('button', { name: en.rose.care })).toBeVisible();
}
await water(page);
await storedCare(page, day);
}
// The fifteenth morning: what she needs today, before any care.
await page.clock.setSystemTime(LAST);
await page.reload();
await expect(page.getByRole('button', { name: en.rose.care })).toBeVisible();
await expect(page.locator('.sun p').first()).toHaveText(/in Prague\.$/);
await shot(page, 'garden');
await openRing(page);
await shot(page, 'ring');
await page.keyboard.press('Escape');
await page.getByRole('button', { name: en.rose.numbers }).click();
await expect(page.locator('#rose-numbers')).toContainText(en.rose.daysOfCare);
await page.locator('#rose-numbers').evaluate((el) => el.scrollIntoView({ block: 'center' }));
await shot(page, 'numbers');
await page.getByRole('button', { name: en.rose.safe.title }).click();
await expect(page.getByRole('button', { name: en.rose.safe.save })).toBeVisible();
await page.getByRole('button', { name: en.rose.safe.save }).scrollIntoViewIfNeeded();
await shot(page, 'safe');
// The same rose, carried to the phone below as a player carries her: in a file.
const download = page.waitForEvent('download');
await page.getByRole('button', { name: en.rose.safe.save }).click();
saved = await readFile((await (await download).path())!, 'utf8');
expect(saved).not.toMatch(/Prague|privateKey/);
await page.reload();
await page.getByRole('button', { name: en.chair.move }).click();
const scene = page.getByRole('dialog', { name: en.chair.scene });
await expect(scene).toBeVisible();
await page.clock.runFor(30_000);
await expect(scene.getByText(/^Tonight the sun sets at .* in Prague\.$/)).toBeVisible();
await shot(page, 'sunset');
expect(requests.filter((url) => !url.startsWith(server.origin + '/'))).toEqual([]);
} finally {
await context.close();
}
});
test('the same rose on a phone', async ({ browser }) => {
expect(saved, 'the desktop test saves the rose this one opens').not.toBe('');
const context = await newContext(browser, true);
try {
const page = await context.newPage();
const requests = watch(page);
await page.clock.install({ time: LAST });
await page.goto(server.url);
await chooseGardenerAndTown(page);
await page.getByRole('button', { name: en.rose.safe.title }).click();
await page.getByLabel(en.rose.safe.bringBack).setInputFiles({ name: 'rose.json', mimeType: 'application/json', buffer: Buffer.from(saved) });
await expect(page.getByText(/^She is back/)).toBeVisible();
await storedCare(page, DAYS);
await page.reload();
await expect(page.getByRole('button', { name: en.rose.care })).toBeVisible();
await shot(page, 'phone-garden');
await openRing(page);
await shot(page, 'phone-ring');
expect(requests.filter((url) => !url.startsWith(server.origin + '/'))).toEqual([]);
} finally {
await context.close();
}
});
+19
View File
@@ -0,0 +1,19 @@
import { defineConfig, devices } from '@playwright/test';
/**
* The Aula pictures (`pnpm aula:shots`, .agents/features/fabrica-release.md F7): the BUILT PWA
* on demo data the game makes itself, written to e2e/aula/ (git-ignored). Its own config, so
* `pnpm test:e2e` stays the suite of record and the pictures are taken only when asked for.
*/
export default defineConfig({
testDir: '.',
testMatch: /aula\.spec\.ts/,
fullyParallel: false,
workers: 1,
retries: 0,
reporter: [['list']],
use: {
...devices['Desktop Chrome'],
trace: 'retain-on-failure'
}
});
+21
View File
@@ -0,0 +1,21 @@
import { defineConfig, devices } from '@playwright/test';
/**
* Fabrica's targets (.fabrica/tests.yaml; .agents/features/fabrica-release.md F9).
* - `web`: the specs of `pnpm test:e2e`, against the BUILT bundle (build it first).
* - `android`: the app on Fabrica's test phone, leased from its phone queue. Without the
* environment Fabrica gives it, the test skips and says why: it never reaches for a phone itself.
* `pnpm test:e2e` keeps its own config, so nothing here changes the suite of record.
*/
export default defineConfig({
testDir: '.',
fullyParallel: false,
workers: 1,
retries: 0,
reporter: [['list']],
use: { trace: 'retain-on-failure' },
projects: [
{ name: 'web', testMatch: /(shell|update|petal|planet)\.spec\.ts/, use: { ...devices['Desktop Chrome'] } },
{ name: 'android', testMatch: /android\/.*\.android\.ts/ }
]
});
+2
View File
@@ -16,6 +16,7 @@
"test:e2e": "pnpm guard:cpu && turbo run build --filter=@rosea/app && playwright test --config=e2e/playwright.config.ts", "test:e2e": "pnpm guard:cpu && turbo run build --filter=@rosea/app && playwright test --config=e2e/playwright.config.ts",
"test:offline": "pnpm guard:cpu && turbo run build --filter=@rosea/app && playwright test --config=e2e/playwright.offline.config.ts", "test:offline": "pnpm guard:cpu && turbo run build --filter=@rosea/app && playwright test --config=e2e/playwright.offline.config.ts",
"test:android": "tsx scripts/android-smoke.ts", "test:android": "tsx scripts/android-smoke.ts",
"aula:shots": "pnpm guard:cpu && turbo run build --filter=@rosea/app && playwright test --config=e2e/playwright.aula.config.ts",
"validate:library": "tsx scripts/validate-library.ts", "validate:library": "tsx scripts/validate-library.ts",
"library:verify": "tsx scripts/verify-sentences.ts", "library:verify": "tsx scripts/verify-sentences.ts",
"lint:copy": "tsx scripts/lint-copy.ts", "lint:copy": "tsx scripts/lint-copy.ts",
@@ -25,6 +26,7 @@
"tauri:dev": "pnpm --filter @rosea/tauri dev", "tauri:dev": "pnpm --filter @rosea/tauri dev",
"tauri:build": "pnpm --filter @rosea/tauri build:desktop", "tauri:build": "pnpm --filter @rosea/tauri build:desktop",
"tauri:android": "pnpm --filter @rosea/tauri build:android", "tauri:android": "pnpm --filter @rosea/tauri build:android",
"tauri:android-release": "pnpm --filter @rosea/tauri build:android-release",
"tauri:ios": "pnpm --filter @rosea/tauri build:ios" "tauri:ios": "pnpm --filter @rosea/tauri build:ios"
}, },
"devDependencies": { "devDependencies": {
+4
View File
@@ -83,7 +83,11 @@ export const en = {
ask: 'Ask the browser to keep her', ask: 'Ask the browser to keep her',
refused: 'The browser did not promise. A saved file keeps her for sure.', refused: 'The browser did not promise. A saved file keeps her for sure.',
install: 'On an iPhone or iPad, add the garden to your Home Screen to keep her.', install: 'On an iPhone or iPad, add the garden to your Home Screen to keep her.',
/** In the Android, iOS and desktop apps (keep-her-safe-apps.md A1): no browser, and nothing clears her for being left alone. */
app: 'She lives in this app, on this device, until the app is removed. A saved file keeps her anywhere.',
save: 'Save her to a file', save: 'Save her to a file',
/** Said only when the app knows the file was written (A4); a cancelled save is not commented on. */
saved: 'She is in that file now.',
fileNote: 'The file holds her care and when it was given. It never holds your town.', fileNote: 'The file holds her care and when it was given. It never holds your town.',
bringBack: 'Bring her back from a file', bringBack: 'Bring her back from a file',
broughtBack: (n: number): string => broughtBack: (n: number): string =>
+12 -4
View File
@@ -14,7 +14,11 @@
let refused = $state(false); let refused = $state(false);
let said = $state(''); let said = $state('');
const inApp = $derived(wiring.keeping.where === 'app');
$effect(() => { $effect(() => {
// In an app there is no browser to ask, and the answer would always be no (A1).
if (inApp) return;
wiring.keeping.persisted().then( wiring.keeping.persisted().then(
(p) => (persisted = p), (p) => (persisted = p),
(error: unknown) => { (error: unknown) => {
@@ -38,7 +42,9 @@
async function save(): Promise<void> { async function save(): Promise<void> {
try { try {
const file = await wiring.exportRose(currentKey); const file = await wiring.exportRose(currentKey);
wiring.saveFile(`rose-${today}.json`, JSON.stringify(file, null, 1)); said = '';
const written = await wiring.saveFile(`rose-${today}.json`, JSON.stringify(file, null, 1));
if (written === true) said = en.rose.safe.saved;
} catch (error) { } catch (error) {
console.error('keep: the rose could not be saved to a file', error); console.error('keep: the rose could not be saved to a file', error);
} }
@@ -64,13 +70,15 @@
<section class="safe" aria-labelledby="{uid}-title"> <section class="safe" aria-labelledby="{uid}-title">
<h3 id="{uid}-title">{en.rose.safe.title}</h3> <h3 id="{uid}-title">{en.rose.safe.title}</h3>
{#if persisted !== undefined} {#if inApp}
<p>{en.rose.safe.app}</p>
{:else if persisted !== undefined}
<p>{refused ? en.rose.safe.refused : persisted === true ? en.rose.safe.kept : persisted === false ? en.rose.safe.mayClear : en.rose.safe.unknown}</p> <p>{refused ? en.rose.safe.refused : persisted === true ? en.rose.safe.kept : persisted === false ? en.rose.safe.mayClear : en.rose.safe.unknown}</p>
{/if} {/if}
{#if persisted === false && !refused} {#if !inApp && persisted === false && !refused}
<button type="button" class="quiet" onclick={ask}>{en.rose.safe.ask}</button> <button type="button" class="quiet" onclick={ask}>{en.rose.safe.ask}</button>
{/if} {/if}
{#if wiring.installHint} {#if !inApp && wiring.installHint}
<p>{en.rose.safe.install}</p> <p>{en.rose.safe.install}</p>
{/if} {/if}
+12 -2
View File
@@ -30,10 +30,20 @@ export interface RoseWiring {
}; };
/** Hears care, a petal or a rose brought back in another tab (two-tabs.md); returns the way to stop. */ /** Hears care, a petal or a rose brought back in another tab (two-tabs.md); returns the way to stop. */
readonly changes?: (listener: () => void) => () => void; readonly changes?: (listener: () => void) => () => void;
/** Hands the player a file to keep. */ /**
readonly saveFile: (name: string, text: string) => void; * Hands the player a file to keep. Where the app learns the outcome (Android's save screen,
* keep-her-safe-apps.md A4) it answers true when written and false when the player stepped back;
* where it cannot know (a browser download) it answers nothing.
*/
readonly saveFile: (name: string, text: string) => void | Promise<boolean>;
/** The browser's promise to keep the garden: true, false, or null when it cannot say. */ /** The browser's promise to keep the garden: true, false, or null when it cannot say. */
readonly keeping: { readonly keeping: {
/**
* Where she lives (keep-her-safe-apps.md A1): `'browser'` (the default) or `'app'`, the
* Android, iOS and desktop apps, where there is no browser to ask and nothing clears her
* for being left alone.
*/
readonly where?: 'browser' | 'app';
readonly persisted: () => Promise<boolean | null>; readonly persisted: () => Promise<boolean | null>;
readonly persist: () => Promise<boolean | null>; readonly persist: () => Promise<boolean | null>;
}; };
+43
View File
@@ -229,6 +229,49 @@ describe('keep her safe (keep-her-safe.md)', () => {
await waitFor(() => expect(document.getElementById('rose-numbers')?.textContent).toContain(`${en.rose.daysOfCare}1`)); await waitFor(() => expect(document.getElementById('rose-numbers')?.textContent).toContain(`${en.rose.daysOfCare}1`));
}); });
it('in an app, says where she lives and asks no browser, which is not there (keep-her-safe-apps.md A1)', async () => {
const persisted = vi.fn(async () => false);
const persist = vi.fn(async () => false);
render(Rose, { wiring: wiring({ keeping: { where: 'app', persisted, persist }, installHint: true }), timeZone: ZONE });
await open();
expect(await screen.findByText(en.rose.safe.app)).toBeTruthy();
for (const said of [en.rose.safe.mayClear, en.rose.safe.unknown, en.rose.safe.kept, en.rose.safe.install]) {
expect(screen.queryByText(said)).toBeNull();
}
expect(screen.queryByRole('button', { name: en.rose.safe.ask })).toBeNull();
expect(screen.getByRole('button', { name: en.rose.safe.save })).toBeTruthy();
expect(screen.getByLabelText(en.rose.safe.bringBack)).toBeTruthy();
expect(persisted).not.toHaveBeenCalled();
expect(persist).not.toHaveBeenCalled();
});
it('the app words never speak of a browser', () => {
expect(en.rose.safe.app).not.toMatch(/browser/i);
expect(en.rose.safe.saved).not.toMatch(/browser/i);
});
it('says she is in the file only when the app knows it was written (A4)', async () => {
let answer = true;
render(Rose, { wiring: wiring({ saveFile: async () => answer }), timeZone: ZONE });
await open();
const save = screen.getByRole('button', { name: en.rose.safe.save });
await fireEvent.click(save);
expect(await screen.findByText(en.rose.safe.saved)).toBeTruthy();
// A second save the player steps back from: the earlier word goes, and nothing is said.
answer = false;
await fireEvent.click(save);
await waitFor(() => expect(screen.queryByText(en.rose.safe.saved)).toBeNull());
});
it('a browser download says nothing of its own: the browser shows it', async () => {
const w = wiring();
render(Rose, { wiring: w, timeZone: ZONE });
await open();
await fireEvent.click(screen.getByRole('button', { name: en.rose.safe.save }));
await waitFor(() => expect(w.saved).toHaveLength(1));
expect(screen.queryByText(en.rose.safe.saved)).toBeNull();
});
it('a file that is not a rose is said calmly, and nothing changes', async () => { it('a file that is not a rose is said calmly, and nothing changes', async () => {
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined); const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
render(Rose, { wiring: wiring({ importRose: () => Promise.reject(new TypeError('storage: this file does not hold a rose')) }), timeZone: ZONE }); render(Rose, { wiring: wiring({ importRose: () => Promise.reject(new TypeError('storage: this file does not hold a rose')) }), timeZone: ZONE });
+12
View File
@@ -271,6 +271,18 @@ importers:
specifier: 3.2.7 specifier: 3.2.7
version: 3.2.7(@types/node@22.20.1)(jsdom@25.0.1)(terser@5.51.2)(tsx@4.23.12) version: 3.2.7(@types/node@22.20.1)(jsdom@25.0.1)(terser@5.51.2)(tsx@4.23.12)
tools/release:
devDependencies:
'@types/node':
specifier: 22.20.1
version: 22.20.1
typescript:
specifier: 5.9.3
version: 5.9.3
vitest:
specifier: 3.2.7
version: 3.2.7(@types/node@22.20.1)(jsdom@25.0.1)(terser@5.51.2)(tsx@4.23.12)
packages: packages:
'@apideck/better-ajv-errors@0.3.7': '@apideck/better-ajv-errors@0.3.7':
+3
View File
@@ -0,0 +1,3 @@
/** Types for check-version.mjs, which Fabrica runs with plain `node` (no build step). */
export declare const VERSION_FILES: readonly string[];
export declare function versionProblems(root: string, want: string | undefined): string[];
+38
View File
@@ -0,0 +1,38 @@
// The release tag and the version files must agree (.agents/features/fabrica-release.md F10).
// Fabrica's Deploy runs `node scripts/check-version.mjs <version>` and rewrites exactly the files it names;
// each line is Fabrica's contract: `<file> says <old>, the tag says <new>` (Fabrica docs/04_deploy.md).
// The installer and the APK take their version from apps/rosea/package.json (tauri.conf.json reads it).
import { readFileSync } from 'node:fs';
import { join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
/** Every file that carries the app's version, relative to the repository root. */
export const VERSION_FILES = [
'package.json',
'apps/rosea/package.json',
'apps/rosea-tauri/package.json',
'apps/rosea-tauri/src-tauri/Cargo.toml'
];
function versionOf(root, file) {
const text = readFileSync(join(root, file), 'utf8');
if (file.endsWith('.toml')) return text.match(/^version = "([^"]+)"/m)?.[1];
return JSON.parse(text).version;
}
/** The lines to print, one per file whose version is not `want`. Empty when they all agree. */
export function versionProblems(root, want) {
if (!want) return ['usage: node scripts/check-version.mjs <version>'];
return VERSION_FILES.map((f) => [f, versionOf(root, f)])
.filter(([, v]) => v !== want)
.map(([f, v]) => `${f} says ${v}, the tag says ${want}`);
}
const isMain = (arg) => Boolean(arg) && resolve(arg).toLowerCase() === fileURLToPath(import.meta.url).toLowerCase();
if (isMain(process.argv[1])) {
const want = process.argv[2]?.replace(/^v/, '');
const problems = versionProblems(fileURLToPath(new URL('..', import.meta.url)), want);
for (const p of problems) console.error(p);
if (problems.length > 0) process.exit(1);
console.log(`version ${want} everywhere`);
}
+20 -3
View File
@@ -19,11 +19,22 @@ const TARGETS: readonly { dir: string; ext: readonly string[] }[] = [
{ dir: 'packages/ui/src', ext: ['.ts', '.svelte', '.css'] }, { dir: 'packages/ui/src', ext: ['.ts', '.svelte', '.css'] },
{ dir: 'apps/rosea/src', ext: ['.ts', '.svelte', '.css'] }, { dir: 'apps/rosea/src', ext: ['.ts', '.svelte', '.css'] },
// Store listings, once they exist, live here and are player-facing too (§8). // Store listings, once they exist, live here and are player-facing too (§8).
{ dir: 'store', ext: ['.md', '.txt', '.json'] } { dir: 'store', ext: ['.md', '.txt', '.json'] },
// The Aula page's brief and each release's notes: a stranger reads them (fabrica-release.md F11).
{ dir: '.fabrica/aula', ext: ['.md'] },
{ dir: '.fabrica/notes', ext: ['.md'] }
]; ];
/** Single files: the page shell, the config that builds the web manifest, and the Letter. */ /** Single files: the page shell, the config that builds the web manifest, the Letter, and the Aula page's text. */
const FILES: readonly string[] = ['apps/rosea/index.html', 'apps/rosea/vite.config.ts', 'docs/LETTER.md']; const FILES: readonly string[] = [
'apps/rosea/index.html',
'apps/rosea/vite.config.ts',
'docs/LETTER.md',
'AULA.md',
// Written by `fabrica notes` from commit subjects during a release; read when it is there, so the
// release's `notes-copy` step stops a forbidden word before it reaches the page (fabrica-release.md F11).
'target/notes/release-notes.md'
];
function walk(dir: string, ext: readonly string[]): string[] { function walk(dir: string, ext: readonly string[]): string[] {
if (!existsSync(dir)) return []; if (!existsSync(dir)) return [];
@@ -44,6 +55,12 @@ if (files.length === 0) {
process.exit(1); process.exit(1);
} }
// `--list` prints what would be read and checks nothing: the seam tools/release tests the list through.
if (process.argv.includes('--list')) {
for (const file of files) console.log(relative(root, file).replace(/\\/g, '/'));
process.exit(0);
}
let problems = 0; let problems = 0;
for (const file of files) { for (const file of files) {
for (const p of lintCopy(readFileSync(file, 'utf8'))) { for (const p of lintCopy(readFileSync(file, 'utf8'))) {
+16
View File
@@ -0,0 +1,16 @@
{
"name": "@rosea/release",
"version": "0.1.0",
"private": true,
"type": "module",
"description": "Tests of what a release through Fabrica reads from this repository (.agents/features/fabrica-release.md): the version files, the page's words under lint:copy, the pipeline files. Never imported by the app.",
"scripts": {
"typecheck": "tsc -p tsconfig.json",
"test": "vitest run --reporter=verbose"
},
"devDependencies": {
"@types/node": "22.20.1",
"typescript": "5.9.3",
"vitest": "3.2.7"
}
}
+49
View File
@@ -0,0 +1,49 @@
import { spawnSync } from 'node:child_process';
import { createRequire } from 'node:module';
import { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { describe, expect, it } from 'vitest';
/**
* The Aula page's words are read by strangers, like a store listing (CLAUDE.md §8), so
* lint:copy must read them (fabrica-release.md F11). The rules themselves are tested in
* @rosea/content; this proves the files are in the list the script checks.
*/
const repo = fileURLToPath(new URL('../../../', import.meta.url));
const tsx = createRequire(join(repo, 'package.json')).resolve('tsx/cli');
function listed(): string[] {
const run = spawnSync(process.execPath, [tsx, join(repo, 'scripts/lint-copy.ts'), '--list'], { cwd: repo, encoding: 'utf8' });
expect(run.status, run.stderr).toBe(0);
return run.stdout.split(/\r?\n/).filter(Boolean);
}
describe('lint:copy reads the Aula page', { timeout: 60_000 }, () => {
it('AULA.md, the brief and every release note are checked', () => {
const files = listed();
expect(files).toContain('AULA.md');
expect(files).toContain('.fabrica/aula/brief.md');
expect(files).toContain('.fabrica/notes/0.1.0.md');
});
it("a release's generated notes are checked when they are there", () => {
const notes = join(repo, 'target/notes/release-notes.md');
const had = existsSync(notes);
if (!had) {
mkdirSync(dirname(notes), { recursive: true });
writeFileSync(notes, '# notes\n');
}
try {
expect(listed()).toContain('target/notes/release-notes.md');
} finally {
if (!had) rmSync(notes);
}
});
it('the game itself is still checked', () => {
const files = listed();
expect(files).toContain('packages/ui/src/copy/en.ts');
expect(files).toContain('docs/LETTER.md');
});
});
+62
View File
@@ -0,0 +1,62 @@
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { spawnSync } from 'node:child_process';
import { afterEach, describe, expect, it } from 'vitest';
import { VERSION_FILES, versionProblems } from '../../../scripts/check-version.mjs';
/** The version check Fabrica's Deploy reads (fabrica-release.md F10). */
const repo = fileURLToPath(new URL('../../../', import.meta.url));
const temps: string[] = [];
afterEach(() => {
for (const t of temps.splice(0)) rmSync(t, { recursive: true, force: true });
});
function fakeRepo(versions: Record<string, string>): string {
const root = mkdtempSync(join(tmpdir(), 'rosea-version-'));
temps.push(root);
for (const file of VERSION_FILES) {
const v = versions[file] ?? '0.1.0';
mkdirSync(dirname(join(root, file)), { recursive: true });
const text = file.endsWith('.toml') ? `[package]\nname = "x"\nversion = "${v}"\n` : JSON.stringify({ name: 'x', version: v });
writeFileSync(join(root, file), text);
}
return root;
}
describe('check-version', { timeout: 30_000 }, () => {
it('agrees when every file carries the version', () => {
expect(versionProblems(fakeRepo({}), '0.1.0')).toEqual([]);
});
it('names each file that differs, in the words Fabrica parses', () => {
const root = fakeRepo({ 'apps/rosea-tauri/src-tauri/Cargo.toml': '0.0.9', 'apps/rosea/package.json': '0.2.0' });
expect(versionProblems(root, '0.1.0')).toEqual([
'apps/rosea/package.json says 0.2.0, the tag says 0.1.0',
'apps/rosea-tauri/src-tauri/Cargo.toml says 0.0.9, the tag says 0.1.0'
]);
});
it('refuses without a version', () => {
expect(versionProblems(fakeRepo({}), undefined)).toEqual(['usage: node scripts/check-version.mjs <version>']);
});
it('covers the file the installer and the APK take their version from', () => {
const conf = JSON.parse(readFileSync(join(repo, 'apps/rosea-tauri/src-tauri/tauri.conf.json'), 'utf8')) as { version: string };
// tauri.conf.json names the game's package.json relative to itself.
const named = join('apps/rosea-tauri/src-tauri', conf.version).replace(/\\/g, '/');
expect(VERSION_FILES).toContain(named);
});
it('this repository agrees with itself, and the CLI says so (a v prefix is the tag, not the version)', () => {
const version = (JSON.parse(readFileSync(join(repo, 'package.json'), 'utf8')) as { version: string }).version;
expect(versionProblems(repo, version)).toEqual([]);
const ok = spawnSync(process.execPath, [join(repo, 'scripts/check-version.mjs'), `v${version}`], { encoding: 'utf8' });
expect(ok.status).toBe(0);
expect(ok.stdout).toContain(`version ${version} everywhere`);
const bad = spawnSync(process.execPath, [join(repo, 'scripts/check-version.mjs'), '9.9.9'], { encoding: 'utf8' });
expect(bad.status).toBe(1);
expect(bad.stderr).toContain(`package.json says ${version}, the tag says 9.9.9`);
});
});
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node"]
},
"include": ["test/**/*.ts"]
}