[repo] Workspace: Review Phase 0 and record gaps, lessons and handover

Adversarial review with per-package counts and 13 reintroduced bugs, all
caught. Fixes from the review: the trace geocell is capped at 6 characters
(~1 km; 16 allowed centimetres), one forbidden-word hit per place, and an
e2e guard that meta charset stays within the first 1024 bytes.

CLAUDE.md §6.2 no longer contradicts itself about care acts; §2 and §3
say what Phase 0 actually built.
This commit is contained in:
2026-11-01 00:36:06 +01:00
parent 49c8def037
commit 6885a217cd
16 changed files with 417 additions and 27 deletions
+8
View File
@@ -0,0 +1,8 @@
# Features
One row per feature, with its analysis document (CLAUDE.md §5.1). Gaps live in
[`GAP_ANALYSIS.md`](GAP_ANALYSIS.md).
| Feature | Phase | Status | Analysis | Review |
|:--|:--|:--|:--|:--|
| Workspace, contracts, gates, PWA shell | 0 | Built on `feature/phase0-workspace`, not merged | [phase0-workspace.md](features/phase0-workspace.md) | [feature-phase0-workspace.md](reviews/feature-phase0-workspace.md) |
+36
View File
@@ -0,0 +1,36 @@
# Gap analysis
What the product needs that it does not have yet, and what was closed. A closed gap
is struck through **with its evidence in the row** (CLAUDE.md §5.1).
Ids are `G<phase>.<n>`. `docs/ROADMAP.md` does not exist yet, so the phases here are
provisional. Phase 0 is defined in
[`features/phase0-workspace.md`](features/phase0-workspace.md).
## Phase 0 — the workspace
| Id | Gap | Status / evidence |
|:--|:--|:--|
| ~~G0.1~~ | ~~No workspace, no commands~~ | Closed 2026-11-01 on `feature/phase0-workspace`. Every §3 command except `art:prep` and `cargo test` runs; counts in the review. |
| ~~G0.2~~ | ~~Contracts §6.1–6.3 only in prose~~ | Closed 2026-11-01. `packages/schema/schemas/*.json` with generated types; `schemas.test.ts` 15 tests. §6.2's contradictory `act` list resolved (D5). |
| ~~G0.3~~ | ~~No single place computes a day~~ | Closed 2026-11-01. `engine/src/time/localDay.ts`; 18 golden, refusal and property tests. The UTC-day trap measured: Anchorage Monday 20:00 is UTC Tuesday. |
| ~~G0.4~~ | ~~Engine purity enforced by good intentions~~ | Closed 2026-11-01. ESLint rule in `eslint.config.mjs`; `purity-lint.test.ts` proves 16 bans fire inside the engine and not outside. |
| ~~G0.5~~ | ~~No library validator~~ | Closed 2026-11-01. `content/src/validator.ts`, 13 negative fixtures, each rejected with its named rule; every rule proved by a fixture. Mutation: disabling the length cap fails `validate:library`. |
| ~~G0.6~~ | ~~No `lint:copy`~~ | Closed 2026-11-01. One forbidden list shared with the validator; 9 files checked, 0 problems. |
| ~~G0.7~~ | ~~No commit guards~~ | Closed 2026-11-01. `pre-commit` blocked a 5.7 MB probe; `commit-msg` blocked a `Co-Authored-By: Claude` trailer; both passed clean input. |
| ~~G0.8~~ | ~~Never tested under the Pages sub-path~~ | Closed for the local build 2026-11-01. `shell.spec.ts` serves `dist/` at `/Rosea/` and asserts manifest scope = start_url = SW scope. Mutation: scope `/` fails it. **On real GitHub Pages: still predicted** (G0.13). |
| ~~G0.9~~ | ~~No proof the app opens offline~~ | Closed for the shell 2026-11-01. `offline.spec.ts` closes the server, then reload, cold start and a deep link all render. Mutations: `clientsClaim: false` and no `navigateFallback` both fail it. |
| G0.10 | No calm *refresh* control for a waiting service worker (CLAUDE.md §8, stale SW) | Open. `registerType: 'prompt'` and `skipWaiting: false` are set, so a new worker waits. Nothing tells the player yet. |
| G0.11 | IndexedDB eviction: no `navigator.storage.persist()`, no export-my-rose (§8) | Open. Arrives with `packages/storage`. |
| G0.12 | The app cannot validate content in the browser | Open. Ajv compiles with `new Function`, which the CSP forbids. Needs standalone pre-compiled validators before the app reads the library. |
| G0.13 | No GitHub remote, no Pages deploy workflow, no mirror check (§5.2) | Open. Only the Gitea remote exists. |
| G0.14 | Author-owned docs missing: `docs/ROADMAP.md`, `docs/GAMEPLAY.md`, `docs/PRINCIPLES.md`, `docs/ART.md`, `art/STYLE.md`, `docs/LETTER.md`, `HANDOVER.md` predecessor | Open. **GAMEPLAY.md blocks all game code.** Agents scaffold LETTER.md; they never write its voice. |
| G0.15 | Deferred packages: `storage`, `identity`, `sync`, `services/lucerna`, `tools/art-prep` | Open by design (D1). Each arrives with its first feature. |
| G0.16 | The outcome-phrase heuristic has no reviewed override | Open. A real sentence that trips it (a false positive) cannot enter the library. Design: a `reviewedBy` field on the entry, set only by a person. |
| G0.17 | Manual: install on a phone, open in airplane mode | Open. Needs a hosted build (G0.13). |
| G0.18 | The library is empty | Open by design (D4). Release needs ≥ 365 sunset sentences, each verified by the author. |
| G0.19 | Event kinds other than `care` | Open. Wait for GAMEPLAY.md: their fields are game design. |
| G0.20 | Node 22.11 on the dev machine is below what some pinned dependencies declare | Open. All gates pass on 22.11 today. Upgrade to ≥ 22.13 and unpin (D11). |
| G0.21 | No PNG icons | Open (predicted trap). iOS ignores SVG for `apple-touch-icon`. Comes through the art pipeline. |
| G0.22 | No CI | Open. Every gate ran on this machine only. With G0.13. |
| G0.23 | Source maps are built and would be published | Open. `sourcemap: true`; maps are not precached. Decide with G0.13 whether the repository is public. If not, use `'hidden'`. |
+23 -9
View File
@@ -1,6 +1,7 @@
# Phase 0 — the workspace
Status: **built on `feature/phase0-workspace`**, not yet merged.
Status: **built on `feature/phase0-workspace`**, not yet merged. Review:
[`feature-phase0-workspace.md`](../reviews/feature-phase0-workspace.md).
Gates closed and still open: [`GAP_ANALYSIS.md`](../GAP_ANALYSIS.md).
`docs/ROADMAP.md` does not exist yet, so this document defines Phase 0 itself. It
@@ -44,15 +45,19 @@ flowchart LR
scripts["scripts/<br/>lint-copy, validate-library,<br/>git hooks"]
e2e["e2e/<br/>Playwright: built bundle,<br/>server killed for offline"]
app --> ui --> engine --> schema
app --> content --> schema
content --> engine
app --> ui --> schema
engine --> schema
content --> schema
app --> schema
scripts --> content
content -. reads .-> lib
e2e -. serves .-> app
```
`ui → engine` (CLAUDE.md §2) is not drawn because nothing in `ui` calls the engine yet, and an unused
dependency is a dependency nobody tested. It arrives with the first component that renders a value
the engine computes. `app → content` likewise.
### Decisions
| # | Decision | Why |
@@ -66,6 +71,9 @@ flowchart LR
| D7 | The CSP lives in a `<meta>` tag: `default-src 'self'`, no inline script. The service worker is registered from an emitted file, not an inline snippet. | GitHub Pages cannot set headers (§8, predicted). An inline registration script would need `'unsafe-inline'` and quietly widen the policy for everything. |
| D8 | No deploy workflow yet. | There is no GitHub remote. A workflow for a host that does not exist is configuration nobody can test. |
| D9 | `localDay(epochMs, timeZone)` is the only day computation. It formats with `Intl.DateTimeFormat` for an explicit IANA zone. | §7: one module computes a day. The zone is always passed in. A city the player chooses maps to a zone, and so does the device fallback, which the app reads and the engine never does. |
| D10 | `apps/rosea/vite.config.ts` imports the name constants by **relative path** (`../../packages/schema/src/constants.js`), not as `@rosea/schema`. | Vite bundles a config's relative imports but externalises anything under `node_modules`, and Node cannot load a workspace package's `.ts`. `--configLoader runner` fixed `vite build` but not `svelte-check`, which still printed *failed to load config* inside a green run. The constants module is pure and has no imports. |
| D11 | Every direct dependency is **pinned exactly** to the version Ludus's lockfile resolved, and `engine-strict` is off. | This machine runs Node 22.11. Fresh resolution pulled `@axe-core/playwright@4.14` (needs ≥ 22.12) and `eslint-visitor-keys@5` (declares ≥ 22.13). Ludus runs the same packages on the same Node. Upgrading Node is G0.20. |
| D12 | The trace's `geocell` is capped at 6 characters. | Found in self-review: the first draft allowed 16, and a 16-character geohash is centimetres. Six is ~1.2 × 0.6 km, the ~1 km of CLAUDE.md §4. Anything finer is rejected by the schema, before any code could send it. |
## 3. Risk analysis
@@ -101,13 +109,19 @@ is no mechanic yet that could carry any of them.
| Hope-sentence schema accepts a valid entry | unit | `packages/schema/test/schemas.test.ts` |
| Care event rejects an unknown `act`, a missing `localDay`, free text in `messageId` | unit | same |
| Trace rejects a timestamp finer than a day and extra properties | unit | same |
| `localDay` in Prague on both 2026 DST days, Sydney, Anchorage, UTC±14 | unit (golden) | `packages/engine/test/localDay.test.ts` |
| Monday 23:30 in Prague is Monday, not Tuesday | unit | same |
| `localDay` is the same for every ms within one local day (property) | property | same, fast-check |
| `localDay` in Prague on both 2026 DST days, Sydney, Reykjavík, UTC+14, UTC−12 | unit (golden) | `packages/engine/test/localDay.test.ts` |
| Monday evening in Anchorage is Monday, though the UTC day is Tuesday (the trap, measured) | unit | same |
| An unknown zone throws instead of falling back to UTC | unit | same |
| Days never go backwards, always advance within 26 h, are deterministic (8 zones, 2000–2100) | property | same, fast-check |
| Each purity ban fires on an impure snippet; clean code passes | unit | `packages/engine/test/purity-lint.test.ts` |
| Every fixture in `content/fixtures/` fails with its named message | unit | `packages/content/test/validator.test.ts` |
| Forbidden words: whole-word, case-insensitive; no false hit on *treaty* or *cured meat*… | unit | `packages/content/test/forbidden.test.ts` |
| Shell copy passes `lint:copy` | unit + script | `packages/ui/test/copy.test.ts`, `pnpm lint:copy` |
| Forbidden words: whole-word, case-insensitive; no false hit on *treaty*, *healthy*, *patience* | unit | `packages/content/test/forbidden.test.ts` |
| `lint:copy` core: strings and markup caught, comments ignored, *Domi* never alone | unit | `packages/content/test/copy-lint.test.ts` |
| Shell copy passes `lint:copy` | script | `pnpm lint:copy` |
| Shell names the product from the constant, has a `main` landmark and no controls | unit | `packages/ui/test/Shell.test.ts` |
| Trace rejects a geocell finer than ~1 km | unit | `packages/schema/test/schemas.test.ts` |
| `<meta charset>` stays within the first 1024 bytes after the CSP | e2e | `e2e/shell.spec.ts` |
| Hooks block a > 5 MB file and an AI trailer, and pass a clean commit | manual, run | `.agents/reviews/feature-phase0-workspace.md` |
| Built app renders its name at `/Rosea/` | e2e | `e2e/shell.spec.ts` |
| No request to any other origin; no cookie; no `localStorage` | e2e | same |
| Manifest `scope`/`start_url` and service-worker scope equal the base | e2e | same |
+20
View File
@@ -0,0 +1,20 @@
# Lessons
One file per category of problem (CLAUDE.md §5.1b). Read these first when something
behaves strangely. Each entry has three parts: **what happened**, **why it bit**,
and **how to apply it**.
| File | Entries | What belongs in it |
|:--|:--|:--|
| `soul.md` | none yet | What comforts and what only looks like comfort. **The most important file here.** No mechanic exists yet that could teach anything. |
| `architecture.md` | none yet | Layering, ownership, seams. |
| `design.md` | none yet | Wording, silence, empty states. |
| `art.md` | none yet | The image pipeline. |
| [`code.md`](code.md) | 1 | TypeScript, Svelte, async ordering, Rust. |
| [`technical.md`](technical.md) | 3 | The browser and the build as platforms. |
| [`testing.md`](testing.md) | 3 | 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) | 2 | Workflow, commits, credentials, honesty about what shipped. |
A file is created with its first real entry. An empty lessons file only looks like
knowledge.
+22
View File
@@ -0,0 +1,22 @@
# Code
## An agent's write tool can turn `\u00a0` into a real non-breaking space
**What happened.** `packages/content/src/copy-lint.ts` was written with the regex
`[\s\u00a0]`. On disk the file held `[\s` + the bytes `C2 A0` + `]`: an actual U+00A0.
ESLint's `no-irregular-whitespace` caught it. Fixing it with `sed`, then with a
`node -e` replace, then with a quoted heredoc each wrote the same character back. The
fix that worked built both strings from char codes (`String.fromCharCode(160)`,
`String.fromCharCode(92) + 'u00a0'`).
**Why it bit.** Somewhere between the agent and the file, a single-backslash
`\uXXXX` in the input was decoded. A double-backslash `\\u00a0` inside a JS string
(`forbidden.ts`) survived. The bug is invisible on screen: the two forms look the same.
**How to apply it.** Prefer `\s` or a named class over a literal Unicode escape in a
regex. When one is needed, check the bytes after writing.
This entry was itself written with two literal NBSPs where it named the escape, and was
fixed the same way. Check with `grep -n $'\xc2\xa0' file` (the two UTF-8 bytes) or
`sed -n Np file | od -c`. Do not use `grep -P '\xA0'`: it matches the last byte of `≠`
and other characters, and raised a false alarm on the review document. Keep
`no-irregular-whitespace` on.
+33
View File
@@ -0,0 +1,33 @@
# Process
## Never "try" a credential helper to see if it works
**What happened.** On 2026-10-31 the first push to Gitea failed for lack of
credentials. The agent retried with `-c credential.helper=manager`. Git Credential
Manager returned a stored login for `gitea.marek-novak.cz`, Gitea rejected it, and git
then told GCM to erase that login. The push finally worked once the author copied
Ludus's repo-local `credential.helper` into this repository.
**Why it bit.** Git calls `credential reject` after an authentication failure. With
GCM that deletes the stored credential, so a failed probe is not harmless: it can
break every other repository that relied on the entry.
**How to apply it.** When a push needs credentials, ask the author how this machine
authenticates for that host. Never probe with a different helper, and never read,
print or search for token values. On this machine, each repository carries its own
`credential.helper`.
## Pin to a sibling's lockfile when the machine's Node is old
**What happened.** The first `pnpm install` resolved the newest versions.
`@axe-core/playwright@4.14` needs Node ≥ 22.12, and `typescript-eslint@8.72` pulled in
`eslint-visitor-keys@5`, which declares ≥ 22.13. This machine runs 22.11. Pinning every
direct dependency to the versions in Ludus's `pnpm-lock.yaml` and turning
`engine-strict` off gave an install that every gate passes on.
**Why it bit.** A caret range is a promise about the future, and the future had moved
past this machine's Node. Ludus, a known-good sibling on the same machine, was a
better source of versions than the registry.
**How to apply it.** Start a new repository from a sibling's resolved versions, and
pin them exactly. Unpin deliberately, in its own commit, after upgrading Node (G0.20).
+42
View File
@@ -0,0 +1,42 @@
# Technical
## A Vite config cannot import a workspace package's TypeScript source
**What happened.** `apps/rosea/vite.config.ts` imported the name constants from
`@rosea/schema`, whose `main` is `src/index.ts`. `vite build` failed with
`ERR_UNKNOWN_FILE_EXTENSION ".ts"`. `--configLoader runner` fixed the build. But
`svelte-check` loads the same config on its own, still failed, and printed
*failed to load config* while reporting 0 errors.
**Why it bit.** Vite bundles a config's relative imports but externalises anything
resolved through `node_modules`. Workspace packages are symlinks there, so Node
loads them natively, and Node 22.11 does not strip types. A tool that reads the config
for you has its own loader.
**How to apply it.** In a Vite config, import workspace code by **relative path**
to a dependency-free module. Treat a failure message inside a green run as a
failure: find which tool printed it.
## Vite escapes the quotes in an injected `<meta>` CSP
**What happened.** The built `index.html` carries `content="default-src &#39;self&#39;…"`.
A regex over the raw HTML looking for `'self'` would never match it.
**Why it bit.** The HTML is valid and the browser decodes the entities. Only a test
that reads the bytes sees the difference.
**How to apply it.** Read attributes from the DOM:
`page.locator('meta[http-equiv=…]').getAttribute('content')`. Keep raw-HTML checks for
byte-level questions, such as whether there is an inline `<script>` or where `<meta charset>` sits.
## Svelte 5 needs no preprocessor for `lang="ts"`
**What happened.** With `vitePreprocess()` in `svelte.config.js`, `svelte-check` tried
to load `vite.config.ts` to preprocess styles, and hit the error above. Removing the
preprocessor removed the problem, and every component still typechecks.
**Why it bit.** Svelte 5 strips type annotations natively. A preprocessor is only
needed for non-CSS style languages or TS features that emit code (enums, decorators).
**How to apply it.** Leave `svelte.config.js` as `export default {}` until a component
needs SCSS or emitted TS. Add the preprocessor in the same commit as that need.
+45
View File
@@ -0,0 +1,45 @@
# Testing
## A pipe hides the exit code of the command you are checking
**What happened.** On 2026-11-01 Phase 0 ran `pnpm -s lint 2>&1 | tail -30; echo "exit=$?"`.
It printed one ESLint error and then `exit=0`. The `0` belonged to `tail`, not to ESLint.
**Why it bit.** Anything piped through `tail`, `grep` or `head` reports the last command's
status. A gate read that way can be red and look green. This is the same lie as
`pnpm test` exiting 0 having run nothing, one layer further out.
**How to apply it.** When the exit code matters, redirect to a file and read `$?`
before filtering: `cmd > log 2>&1; ec=$?; grep … log; echo "exit=$ec"`. You can also use
`${PIPESTATUS[0]}` in bash. Never quote `exit=0` from the far end of a pipe.
## `setOffline` tests the harness, not the service worker *(imported from Ludus)*
**What happened.** In Ludus, `context.setOffline(true)` and `route().abort()` both
failed the navigation before the service worker was consulted. So an "offline" test
passed or failed for reasons that had nothing to do with the cache.
**Why it bit.** Both mechanisms act at the browser's network layer, which sits in
front of service-worker dispatch.
**How to apply it.** Prove offline by **closing the server**: start it, wait for
`navigator.serviceWorker.controller` and for the precache, call `server.close()`,
then navigate. `e2e/offline.spec.ts` does this, and also fetches from Node to prove
the server really is gone. Not re-measured in Rosea. Strike the "imported" mark once
someone has.
## Put the bug back before you trust the test
**What happened.** Phase 0 put 13 bugs back one at a time: `clientsClaim: false`, no
`navigateFallback`, manifest scope `/`, an inline script, a Google Fonts link, a
`localStorage` write, a hard-coded heading, a UTC `localDay`, a disabled length cap
(checked twice), a lost word boundary, a removed Domi rule, and both git hooks.
Every one was caught. The results are recorded in
`.agents/reviews/feature-phase0-workspace.md`.
**Why it bit.** It didn't, this time. But a guard that has only ever been seen not
firing has not been tested. Without the run, a review can only say "I believe".
**How to apply it.** For every guard a branch adds, apply the inverse change, run the
one suite that should catch it, record CAUGHT or MISSED, and restore the file with
`git checkout`. Commit first, so the restore is exact.
@@ -0,0 +1,96 @@
# Review — `feature/phase0-workspace`
Adversarial self-review (CLAUDE.md §5.3). Analysis:
[`features/phase0-workspace.md`](../features/phase0-workspace.md).
Reviewed 2026-11-01 on Node 22.11.0, pnpm 9.12.3, Windows 10.
There is no PR. The only remote is Gitea, and this session has no API access to open
one there. The branch is pushed for the author to merge.
## Gates — counts, not exit codes
Each exit code was read directly (`cmd > log; ec=$?`), never through a pipe
(`lessons/testing.md`).
| Gate | Result |
|:--|:--|
| `pnpm lint` | exit 0 |
| `pnpm typecheck` | exit 0; 10 turbo tasks, `svelte-check` 0 errors 0 warnings in ui and app, plus root `tsc` over `e2e/` and `scripts/` |
| `pnpm test` | **117 passed**: schema 15, content 47, engine 52, ui 3 |
| `pnpm lint:copy` | 9 files checked, 0 problems |
| `pnpm validate:library` | 0 entries (empty by design, D4); **13 of 13 fixtures rejected** with their named rule |
| `pnpm test:e2e` | **6 passed**, against the built bundle under `/Rosea/` |
| `pnpm test:offline` | **1 passed**: reload, cold start and a deep link render after the server is closed |
The bundle was **built** (`apps/rosea/dist`) but **not deployed** (§5.4): there is no
host yet (G0.13). No player can see this change.
## Test honesty — every guard was made to fail
Each bug was reintroduced one at a time, the one suite that should catch it was run,
and the file was restored with `git checkout` after the commit `49c8def`.
| Bug put back | Suite | Result |
|:--|:--|:--|
| `clientsClaim: false` (first visit never controlled) | offline | CAUGHT: controller wait timed out |
| `navigateFallback: null` | offline | CAUGHT: deep link `ERR_CONNECTION_REFUSED` |
| manifest `scope: '/'` | e2e | CAUGHT: scope ≠ `/Rosea/` |
| inline `<script>` in `index.html` | e2e | CAUGHT: inline script list not empty |
| a Google Fonts `<link>` | e2e | CAUGHT: other-origin request recorded |
| `localStorage.setItem` on load | e2e | CAUGHT |
| `<h1>Rosea</h1>` instead of the constant | e2e | CAUGHT |
| `localDay` returns the UTC day | engine unit | CAUGHT: 11 failed |
| length cap never fires | `validate:library` | CAUGHT: `too-long.json` passed, run failed |
| length cap never fires | content unit | CAUGHT |
| forbidden match loses its trailing word boundary | content unit | CAUGHT: *treaty*, *healthy*, *patiently* flagged |
| Domi-alone rule removed | content unit | CAUGHT |
| 5.7 MB file staged / `Co-Authored-By: Claude` trailer | hooks, run directly | BLOCKED both; clean input passed both |
Not mutated: each of the 16 engine-purity bans separately. `purity-lint.test.ts`
already lints one impure snippet per ban and asserts it is reported, which is the
same check from the other side.
## Findings
| # | Area | Finding | Resolution |
|:--|:--|:--|:--|
| 1 | **Privacy** | The trace schema allowed `geocell` up to 16 characters. A 16-character geohash is centimetres: a house, not a district. | **Fixed** in this branch: capped at 6 (~1.2 × 0.6 km), with a test that 7 and 12 characters are rejected. D12. |
| 2 | Correctness | Terms with a hyphen and a space matched the same word twice, so `lint:copy` reported one word twice. Fixing that showed `Middle earth` was redundant with `Middle-earth`. | **Fixed**: one hit per index, and the redundant entry removed. Test added. |
| 3 | Correctness | The CSP meta is injected before `<meta charset>`, which must stay within 1024 bytes. Measured at byte 404 in this build. | **Fixed** with a guard: an e2e assertion on the byte offset. The order is kept, because the CSP must precede every script. |
| 4 | Correctness | `ROSEA_BASE`'s default `/Rosea/` is written twice, in `vite.config.ts` and `e2e/static-server.ts`. | **Accepted.** If they disagree, every asset 404s and every e2e test fails at once, so drift cannot be silent. |
| 5 | Architecture | `vite.config.ts` reaches into `packages/schema/src/constants.ts` by relative path. | **Accepted**, D10. The module is pure and import-free, and the alternative printed a load failure inside a green run. |
| 6 | Correctness | `validator.ts` maps Ajv's English error text to the `no-source` / `no-tradition` rules by regex. An Ajv upgrade that rewords them would turn those rules into `schema`. | **Accepted.** The fixtures would fail loudly: `no-source.json` expects `no-source`. Dependencies are pinned (D11). |
| 7 | Correctness | `stripComments` treats `//` inside a string as a comment, so `"a // therapy"` would be missed by `lint:copy`. | **Deferred.** A real tokenizer is not worth it while copy is one line. Revisit when `copy/` grows. |
| 8 | Privacy | Source maps are built (`sourcemap: true`) and would be published with the site. They are not precached. | **Deferred** to G0.23: depends on whether the repository is public. |
| 9 | Technical | `engine-strict` is off and Node 22.11 is below what `eslint-visitor-keys@5` declares. A package could use an API this Node lacks. | **Accepted for now**: every gate ran green on 22.11. Upgrade Node, G0.20. |
| 10 | Soul | The shell says *The garden is being prepared.* A first-time visitor finds nothing to do and might feel turned away, or feel asked to come back. | **Accepted.** The line asks nothing and promises no date, and the build is not deployed (D8), so no player sees it. It is replaced by the first real screen. |
Looked for and found none:
- **Soul.** No guilt, comparison, rejection or dependence. There is no mechanic, no
count, no notification and no streak.
- **Reachability.** There is no network feature. The care-event schema refuses free
text in `messageId` (a test), and refuses any extra field, so nothing can ride along.
- **Offline.** The whole shell works with the server closed (offline suite).
- **Privacy.** Every request goes to the serving origin (e2e records all of them).
There are no cookies and no Web Storage (e2e), and the CSP is `'self'` only. The
only bytes that leave the device are the requests for the app's own files.
Correctness cases from §5.3: second run, clock change, DST, partial write, tab closed
mid-action and two tabs do not apply to a shell with no state. DST is covered for
`localDay`, on both 2026 Prague transition days. The rest return with
`packages/storage`.
## What was NOT verified
- **Real GitHub Pages.** The sub-path is tested against a local server only.
- **A phone.** No install, no airplane mode, no iOS Safari. The suites use desktop
Chromium only.
- **Firefox and WebKit.** Not run.
- **Screen reader.** axe passes. No one has listened to the page.
- **`pnpm install --frozen-lockfile` from a fresh clone.** Not run. The lockfile is
committed, but the install was done in place.
- **The setOffline lesson** is imported from Ludus and was not re-measured here.
- **The rename-in-one-commit property.** Nobody has tried renaming. The name lives
in `constants.ts` and `index.html`, the manifest is built from the constants, and
the `@rosea/*` scope and database name are as listed in CLAUDE.md.
+22 -11
View File
@@ -110,7 +110,11 @@ feed of anything.
---
## 2. Repository layout (proposed — confirmed when Phase 0 scaffolds it)
## 2. Repository layout
Phase 0 scaffolded `schema`, `engine`, `content`, `ui` and `apps/rosea`. `storage`, `identity`,
`sync`, `services/lucerna`, `tools/art-prep` and `art/` arrive with their first feature, because an
empty package has a test suite that runs nothing ([`phase0-workspace.md`](.agents/features/phase0-workspace.md) D1).
```
pnpm-workspace.yaml
@@ -192,27 +196,32 @@ Web first is the decision: the game must run from a link, on any phone, with no
---
## 3. Commands (proposed until Phase 0 scaffolds them)
## 3. Commands
```bash
pnpm install --frozen-lockfile
pnpm --filter @rosea/schema build # schema first, always
pnpm install --frozen-lockfile # also installs the git hooks (§5.2)
pnpm --filter @rosea/schema build # schema first, always (generates the contract types)
pnpm --filter @rosea/app dev # 127.0.0.1:5173 — never --host (§5.7)
pnpm build # turbo: schema -> engine -> content -> ui -> app
pnpm build # turbo: schema -> engine/content/ui -> app
pnpm lint # ESLint, incl. the engine-purity rule (§7)
pnpm typecheck # tsc + svelte-check, every package plus e2e/ and scripts/
pnpm test # vitest, all packages — quote counts per package
pnpm --filter @rosea/engine test # incl. fast-check property tests and sun golden tests
pnpm test:e2e # Playwright against the BUILT app
pnpm test:offline # Playwright, network cut after first load
pnpm --filter @rosea/engine test # incl. fast-check property tests (sun golden tests: later)
pnpm test:e2e # builds, then Playwright against the BUILT app under /Rosea/
pnpm test:offline # builds, loads once, CLOSES the server, reloads
pnpm validate:library # every hope sentence; fixtures must FAIL
pnpm lint:copy # forbidden words and names (§5.6)
# Not yet — they arrive with their first feature:
pnpm art:prep # opens tools/art-prep on 127.0.0.1
cargo test --manifest-path services/lucerna/Cargo.toml # Phase 4 onward
```
The build's base path is `/Rosea/` (GitHub Pages' project sub-path); `ROSEA_BASE=/x/` overrides it
for the build and for both Playwright suites together.
> **The `pnpm test` trap, imported from Aeterna.** Exit code 0 says the command succeeded, not that
> tests ran. A filter that matched nothing and a green run look identical. **Quote the counts per
> package, or do not claim green.**
@@ -421,9 +430,11 @@ player can send another player, and the sender picks one.
```jsonc
{ "kind": "care", "ts": 1761500000000, "localDay": "2026-10-24",
"from": "<pubkey>", "to": "<pubkey>", "act": "water" | "shade" | "wind" | "light",
"from": "<pubkey>", "to": "<pubkey>", "act": "water" | "shade" | "weed" | "petals",
"trace": "petal:<colour>", "messageId": "ps-23-4" | null, "clientVersion": "0.1.0" }
// act: "water" | "shade" | "weed" | "petals" (own rose or another player's)
// act applies to the player's own rose or another player's. (This example once
// listed "wind" | "light"; §1's weeds and fallen petals won — phase0-workspace.md D5.)
// Only "care" is in packages/schema so far; the other kinds wait for docs/GAMEPLAY.md.
// other kinds: "sentence-opened", "sunset" (seen), "planet-step", "fox" (pet | brush | feed),
// "harvest" (berry kind), "thanks", "lantern" (lit — never unlit)
```
+40
View File
@@ -0,0 +1,40 @@
# Handover
Rewritten at the end of each session (CLAUDE.md §5.1).
## Last session — 2026-10-31 to 2026-11-01
**Done.**
- **Repository:** the git repo exists, and `origin` is Gitea (`mnovak/Rosea`).
`main` holds `CLAUDE.md` and `.gitignore` (`1e4c5a0`).
- **Phase 0:** built on `feature/phase0-workspace` and pushed. **It is not merged.**
Analysis: [`.agents/features/phase0-workspace.md`](.agents/features/phase0-workspace.md).
Review, with counts and the mutation results:
[`.agents/reviews/feature-phase0-workspace.md`](.agents/reviews/feature-phase0-workspace.md).
- **Gates:** all pass on this machine. Unit tests: 117 (schema 15, content 47,
engine 52, ui 3). E2E: 6. Offline: 1. `lint:copy`: 9 files, 0 problems.
`validate:library`: 13 of 13 fixtures rejected.
- **Built, not deployed:** there is no host yet.
**Waiting on the author.**
1. **Merge** `feature/phase0-workspace` into `main` (with `--no-ff`, §5.3), or say what
to change first.
2. **`docs/GAMEPLAY.md`.** No game code can start without it (G0.14). `docs/ROADMAP.md`
is needed to name Phase 1.
3. **A GitHub repository** for Pages, and the decision whether it is public. That
decides the source maps (G0.23), the deploy workflow and the mirror check (G0.13).
4. **Upgrading Node** to ≥ 22.13 on this machine (G0.20).
**How this machine works** (not in the code):
- **Commit identity:** `mnovak <giteatruenasadminacc.from729@passmail.net>`, set in
this repository only.
- **Pushing:** it uses a repo-local `credential.helper`, copied from Ludus. Do not
probe other helpers: `lessons/process.md`.
- **Hooks:** `pnpm install` installs them. They block files over 5 MB and AI
attribution trailers.
**Read first next time:** [`.agents/GAP_ANALYSIS.md`](.agents/GAP_ANALYSIS.md), then
[`.agents/lessons/`](.agents/lessons/README.md).
+7
View File
@@ -68,6 +68,13 @@ test('the built page carries the CSP and no inline script, and nothing violates
);
expect(inline.map(([tag]) => tag)).toEqual([]);
expect(cspViolations).toEqual([]);
// The CSP is injected FIRST in <head>, ahead of <meta charset>, so it governs
// every script. The charset must still fall in the first 1024 bytes or the
// browser may guess the encoding; a CSP that grows can push it out.
const charsetAt = Buffer.from(html).indexOf('<meta charset');
expect(charsetAt, 'meta charset present').toBeGreaterThan(-1);
expect(charsetAt, 'meta charset within the first 1024 bytes').toBeLessThan(1024);
});
test('manifest scope, start_url and the service worker scope all equal the base path', async ({ page }) => {
+10 -5
View File
@@ -46,7 +46,8 @@ export const FORBIDDEN: readonly ForbiddenTerm[] = [
]),
...terms('tolkien', TOLKIEN, [
'Tolkien', 'Gandalf', 'Mithrandir', 'Frodo', 'Bilbo', 'Samwise', 'Aragorn', 'Galadriel', 'Sauron',
'Mordor', 'Rivendell', 'Middle-earth', 'Middle earth', 'hobbit', 'hobbits', 'Lothlórien', 'Lothlorien'
// 'Middle-earth' also matches 'Middle earth': spaces and hyphens are interchangeable in a term.
'Mordor', 'Rivendell', 'Middle-earth', 'hobbit', 'hobbits', 'Lothlórien', 'Lothlorien'
])
];
@@ -68,14 +69,18 @@ const PATTERNS = FORBIDDEN.map((entry) => ({
regex: new RegExp(`(?<![\\p{L}\\p{N}])${escape(entry.term)}(?![\\p{L}\\p{N}])`, 'giu')
}));
/** Every forbidden term in `text`, in order of appearance. */
/**
* Every forbidden term in `text`, in order of appearance, once per place.
* `Middle-earth` and `Middle earth` both match either spelling, so a second hit
* at the same index is the same word and is dropped.
*/
export function findForbidden(text: string): ForbiddenHit[] {
const hits: ForbiddenHit[] = [];
const byIndex = new Map<number, ForbiddenHit>();
for (const { entry, regex } of PATTERNS) {
regex.lastIndex = 0;
for (let m = regex.exec(text); m !== null; m = regex.exec(text)) {
hits.push({ ...entry, index: m.index });
if (!byIndex.has(m.index)) byIndex.set(m.index, { ...entry, index: m.index });
}
}
return hits.sort((a, b) => a.index - b.index);
return [...byIndex.values()].sort((a, b) => a.index - b.index);
}
+5
View File
@@ -27,6 +27,11 @@ describe('forbidden words — what is caught', () => {
it('reports hits in reading order', () => {
expect(terms('cure first, then therapy')).toEqual(['cure', 'therapy']);
});
it('reports one word once, though two spellings of it match', () => {
expect(terms('Middle earth')).toHaveLength(1);
expect(terms('Middle-earth and Middle earth')).toHaveLength(2);
});
});
describe('forbidden words — what is NOT caught', () => {
+2 -2
View File
@@ -9,9 +9,9 @@
"properties": {
"traceId": { "description": "Random and rotating.", "type": "string", "pattern": "^[A-Za-z0-9_-]{16,64}$" },
"geocell": {
"description": "A coarse cell id. The cell system and its density-adaptive size are decided in the Phase 4 feature doc.",
"description": "A coarse cell id, at most ~1 km (CLAUDE.md §4). Capped at 6 characters: a 6-character geohash is ~1.2 x 0.6 km, and every character more is ~5x finer, down to centimetres. The cell system and its density-adaptive size are decided in the Phase 4 feature doc.",
"type": "string",
"pattern": "^[a-z0-9]{4,16}$"
"pattern": "^[a-z0-9]{3,6}$"
},
"dayBucket": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
"gesture": { "type": "string", "enum": ["petal", "light"] },
+6
View File
@@ -109,4 +109,10 @@ describe('trace', () => {
it('rejects a precise coordinate in place of a cell', () => {
expect(validateTrace({ ...trace, geocell: '50.0755,14.4378' }).ok).toBe(false);
});
it('rejects a cell finer than ~1 km: a long geohash is a house, not a district', () => {
expect(validateTrace({ ...trace, geocell: 'u2fkbn' }).ok, '6 chars, ~1.2 km').toBe(true);
expect(validateTrace({ ...trace, geocell: 'u2fkbnx' }).ok, '7 chars, ~150 m').toBe(false);
expect(validateTrace({ ...trace, geocell: 'u2fkbnxq9vk2' }).ok, '12 chars, ~4 cm').toBe(false);
});
});