Files
Rosea/.agents/reviews/feature-phase0-workspace.md
mnovak 6885a217cd [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.
2026-11-01 00:36:06 +01:00

97 lines
6.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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.