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

98 lines
5.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.
## Git Bash rewrites Android paths
**What happened.** On 2026-11-17 `adb shell ls -l /sdcard/Download/…` typed in Git Bash answered
`ls: C:/Program: No such file or directory`: MSYS turned `/sdcard/…` into
`C:/Program Files/Git/sdcard/…` before adb saw it.
**Why it bit.** The rewrite is silent and the error looks like the device's.
**How to apply it.** Prefix hand-typed adb commands with `MSYS_NO_PATHCONV=1`, or pass arguments from
Node (`spawnSync`), which the shell does not touch.
## A bug drill restored with `git checkout` loses the work beside it
**What happened.** On 2026-11-19 (`feature/fabrica-release`) a drill edited `scripts/lint-copy.ts`
and restored it with `git checkout --`. That brought back the *committed* file and silently dropped an
uncommitted change in it (the release notes' entry). The diff showed it at once; it was re-applied.
**Why it bit.** `git checkout -- <file>` restores the index, not the file as it was a minute ago.
**How to apply it.** Commit before drilling, or copy the file aside and copy it back. Check
`git diff --stat` after every drill.
## A claim about another system's behaviour, written from its docs' general rule, was wrong for us
**What happened.** On 2026-11-19 `fabrica-release.md` F4 said "Custos makes `rosea-android` on the
first release". Custos does that only for the apps in its `ANDROID_APPS` table, and Rosea was never in
it (`apps/desktop/src-tauri/src/signing.rs`, read on 2026-11-21). The release would have stopped at
`no_key` after Mark's approval card. Culina and Liber hit exactly that on 2026-11-20.
**Why it bit.** The doc described what Custos does for Postea, and it read like a rule for every app.
Nothing in Rosea could test the claim: the step that would have failed runs only after a human approves.
**How to apply it.** When a step depends on another system doing something for us, find the line in
that system's source or config that names us, and cite it in the analysis. If no line names us,
write the claim as a gap, not as a fact.