5.3 KiB
5.3 KiB
Review — feature/sunset-place
Adversarial self-review (CLAUDE.md §5.3). Analysis: features/sunset-place.md.
Reviewed 2026-11-02 on Node 22.11.0, Windows 10. There is no PR: the only remote is Gitea.
Gates — counts, not exit codes
| Gate | Result |
|---|---|
pnpm lint |
exit 0 (after finding 6) |
pnpm typecheck |
exit 0, @rosea/storage included; svelte-check 0 errors, 0 warnings |
pnpm test |
299 passed: schema 15, storage 18 (new), content 71 (+24), art-prep 56, engine 113 (+11), ui 26 (+10) |
pnpm test:e2e |
10 passed (+3), against the built app |
pnpm test:offline |
1 passed, now choosing a town online and changing it offline |
pnpm lint:copy |
15 files, 0 problems |
pnpm validate:library |
13 of 13 fixtures rejected |
The app changed (CLAUDE.md §5.4): the garden now asks where the sunset is and shows it. The bundle was rebuilt by the e2e and offline runs. It is not deployed: there is no host yet (G0.13).
Stable. After finding 2, the offline suite passed 3 runs of 3 and e2e 2 of 2 in a row.
Bug drills — each put back once
| Put back | Result |
|---|---|
| Storage writes the caller's object, not a plain copy | CAUGHT: the Proxy test |
The zone guess reads inherited keys (constructor) |
CAUGHT |
| Search without accent folding | CAUGHT, by the normalise test only: plzen still found Plzeň through Natural Earth's ASCII name, a second path |
nextInvitation skips yesterday |
CAUGHT: 2 (Reykjavík after midnight, the property) |
| "Tomorrow" said on the same day | CAUGHT: 2 |
| A failed save goes unmentioned | CAUGHT |
Findings
| # | Area | Finding | Resolution |
|---|---|---|---|
| 1 | Correctness | Saving never worked in a browser. The UI's towns lived in Svelte 5 $state, which wraps them in a Proxy; IndexedDB cannot clone a Proxy and threw DataCloneError. Every unit test passed, because the fake save only pushed into an array. Found by e2e: after a reload the garden asked again. |
Fixed twice: storage writes a plain copy built by its own shape check (and refuses a malformed one), and the results list is $state.raw. A storage test saves a Proxy. Lessons: code.md, testing.md. |
| 2 | Test honesty | The tests reloaded or closed the tab milliseconds after the click, racing the IndexedDB commit; the offline suite passed and failed on alternate runs. | Fixed: e2e/stored.ts waits until the town is in IndexedDB before a reload or close. |
| 3 | Correctness | Natural Earth's time zones are wrong where it matters: Prague America/Chicago, Cardiff Australia/Sydney, Anchorage America/Juneau, Sydney none, and 1,183 towns none. A nearest-zone fallback then made its own errors: southern Ukraine on Moscow time (Simferopol), Gansu on Xinjiang time. | Fixed (P2): identical-clock check, longitude fit across the date line, neighbour vote, nearest zone location last. The cases are pinned by name in places.test.ts, and every town's clock is checked against its longitude. |
| 4 | Correctness | Browsers report CLDR zone names (Asia/Calcutta, Europe/Kiev), not always the tz database's. A guess table keyed only by the database's names would guess nothing in Kolkata. |
Fixed: the guesses are also keyed by the name Intl resolves to; a test checks every zone Intl knows. |
| 5 | Correctness | Tonga and Samoa (UTC+13 at 175° W) were dropped by a longitude check that did not wrap. | Fixed; Apia is pinned. |
| 6 | Process | The shell turned in a heredoc into the character itself; lint caught it (no-irregular-whitespace). |
Fixed with a plain \s+. |
| 7 | Privacy | The town is where the player lives, near enough. | It is written only to this device's IndexedDB. The e2e test asserts that searching and choosing request nothing from another origin, and that the town list came from this origin. No GPS, no IP, no lookup. |
| 8 | Privacy | The build downloaded datasets. | By hand, with the author's approval, into the session's scratch folder; only the derived JSON is committed. Public domain both. |
| 9 | Soul | A question on the first screen can feel like a demand, and a small town not found like a judgment. | One tap skips it and still gives a sunset; an empty search says "A larger one nearby will do." No copy mentions a missed sunset. |
| 10 | Soul | A guess shown as fact could send someone out at the wrong time. | The guessed line says it is a guess, and Change town is always under it. |
| 11 | Correctness | Not verified: a town Natural Earth filed under a wrong zone of its own country with the same clock rules (Dunhuang, Gansu, voted onto Xinjiang time by its neighbours). | Open, stated. The longitude check cannot see it. Rare, and the player can choose a neighbouring town. |
| 12 | Scope | navigator.storage.persist() is not called; a drifted-away player on iOS can lose the town (CLAUDE.md §8). |
Deferred to G0.11 with export-my-rose (P8). Losing the town only means being asked again. |
What was not verified
- A real phone, a real install, Safari or Firefox: only Chromium under Playwright.
- A private window that refuses IndexedDB in a real browser: covered by unit tests with a rejecting store.
- Two tabs choosing different towns at once: last write wins, and the other tab shows its own until reload.
- Czech town names (Vídeň): Natural Earth has none.