| index 9bd87f6e..a5a29cf2 100644 |
| --- a/docs/superpowers/plans/HOSTED-CI-PROGRESS.md |
| +++ b/docs/superpowers/plans/HOSTED-CI-PROGRESS.md |
| @@ -32,8 +32,10 @@ between two delegated cgroups. So: |
| 0.165.0 on PATH, and codex, its code mode host and claude 2.1.312 in |
| `~/.local/share/equipo/try/bin`. The entry script gives `/etc` its own |
| filesystem (containment overlays `/etc`, and the kernel refuses an |
| - overlay over the container's overlay root) and makes a cgroup v2 |
| - subtree the user may write, at the path a systemd user session has. |
| + overlay over the container's overlay root), a machine id, a git |
| + identity, and a cgroup v2 subtree the user may write, at the path a |
| + systemd user session has. socat (Claude's own sandbox needs it) is |
| + fetched and pinned like the rest. |
| - **On a runner host the box is skipped.** `ci-box.py run` runs the |
| command directly where `/usr/bin/bwrap` is already 0.11.0 and codex is |
| on PATH. `EQUIPO_CI_BOX=on|off` forces it. |
| @@ -63,30 +65,90 @@ between two delegated cgroups. So: |
| - `ci-box.py prepare` sets every tracked file's modification time from |
| its git blob and every directory's to one fixed time, so go test's |
| cached results (keyed on size and time of each file a test opened) |
| - hold on the next machine. A changed file gets a new time. |
| + hold on the next machine. A changed file gets a new time. Measured: a |
| + rerun on a fresh machine replayed every test package from the cache. |
| +- `ci-box.py prepare` also deepens the clone (hosted clones one commit; |
| + gitleaks, the mixed-version test and a release test read history). It |
| + runs on the machine, outside the box, where the job's git credential |
| + is. |
| - `ci-box.py cache` (last step) reports the cache sizes and, past 4 GiB, |
| drops build cache entries the job did not read. A restore stamps every |
| - entry "now", so Go's own trim never fires on hosted. |
| + entry "now", so Go's own trim never fires on hosted. One full run |
| + leaves 1.96 GiB of build cache and 0.79 GiB of modules, under the |
| + 6 GiB limit. |
| |
| ## Steps |
| |
| | step | what | |
| |---|---| |
| | `00-prepare` | fetch and verify the pinned programs, pull the image, deepen the clone, set file times | |
| -| `10-lint@4` | build, vet, format, budgets, references, migration check; staticcheck; govulncheck; gitleaks | |
| -| `30-test@9` | the seven test lanes, the quarantine, and `runner-host` (bubblewrap build, pinned codex, namespaces, cgroup move, uncached) | |
| +| `10-compile` | compile every package once, link nothing | |
| +| `20-check@24` | 18 test lanes, the quarantine, `runner-host` (bubblewrap build, pinned codex, namespaces, cgroup move, uncached), and the static checks in four groups | |
| | `50-perf` | alone, it measures time | |
| | `90-cache` | report and trim the caches | |
| |
| +Hosted runs steps one after another and only a step's shards side by |
| +side, so everything that can run together is one step. |
| + |
| +## What made it fast, in the order found |
| + |
| +1. **/tmp in memory.** With /tmp on the machine's disk every lane took |
| + twice as long (thintest 35 to 78 s, directlive 88 to 168 s): the tests |
| + sync small files and databases thousands of times. The installer |
| + tests, which need user extended attributes a tmpfs refuses before |
| + Linux 6.6, put their home under the user's home instead. |
| +2. **Compile once, then fan out.** 23 shards on an empty cache each |
| + compiled the same packages (Go shares no compile between processes |
| + that start together): every shard took 150 to 370 s and two |
| + timing-sensitive tests failed under the load. |
| +3. **Lanes split by test name** (`scripts/ci-test.py` LANES), from |
| + measured times: headless six lanes, runner three, equipotest four. A |
| + lane that names no tests runs whatever its package's other lanes do |
| + not, so a new test always lands somewhere. directlive stays whole: |
| + two of its lanes side by side both failed with |
| + `provider_account_containment`. |
| +4. **Static checks beside the tests**, not before them. |
| + |
| +To rebalance: each shard's log ends with its time and its five slowest |
| +tests; move names between lanes of a package, keep `20-check@N` equal to |
| +the lanes plus the extra shards (a test checks the count). |
| + |
| ## Before (docs-t1) |
| |
| Main c6319a5 on docs-t1 (load 26 to 44): failed after 512 s; the |
| headless lane ran 470 s and failed, thintest failed at 102 s. Best warm |
| docs-t1 run (ci-speed 5258905, nothing changed): 217 s. |
| |
| -## Runs on hosted |
| - |
| -Proved first in the scratch repository `oficina/equipo-hostedci` (hosted |
| -is per repository, and main's old steps cannot pass there). |
| - |
| -(filled in below as runs come back) |
| +## Runs on hosted (32 CPUs, arm64) |
| + |
| +Proved in the scratch repository `oficina/equipo-hostedci` (hosted is |
| +per repository, and main's old steps cannot pass there). Times are the |
| +sum of steps; push to verdict adds the machine's boot and the cache |
| +restore, about 110 s, which is amadan's side. |
| + |
| +| run | what | steps | slowest shard | |
| +|---|---|---|---| |
| +| 0d5e136 | first full run, cold, 9 shards, old layout | 351 s, red | headless 265 s | |
| +| d4ea8db | /tmp on disk | 397 s, red | headless 312 s | |
| +| dd9e43c | 23 shards, no compile step | 384 s, red | equipotest 373 s | |
| +| dd7960c | compile step, /tmp in memory | 249 s, red | equipotest 196 s | |
| +| 42e4278 | rebalanced, 24 shards, cold | **202 s, green** | directlive 121 s | |
| +| 42e4278 rerun | nothing changed, fresh machine, warm cache | **100 s, green** | runner-host 26 s | |
| + |
| +In the cold green run: prepare 10 s, compile 42 s, checks 121 s, perf |
| +28 s. In the warm rerun: prepare 11 s, compile 38 s (it still linked |
| +every test binary; it no longer does), checks 26 s, perf 24 s. |
| + |
| +## Open |
| + |
| +- Timing budgets are reported, not enforced (`EQUIPO_CI_DEDICATED` is |
| + unset). The machine is the job's own, but 24 shards share it; set the |
| + variable once a week of hosted times says the budgets hold. |
| +- `provider_account_containment` in directlive when two of its lanes run |
| + side by side: cause unknown, worked around by keeping it one lane. |
| +- Two tests failed once each under the load of the uncompiled 23 shard |
| + run and not since: TestGateVerifyByMarkerAlone (runner/mac) and |
| + TestCoordinatorRecoveryCallRefusalKeepsServing (runner). |
| +- The image is pinned by digest and pulled from the public ECR mirror of |
| + Docker Hub each job (8 s). The pinned programs come from GitHub, |
| + downloads.claude.ai and snapshot.debian.org each job (4 s). |