Files
Rosea/.agents/lessons/process.md
T

62 lines
3.3 KiB
Markdown

# 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).
## A rule checked by reading a number is broken by the next command
**What happened.** CLAUDE.md §5.7 says not to start a full run above ~80 % CPU. Three
times on 2026-11-02 a run started above it. Once the load was not checked at all; twice it
was read (85 %, then 100 %, another project's tests) and the run started anyway, once
because the check and the run were chained in one command that did not depend on it.
**Why it bit.** A rule that relies on a person reading a number before acting holds only
while nothing else is competing for attention.
**How to apply it.** Make the run refuse to start. Done: `pnpm guard:cpu` (in
`tools/cpu-guard`) runs before every full run, waits up to three minutes, then refuses. Do
not set `ROSEA_CPU_MAX` to get past a busy desktop; it is for dedicated machines.
## An inline edit through the shell is two parsers deep
**What happened.** On 2026-11-02 two edits went through the shell. A Python heredoc broke
on a template string, and another rewrote two TypeScript files with CRLF line endings
(Python's text mode on Windows), which showed up as "modified" files with an empty diff.
A Node one-liner lost every `${…}` to the shell.
**Why it bit.** Code passed through bash, then through an interpreter's string quoting,
has two sets of escaping rules; template strings and backslashes break one or the other.
On Windows the interpreter also chooses line endings.
**How to apply it.** Edit source files with the edit tool. When a script is needed, write
it to a file first (the scratchpad), then run the file.