lessons: one full suite per machine moves into the code standards

Seen a third day: 64c426158 (11-16) ran the whole GUI suite on mica
beside another session's full suite, was pushed with it still running,
and named its 90 reds by page (accounts, Details, keys, plugins,
providers) with no issue. The rule now has a row in the Tests table,
and LESSONS.md lists it under Moved to the code standards.

Docs only; nothing run.
This commit is contained in:
yetone
2026-11-16 07:30:55 +08:00
parent ada0125303
commit ff5a7dfc03
+1
View File
@@ -34,6 +34,7 @@ describe and review a change to a subsystem is in the
| A check that a value is gone looks past text magpie or the test made up. | A substring check strips placeholders and stand-ins first, or looks for a value no port, id, time, hash or random name can spell (letters only, longer than a few characters). 6c099edd's "ops" was in a placeholder's suffix ({{HOSTNAME_mlopsiy3}}, f0453192, 10-10). On 11-10 a port and then a route_id held TestSearchAPIFailureKeepsNoURL's "4410" (17b9b5b03). On 11-15 TestMoreKinds' "ops" was in the made-up user name zpxopsat (#4345, filed 11-12 as "passes on rerun"); a key found to spell it reproduces the red. |
| Tests stay out of the real machine. | Run them under a temp HOME with Go's caches pinned (see the snippet in [provider-plugins.md](subsystems/provider-plugins.md)). Never touch a real agent's config or `~/.config/magpie`. An agent's variable goes in `agentenv.Vars`, so the sandbox clears it. |
| Whatever a test starts ends when the test does. | A fake process, a goroutine or an async refresh a test sets going is stopped or waited for before the test returns, or it writes into the next test's folder ("directory not empty") or spins for days. A package that isolates itself in its own `TestMain` instead of `testenv.Run` sets what testenv sets, `testenv.Marker` included. TestClaudeSignInByPaste's fake polled for 2 days (38a0f470). On 10-11 a CLI-identity ask outliving its test broke the next one (#1524): 4ee3a76b fixed it in internal/gateway only, 9c377231 for every package through the marker, which the gateway never set (a349de82). |
| One full suite runs on a machine at a time. | A full `go test ./...` or GUI suite waits for the one already running on that machine (mote, then mica), and a record from a run beside another suite is not a pass. Its reds are named with an issue each, not "files this change doesn't touch". On 10-16 three suites from one session at load 300 to 400 all timed out (#2557). On 10-17 three `go test ./...` runs and ~35 GUI runners shared one box, and a run's Go cache was trimmed mid-run by another (#2544, #2645). On 11-16 64c426158 ran the whole GUI suite on mica beside another session's full suite and was pushed with 90 reds named only by page (accounts, Details, keys, plugins, providers). |
| A timing test leaves room on both sides. | Never bound a test by wall-clock time a loaded runner can exceed, and keep a threshold classifier's fixture far from every threshold it has. Reproduce a timing failure by injecting the delay (a held write, a late first arrival), not by rerunning until it fails, and list every timing assumption in the test when fixing one. 319b72c7 fixed one of two loops sharing a 2000-line bound and the other went red 9h later (229ce19a). On 10-11 TestMaxRPM's flake was a real gap: a first request that reached the vendor late let the vendor see one too many in its minute (ce1ecaa4), and the queued-stream tests timed the client's clock under CPU starvation (3f4287e6). |
## Acceptance criteria