[docs] CalmRefresh: Analysis, review, and G0.10 closed
This commit is contained in:
@@ -8,6 +8,7 @@ One row per feature, with its analysis document (CLAUDE.md §5.1). Gaps live in
|
||||
| Workspace, contracts, gates, PWA shell | 0 | Merged to `main` 2026-11-01 (`d11d242`); built, not deployed. Phase 0 gate still open | [phase0-workspace.md](features/phase0-workspace.md) | [feature-phase0-workspace.md](reviews/feature-phase0-workspace.md) |
|
||||
| Roadmap and gameplay docs, read against the code | 0 | Merged 2026-11-01; Q1–Q7 answered by the author | — | [docs-roadmap-gameplay.md](reviews/docs-roadmap-gameplay.md) |
|
||||
| The Letter slot: page at `#letter`, empty `docs/LETTER.md` | 0 | Merged to `main`; built, not deployed. Invisible until the author writes | [letter-slot.md](features/letter-slot.md) | [feature-letter-slot.md](reviews/feature-letter-slot.md) |
|
||||
| A calm refresh: a waiting new version is offered in one line, never swapped in by itself | 0 | Merged to `main`; built, not deployed | [calm-refresh.md](features/calm-refresh.md) | [feature-calm-refresh.md](reviews/feature-calm-refresh.md) |
|
||||
| The CPU guard: full runs wait for, then refuse, a busy machine | 0 | Merged to `main` | — | [fix-cpu-guard.md](reviews/fix-cpu-guard.md) |
|
||||
| Keep her safe: the browser's promise, save her to a file, bring her back | 0–1 | Merged to `main`; built, not deployed | [keep-her-safe.md](features/keep-her-safe.md) | [feature-keep-her-safe.md](reviews/feature-keep-her-safe.md) |
|
||||
| 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) |
|
||||
|
||||
@@ -26,7 +26,7 @@ board exist, and the first real picture is the author's to make.
|
||||
| ~~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.10~~ | ~~No calm *refresh* control for a waiting service worker (CLAUDE.md §8, stale SW)~~ | Closed 2026-11-02 on `feature/calm-refresh`: the app registers the worker and shows *A new version of the garden is ready.* with *Refresh*. e2e publishes a real second version: offered, not swapped, then taken over on Refresh; 3 of 3 put-back bugs caught. |
|
||||
| ~~G0.11~~ | ~~IndexedDB eviction: no `navigator.storage.persist()`, no export-my-rose (§8)~~ | Closed 2026-11-02 on `feature/keep-her-safe`: *Keep her safe* asks the browser (and an installed app asks by itself), saves her to a file without the town or the private key, and brings her back additively on any device. e2e: saved on one browser profile, restored on a fresh one, survives a reload. Not seen in Firefox or Safari. |
|
||||
| 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. |
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
# A calm refresh — when a new version of the garden is waiting
|
||||
|
||||
Status: built on `feature/calm-refresh`. Gap G0.10; CLAUDE.md §8, *the stale service worker: a
|
||||
precached shell keeps serving old JS to a player who has "updated". Detect a waiting worker and offer
|
||||
an explicit, calm refresh control.* Needed before the Phase 1 gate, where the author plays the
|
||||
installed app daily while fixes are deployed. Review:
|
||||
[`feature-calm-refresh.md`](../reviews/feature-calm-refresh.md).
|
||||
|
||||
## 1. Why and what, in the player's terms
|
||||
|
||||
The garden works offline because a service worker keeps a copy of it. When a new version is
|
||||
published, the browser fetches it in the background and **waits**: the garden the player has open
|
||||
never changes under their hands. When the new one is ready, one quiet line appears at the foot of
|
||||
the page: **"A new version of the garden is ready."** with a **Refresh** button. The player
|
||||
refreshes when they like; nothing is lost either way, since the rose lives in the device's
|
||||
database, not in the code.
|
||||
|
||||
## 2. Technical architecture
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant P as the open garden (version A)
|
||||
participant B as the browser
|
||||
participant S as the server
|
||||
B->>S: sw.js (on a navigation or a check)
|
||||
S-->>B: version B's bytes differ
|
||||
B->>B: install B, precache; B waits (skipWaiting: false)
|
||||
B-->>P: "waiting" (workbox-window, via virtual:pwa-register)
|
||||
P->>P: show "A new version of the garden is ready." + Refresh
|
||||
P->>B: Refresh: SKIP_WAITING to B
|
||||
B-->>P: B controls; the page reloads under B
|
||||
```
|
||||
|
||||
| # | Decision | Why |
|
||||
|:--|:--|:--|
|
||||
| U1 | Register through `virtual:pwa-register` in the app; `injectRegister: false`. | The emitted `registerSW.js` registers but tells the page nothing; the virtual module reports the waiting worker. Bundled, so the CSP needs no inline script. |
|
||||
| U2 | **Never refresh by itself.** The line waits for the player. | CLAUDE.md §1, *gentle*; a reload in the middle of pouring water would lose the pour. |
|
||||
| U3 | The line sits in its own `aside` at the foot, on the garden and the Letter alike. | It is about the whole app, not one page; a landmark keeps it findable. |
|
||||
| U4 | The e2e test serves a **real second version** (version A's build with `sw.js` changed) from the same origin. | A waiting worker exists only between two builds; a mock would test the mock. |
|
||||
|
||||
## 3. Risk analysis
|
||||
|
||||
| Risk | Answer |
|
||||
|:--|:--|
|
||||
| A player keeps old code forever and never sees a fix. | The line appears as soon as a new worker waits; tested end to end. |
|
||||
| A silent swap mid-action loses care. | U2; the test asserts the old worker still controls the page until Refresh. |
|
||||
| Feeling pushed. | One line, no badge, no repeat, no count; nothing happens if it is ignored. |
|
||||
| Privacy | Nothing new leaves the device: update checks were already made by the browser to the same origin. |
|
||||
|
||||
## 4. Gaps
|
||||
|
||||
| Gap | State |
|
||||
|:--|:--|
|
||||
| G0.10 | Built |
|
||||
| What changed in a version (release notes) | Open: not needed for the Phase 1 gate |
|
||||
|
||||
## 5. Verification matrix
|
||||
|
||||
| Case | Kind | Where |
|
||||
|:--|:--|:--|
|
||||
| No line without a waiting version; the line and Refresh when there is one; Refresh calls the app; on the Letter too | unit | `ui/test/Shell.test.ts` |
|
||||
| Built app: version A controls; version B published; the line appears; A still controls; Refresh; B controls and the line is gone; axe | e2e | `e2e/update.spec.ts` |
|
||||
@@ -0,0 +1,39 @@
|
||||
# Review — `feature/calm-refresh`
|
||||
|
||||
Adversarial self-review (CLAUDE.md §5.3). Analysis: [`features/calm-refresh.md`](../features/calm-refresh.md).
|
||||
Reviewed 2026-11-02 on Node 22.11.0, Windows 10. There is no PR: the only remote is Gitea.
|
||||
|
||||
## Gates
|
||||
|
||||
Counts are on the merge; HANDOVER repeats them. New: ui +3 (the line, Refresh, on the Letter);
|
||||
e2e +1 (`update.spec.ts`: a real second version).
|
||||
|
||||
**The app changed** (CLAUDE.md §5.4): the worker is registered by the app (`virtual:pwa-register`)
|
||||
instead of the emitted `registerSW.js`, and a waiting version shows one line with *Refresh*. Rebuilt by
|
||||
the e2e and offline runs; **not deployed** (G0.13). This is the change that lets every later fix
|
||||
reach an installed garden.
|
||||
|
||||
## Bug drills — each put back once, the app rebuilt each time
|
||||
|
||||
| Put back | Result |
|
||||
|:--|:--|
|
||||
| The app never hears that a version waits | CAUGHT |
|
||||
| The new worker swaps itself in silently (`skipWaiting: true`) | CAUGHT: version B controlled the page before Refresh |
|
||||
| Refresh does nothing | CAUGHT: version A still controlled after Refresh |
|
||||
|
||||
## Findings
|
||||
|
||||
| # | Area | Finding | Resolution |
|
||||
|:--|:--|:--|:--|
|
||||
| 1 | Test honesty | A waiting worker cannot be faked without testing the fake. | The test publishes a real version B (A's build, `sw.js` changed) on the same origin; B's own listener says which worker controls the page, before and after. |
|
||||
| 2 | Correctness | Registration moved from `registerSW.js` to the app bundle. The first worker must still control the first page, or the offline promise breaks. | `clientsClaim: true` unchanged; the offline suite (first load, server closed, reload, cold start) passes on the merge. |
|
||||
| 3 | Correctness | A player who ignores the line keeps version A until every garden tab closes, which is how service workers work. | Accepted and intended (U2). Closing and reopening the app also brings B. |
|
||||
| 4 | Soul | An update line can nag. | One line, no badge, no count, never repeated in a modal; it disappears after Refresh. |
|
||||
| 5 | Privacy | Update checks are requests. | They already happened (the browser checks `sw.js` on navigation), same origin only; nothing new is sent. |
|
||||
| 6 | Correctness | Two tabs: Refresh in one reloads only that one; the other keeps showing the line until it reloads. | Accepted; it is still true there. |
|
||||
|
||||
## What was not verified
|
||||
|
||||
- An installed PWA on a real phone, and Safari's update timing.
|
||||
- The leftover `dist/registerSW.js` from older builds is no longer emitted; GitHub Pages will simply
|
||||
not serve it. No page references it.
|
||||
Reference in New Issue
Block a user