ci: take activator out of the race step; show race reports
The wakeplan change did not fix the race it was made for: the wake goroutine itself outlives the test, so reading firstWakeSettle earlier only moved the read. Restore wakeplan.go and drop its census overlay. 46 activator tests restore a package-level timing knob in a cleanup while their wake still runs, so the package cannot be green under -race yet. It joins the step once those tests wait for their wakes. Edge gets 16 shards to fit the budget, and skips one rate-limit test whose bcrypt logins outlast the window under -race. The failure summary now prints race reports, which CI's log tail would otherwise lose.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 files changed,
+52
−56
.amadan/README.md+14 −8.amadan/ci.d/70-race+10 −5.amadan/test-gate.sh+20 −5AGENTS.md+6 −7docs/superpowers/notes/census-proposal-race-helpers.md+0 −19internal/activator/wakeplan.go+2 −6internal/provision/testdata/plan14-root-reads-chain.tsv+0 −1internal/provision/testdata/plan14-root-reads-race-helpers.tsv+0 −5
CI failed — run details
Intent
diff --git a/.amadan/README.md b/.amadan/README.md| index 5015e920d..93359c0e3 100644 |
| --- a/.amadan/README.md |
| +++ b/.amadan/README.md |
| @@ -45,7 +45,7 @@ and gitleaks on 2026-11-17. |
| | `govulncheck` | `50-govulncheck` | `make govulncheck`: v1.8.0 over this module and `launchctx`; fails only on vulnerabilities the code calls, less the exceptions file; see below | |
| | code-health gate | `60-code-health` | `make code-health`: the code against `.amadan/code-health.tsv`, scanned with type information; see below | |
| | code-health record | `61-code-health-record` | the record against the merge base's copy; see below | |
| -| race detector | `70-race` | `make race`: `go test -race` over the edge, activator, rootaws and systemd packages and host's loop and lease tests, sharded like the gate; see below | |
| +| race detector | `70-race` | `make race`: `go test -race` over the edge, rootaws and systemd packages and host's loop and lease tests, sharded like the gate; see below | |
| | `gitleaks` | `80-gitleaks` | `make gitleaks`: v8.30.1 over the working tree's tracked files, less the values `.gitleaks.toml` allows; see below | |
| ## `govulncheck`: what turns it red |
| @@ -122,18 +122,24 @@ how it finds the base, and why it uses HEAD's parent on main. |
| dealt onto shards by `test-weights.tsv` and held by the same fence as |
| `make test`, so a new test is covered without touching anything. The |
| packages are the ones with real concurrency: every test of |
| -`internal/edge`, `internal/activator`, `internal/rootaws` and |
| -`internal/systemd`, and of `internal/host` the tests named for a loop or |
| -a lease (`RACE_ONLY`). The whole host suite under `-race` is far past |
| +`internal/edge` (less `TestLinkPinForwardedFallback`, `RACE_SKIP`: its |
| +ten bcrypt logins outlast the rate-limit window under `-race`), |
| +`internal/rootaws` and `internal/systemd`, and of `internal/host` the |
| +tests named for a loop or a lease (`RACE_ONLY`). The whole host suite under `-race` is far past |
| the step's budget: measured once on docs-t1 (16 cores, `GOMAXPROCS=4`, |
| the machine otherwise busy), every host shard ran past fifteen minutes. |
| -The seeded simulations run fewer seeds here (`LINKSIM_SEEDS`, |
| -`SWAP_SIM_SEEDS`); `make test` runs them at full breadth. It is its own |
| +The link simulations run fewer seeds here (`LINKSIM_SEEDS`); `make test` |
| +runs them at full breadth. It is its own |
| step because `-race` compiles those packages again and runs their tests |
| several times slower. |
| -Two packages are left out. The root package's e2e tests build the CLI |
| -many times over and are too slow under `-race`. `internal/lease` trips a |
| +Three packages are left out. The root package's e2e tests build the CLI |
| +many times over and are too slow under `-race`. `internal/activator` has |
| +46 tests that shrink a package-level timing knob and restore it in a |
| +cleanup while the wake they started is still running, so the restore |
| +races the wake's read. Production never changes those knobs; the fix is |
| +for the tests to wait for their wakes, or for the knobs to stop being |
| +plain variables, and the package joins the step then. `internal/lease` trips a |
| race inside litestream v0.5.14: `Store.Close` closes the database while |
| the store's own snapshot monitor is still reading it. Upstream fixed it |
| in v0.5.18 (`Store.Close` now stops its monitors first); lease joins the |
diff --git a/.amadan/ci.d/70-race b/.amadan/ci.d/70-race| index 0b2b08809..7b23c13b9 100755 |
| --- a/.amadan/ci.d/70-race |
| +++ b/.amadan/ci.d/70-race |
| @@ -1,7 +1,6 @@ |
| #!/bin/sh |
| # The race detector over the packages with real concurrency: the edge |
| -# (servers, pollers, the tunnel), the activator (wakes, reapers, sweeps), |
| -# the host agent's loops and lease handling, and the two packages those |
| +# (servers, pollers, the tunnel), the host agent's loops and lease handling, and the two packages those |
| # loops call into for AWS and systemd, internal/rootaws and |
| # internal/systemd. `make race` is the one definition; this step only |
| # runs it, so a developer gets the same answer with the same command. |
| @@ -9,9 +8,9 @@ |
| # The tests in those packages, with -race, dealt onto shards and fenced by |
| # .amadan/test-gate.sh exactly as `make test` deals its own (GATE_RACE=1; |
| # RACE_SPLIT in that file names the packages and how many shards each). |
| -# Every test of edge, activator, rootaws and systemd; of internal/host only |
| -# the tests named for a loop or a lease (RACE_ONLY), because its whole |
| -# suite under -race is far past this step's budget. |
| +# Every test of edge, rootaws and systemd, less one (RACE_SKIP); of |
| +# internal/host only the tests named for a loop or a lease (RACE_ONLY), |
| +# because its whole suite under -race is far past this step's budget. |
| # Its own step, not part of 10-gate: -race compiles the packages again and |
| # runs their tests several times slower, and a red here is a race, which |
| # should read as that. |
| @@ -19,6 +18,12 @@ |
| # Left out, each for a reason: |
| # - the root package: its e2e tests build the CLI many times over, too |
| # slow under -race; |
| +# - internal/activator: 46 tests shrink a package-level timing knob and |
| +# put it back in a cleanup while the wake they started is still |
| +# running, so the restore races the wake's read. The race is in how |
| +# the tests end, not in production, where the knobs never change. It |
| +# joins this step once those tests wait for their wakes, or the knobs |
| +# stop being plain variables; |
| # - internal/lease: litestream v0.5.14's Store.Close closes the database |
| # while its own snapshot monitor still reads it (a race inside the |
| # dependency, fixed upstream in v0.5.18, which stops the monitors |
diff --git a/.amadan/test-gate.sh b/.amadan/test-gate.sh| index 66e60bdcb..b693b60c8 100755 |
| --- a/.amadan/test-gate.sh |
| +++ b/.amadan/test-gate.sh |
| @@ -59,8 +59,9 @@ |
| # fenced exactly as above, with -race on the list and on every shard. |
| # RACE_SPLIT overrides the packages and their shard counts the way |
| # TEST_SPLIT does; TEST_SPLIT itself is ignored in this mode. RACE_ONLY |
| -# narrows a package to the listed tests whose names match a regex |
| -# ("dir=regex", no spaces); the fence then holds for those. -race needs |
| +# narrows a package to the listed tests whose names match a regex and |
| +# RACE_SKIP drops the ones that match ("dir=regex", no spaces); the fence |
| +# then holds for what is left. -race needs |
| # cgo, so CGO_ENABLED=1 is set here and the machine needs a C compiler. |
| set -eu |
| @@ -68,19 +69,22 @@ race="" |
| if [ "${GATE_RACE:-}" = 1 ]; then |
| # The packages with real concurrency (.amadan/ci.d/70-race says why |
| # these and not the rest), heaviest first like TEST_SPLIT. |
| - : "${RACE_SPLIT=./internal/edge=8 ./internal/activator=8 ./internal/host=2 ./internal/rootaws=1 ./internal/systemd=1}" |
| + : "${RACE_SPLIT=./internal/edge=16 ./internal/host=2 ./internal/rootaws=1 ./internal/systemd=1}" |
| # internal/host's whole suite under -race is far past the step's |
| # budget (every shard ran past fifteen minutes on a 16-core box), so |
| # only its loops and its lease handling: the tests named for them. |
| : "${RACE_ONLY=./internal/host=Loop|Lease}" |
| + # Ten bcrypt logins must land inside one rate-limit window, and under |
| + # -race they take long enough for the bucket to refill. |
| + : "${RACE_SKIP=./internal/edge=^TestLinkPinForwardedFallback\$}" |
| TEST_SPLIT=$RACE_SPLIT |
| race=-race |
| # The seeded simulations search for invariant breaks, which `make |
| # test` does at full breadth. Here they only need to drive the |
| # concurrent paths, and at full breadth under -race one link sim |
| # alone ran past twelve minutes. A value already set is kept. |
| - : "${LINKSIM_SEEDS=50}" "${SWAP_SIM_SEEDS=20}" |
| - export LINKSIM_SEEDS SWAP_SIM_SEEDS |
| + : "${LINKSIM_SEEDS=50}" |
| + export LINKSIM_SEEDS |
| CGO_ENABLED=1 |
| export CGO_ENABLED |
| fi |
| @@ -310,6 +314,12 @@ deal_split() { |
| mv "$out/list-$tag.only" "$out/list-$tag" |
| fi |
| done |
| + for skip in ${race:+${RACE_SKIP:-}}; do |
| + if [ "${skip%%=*}" = "$dir" ]; then |
| + grep -vE "${skip#*=}" "$out/list-$tag" >"$out/list-$tag.only" || true |
| + mv "$out/list-$tag.only" "$out/list-$tag" |
| + fi |
| + done |
| set +f |
| listed=$(wc -l <"$out/list-$tag") |
| if [ "$listed" -eq 0 ]; then |
| @@ -467,6 +477,11 @@ if [ -n "$failed" ]; then |
| for name in $failed; do |
| echo "--- $name" |
| grep -E '^[[:space:]]*--- FAIL|^panic:|^FAIL[[:space:]]|^[[:space:]]+[A-Za-z0-9_./-]+_test\.go:[0-9]+:|^[[:space:]]*running tests:|^[[:space:]]+Test[A-Za-z0-9_/-]* \([0-9.]+[a-z]+\)$' "$out/$name.log" 2>/dev/null | head -60 || true |
| + # A race fails its test with no message of its own, and CI keeps |
| + # only the log's tail, so the reports themselves come here too. |
| + if [ -n "$race" ]; then |
| + awk '/WARNING: DATA RACE/ { n++; p = n <= 3 } p && !/go-dist/ { print } /^==================$/ { p = 0 }' "$out/$name.log" 2>/dev/null | head -80 || true |
| + fi |
| done |
| echo |
| echo "FAILED:$failed" |
diff --git a/AGENTS.md b/AGENTS.md| index 6c33b0680..7520f8e5d 100644 |
| --- a/AGENTS.md |
| +++ b/AGENTS.md |
| @@ -295,16 +295,15 @@ anything. |
| anything. Imported-only and required-only findings are printed, not |
| fatal. It needs `vuln.go.dev` and the module proxy; `.amadan/README.md` |
| has the details. |
| -- `70-race` runs `make race`: every test in `internal/edge`, |
| - `internal/activator`, `internal/rootaws` and `internal/systemd`, and |
| - `internal/host`'s tests named for a loop or a lease, under `-race`, |
| - sharded by `.amadan/test-gate.sh` (`GATE_RACE=1`, `RACE_SPLIT`, |
| - `RACE_ONLY`). It needs cgo and a C compiler. A test |
| +- `70-race` runs `make race`: `internal/edge`, `internal/rootaws`, |
| + `internal/systemd` and `internal/host`'s tests named for a loop or a |
| + lease, under `-race`, sharded by `.amadan/test-gate.sh` (`GATE_RACE=1`, |
| + `RACE_SPLIT`, `RACE_ONLY`, `RACE_SKIP`). It needs cgo and a C compiler. A test |
| in those packages that reads the standard log uses its package's |
| `captureLog` (one locked buffer per package; host also has |
| `captureLogBuffer`), never a plain `bytes.Buffer`, and a goroutine a |
| - test starts ends before the test does. `internal/lease` is out until |
| - litestream is at v0.5.18 or later (`.amadan/README.md` says why). |
| + test starts ends before the test does. `internal/activator` and |
| + `internal/lease` are out for now (`.amadan/README.md` says why). |
| - `80-gitleaks` runs `make gitleaks` (v8.30.1, pinned) over the working |
| tree's tracked files, not the history. A committed fake (a test key, a |
| fixture) is allowed in `.gitleaks.toml` by its exact value, with the |
diff --git a/docs/superpowers/notes/census-proposal-race-helpers.md b/docs/superpowers/notes/census-proposal-race-helpers.md| deleted file mode 100644 |
| index 4c9641454..000000000 |
| --- a/docs/superpowers/notes/census-proposal-race-helpers.md |
| +++ /dev/null |
| @@ -1,19 +0,0 @@ |
| -# Census approval: race-helpers |
| - |
| -Ruling `census-ruling-race-helpers`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| - |
| -| unit | change | read sites | what changed | |
| -|---|---|---|---| |
| -| `internal/activator/wakeplan.go` `Service.watchFirstWake` | body | unchanged (10) | reads firstWakeSettle once before starting the watcher goroutine instead of inside it; the same value is used for the same wait and the same failure reason, and nothing root opens, runs or reads changes | |
| - |
| -Envelopes re-pinned: `internal/activator`. |
| - |
| -Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| - |
| -Recorded dispositions, which each change must still satisfy: |
| - |
| -- `internal/activator/wakeplan.go` `Service.watchFirstWake`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route |
| - |
| -Seal: `c9cd3c8fdf31240b83affa0b2798422f3a99e1d0d400dbaf68665c1127996448` → `207dbb26de8b2899772cb5814f7985f22d3bfa706f94f8f808957f1e288eadd0`. |
| - |
| -Overlay: `internal/provision/testdata/plan14-root-reads-race-helpers.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/activator/wakeplan.go b/internal/activator/wakeplan.go| index ccadd95b7..099288957 100644 |
| --- a/internal/activator/wakeplan.go |
| +++ b/internal/activator/wakeplan.go |
| @@ -912,12 +912,8 @@ func (a *Service) watchFirstWake(e *actEntry, g Gen, plan WakePlan) { |
| cancelled(rt) |
| return |
| } |
| - // Read before the goroutine starts: a test shrinks firstWakeSettle and |
| - // puts it back when it ends, and a watcher scheduled after that would |
| - // read it as it is written (`make race`). |
| - settle := firstWakeSettle |
| go func() { |
| - r := observeSettle(ctx, proc, settle) |
| + r := observeSettle(ctx, proc, firstWakeSettle) |
| a.mu.Lock() |
| rt, unexpected, release := e.route, e.unexpectedExit, e.firstWatchRelease |
| a.mu.Unlock() |
| @@ -952,7 +948,7 @@ func (a *Service) watchFirstWake(e *actEntry, g Gen, plan WakePlan) { |
| // current (and admits an attempt onto it) before the failure is |
| // recorded. |
| a.emitPlanned(plan, GenEvent{Kind: GenFailed, Route: rt, Failed: plan.Boot, Mode: plan.Mode, FirstWake: true, |
| - Reason: "exited within " + settle.String() + " of becoming healthy", At: time.Now(), FailedUnder: plan.FailedUnder}) |
| + Reason: "exited within " + firstWakeSettle.String() + " of becoming healthy", At: time.Now(), FailedUnder: plan.FailedUnder}) |
| end() |
| default: // an intentional stop cancelled it |
| cancelled(rt) |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 925321336..fa6913fa2 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -245,4 +245,3 @@ plan14-root-reads-ha-1192.tsv 8df52839a0c961d3721f3a5c3247d06202dae4e00d011844b7 |
| plan14-root-reads-audit-bugs-2.tsv 1610abfc476fe45d259494242243756dac9cfec49cdd7f7f7b238329392241a1 |
| plan14-root-reads-bounded-systemctl.tsv 16cae3931aadfa57a5293d69becf318645681400777cc08972cf08eb449c2457 |
| plan14-root-reads-mail-submission-followups.tsv c9cd3c8fdf31240b83affa0b2798422f3a99e1d0d400dbaf68665c1127996448 |
| -plan14-root-reads-race-helpers.tsv 207dbb26de8b2899772cb5814f7985f22d3bfa706f94f8f808957f1e288eadd0 |
diff --git a/internal/provision/testdata/plan14-root-reads-race-helpers.tsv b/internal/provision/testdata/plan14-root-reads-race-helpers.tsv| deleted file mode 100644 |
| index 1ca4da7f3..000000000 |
| --- a/internal/provision/testdata/plan14-root-reads-race-helpers.tsv |
| +++ /dev/null |
| @@ -1,5 +0,0 @@ |
| -# Census overlay race-helpers, written by census-propose (#369). census-ruling-race-helpers, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-race-helpers.md. |
| -# 1 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| -@legacy 8a9c79cad8aee34584e1e6b2467faae7b404791821162e73e6e4ee787af81a96 internal/activator/wakeplan.go Service.watchFirstWake legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-race-helpers;basis=reads firstWakeSettle once before starting the watcher goroutine instead of inside it; the same value is used for the same wait and the same failure reason, and nothing root opens, runs or reads changes whole:Route@1256,whole:Route@2166,whole:Route@2173,whole:Route@2448,whole:Route@2455,whole:Route@2702,whole:Route@406,whole:Route@413,whole:Route@868,whole:Route@926 4cd2a9c67f74c1a00a33464393bf4f2e6e8b049491ec2ad19817b8c0191f30c8 |
| -internal/activator/wakeplan.go Service.watchFirstWake legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-race-helpers;basis=reads firstWakeSettle once before starting the watcher goroutine instead of inside it; the same value is used for the same wait and the same failure reason, and nothing root opens, runs or reads changes whole:Route@1256,whole:Route@2166,whole:Route@2173,whole:Route@2448,whole:Route@2455,whole:Route@2702,whole:Route@406,whole:Route@413,whole:Route@868,whole:Route@926 4cd2a9c67f74c1a00a33464393bf4f2e6e8b049491ec2ad19817b8c0191f30c8 |
| -@coverage internal/activator 6850c53377aee5a1d92ce990a98eb955d8d157774b0b05d2117937657e4bcfd4 |