[ui] LetterSlot: Add the page for A Letter from the Gardener, shown once the author writes it

docs/LETTER.md holds slots as comments only, so the player sees no change
until the author writes. The app bundles the letter at build time, a small
Markdown subset renders without {@html}, only https: and tel: become links,
and lint:copy now reads the letter. Review found turbo replaying a stale
build after the letter changed; docs/LETTER.md is now in its cache key.
This commit is contained in:
2026-11-01 15:39:17 +01:00
parent b871ab9899
commit a200832cfb
23 changed files with 639 additions and 21 deletions
+3 -3
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` | 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. |
| [`code.md`](code.md) | 2 | TypeScript, Svelte, async ordering, Rust. |
| [`technical.md`](technical.md) | 4 | The browser and the build as platforms. |
| [`testing.md`](testing.md) | 4 | 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. |
+15
View File
@@ -20,3 +20,18 @@ fixed the same way. Check with `grep -n $'\xc2\xa0' file` (the two UTF-8 bytes)
`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.
## A Svelte 5 effect that short-circuits never tracks what it skipped
**What happened.** `Shell.svelte` moved focus with
`$effect(() => { if (moved) heading?.focus(); })`. `moved` is a plain variable and was
`false` on the first run, so the effect never read `heading` and had no dependencies.
When the view changed and `heading` was bound to the new `<h1>`, nothing re-ran. The
Shell test caught it: the focus stayed on `<body>`.
**Why it bit.** An effect tracks only the state it actually reads on each run. A
condition that returns early hides every read after it.
**How to apply it.** In an effect, read the state you depend on before any early
return or `&&` (`const target = heading; if (moved) target?.focus();`). Test the
re-run, not just the first run.
+15
View File
@@ -40,3 +40,18 @@ needed for non-CSS style languages or TS features that emit code (enums, decorat
**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.
## Turbo's cache does not see a file the app imports from outside its package
**What happened.** The app imports `docs/LETTER.md?raw`. With a sample letter written
into the file, `pnpm test:e2e` printed `@rosea/app:build: cache hit` and tested the
*old* bundle, so the link to the letter was missing. Turbo hashes a package's own
files, and `docs/` belongs to no package. Adding `docs/LETTER.md` to
`globalDependencies` in `turbo.json` turned it into a `cache miss`, and the test passed.
**Why it bit.** A build cache keyed on the wrong inputs gives a stale bundle that looks
fresh. This is CLAUDE.md §5.4 again, caused by the build tool and not the service worker.
**How to apply it.** Any file the app bundles from outside its package goes into
`globalDependencies` or the task's `inputs`, in the same commit as the import. To
check, change the file, run the build, and look for `cache miss`.
+15
View File
@@ -43,3 +43,18 @@ 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.
## Fill an empty slot for one run, to test the state it will have later
**What happened.** The Letter's e2e test branches: no link while `docs/LETTER.md` is
empty, and the page opens once it is written. Only the empty branch could run, because
the author has not written the letter. One run with a temporary sample letter took the
other branch. It found the stale-cache bug (`technical.md`), and then passed the
written-letter page, axe included, in a real browser. The scaffold was restored
afterwards.
**Why it bit.** A test written for a future state passes trivially until that state
arrives. Then it fails for the first time on the author's machine, with the author's words.
**How to apply it.** When a test branches on content that does not exist yet, fill the
content temporarily, run the suite, restore it, and record the run in the review.