[ui] PlanetGarden: Analysis, review, lessons and the tablet smoke that always stops Chrome

This commit is contained in:
2026-11-17 19:56:24 +01:00
parent 1ff00b0e3f
commit f0cb6750c4
13 changed files with 467 additions and 8 deletions
+1
View File
@@ -19,4 +19,5 @@ One row per feature, with its analysis document (CLAUDE.md §5.1). Gaps live in
| The rose: care by feel, growth from days of care, drift, moods, her numbers; the care log and the identity | 1 | Merged to `main`; built, not deployed. Tuning is the author's | [rose.md](features/rose.md) | [feature-rose-care.md](reviews/feature-rose-care.md) |
| Where the sunset is: choose a town (or skip to a guess from the device's zone), kept on the device; tonight's sunset in the garden | 1 | Merged to `main`; built, not deployed | [sunset-place.md](features/sunset-place.md) | [feature-sunset-place.md](reviews/feature-sunset-place.md) |
| The sun: real sunrise, sunset and solar noon on the device; polar day and night | 1 | Merged to `main`; engine only, the app does not show it yet | [sun.md](features/sun.md) | [feature-sun.md](reviews/feature-sun.md) |
| Her planet and the gardener: a round tiny planet, a boy or girl chosen at the first open, the ring of care by a tap on her, care by gesture (tilt the can, swipe weeds up, sweep petals, drag the windbreak, stroke her); every gesture also a button | 1 | Merged to `main`; built, not deployed. Code stand-ins; the painted art waits on the board | [planet-garden.md](features/planet-garden.md) | [feature-planet-garden.md](reviews/feature-planet-garden.md) |
| The art pipeline and the art board: STYLE.md (S1–S5 and the fox's F1–F4 approved), the manifest (Phase 1–3, 53 pictures), stand-ins, `tools/art-prep`, the published board | 0 | Merged to `main`; board published (private). The app is unchanged. Gate waits on the first real picture | [art-pipeline.md](features/art-pipeline.md) | [feature-art-board.md](reviews/feature-art-board.md), [art-phase2-3-pictures.md](reviews/art-phase2-3-pictures.md) |
+8 -1
View File
@@ -49,7 +49,7 @@ board exist, and the first real picture is the author's to make.
## Phase 1 — The rose alone
**Started 2026-11-01** with the sun, while the Phase 0 gate waits on the author (pictures,
sentences). Nothing in Phase 1 is visible to the player yet.
sentences). Phase 1 is built in code, not deployed (no host yet, G0.13).
| Id | Gap | Status / evidence |
|:--|:--|:--|
@@ -61,8 +61,15 @@ sentences). Nothing in Phase 1 is visible to the player yet.
| ~~G1.7~~ | ~~Thorns were on the roadmap but undesigned~~ | Closed 2026-11-02 on `feature/thorns`, as the author chose: thorns teach gentleness. `engine/touch` (2 properties: spaced taps are never a rush; one blush a visit); a tremor is one touch; nothing recorded. 6 of 6 put-back bugs caught. |
| ~~G1.8~~ | ~~Two tabs (CLAUDE.md §8, predicted)~~ | Closed 2026-11-07 on `fix/two-tabs`. Measured first: two e2e tests failed (an open tab saw neither care nor a town from the other). Storage announces committed writes on a `BroadcastChannel`; the rose and the garden read again, adding to what they show. No lock needed: nothing stored drifts. 7 of 7 put-back bugs caught. |
| ~~G1.10~~ | ~~The garden named only the sunset, never the sunrise (ROADMAP Phase 1: *sunset and sunrise*)~~ | Closed 2026-11-17 on `feature/sunrise`: from sunset until it comes, the line names the real sunrise; the in-game sunset still names the sunset. engine `nextSunEvent` with a 300-run property; e2e at 05:00 in Brno; seen on a real Android tablet. 5 of 5 put-back bugs caught. |
| ~~G1.9~~ | ~~The garden was a page of buttons, not a game (the author, 2026-11-17)~~ | Closed 2026-11-17 on `feature/planet-garden`: her round planet, a gardener the player chooses at the first open (fixed lists, kept in `profile`, never in the rose file), the ring of care by a tap on her, care by gesture with a button for each. 84 ui tests incl. 7 on the planet and 7 on gestures; e2e `planet.spec.ts` 3; 9 of 9 put-back bugs caught (2 only after tests were added); 7 of 7 by real touch on the Android tablet. **Open in it:** painted art for the planet and the gardener, and how customised looks are drawn (STYLE.md §3b, the author's). |
| G1.3 | Towns have no Czech names (*Vídeň*) | Open. Natural Earth has none; arrives with Czech copy. |
## Phase 6 — Release
| Id | Gap | Status / evidence |
|:--|:--|:--|
| G6.1 | A legal check of the look: a child on a small round planet with a rose is the book's best-known image, and its estate holds trademarks | Open, **before any public release**. The author accepted the risk on 2026-11-17 (CLAUDE.md §8); the guards are STYLE.md S2, S6, §3b and review points 10–11. |
## Design questions — answered
Raised by GAMEPLAY.md and ROADMAP.md, answered by the author 2026-11-01. Details in
+121
View File
@@ -0,0 +1,121 @@
# The planet garden — a gardener, gestures, and her own small world
Status: built on `feature/planet-garden`, merged to `main` 2026-11-17; built, not deployed. Decided by the author, Mark, on 2026-11-17, after
seeing the garden as a page of buttons: *"It is a game: create a proper planet, a character who does
the care, animations of how the character does it; tap the rose for actions; swipe in patterns;
pull weeds by tapping them and swiping."* His answers the same day:
- **Her world:** a **round tiny planet** (reverses STYLE.md S2).
- **The character:** a **human gardener, a boy or a girl, customised at the beginning** (reverses
STYLE.md's *no people*).
- **Gestures:** tap her to choose care; swipe weeds out; pour by tilting; patterns for the rest
(sweep petals, drag the windbreak, stroke her petals). **Buttons stay** for keyboard and screen
readers (CLAUDE.md §7: accessibility is not a phase).
Review: `feature-planet-garden.md`.
## 0. The risk the author accepted, and the guards
A child tending a rose on a small round planet is the most recognisable image of the book whose
text, names and drawings CLAUDE.md §5.6 rule 3 forbids, and whose estate holds trademarks
(GAMEPLAY.md §7). The author was told this in the choice itself and chose it. Recorded here, in
STYLE.md and CLAUDE.md, with these guards, which become review points and avoid lines:
| Guard | Why |
|:--|:--|
| **The gardener is the player's own**: chosen and customised (boy or girl, skin tone, hair style and colour, clothes colour, a hat or not) | No two players' gardeners need look alike, and none is a fixed character from anywhere. |
| **Never**: a scarf, a long coat or cape, a green suit with epaulettes, a crown, a sword; no outfit option recreates one | The book's boy is drawn with these. |
| **The planet is a cultivated garden world**: meadow, the dry-stone wall, the garden bed, the chair, the wild berry bush; **no volcanoes, no baobab-like trees, no single lamp post** | The book's planet is bare with volcanoes and baobabs. |
| **The look is our gouache** (STYLE.md §1), never pen-and-wash | The book's drawings are pen and watercolour. |
| **No glass dome over her, ever; the windbreak is woven willow** | Unchanged (§4). |
| **A legal check of the look before any public release** (store listings, Pages made public) | New gap; the author's risk, made visible. |
## 1. Why and what, in the player's terms
**The first open.** Before the garden, one quiet question: *Who tends her?* The player chooses a
boy or a girl, then skin tone, hair, clothes colour, a hat. A small preview of their gardener turns
as they choose. *This is me* finishes it. It can be changed later, from the garden.
**The garden is a small round world.** Her planet fills the lower half of the screen, the real sky
above it (code, as now). On its top: the garden bed with the rose, the wall behind, the chair, the
watering can by the bed; the gardener stands beside her.
**Tap the rose** and the care she needs right now opens around her as a small ring of choices (only
what she needs; *Touch her* is always there). Choose one and the gardener walks over and does it,
with the player's own hand in the gesture:
| Care | The gesture | The gardener |
|:--|:--|:--|
| **Water** | **Press the can and tilt**: drag sideways from it; the further the tilt, the faster the pour. Let go when her leaves lift (the same *by feel* as now). | Holds the can, tilting it as the player tilts; water falls. |
| **Weeds** | Weeds show in the bed. **Tap a weed, then swipe up** from it: it stretches, then pops out with its roots. | Bends, tugs, the weed comes free, the gardener bumps down on the grass and gets up. |
| **Fallen petals** | **Sweep**: one swipe sideways across the petals gathers them. | Sweeps them into a little pile and pockets them. |
| **Wind** | **Drag the windbreak** from the side of the bed into the wind, on her windward side. | Carries it and sets it in the ground. |
| **Touch her** | **Stroke** slowly across her petals: a fond answer. Quick, rushed taps: *Gently. I have thorns.* (thorns.md) | Reaches out and touches a petal. |
Every act is the same event as today (rose.md, thorns.md): nothing about growth, drift, the petal or
her numbers changes. The gestures are how the player's hand meets the same rules.
**Keyboard and screen readers.** The ring's choices are buttons; each one also works without its
gesture: *Water* still pours while Space or Enter is held; *Pull the weeds* pulls them all, one by
one, while the gardener does it; *Gather the petals*, *Shade her*, *Touch her* likewise. The scene
says what happens in one polite line.
**Reduced motion.** The gardener does not walk or bend: the scene shows the result at once.
## 2. Technical architecture
```mermaid
flowchart LR
app["apps/rosea<br/>App.svelte"] --> shell["packages/ui<br/>Shell: first-open choice, then the scene"]
shell --> scene["packages/ui/scene<br/>Planet.svelte (SVG): planet, bed, rose, can,<br/>weeds, petals, windbreak, gardener"]
scene --> gestures["packages/ui/scene/gestures.ts<br/>pure: tilt, swipe up, sweep, drag, stroke"]
scene --> engine["packages/engine<br/>rose (care, pour), touch (thorns),<br/>scene/ weedsToday, petalsToday (seeded counts)"]
shell --> storage["packages/storage<br/>profile: gardener (shape-checked)"]
```
| # | Decision | Why |
|:--|:--|:--|
| G1 | **One SVG scene** (`Planet.svelte`), every part its own group with a stand-in drawn in code until art is accepted; the sky stays code (S5). | One coordinate system for gestures, animation and layout; no canvas, so every part can carry an accessible name. |
| G2 | **Gesture recognisers are pure functions** of pointer samples (`gestures.ts`): `tiltOf`, `isSwipeUp`, `isSweep`, `dropTarget`, `strokeOf`. Unit- and property-tested. | Input interpretation is not game logic, but it must be testable without a browser. The rules stay in the engine. |
| G3 | **How many weeds and petals** a day shows is the engine's: `weedsToday(seed, day)` (2–4 when `weedsOn`), `petalsToday(seed, day)` (3–5 when `petalsOn`). One `weed` / `petals` care event when the **last** one is pulled or gathered. | A count on screen is the engine's (CLAUDE.md §6.2). Half-pulled weeds are not care yet: nothing is written until the job is done, and leaving half-way loses nothing earned. |
| G4 | **Pour by tilt** maps tilt to the same pour rate the hold uses (`ROSE.fullPour` over `FULL_CAN_MS`), scaled 0–1.5× by tilt; the event's `amount` is unchanged in meaning. | Watering by feel (rose.md R1) stays one rule. |
| G5 | **The gardener** is a separate component with poses (`stand`, `walk`, `pour`, `bend`, `pull`, `sweep`, `carry`, `reach`, `sit`) and a look from the player's choice. Poses are SVG stand-ins now; real art replaces them sheet by sheet. | Art and animation can arrive later without touching gestures or rules. |
| G6 | **The gardener's look is stored in `profile`** as `{ presentation: 'boy' \| 'girl', skin, hair, hairColour, clothes, hat }`, each from a fixed list; shape-checked like every stored value. Never sent anywhere. | No free text; nothing identifying; local only (CLAUDE.md §4). |
| G7 | **The ring** opens on a tap of the rose; it holds only her current needs plus *Touch her*; Escape or a tap outside closes it; focus moves into it and back. | Silence and calm: no permanent row of buttons over her. |
## 3. Risk analysis
| Risk | Answer |
|:--|:--|
| **Likeness to the book** (the author's accepted risk) | §0's guards, as avoid lines in every prompt, review points, and a legal check before release. |
| **Soul: a child avatar for adult players** | The author chose boy or girl. Recorded as a question for his two-week play: does an adult player see themselves in a child gardener? A grown-up option is one list entry away. |
| **Soul: fiddly gestures that make care feel like failing** | Generous thresholds; every gesture has a button; a missed gesture does nothing and says nothing; nothing is lost. |
| **Motion** | `prefers-reduced-motion`: no walking or bending; results at once. |
| **Accessibility** | Buttons for every act (G7); one polite line says what the gardener did; keyboard focus never trapped. |
| Privacy | The gardener's look stays in `profile`, on the device; it is not in the rose file (keep-her-safe.md K4 is unchanged). |
| Offline | Everything is code and bundled stand-ins. |
## 4. Gap analysis
- New: **G1.9** the planet garden (this); **G6.x** a legal check of the look before any public release.
- STYLE.md: S2 (where she lives) and *no people* are reversed by the author; §3b *the gardener* is
new; §4 and §7 gain the guards; the manifest gains the planet, the gardener's sheet and pose
sheets, and the customisation parts.
- Not in this feature: the gardener on the journey's other planets (Phase 2), the fox on her planet.
## 5. Verification matrix
| Case | Kind | Where |
|:--|:--|:--|
| `tiltOf`: sideways drag → 0–1 tilt; `isSwipeUp` needs upward distance and direction; `isSweep` needs sideways distance across the petals; `strokeOf` tells a slow stroke from a tap | unit + property | `ui/test/gestures.test.ts` |
| `weedsToday` / `petalsToday`: 0 on a day without, 2–4 / 3–5 with, the same on every replay | unit + property | `engine/test/scene.test.ts` |
| Gardener look: every option list is fixed; storage refuses anything else; it never enters the rose file | unit | `storage/test` |
| First open asks *Who tends her?*; the choice is kept; *Change gardener* reopens it | unit | `ui/test/gardener.test.ts` |
| Tap the rose: the ring shows only her needs plus *Touch her*; Escape closes it and focus returns | unit | `ui/test/planet.test.ts` |
| Pulling every weed writes one `weed` event; leaving half-way writes none | unit | same |
| A sweep across the petals writes one `petals` event; dragging the windbreak onto the windward side writes `shade` | unit | same |
| Pour by tilt writes one `water` event whose amount follows the tilt and time | unit | same |
| Buttons do every act without a gesture | unit | same |
| Reduced motion: no animation classes | unit | same |
| Built app: first-open choice, tap the rose, pull weeds by swiping, axe | e2e | `e2e/planet.spec.ts` |
| The real tablet: the same by real touch | device | `scripts/android-smoke.ts` (made permanent here) |
+2 -2
View File
@@ -10,9 +10,9 @@ and **how to apply it**.
| `architecture.md` | none yet | Layering, ownership, seams. |
| `design.md` | none yet | Wording, silence, empty states. |
| [`art.md`](art.md) | 3 | The image pipeline. |
| [`code.md`](code.md) | 3 | TypeScript, Svelte, async ordering, Rust. |
| [`code.md`](code.md) | 4 | TypeScript, Svelte, async ordering, Rust. |
| [`technical.md`](technical.md) | 7 | The browser and the build as platforms. |
| [`testing.md`](testing.md) | 10 | What makes a test worth having, and how a passing test lies. |
| [`testing.md`](testing.md) | 12 | What makes a test worth having, and how a passing test lies. |
| `privacy.md` | none yet | What could leave the device or make a person findable. (The geocell finding is in the review, not here: it was caught before it cost anything.) |
| [`process.md`](process.md) | 4 | Workflow, commits, credentials, honesty about what shipped. |
+13
View File
@@ -50,3 +50,16 @@ hands out Proxies wherever state is deep.
**How to apply it.** At every storage or messaging boundary, write a plain copy built
field by field (in `@rosea/storage`, the same shape check used on reading). Keep lists
that are only passed along as `$state.raw`. Test the boundary with `new Proxy(value, {})`.
## `svelte/motion` reads `matchMedia` when it is imported
**What happened.** On 2026-11-17 the gardener's walk used `Tween` from `svelte/motion`. Every UI
test file failed at import: jsdom has no `window.matchMedia`, and the module reads it at load (for
its reduced-motion store), not when a tween runs.
**Why it bit.** An import with side effects breaks every file that imports it, even transitively,
and the error points at the module, not at the component that needed it.
**How to apply it.** In `packages/ui`, animate with a small `setInterval` easing inside an
`$effect` (`packages/ui/src/scene/Planet.svelte`), reading reduced motion once through a guarded
`matchMedia` call. If `svelte/motion` is wanted later, stub `matchMedia` in the test setup first.
+28
View File
@@ -146,3 +146,31 @@ asserts something the edge makes false.
**How to apply it.** Bound every search to the region the test means (here: daytime on the
pour's own local day), and when a test built on a search fails, print what the search
returned before debugging the code under test.
## jsdom has no `PointerEvent`, so a test pointer carries no coordinates
**What happened.** On 2026-11-17 the planet garden's gesture tests fired `pointerDown` and
`pointerMove` with `clientX`/`clientY`, and every gesture read as a tap at (0, 0). jsdom has no
`PointerEvent`; testing-library falls back to a plain `Event`, which drops the coordinates.
**Why it bit.** The test looked like a finger and measured nothing. A missing browser API in the
test environment does not fail loudly; it quietly hands the code a poorer event.
**How to apply it.** Before testing pointer gestures in jsdom, polyfill `PointerEvent` on
`MouseEvent` (`packages/ui/test/planet.test.ts`) and assert one coordinate-dependent outcome first
(a sideways swipe does *not* pull a weed). Check real fingers on the device (`pnpm test:android`).
## A device test's clean-up must cover its very first step
**What happened.** On 2026-11-17 `scripts/android-smoke.ts` connected to Chrome on the tablet
*before* its `try`. Chrome was still cold-starting, the connect failed with *socket hang up*, and
the `finally` that stops Chrome and removes the adb mappings never ran: Chrome stayed open on a
device the author asked to leave as it was found. It was stopped by hand.
**Why it bit.** Clean-up written for the failures you expect (a step fails) misses the one that
happens first (the setup fails). On a shared device, a leftover is somebody else's problem.
**How to apply it.** Open the `try` before the first command that changes the device; make the
clean-up tolerate half-done setup (`page?.close()`, `browser?.close()`); retry connections that
race a cold start (the script tries for 30 s). After every device run, check: `pidof` the app is
empty, `reverse --list` and `forward --list` are empty.
+68
View File
@@ -0,0 +1,68 @@
# Review — `feature/planet-garden`
Adversarial self-review (CLAUDE.md §5.3). Analysis: [`features/planet-garden.md`](../features/planet-garden.md).
Reviewed 2026-11-17 on Node 22.23.4, Windows 10. There is no PR: the only remote is Gitea.
## What the author decided, and what was built
Mark, on 2026-11-17: *a game, with a proper planet, a character who does the care with animations,
taps on the rose and swiped patterns; weeds tapped and swiped out.* He chose a **round tiny planet**,
a **human gardener, a boy or a girl, customised at the beginning**, and **all four gesture sets**.
- The first open asks **Who tends her?**: boy or girl, skin tone, hair style and colour, clothes
colour, a hat, with a live preview; kept on the device (`profile.gardener`, a JSON Schema of
fixed lists). *Change gardener* reopens it.
- The garden is **her planet** (SVG): the real sky's light (engine `lightAt`), the meadow world, her
bed, the wall, the chair, the watering can, the day's weeds and fallen petals (engine
`weedsToday`, `petalsToday`), the windbreak on a windy hour, and **the gardener**, who walks round
the world to the work and takes a pose for it (stand-ins until art).
- **Tap her** (or Enter on her) opens **the ring** of what she needs, plus *Touch her* and *Close*;
Escape closes it, focus returns to her. **Press the can and tilt** to pour (the tilt sets the
rate); **swipe each weed up**; **sweep across the petals**; **drag the windbreak** to her
windward side; **stroke her petals** slowly. Every gesture has its button in the ring.
- The art board gains the gardener's sheet and eight poses, and her home planet in three lights;
STYLE.md records S2 (reversed) and S6 with their guards and review points 10–11.
Also on this branch: the tap-highlight fix (seen on the real tablet) and `pnpm test:android`.
## Bug drills
| Put back | Result |
|:--|:--|
| A sideways swipe pulls a weed | **MISSED at first**, then CAUGHT: the "sideways" tests were also too short, so the distance rule hid the direction rule; a long diagonal test added |
| Every pulled weed is written as care, not only the last | CAUGHT |
| The sweep need not cover every petal | CAUGHT |
| The windbreak counts wherever it is dropped | CAUGHT |
| Tilt is ignored (pours at the steady rate) | CAUGHT |
| A stroke opens the ring instead of touching her | CAUGHT |
| The gardener question is not shown at the first open | CAUGHT: 2 |
| The gardener's look accepts any value | CAUGHT: 2 |
| Reduced motion still walks | **MISSED at first**, then CAUGHT: the test checked a CSS class, not where the gardener stands; it now reads his angle straight after an act |
The first rerun of the reduced-motion drill reported CAUGHT against a test that was failing on its own (it looked before the garden loaded); fixed, then every drill was run again against a green suite.
## Findings
| # | Area | Finding | Resolution |
|:--|:--|:--|:--|
| 1 | Likeness / legal | A child tending a rose on a small round planet is the book's most recognisable image. | The author's decision, made knowingly. Guards: the gardener is the player's own, in work clothes; nothing to choose recreates the book's boy (tested on the option lists); the planet is a cultivated garden; review points 10–11; **G6.1: a legal check of the look before any public release.** |
| 2 | Soul | A child gardener for players who are mostly grown-ups. | Recorded as a question for the author's two-week play; a grown-up option is one list entry away (`gardener.schema.json`). |
| 3 | Soul | Gestures can feel like failing. | Generous thresholds; a missed gesture does nothing and says nothing; every act also has a button. |
| 4 | Accessibility | Gestures are not keyboard or screen-reader operable. | The ring's buttons do every act; the rose target is a focusable `role=button` with `aria-expanded`; one polite line says what the gardener did; axe passes on the choice, the scene and the ring (e2e). |
| 5 | Motion | Walking and swaying. | `prefers-reduced-motion`: the gardener is placed at once (tested); the global rule shortens the rest. |
| 6 | Two tabs | A gardener changed in one tab is not shown in another until reload (storage announces `gardener`, the UI does not listen yet). | Deferred: harmless (nothing is lost) and rare; noted for the next touch of the Shell. |
| 7 | Correctness | Half the weeds pulled, then the tab closed: nothing written, the weeds come back. | By design (G3): care is the finished job; nothing earned is lost. |
| 8 | Testing | jsdom has no `PointerEvent`: test pointers carried no coordinates, and `svelte/motion` read `matchMedia` at import, failing every file. | A `PointerEvent` polyfill in the planet tests; the walk is a small interval instead of `Tween`. Lessons in `testing.md` and `code.md`. |
| 9 | Process | The first look in the browser was the **old** garden: the preview's service worker served the cached build, as a player's would until *Refresh*. | Cleared for the check; it is exactly what calm-refresh exists for. |
| 10 | Design | The first stand-in had a shading arc that read as a smile on the planet. | Removed after looking. |
| 11 | Art | Painted art cannot simply be recoloured for every skin tone, hair and clothes choice the way the code stand-in is. | The board makes the first look; **how the other looks are drawn is open for the author** (STYLE.md §3b). |
| 12 | Testing | The first tablet run failed to connect while Chrome cold-started, and the connect sat **before** the `try`: Chrome was left running on the tablet. | Stopped by hand at once; the script now opens `try` before the first adb command, retries the connect for 30 s and tolerates half-done setup. Lesson in `testing.md`. |
| — | Privacy | The gardener's look stays in `profile`; it is not in the rose file (tested); nothing is sent. | — |
## Gates and devices
Counts are on the merge (HANDOVER). The tablet (WAVE 10C, 2026-11-17): `pnpm test:android` **7 of 7**
by real touch: the gardener question (a boy, a cap), the town, the ring opened by a tap on her and
closed, pouring by tilting the can, a stroke across her petals, and offline with the server
unreachable. Afterwards Chrome was stopped (`pidof` empty) and both adb mappings removed. **Not verified:** a screen reader; Safari; a phone smaller
than the tablet; weeds and petals by real touch on the device (their days depend on the key).
+7
View File
@@ -54,6 +54,12 @@ encouraging, never ruling), never a name or a quote.
Neglect makes her **drift** — turn away, close a little — never break. Short visits hold her; real
time — calendar days on which care helped, never minutes on screen — brings full bloom. One tap
shows her real numbers (water, warmth, days of care, trend).
- **Her planet and the gardener** *(decided by the author, 2026-11-17)* — she lives on a round tiny
planet of her own, cultivated as a garden, and **a gardener the player chooses** (a boy or a girl,
dressed at the first open) does the care, animated. The player cares by hand: tap her to open the
ring of care, tilt the can to pour, swipe weeds out, sweep petals, drag the windbreak, stroke her
petals; every gesture also has a button. The guards against the book's likeness are in
`art/STYLE.md` S2, S6, §3b and `.agents/features/planet-garden.md` §0.
- **The planets** — a journey through lonely grown-ups (the king, the vain man, the businessman, the
lamplighter, the geographer…). Each planet lets the player feel one shape of loneliness.
- **The fox** — follows at a distance from the first planet and comes closer through touch (pet,
@@ -506,6 +512,7 @@ No timestamp finer than a day, no precise location, no free text, no link to the
| **Location makes people findable** | Coarse cells next to a sparse population identify a house. Cell size must adapt to density, traces must be delayed and auto-deleted, and stranger contact is consent-only (§5.6). |
| **The library as a scam channel** | If any field lets a sender attach free text, a lonely recipient can be manipulated. The id-only contract (§6.1) is the defence. |
| **Copyright through the back door** | An image prompt "in the style of" the book's drawings, a fox or rose that looks like the original, or a famous line "paraphrased" too closely. All forbidden (§5.6); the art pipeline checks likeness (`docs/ART.md`). |
| **A child on a small round planet with a rose** *(a risk the author accepted, 2026-11-17)* | It is the book's most recognisable image, and its estate holds trademarks. The author chose it knowingly. Keep every guard (STYLE.md S2, S6, §3b, review points 10–11: the gardener is the player's own, in work clothes, never a scarf, coat, cape, suit or crown; the planet is a cultivated garden, never volcanoes, baobabs or a lone lamp post), and **a legal check of the look comes before any public release** (G6.1). |
| **Medical claims in a store listing** | One word like *heal* in marketing copy can pull the product toward medical-device rules. `lint:copy` also runs on store text kept in the repo. |
| **IndexedDB is evictable** *(predicted; answered by `keep-her-safe.md`)* | WebKit can discard origin storage after seven days without interaction — exactly the shape of a player who drifted away and comes back. Call `navigator.storage.persist()` where it exists, prompt iOS players to install, and make export-my-rose a first-class feature. A player returning to find their rose gone is the cruellest bug this product could have. |
| **The stale service worker** *(answered by `calm-refresh.md`)* | A precached shell keeps serving old JS to a player who has "updated". Detect a waiting worker and offer an explicit, calm *refresh* control. |
+24 -4
View File
@@ -2,7 +2,7 @@
Rewritten at the end of each session (CLAUDE.md §5.1).
## Last session — 2026-10-31 to 2026-11-01
## Last session — 2026-10-31 to 2026-11-17
**Done.**
@@ -113,6 +113,19 @@ Rewritten at the end of each session (CLAUDE.md §5.1).
still on 127.0.0.1), driven through Chrome's DevTools socket: first open, the town, watering by a
real held touch, the in-game sunset, and **offline** reloads with the server unreachable all pass.
When device testing ends, the app used is stopped at once (the author's rule).
- **Her planet and the gardener (2026-11-17, G1.9):** merged to `main`, as the author decided after
seeing a page of buttons. She lives on a round tiny planet; at the first open *Who tends her?* lets
the player dress a boy or a girl (fixed lists, kept in `profile`, never in the rose file; *Change
gardener* reopens it). A tap on her opens the ring of what she needs today plus *Touch her*; the
gardener walks round the planet to the work. By hand: press the can and move sideways to tilt and
pour (further tilts pour faster), swipe each weed up and out, sweep across the fallen petals, drag
the windbreak to her windward side, stroke her petals slowly. Every gesture is also a button.
The pictures are code stand-ins until the board's are painted. **Accepted risk:** a child on a
small round planet with a rose is the book's best-known image; the guards are in STYLE.md (S2, S6,
§3b, review points 10–11), and a legal check comes before any public release (G6.1). Tested by
real touch on the Android tablet (`pnpm test:android`, 7 of 7). Analysis:
[`.agents/features/planet-garden.md`](.agents/features/planet-garden.md). Review:
[`.agents/reviews/feature-planet-garden.md`](.agents/reviews/feature-planet-garden.md).
- **Phase 1 is built in code.** What remains of it is the author's: verified sentences (the petal
appears with them), hosting (G0.13), and the gate itself — two weeks of daily play on a phone.
@@ -135,9 +148,13 @@ The notification decision is made: in-app only on the web (G0.26).
After an accept, Claude reads the row (`ArtifactData get art/<id>`), downloads the picture
(`Artifact read` with the asset id as `path`), runs `pnpm art:accept`, commits on `art/<set>`,
and writes `final` back into the row.
4. **A GitHub repository** for Pages, and whether it is public (G0.13, G0.23).
5. **Node is upgraded** (22.23.4); unpinning the dependencies pinned for 22.11 remains (G0.20).
6. **The rose's tuning** (`.agents/features/rose.md` R2, R4, R5, R6, all in `ROSE` in
4. **The gardener in paint:** the board asks for the first look (a girl, braids, sage, a straw hat).
Painted art cannot be recoloured for every skin, hair and clothes choice the way the stand-in is:
layered parts, a few painted looks, or tints? (STYLE.md §3b). Also: a gardener changed in one tab
shows in another only after a reload (the rose's care does update live).
5. **A GitHub repository** for Pages, and whether it is public (G0.13, G0.23).
6. **Node is upgraded** (22.23.4); unpinning the dependencies pinned for 22.11 remains (G0.20).
7. **The rose's tuning** (`.agents/features/rose.md` R2, R4, R5, R6, all in `ROSE` in
`packages/engine/src/rose/rose.ts`): how fast she gets thirsty, how often weeds, petals and wind
come, and how many days of care each stage takes (full bloom after 25). Play it for a week,
then say what feels wrong.
@@ -153,6 +170,9 @@ The notification decision is made: in-app only on the web (G0.26).
download: ask first). The cause is unknown.
- **The Android tablet:** WAVE 10C on USB debugging; always `adb -s WAVE10CEEA036785` (an emulator
attaches too, and other projects use the same tablet). Stop the app used when testing ends.
`pnpm test:android` with `ROSEA_ADB=F:\Tools\Android\Sdk\platform-tools\adb.exe` and
`ROSEA_ANDROID_SERIAL=WAVE10CEEA036785`, while `vite preview` serves the build on 127.0.0.1:4173;
it stops Chrome and removes its mappings itself, even when it fails.
- **Commit identity:** `mnovak <giteatruenasadminacc.from729@passmail.net>`, set in
this repository only.
+1
View File
@@ -15,6 +15,7 @@
"test": "pnpm guard:cpu && turbo run test",
"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:android": "tsx scripts/android-smoke.ts",
"validate:library": "tsx scripts/validate-library.ts",
"library:verify": "tsx scripts/verify-sentences.ts",
"lint:copy": "tsx scripts/lint-copy.ts",
+5
View File
@@ -40,6 +40,11 @@ describe('pulling a weed', () => {
expect(isPull(line(at(100, 200), at(100, 120), GESTURE.pullMs + 1))).toBe(false);
expect(isPull(line(at(100, 200), at(100, 280), 300))).toBe(false);
});
it('far enough up but more sideways than up is not a pull (only the direction decides)', () => {
expect(isPull(line(at(100, 200), at(200, 140), 300))).toBe(false);
expect(isPull(line(at(100, 200), at(150, 140), 300))).toBe(true);
});
});
describe('sweeping the petals', () => {
+18 -1
View File
@@ -178,10 +178,27 @@ describe('her planet (planet-garden.md)', () => {
expect(screen.queryByRole('group', { name: en.scene.ring })).toBeNull();
});
it('with reduced motion the gardener does not walk', async () => {
/** Where the gardener stands now, in degrees round the world. */
const gardenerAt = (): number => Number(/rotate\((-?[\d.]+)/.exec(document.querySelector('.walker')?.getAttribute('transform') ?? '')?.[1]);
/** Asks the gardener to touch her (from the ring), and reads where they are straight after. */
async function touchFromRing(): Promise<number> {
await fireEvent.keyDown(await screen.findByRole('button', { name: en.rose.care }), { key: 'Enter' });
await tick();
await fireEvent.click(screen.getByRole('button', { name: en.rose.touch.label }));
await tick();
return gardenerAt();
}
it('with reduced motion the gardener is at the work at once; otherwise still on the way', async () => {
render(Rose, { wiring: wiring(morningWhen(() => true)), timeZone: ZONE });
expect(await touchFromRing()).toBeCloseTo(-28, 0);
cleanup();
vi.stubGlobal('matchMedia', (q: string) => ({ matches: q.includes('reduce'), media: q, addEventListener: () => undefined, removeEventListener: () => undefined }));
render(Rose, { wiring: wiring(morningWhen(() => true)), timeZone: ZONE });
await screen.findByRole('button', { name: en.rose.care });
expect(document.querySelector('.planet')?.classList.contains('reduced')).toBe(true);
expect(await touchFromRing()).toBe(-10);
});
});
+171
View File
@@ -0,0 +1,171 @@
/**
* `pnpm test:android` — the BUILT app on a real Android device over USB, by real touch.
*
* Needs: the device on USB debugging, the app built (`pnpm build`), and `vite preview` serving
* apps/rosea/dist on 127.0.0.1:4173 (`pnpm --filter @rosea/app exec vite preview --port 4173`).
* `ROSEA_ADB` names adb (default: on PATH); `ROSEA_ANDROID_SERIAL` names the device (default:
* the only one attached). Screenshots go to the folder given as the first argument.
*
* `adb reverse` maps the device's own localhost:4173 to this computer's 127.0.0.1:4173, so nothing
* listens on the network (CLAUDE.md §5.7), and Chrome treats localhost as secure, so the service
* worker runs as it will on the real host. Chrome is driven through its DevTools socket, as
* chrome://inspect does; every tap is Chrome's own touch input, so the gestures are a finger's.
* Offline is real: the mapping is removed, so the device cannot reach the server at all.
*
* It leaves the device as it found it, as the author asks: everything stored for
* http://localhost:4173 is deleted, the tab is closed, **Chrome is stopped**, the mappings removed.
*/
import { chromium, expect, type Browser, type Locator, type Page } from '@playwright/test';
import { en } from '@rosea/ui/copy';
import { execFileSync } from 'node:child_process';
import { mkdirSync } from 'node:fs';
import { join } from 'node:path';
const ADB = process.env['ROSEA_ADB'] ?? 'adb';
const SERIAL = process.env['ROSEA_ANDROID_SERIAL'];
const URL = 'http://localhost:4173/Rosea/';
const OUT = process.argv[2] ?? 'android-shots';
mkdirSync(OUT, { recursive: true });
const adb = (...args: string[]): string => execFileSync(ADB, [...(SERIAL ? ['-s', SERIAL] : []), ...args], { encoding: 'utf8' }).trim();
const results: string[] = [];
async function step(name: string, run: () => Promise<void>): Promise<void> {
const t = Date.now();
try {
await run();
results.push(`PASS ${name} (${((Date.now() - t) / 1000).toFixed(1)} s)`);
} catch (error) {
results.push(`FAIL ${name}: ${String(error).split('\n')[0]}`);
throw error;
}
}
const shot = (page: Page, name: string): Promise<Buffer> => page.screenshot({ path: join(OUT, `${name}.png`) });
/** A finger: touch down on the middle of `target`, move by (dx, dy) in `steps`, hold, lift. */
async function finger(page: Page, target: Locator, o: { dx?: number; dy?: number; holdMs?: number; steps?: number; moveMs?: number } = {}): Promise<void> {
await target.scrollIntoViewIfNeeded();
const box = await target.boundingBox();
if (!box) throw new Error('nothing to touch');
const cdp = await page.context().newCDPSession(page);
const x = box.x + box.width / 2, y = box.y + box.height / 2;
const { dx = 0, dy = 0, holdMs = 60, steps = 0, moveMs = 0 } = o;
await cdp.send('Input.dispatchTouchEvent', { type: 'touchStart', touchPoints: [{ x, y }] });
for (let i = 1; i <= steps; i++) {
if (moveMs) await page.waitForTimeout(moveMs / steps);
await cdp.send('Input.dispatchTouchEvent', { type: 'touchMove', touchPoints: [{ x: x + (dx * i) / steps, y: y + (dy * i) / steps }] });
}
await page.waitForTimeout(holdMs);
await cdp.send('Input.dispatchTouchEvent', { type: 'touchEnd', touchPoints: [] });
await cdp.detach();
}
console.log(`device: ${adb('shell', 'getprop', 'ro.product.model')} (${adb('get-serialno')})`);
let browser: Browser | undefined;
let page: Page | undefined;
/** Chrome's DevTools socket comes up a moment after Chrome starts: try for half a minute. */
async function connect(): Promise<Browser> {
for (let i = 0; ; i++) {
try {
return await chromium.connectOverCDP('http://127.0.0.1:9222');
} catch (error) {
if (i >= 30) throw error;
await new Promise((r) => setTimeout(r, 1000));
}
}
}
// Everything from the first mapping on is inside try, so the clean-up below always runs.
try {
adb('reverse', 'tcp:4173', 'tcp:4173');
adb('forward', 'tcp:9222', 'localabstract:chrome_devtools_remote');
adb('shell', 'am', 'start', '-a', 'android.intent.action.VIEW', '-d', URL, 'com.android.chrome');
browser = await connect();
const context = browser.contexts()[0];
if (!context) throw new Error('Chrome on the device has no context');
for (let i = 0; i < 30 && !page; i++) {
page = context.pages().find((p) => p.url().startsWith(URL));
if (!page) await new Promise((r) => setTimeout(r, 1000));
}
if (!page) throw new Error(`Chrome did not open ${URL}`);
const tab: Page = page;
await step('opens the built app under /Rosea/; the service worker takes control', async () => {
await expect(tab.getByRole('heading', { level: 1 })).toHaveText('Rosea Domi', { timeout: 30_000 });
await tab.waitForFunction(() => navigator.serviceWorker.ready.then(() => true), null, { timeout: 30_000 });
await tab.waitForFunction(() => navigator.serviceWorker.controller !== null, null, { timeout: 30_000 });
});
await step('Who tends her? A boy, by touch, then This is me', async () => {
await expect(tab.getByRole('heading', { level: 2, name: en.gardener.question })).toBeVisible({ timeout: 15_000 });
await shot(tab, '1-who-tends-her');
await finger(tab, tab.getByText(en.gardener.values.presentation.boy, { exact: true }));
await finger(tab, tab.getByText(en.gardener.values.hat.cap, { exact: true }));
await finger(tab, tab.getByRole('button', { name: en.gardener.done }));
await expect(tab.getByRole('group', { name: en.scene.planet })).toBeVisible();
});
await step('chooses Brno: the line names the next sunrise or sunset', async () => {
await tab.getByRole('searchbox', { name: en.sunset.searchLabel }).fill('brno');
await finger(tab, tab.getByRole('button', { name: /^Brno/ }).first());
await expect(tab.locator('.sun p').first()).toHaveText(/(rises|sets) at .* in Brno\.$/);
await shot(tab, '2-planet');
});
await step('a tap on her opens the ring of care; Close closes it', async () => {
await finger(tab, tab.getByRole('button', { name: en.rose.care }));
await expect(tab.getByRole('group', { name: en.scene.ring })).toBeVisible();
await shot(tab, '3-ring');
await finger(tab, tab.getByRole('button', { name: en.scene.close }));
await expect(tab.getByRole('group', { name: en.scene.ring })).toHaveCount(0);
});
await step('pressing the can and tilting it by finger pours: she thanks the player', async () => {
await finger(tab, tab.getByRole('img', { name: en.scene.can }), { dx: 90, steps: 6, moveMs: 300, holdMs: 1300 });
await expect(tab.getByText(en.rose.says.thanks)).toBeVisible();
await shot(tab, '4-watered');
});
await step('a slow stroke across her petals touches her', async () => {
await tab.waitForTimeout(400);
await finger(tab, tab.getByRole('button', { name: en.rose.care }), { dx: 30, dy: -20, steps: 6, moveMs: 500 });
await expect(tab.locator('.bubble')).toHaveText(en.rose.touch.fond[0]!);
});
await step('OFFLINE: with the server unreachable, a reload brings back the planet, the gardener, her care and the town', async () => {
adb('reverse', '--remove', 'tcp:4173');
await tab.reload();
await expect(tab.getByRole('group', { name: en.scene.planet })).toBeVisible({ timeout: 30_000 });
await expect(tab.getByRole('heading', { name: en.gardener.question })).toHaveCount(0);
await expect(tab.locator('.sun p').first()).toHaveText(/in Brno\.$/);
await finger(tab, tab.getByRole('button', { name: en.rose.numbers }));
await expect(tab.locator('#rose-numbers')).toContainText(`${en.rose.daysOfCare}1`);
await shot(tab, '5-offline');
});
} finally {
// Leave the device as it was: nothing of this origin stays behind, and Chrome is stopped.
if (page) try {
await page.evaluate(async () => {
for (const r of await navigator.serviceWorker.getRegistrations()) await r.unregister();
for (const k of await caches.keys()) await caches.delete(k);
await new Promise<void>((resolve) => {
const req = indexedDB.deleteDatabase('rosea');
req.onsuccess = req.onerror = req.onblocked = () => resolve();
});
});
results.push(' cleaned: service worker, caches and the rosea database for localhost:4173');
} catch (error) {
results.push(`WARN cleanup failed: ${String(error).split('\n')[0]}`);
}
await page?.close().catch((error: unknown) => results.push(`WARN could not close the tab: ${String(error)}`));
await browser?.close().catch((error: unknown) => results.push(`WARN could not disconnect: ${String(error)}`));
for (const args of [['shell', 'am', 'force-stop', 'com.android.chrome'], ['reverse', '--remove', 'tcp:4173'], ['forward', '--remove', 'tcp:9222']]) {
try {
adb(...args);
} catch (error) {
results.push(` ${args.join(' ')}: ${String(error).split('\n')[0]} (already done)`);
}
}
results.push(' stopped: Chrome on the device; adb mappings removed');
console.log(results.join('\n'));
}