[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:
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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).
|
||||
@@ -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 'self'…"`.
|
||||
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.
|
||||
@@ -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.
|
||||
Reference in New Issue
Block a user