[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

This commit is contained in:
2026-11-19 01:38:53 +01:00
parent 185625e7fe
commit 0d37f91763
34 changed files with 1148 additions and 6 deletions
+1
View File
@@ -5,6 +5,7 @@ One row per feature, with its analysis document (CLAUDE.md §5.1). Gaps live in
| Feature | Phase | Status | Analysis | Review | | 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 | On `feature/fabrica-release`. 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) |
| 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) | | 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) |
+13 -2
View File
@@ -77,14 +77,25 @@ 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` (Custos makes the key on the first release); no key in the repository (`fabrica-release.md` F4). **Still open:** 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~~ | 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-T4~~ | ~~Keep her safe inside the apps — release blocker~~ | Closed 2026-11-17 on `feature/keep-her-safe-apps`: the apps say *She lives in this app, on this device, until the app is removed…* and ask no browser; Android saves through its own save screen by a narrow Kotlin bridge (no plugin, no IPC, no permission) and says *She is in that file now.*; Windows downloads. Seen on the tablet (2 of 2) and on Windows (3 of 3); 572 unit tests; every drill caught after one test was tightened. |
| ~~G-T5~~ | ~~Bringing her back from a file inside the apps~~ | Closed on Android 2026-11-17: the round trip on the tablet, *Everything in that file is already here.* Windows not driven. | | ~~G-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 | Open: it runs only through Fabrica's phone queue (CLAUDE.md for this brief); see the review. |
| 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 |
+194
View File
@@ -0,0 +1,194 @@
# 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` (Custos makes the key on the first release,
Mark's first-signature card; 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.
## 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 |
+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
+21
View File
@@ -0,0 +1,21 @@
# Rosea Domi: the web e2e suite on this PC's e2e runner (fabrica-release.md F9; Fabrica docs/20_tests.md,
# docs/31_runners_here.md): 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. Manual: no push webhook
# reaches the hub yet. The phone target is not here: it runs through the phone queue with
# `fabrica tests run --target phone`.
name: e2e
on:
manual: true
runner: windows-e2e
env:
PLAYWRIGHT_BROWSERS_PATH: 'F:\ms-playwright'
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/**"]
+102
View File
@@ -0,0 +1,102 @@
# 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 (Custos makes that key on the first release: a first-signature card); 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'
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: shots
needs: [pictures]
run: fabrica aula shots
artifacts: ["target/aula/aula-*.png", "target/aula/aula.json"]
- id: page
needs: [notes, 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
+22
View File
@@ -0,0 +1,22 @@
# Rosea Domi's Playwright targets (fabrica-release.md F9; 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. Build it first
# (`pnpm tauri:android`). The queue clears this app's data before the run (docs/35 `reset: clear`, its
# default); `reset` and `maxMinutes` are not written here because the installed Fabrica (CLI 0.14.0)
# does not know them yet. A release build on the phone blocks the debug one (another key): uninstall it
# there first.
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
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*).
+12
View File
@@ -205,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
@@ -288,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
+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",
+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;
}
+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/);
});
});
+54
View File
@@ -0,0 +1,54 @@
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 {
await device?.close();
}
});
+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').scrollIntoViewIfNeeded();
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": {
+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`);
}
+12 -3
View File
@@ -19,11 +19,14 @@ 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'];
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 +47,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"
}
}
+34
View File
@@ -0,0 +1,34 @@
import { spawnSync } from 'node:child_process';
import { createRequire } from 'node:module';
import { 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('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"]
}