oficina / equipo Public

Merge thin-v1-runners d7c803b; Darwin round 1 findings 5, 6, 8

Merges the runners round-1 fixes (attempt ownership, withdrawal order,
persisted worker identity, MaxTransferChunks); budgets keep both sides'
records. With it, the rest of Astra's round 1 on Darwin:
- 5: reinstalling stops the agent before replacing the runner, srt or
  its tools, so the enrolment check gets the state lock.
- 6: a Mac says it can only be a worker when it begins enrolment
  (worker_only; migration 0055 runner_enrolments.worker_only). The
  instance will not show or approve it for a person with no primary
  and says why ("Add your main runner first"); the runner still
  refuses a welcome as primary (ErrRoleMismatch from the merge).
- 8: the env file reaches the Mac host (Options.Getenv), and every tool
  it runs gets the runner's Node and ripgrep first on PATH.
Copy rows, docs and DARWIN-PROGRESS updated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev be0f1e397e8923a8ad8ef59b283feb34b2dd5624 parent 6316698parent d7c803b
36 files changed, +873 −137
  • .rastrillo/budgets.txt +1 −1
  • Makefile +3 −0
  • cmd/equipo-runner/install_mac.go +5 −2
  • cmd/equipo-runner/install_mac_test.go +41 −1
  • docs/mac-runner.md +3 −0
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +1 −0
  • docs/superpowers/plans/DARWIN-PROGRESS.md +43 −0
  • docs/superpowers/plans/RUNNERS-PROGRESS.md +32 −2
  • internal/equipo/chat/housekeeping_store_test.go +9 −3
  • internal/equipo/chat/questions.go +7 −0
  • internal/equipo/chat/review.go +1 −1
  • internal/equipo/chat/runners.go +45 −12
  • internal/equipo/chat/tasks.go +48 −18
  • internal/equipo/chat/transfers.go +20 −12
  • internal/equipo/copy.go +2 −0
  • internal/equipo/enrolment.go +6 −3
  • internal/equipo/migrations/0055_thin_checks_sandbox.sql +1 −0
  • internal/equipo/migrations/schema.sql +1 −0
  • internal/equipo/runner_handlers.go +5 −1
  • internal/equipo/setup/enrolment.go +17 −8
  • internal/equipo/setup/runner_models.go +2 −0
  • internal/equipotest/enrolment_link_test.go +42 −0
  • internal/headless/m8_test.go +7 −1
  • internal/runner/enrol.go +1 −1
  • internal/runner/enrol_worker_test.go +11 −0
  • internal/runner/thin/link.go +32 −3
  • internal/runner/thin/mac.go +30 −19
  • internal/runner/thin/mac_test.go +7 −5
  • internal/runner/thin/protocol_test.go +58 −0
  • internal/runner/thin/relay.go +5 −1
  • internal/runner/thin/relay_test.go +29 −0
  • internal/runner/thin/run.go +4 −1
  • internal/runnerproto/types.go +3 −0
  • internal/thintest/review1_contract_test.go +256 −0
  • internal/wire/runners.go +4 −0
  • scripts/runner-reference-allowlist.json +91 −42

CI passed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index 5fbd5d7b..b28f8cea 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -37,7 +37,7 @@ perf GET /install.sh skip Mac runners: the one-line bootstrap a terminal pipes t
time internal/runner/containment 15s Plan 3 loaded CI measured 10.817s; niced serial reruns measured 5.773s and 5.750s. The added coordinator mount check has no repeated launches to remove; 15s leaves 38 percent headroom for namespace, process-exit and recovery assertions.
time internal/tryequipo 30s Release starter-set controller K3 records CI runs of 10.8s and 13.1s; 30s retains the guide integration checks with headroom on the shared runner.
size internal/runner/thin 14900 - Mac runners slices A and B add protocol negotiation (link.go), the capability report, the start authorization, the pack relay (relay.go), the primary's publication, the worker executor (worker.go) and the test-build fake worker, about 2700 lines on the same step engine. Composer attachments add the chunked receipt with exactly-once writes, the read-only desk delivery and its checks (files.go, about 230 lines), image blocks and localImage inputs, the attachment read through read_file; measured 11736. Connections slice 1 Astra round 1 adds the Codex step path (codexstep.go: Engineering and Review on the pinned app-server in the implement and inspect containment, about 300 lines); measured 11345. Connections slice 1 (after Astra round 1) also keeps a durable ledger of each turn's write tools so a later attempt never repeats one (effects.go), the waiting state between attempts and usage rows per attempt, about 500 lines more; measured 10590 before gate 1d. Connections slice 1 adds the Codex coordinator beside the Claude one (codex.go: the pinned app-server over JSON-RPC in the converse containment, sharing the coordinator base, desk, tool socket and session table), the connection registry over the bindings with health and provider limits (conns.go), in-app sign-in attempts (connector.go) and turn failover and holding (failover.go), about 1500 lines; the pure parts (the choice function, limit parsing, the app-server client, the sign-in flows) live in internal/runner/connect. Measured 10097. Thin v1 UX1 adds step activity lines from the specialist's stream, the repository head and checks gate in the index and project-tagged notes (about 120 lines); measured 8615 with slice 4c's review fixes. Thin v1 slice 4c adds the merge step (mergestep.go, about 190 lines) and the rebase round beside the slice 4b ask fixes. Thin v1 slice 3 adds Engineering steps beside the coordinator: the durable step state and engine (step.go) and the executor that checks out the task tree, runs the CLI in the implement containment, commits and pushes (engineer.go), about 800 lines sharing the coordinator's launch, tool socket and account selection. Measured 5686 source lines. Splitting would export the launch internals; revisit at the slice 7 sweep. Slice 4 adds checks and review on a candidate (judge.go) and the merge watch (merge.go), about 800 lines, sharing the Engineer launch path; measured 6808, 7035 after review round 1 (branch head watch, deadlines, streamed outputs). Slice 4b keeps Engineering and Review sessions and answers the creator's questions from them (ask.go: kept-session and ask state, read-only git tools, the answer stream), about 700 lines on the same launch path.
-time internal/thintest 110s Mac runners slices A and B add role, scoping, migration, placement, withdrawal, transfer and publication contracts (about 8s). Housekeeping slice 1 adds six contract tests (combine, Undo round trips and the race, Pause, auto-disable, quiet hours, restart while claimed; about 6s); the package measured 67.7s beside other packages locally, so 75s. Thin v1 slice 4c adds the merge, adoption, cancel and retention contract tests (CI measured 35.7s). Thin v1 contract tests: a real instance and a scripted runner per test, fixtures replayed against every request, frame and event. Slice 3 adds the task, step-sync and grant contracts; CI measured 14.805s. 30s keeps room for the slice 4 review contracts. UX1 adds step activity, task source and duplicates, coordinator merging and project facts (four contracts, about 6s); the package measured 34s locally under load, so 40s. UX1's inner screens gallery (two owners, seven tasks, every page) adds about 3s; measured 40.9s locally under load, so 60s.
+time internal/thintest 180s Mac runners slices A and B add role, scoping, migration, placement, withdrawal, transfer and publication contracts, and Astra round 1 eight transition contracts (about 15s; the package measured 126s locally under load). Housekeeping slice 1 adds six contract tests (combine, Undo round trips and the race, Pause, auto-disable, quiet hours, restart while claimed; about 6s); the package measured 67.7s beside other packages locally, so 75s. Thin v1 slice 4c adds the merge, adoption, cancel and retention contract tests (CI measured 35.7s). Thin v1 contract tests: a real instance and a scripted runner per test, fixtures replayed against every request, frame and event. Slice 3 adds the task, step-sync and grant contracts; CI measured 14.805s. 30s keeps room for the slice 4 review contracts. UX1 adds step activity, task source and duplicates, coordinator merging and project facts (four contracts, about 6s); the package measured 34s locally under load, so 40s. UX1's inner screens gallery (two owners, seven tasks, every page) adds about 3s; measured 40.9s locally under load, so 60s.
time internal/runner/mac 30s Mac runners (Darwin worker): real process groups killed after a grace and proven gone (SIGTERM, SIGKILL, the marker sweep), and the probes run end to end with fake srt and xcodebuild, P6 killing a waiting test two seconds after it starts. About 6s alone; loaded CI measured 12.5s.
time internal/runner/thin 45s Thin v1 slice 4 review: real git repositories for the merge and squash checks, a stalled fetch, and a 16 MiB candidate streamed through the review diff and the checks pack (about 5s). Measured 17.8s locally under load. Slice 4b review adds a 16 MiB git output bound, an injected index-pack failure and stall (3s deadline) and held-answer tests; measured 30.3s locally under load. 45s keeps 33 percent headroom.
time internal/headless 720s Mac runners add TestMacWorker (M1, M2, M4, M5 with the fake worker; about 25s) and TestMixedVersions (M8: builds the staging line's headless test binary from git history, about 60 to 150s cold, then both pairs, about 20s). Connections slice 1 after Astra round 1 adds attempts that wait for a connection, Review on a refused credential, Codex Engineering and Review and the preference (about 90s more; loaded CI measured 6m42s). It first adds TestHeadlessConnections (usage rows, failover, Codex coordinator, device code, Claude sign-in, failure kinds, cancel and sign-out, writes replayed, Engineering and Review moving connection, the waiting turn): eleven scenarios, about 55 to 100s locally. Thin v1 headless suite: real instance, runner and bubblewrap per scenario (spec 7, under two minutes). Slice 4 adds the review and checks scenarios (4_review with its fix rounds, branch move and merge; 4_checks_honest); loaded CI measured 170s on 2026-11-07. Slice 4b adds 4b_ask (about 12s); loaded CI measured 182.9s. 240s keeps 30 percent headroom.
diff --git a/Makefile b/Makefile
index 5d20f142..5bc778b7 100644
--- a/Makefile
+++ b/Makefile
@@ -118,6 +118,9 @@ STATICCHECK := honnef.co/go/tools/cmd/staticcheck@v0.7.0
# parent.
ifneq ($(filter /%,$(firstword $(GOCACHE))),)
export STATICCHECK_CACHE ?= $(GOCACHE)/staticcheck
+# The mixed-version test (M8) builds the older release once and keeps it
+# beside the build cache, so later runs do not compile it again.
+export EQUIPO_M8_CACHE ?= $(GOCACHE)/equipo-m8
endif
staticcheck:
diff --git a/cmd/equipo-runner/install_mac.go b/cmd/equipo-runner/install_mac.go
index ce3b5f1c..fb9a2d46 100644
--- a/cmd/equipo-runner/install_mac.go
+++ b/cmd/equipo-runner/install_mac.go
@@ -115,6 +115,11 @@ func installMac(ctx context.Context, args []string, h macInstallHost, out, errou
if err := os.MkdirAll(agents, 0755); err != nil {
return fail("runner.install.destination")
}
+ // A runner installed before is stopped first: nothing it uses is
+ // replaced under it, and its state lock is free for the enrolment
+ // check below (an existing, valid enrolment is kept as it is).
+ domain := "gui/" + strconv.Itoa(account.UID)
+ _ = h.launchctl(ctx, "bootout", domain+"/"+mac.AgentLabel)
binary := filepath.Join(lib, "equipo-runner")
if err := copyPrivate(h.self, binary, 0700); err != nil {
return fail("runner.install.destination")
@@ -165,8 +170,6 @@ func installMac(ctx context.Context, args []string, h macInstallHost, out, errou
if err := os.WriteFile(plist, mac.LaunchAgent(binary, envFile, logs), 0644); err != nil {
return fail("runner.install.service")
}
- domain := "gui/" + strconv.Itoa(account.UID)
- _ = h.launchctl(ctx, "bootout", domain+"/"+mac.AgentLabel)
if err := h.launchctl(ctx, "bootstrap", domain, plist); err != nil {
return fail("runner.install.service")
}
diff --git a/cmd/equipo-runner/install_mac_test.go b/cmd/equipo-runner/install_mac_test.go
index a4e70a48..9fcf4d7f 100644
--- a/cmd/equipo-runner/install_mac_test.go
+++ b/cmd/equipo-runner/install_mac_test.go
@@ -193,7 +193,7 @@ func TestInstallMac(t *testing.T) {
if err != nil || !bytes.Equal(raw, mac.LaunchAgent(filepath.Join(lib, "equipo-runner"), env, filepath.Join(x.home, "Library/Logs/equipo-runner"))) {
t.Fatalf("plist %v", err)
}
- want := []string{"npm " + lib + "/tools/node-v1/bin/npm " + lib + "/srt", "firstLaunch", "launchctl bootout gui/502/io.amadan.equipo-runner", "launchctl bootstrap gui/502 " + plist}
+ want := []string{"launchctl bootout gui/502/io.amadan.equipo-runner", "npm " + lib + "/tools/node-v1/bin/npm " + lib + "/srt", "firstLaunch", "launchctl bootstrap gui/502 " + plist}
if !slices.Equal(x.calls, want) {
t.Fatalf("calls %v", x.calls)
}
@@ -246,3 +246,43 @@ func TestEnvFileAndExits(t *testing.T) {
t.Fatalf("env file not read: %q", log.String())
}
}
+
+// Installing again over a running runner stops it first: nothing is
+// replaced while it runs, and the enrolment check gets the state lock
+// the running runner held (here the test holds it until bootout).
+func TestInstallMacAgain(t *testing.T) {
+ x := newMacRig(t)
+ state := filepath.Join(x.home, ".local/share/equipo-runner/state")
+ held, err := runner.LockState(state)
+ if err != nil {
+ t.Fatal(err)
+ }
+ launchctl := x.h.launchctl
+ x.h.launchctl = func(ctx context.Context, args ...string) error {
+ if args[0] == "bootout" && held != nil {
+ held.Close()
+ held = nil
+ }
+ return launchctl(ctx, args...)
+ }
+ npmCI := x.h.npmCI
+ x.h.npmCI = func(ctx context.Context, npm, prefix string) error {
+ if held != nil {
+ t.Error("dependencies replaced under a running runner")
+ }
+ return npmCI(ctx, npm, prefix)
+ }
+ x.h.enrol = func(_ context.Context, cfg runner.Config, _ io.Writer) error {
+ lock, err := runner.LockState(cfg.StateDir)
+ if err != nil {
+ return err
+ }
+ return lock.Close()
+ }
+ if code, _, errout := x.install(); code != 0 {
+ t.Fatalf("reinstall: %d %s", code, errout)
+ }
+ if held != nil {
+ held.Close()
+ }
+}
diff --git a/docs/mac-runner.md b/docs/mac-runner.md
index af946efa..344345fb 100644
--- a/docs/mac-runner.md
+++ b/docs/mac-runner.md
@@ -57,6 +57,9 @@ what it found in Equipo under Connections, Machines.
## Good to know
+- A Mac runs checks for your main runner, so add your main runner
+ first. If you open the Mac's link before that, the page says so.
+
- The Mac only runs checks while `equipo-paul` is logged in and the Mac
is awake. When it is not, Equipo waits up to 30 minutes, then says
the checks could not run.
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 3df11926..3705f402 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -5810,6 +5810,7 @@ records remain unchanged.
| `runner.mac.user` | Run the installer as a Standard user named equipo-yourname, such as equipo-paul. | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `runner.mac.home` | This user can get into another person's home folder (%s). An administrator can close it with: sudo chmod 700 %s | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `runner.mac.homes_unknown` | Equipo could not check the other home folders on this Mac, so it stopped. Ask an administrator to check that /Users can be listed, then paste the command again. | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `runner.needs_primary` | This Mac can only run checks for your main runner. Add your main runner first, then open this Mac's link again. | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `runner.mac.no_srt` | The checks sandbox could not be downloaded and installed. Checks will run outside the sandbox and say so. Run the install command again to retry. | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `runner.mac.tap` | Open this link and add this Mac to your team: | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `runner.mac.installed` | This Mac is ready. It checks itself, then waits for work whenever this user is logged in. | Mac runners (Darwin worker) | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
diff --git a/docs/superpowers/plans/DARWIN-PROGRESS.md b/docs/superpowers/plans/DARWIN-PROGRESS.md
index 20e8779b..f1a07e96 100644
--- a/docs/superpowers/plans/DARWIN-PROGRESS.md
+++ b/docs/superpowers/plans/DARWIN-PROGRESS.md
@@ -114,6 +114,49 @@ tampered, staged darwin, target version); instance (worker label on the
primary, seatbelt default, task label); views (label, probes); config
(overlap); enrolment link.
+## Astra round 1 (45b6335), fixed
+
+1. P2 on the simulator: the hostile test runs on the newest iOS
+ simulator (none: P2 unavailable) and tries the host's login keychain
+ file from there; denied needs the build and test completed under srt
+ and the end proven. P6's test hashes and writes files until killed.
+ `TestP2NeedsTheSimulatorAndAProvenEnd`.
+2. Unforgeable verdict: the report lives only in the worker's memory;
+ nothing on disk is read back as a verdict; `equipo-runner probe`
+ only asks for a new run. Trusted while this version's, this
+ profile's, made with the srt, Node and ripgrep on disk now
+ (fingerprint) and under a day old; otherwise checks run labelled
+ outside the sandbox and the probes run again. `TestMacProbesTrust`,
+ `TestSRTFingerprint`.
+3. Record before running: marker recorded before anything starts (the
+ worker's git processes carry it too), group recorded once it exists,
+ nothing runs or the group is killed if a record fails; recovery never
+ takes an unrecorded attempt as ended (UnrecordedStep, settled by the
+ marker on a worker, by "no namespace left" on Linux).
+ `TestGateRecordsBeforeRunning`, `TestGateVerifyByMarkerAlone`,
+ `TestWorkerRecordsBeforeRunning`, `TestStepRecoverUnrecorded`.
+4. Homes: closed only if this user can neither list, traverse (a
+ missing name answers "not found" to a searcher) nor open a usual
+ file; symlinked homes and their targets; a /Users that cannot be
+ read stops the installer, fails P4 and denies all of /Users.
+ `TestHomes`. On Linux the file-read check is not separately
+ testable (reading needs traversal), on a Mac ACLs could differ.
+5. Reinstall stops the agent before replacing anything; the enrolment
+ check then gets the state lock. `TestInstallMacAgain`.
+6. Worker only: the Mac says so when it begins enrolment
+ (`worker_only`, migration 0055 `runner_enrolments.worker_only`); the
+ instance refuses to show or approve it for a person with no primary
+ ("Add your main runner first"). The runner refuses a welcome as
+ primary (the runners round's ErrRoleMismatch).
+ `TestMacEnrolmentNeedsAPrimary`, `TestWorkerEnrolRefusesAnOlderInstance`.
+7. Output: 200 lines of at most 4 KB, enforced on every write.
+ `TestTailIsBounded`.
+8. The env file's values reach the Mac host (Options.Getenv), and every
+ tool it runs gets the runner's Node and ripgrep first on PATH.
+ `TestMacHostPaths`.
+Also: Linux-only tests carry a linux build tag and `make vet` vets the
+runner for darwin/arm64. Merged thin-v1-runners d7c803b.
+
## Decisions
- **P2 not denied:** checks still run (ruling 2), labelled none. If the
diff --git a/docs/superpowers/plans/RUNNERS-PROGRESS.md b/docs/superpowers/plans/RUNNERS-PROGRESS.md
index 6c5a5fd8..434308c3 100644
--- a/docs/superpowers/plans/RUNNERS-PROGRESS.md
+++ b/docs/superpowers/plans/RUNNERS-PROGRESS.md
@@ -115,6 +115,35 @@ scripts as in `SLICE1-PROGRESS.md` to `SLICE4C-PROGRESS.md`.
Mutations: about 25, each observed failing a test (listed in the
commits); defence in depth noted where one survived first.
+11. Astra round 1 (REQUEST CHANGES at 1b89bd1, 7 Important, 1 Minor),
+ each fix with a test that failed first:
+ 1. A revoked primary keeps its attempts: only conversation commands
+ move to the replacement; dispatches, cancels, asks, transfers and
+ publications stay with the runner that may still run them, and the
+ replacement's empty sync settles none of its steps
+ (`TestContractRevokedPrimaryKeepsItsAttempts`).
+ 2. Withdrawal comes first in a step report and in sync: a withdrawn
+ attempt's results never count; only its termination proof does,
+ whenever it arrives, and places the next attempt; Retry clears the
+ withdrawal (`TestContractWithdrawnAttemptReports`,
+ `TestContractWithdrawnProofAfterFailure`).
+ 3. A waiting, never-dispatched step ends locally on Cancel, and
+ nothing is ever sent to an empty runner id
+ (`TestContractCancelWaitingSteps`).
+ 4. The Engineering pin is set on the task value the transaction
+ saves (`TestContractEngineeringPinKept`).
+ 5. A worker's role is kept in its state: it never falls back to
+ protocol 1 and never serves under a primary welcome, whatever its
+ OS (`TestWorkerIdentityPersists`, `TestWorkerRefusesAPrimaryWelcome`).
+ 6. A worker's report never clears the primary's `Pushed` or
+ publication (`TestContractPublishedBeforeWorkerDone`).
+ 7. Oversize is declared by a chunk count past `wire.MaxTransferChunks`,
+ refused at once by the instance (checks `checks_unavailable`) and
+ by a receiver (`TestContractTransferDeclaredTooLarge`,
+ `TestRelayDeclaresOversize`).
+ 8. Asking a step whose runner is offline answers 409 `runner_offline`
+ at once (`TestContractAskOfflineRunner`).
+
## Decisions
- New wire fields are `omitempty` rather than always present: the slice
@@ -141,8 +170,9 @@ commits); defence in depth noted where one survived first.
## Open issues
-- Revoking a worker with a started step leaves it unproven (Cancel
- stays); a revoked primary's steps are rebound to the new primary.
+- Revoking a runner with a started step or an unacked dispatch leaves
+ that attempt unproven: nothing else may supply its proof, so the task
+ waits (Cancel is accepted, the step stays with the revoked runner).
- `have`/thin packs are on the wire but packs are whole one-commit packs.
- Copy for the runner lines (waiting, offline, Runners) is not written;
slice D/E, with Luna's pass.
diff --git a/internal/equipo/chat/housekeeping_store_test.go b/internal/equipo/chat/housekeeping_store_test.go
index 0314de47..ae07d265 100644
--- a/internal/equipo/chat/housekeeping_store_test.go
+++ b/internal/equipo/chat/housekeeping_store_test.go
@@ -315,8 +315,13 @@ func TestHousekeepingNever(t *testing.T) {
c.State = wire.CardResolved
return t.saveCard(&c)
},
- "dispatch, no reserve": func(t *txn) error { var s stepRecord; t.db.First(&s); return t.dispatchStep(r.load(k.ID), &s) },
- "a turn, no reserve": func(t *txn) error { return t.dispatch(&turnRecord{ID: "t1", Person: hkOwner}) },
+ "dispatch, no reserve": func(t *txn) error {
+ var s stepRecord
+ t.db.First(&s)
+ kk := r.load(k.ID)
+ return t.dispatchStep(&kk, &s)
+ },
+ "a turn, no reserve": func(t *txn) error { return t.dispatch(&turnRecord{ID: "t1", Person: hkOwner}) },
}
for name, fn := range never {
err := r.tx(func(t *txn) error {
@@ -346,7 +351,8 @@ func TestHousekeepingNever(t *testing.T) {
t.hk = reserved
var s stepRecord
t.db.First(&s)
- return t.dispatchStep(r.load(k.ID), &s)
+ kk := r.load(k.ID)
+ return t.dispatchStep(&kk, &s)
})
}
if err := dispatch(); !errors.Is(err, ErrHousekeepingForbidden) {
diff --git a/internal/equipo/chat/questions.go b/internal/equipo/chat/questions.go
index a50d57fd..5e5469fa 100644
--- a/internal/equipo/chat/questions.go
+++ b/internal/equipo/chat/questions.go
@@ -168,6 +168,13 @@ func (s *Store) Ask(ctx context.Context, person, taskID string, in wire.AskQuest
if !ok || target.Person != person {
return ErrNotAskable
}
+ // The session lives on the runner that ran the step: offline, the
+ // person is told so now (ask again when it is back).
+ if online, err := t.runnerOnline(person, target.RunnerID); err != nil {
+ return err
+ } else if !online {
+ return ErrRunnerOffline
+ }
var n int64
if err := t.db.Model(&questionRecord{}).Where("task_id = ?", k.ID).Count(&n).Error; err != nil {
return err
diff --git a/internal/equipo/chat/review.go b/internal/equipo/chat/review.go
index ef08ca05..fdb3136f 100644
--- a/internal/equipo/chat/review.go
+++ b/internal/equipo/chat/review.go
@@ -226,7 +226,7 @@ func (t *txn) nextStep(k *taskRecord, steps []stepRecord, s stepRecord) error {
if err := t.db.Create(&s).Error; err != nil {
return err
}
- if err := t.dispatchStep(*k, &s); err != nil {
+ if err := t.dispatchStep(k, &s); err != nil {
return err
}
return t.saveStep(&s, k)
diff --git a/internal/equipo/chat/runners.go b/internal/equipo/chat/runners.go
index a1694fae..d8060423 100644
--- a/internal/equipo/chat/runners.go
+++ b/internal/equipo/chat/runners.go
@@ -33,19 +33,35 @@ func UnboundSteps(tx *gorm.DB) (int64, error) {
// current primary's.
const orphanedBy = `SELECT id FROM runners WHERE person = ? AND revoked_at IS NOT NULL AND coalesce(role, '') IN ('primary', '')`
-// rebind gives the person's primary what no runner holds: commands
-// written while the person had no primary, and the unacked commands and
-// unfinished steps of a revoked primary. A worker's are re-placed instead.
+// attemptKinds are commands that belong to one attempt on one runner: a
+// dispatch whose ack was lost may already run there, so they never move.
+var attemptKinds = []string{wire.FrameDispatch, wire.FrameCancelStep, wire.FrameAsk, wire.FrameCancelAsk, wire.FrameBlob, wire.FrameSendPack, wire.FramePublish}
+
+// rebind gives the person's primary the conversation's commands no runner
+// holds: those written while the person had no primary, and a revoked
+// primary's unacked ones. A revoked runner's attempts stay its own (steps,
+// dispatches, questions, transfers, publications) until their termination
+// is proven; the replacement's sync never settles them.
func (t *txn) rebind(p RunnerPrincipal) error {
if primary, err := t.s.authority.PrimaryRunner(t.db, p.Person); err != nil || primary != p.RunnerID {
return err
}
- if err := t.db.Exec(`UPDATE runner_commands SET runner_id = ? WHERE person = ? AND acked_at IS NULL
- AND (coalesce(runner_id, '') = '' OR runner_id IN (`+orphanedBy+`))`, p.RunnerID, p.Person, p.Person).Error; err != nil {
+ return t.db.Exec(`UPDATE runner_commands SET runner_id = ? WHERE person = ? AND acked_at IS NULL AND kind NOT IN ?
+ AND (coalesce(runner_id, '') = '' OR runner_id IN (`+orphanedBy+`))`, p.RunnerID, p.Person, attemptKinds, p.Person).Error
+}
+
+// withdrawnEnded applies the termination proof of a withdrawn attempt:
+// it ends as not run when it was withdrawn for that (a pack too large to
+// relay), else the next attempt is placed.
+func (t *txn) withdrawnEnded(k *taskRecord, s *stepRecord) error {
+ if s.Reason != "" {
+ s.Terminated = true
+ return t.resolveNotRun(k, s, s.Reason)
+ }
+ if err := t.replace(k, s); err != nil {
return err
}
- return t.db.Exec(`UPDATE chat_steps SET runner_id = ? WHERE person = ? AND state IN (?, ?)
- AND runner_id IN (`+orphanedBy+`)`, p.RunnerID, p.Person, wire.StepQueued, wire.StepRunning, p.Person).Error
+ return t.saveStep(s, k)
}
// MaxRunnerLabel bounds the machine label a runner reports.
@@ -131,6 +147,20 @@ func (t *txn) runners(person string) ([]runnerInfo, error) {
return out, nil
}
+// runnerOnline reports whether one of the person's runners is online now.
+func (t *txn) runnerOnline(person, id string) (bool, error) {
+ rs, err := t.runners(person)
+ if err != nil {
+ return false, err
+ }
+ for _, r := range rs {
+ if r.ID == id {
+ return r.Online, nil
+ }
+ }
+ return false, nil
+}
+
// runnerView is the Runner resource.
func runnerView(r runnerInfo) wire.Runner {
v := wire.Runner{ID: r.ID, Revision: r.Revision, Online: r.Online, Label: r.Label, Role: r.Role, Platform: r.Hello.Platform, Capabilities: r.Hello.Capabilities}
@@ -233,7 +263,7 @@ func encodeList(v []string) string {
// leaves the step waiting (placed false). When no runner has ever had the
// tags, or the primary cannot relay a pack (protocol 1), the step goes to
// the primary without needs and ends honestly there (needs_macos).
-func (t *txn) place(k taskRecord, s *stepRecord) (placed bool, err error) {
+func (t *txn) place(k *taskRecord, s *stepRecord) (placed bool, err error) {
primary, err := t.s.authority.PrimaryRunner(t.db, s.Person)
if err != nil {
return false, err
@@ -257,6 +287,9 @@ func (t *txn) place(k taskRecord, s *stepRecord) (placed bool, err error) {
}
}
if k.EngineeringRunner == "" && s.RunnerID != "" {
+ // On the task value the transaction carries, so its next save
+ // keeps the pin.
+ k.EngineeringRunner = s.RunnerID
if err := t.db.Model(&taskRecord{}).Where("id = ?", k.ID).Update("engineering_runner", s.RunnerID).Error; err != nil {
return false, err
}
@@ -267,7 +300,7 @@ func (t *txn) place(k taskRecord, s *stepRecord) (placed bool, err error) {
s.Needs, s.RunnerID = "", primary
return true, nil
}
- needs, err := t.checksNeeds(k, *s)
+ needs, err := t.checksNeeds(*k, *s)
if err != nil {
return false, err
}
@@ -321,7 +354,7 @@ func (t *txn) place(k taskRecord, s *stepRecord) (placed bool, err error) {
// replace ends the current attempt's placement and places the next one:
// after a refusal, a withdrawal before it started, or a withdrawn
// attempt's termination. The caller saves s.
-func (t *txn) replace(k taskRecord, s *stepRecord) error {
+func (t *txn) replace(k *taskRecord, s *stepRecord) error {
if err := t.voidAttempt(*s); err != nil {
return err
}
@@ -350,7 +383,7 @@ func (t *txn) withdraw(k *taskRecord, s *stepRecord) error {
return nil
}
if s.StartedAt == nil {
- if err := t.replace(*k, s); err != nil {
+ if err := t.replace(k, s); err != nil {
return err
}
return t.saveStep(s, k)
@@ -408,7 +441,7 @@ func (t *txn) placeWaiting(person string) error {
continue
}
since := s.WaitingSince
- if err := t.dispatchStep(k, &s); err != nil {
+ if err := t.dispatchStep(&k, &s); err != nil {
return err
}
if s.Placement == wire.PlacementWaiting {
diff --git a/internal/equipo/chat/tasks.go b/internal/equipo/chat/tasks.go
index 75483d46..23e473b5 100644
--- a/internal/equipo/chat/tasks.go
+++ b/internal/equipo/chat/tasks.go
@@ -691,7 +691,7 @@ func (t *txn) startTask(r turnRecord, id, brief string) (wire.ToolResult, error)
if err := t.db.Create(&s).Error; err != nil {
return wire.ToolResult{}, err
}
- if err := t.dispatchStep(k, &s); err != nil {
+ if err := t.dispatchStep(&k, &s); err != nil {
return wire.ToolResult{}, err
}
k.Stage = wire.StageInProgress
@@ -704,7 +704,7 @@ func (t *txn) startTask(r turnRecord, id, brief string) (wire.ToolResult, error)
// dispatchStep queues the dispatch command for the step's attempt on the
// runner it is placed on, with the task's findings. The caller saves s.
-func (t *txn) dispatchStep(k taskRecord, s *stepRecord) error {
+func (t *txn) dispatchStep(k *taskRecord, s *stepRecord) error {
// Housekeeping dispatches only within its reservation, on a connection
// that is not standing down.
if err := t.hkSpend(s.Person); err != nil {
@@ -714,11 +714,21 @@ func (t *txn) dispatchStep(k taskRecord, s *stepRecord) error {
if err != nil || !placed {
return err
}
+ if s.RunnerID == "" {
+ // No runner at all (no primary yet): it waits, and is placed when
+ // one connects. Nothing is ever sent to nobody.
+ now := t.now()
+ s.Placement = wire.PlacementWaiting
+ if s.WaitingSince == nil {
+ s.WaitingSince = &now
+ }
+ return nil
+ }
var p projectRecord
if err := t.db.Where("id = ?", k.ProjectID).First(&p).Error; err != nil {
return err
}
- v, err := t.taskView(k)
+ v, err := t.taskView(*k)
if err != nil {
return err
}
@@ -726,7 +736,7 @@ func (t *txn) dispatchStep(k taskRecord, s *stepRecord) error {
if base == "" && !s.Rebase {
base = k.BaseSHA
}
- brief, err := t.stepBrief(k, *s)
+ brief, err := t.stepBrief(*k, *s)
if err != nil {
return err
}
@@ -752,7 +762,7 @@ func (t *txn) dispatchStep(k taskRecord, s *stepRecord) error {
// from the primary as a pack in an inbound transfer.
cmd.Needs = decodeList(s.Needs)
if s.Specialist == wire.SpecialistChecks {
- if _, err := t.openTransfer(k, *s, primary, s.RunnerID, wire.TransferInbound, cmd.BaseSHA, s.CandidateSHA); err != nil {
+ if _, err := t.openTransfer(*k, *s, primary, s.RunnerID, wire.TransferInbound, cmd.BaseSHA, s.CandidateSHA); err != nil {
return err
}
}
@@ -826,6 +836,14 @@ func (t *txn) cancelTask(person, id string) (int64, error) {
k.Stage = wire.StageCancelled
return s.Attempt, t.saveTask(&k)
}
+ if s.RunnerID == "" {
+ // Waiting for a runner and never dispatched: nothing runs, so it
+ // ends here.
+ now := t.now()
+ s.State, s.Reason, s.Terminated, s.FinishedAt, s.Placement, s.WaitingSince = wire.StepCancelled, "cancelled", true, &now, "", nil
+ k.Stage = wire.StageCancelled
+ return s.Attempt, t.saveStep(&s, &k)
+ }
k.CancelRequested = true
if err := t.saveTask(&k); err != nil {
return 0, err
@@ -889,22 +907,20 @@ func (t *txn) stepReport(l Lease, v *wire.StepReport) error {
if v.TerminationKind != "" && s.TerminationKind == "" && (v.TerminationKind == wire.TerminationNamespace || v.TerminationKind == wire.TerminationProcessGroup) {
s.TerminationKind = v.TerminationKind
}
+ if s.Withdrawn {
+ // A withdrawn attempt's results never count, whatever arrives first;
+ // only its termination proof does, and it places the next attempt.
+ if advanced || !wire.StepTerminal(v.State) || !v.Termination {
+ return nil
+ }
+ return t.withdrawnEnded(&k, &s)
+ }
if !wire.StepTerminal(s.State) && wire.StepTerminal(v.State) && v.State != wire.StepDone && v.Termination {
switch {
- case s.Withdrawn && s.Reason != "":
- // Withdrawn to end as not run (a pack too large to relay).
- s.Terminated, s.TerminationKind = true, firstSet(v.TerminationKind, s.TerminationKind)
- return t.resolveNotRun(&k, &s, s.Reason)
- case s.Withdrawn:
- // Its termination is proven: the next attempt goes elsewhere.
- if err := t.replace(k, &s); err != nil {
- return err
- }
- return t.saveStep(&s, &k)
case v.State == wire.StepFailed && v.Reason == "placement_refused":
// It lacks a need: place it again without that runner.
s.RefusedBy = encodeList(append(decodeList(s.RefusedBy), l.Runner.RunnerID))
- if err := t.replace(k, &s); err != nil {
+ if err := t.replace(&k, &s); err != nil {
return err
}
return t.saveStep(&s, &k)
@@ -962,7 +978,12 @@ func (t *txn) stepReport(l Lease, v *wire.StepReport) error {
if s.CandidateSHA == "" || v.CandidateSHA != s.CandidateSHA || !v.Pushed && role == wire.RolePrimary {
return nil
}
- s.Pushed, s.Apple = v.Pushed, v.Apple
+ // Pushed is the primary's word: for a worker's commit only the
+ // primary's published report sets it, and this report keeps it.
+ if role == wire.RolePrimary {
+ s.Pushed = true
+ }
+ s.Apple = v.Apple
s.Askable = v.Askable
if s.Rebase && s.BaseSHA != "" {
// The change sits on the new tip now: review reads it from
@@ -1126,6 +1147,14 @@ func (t *txn) syncSteps(l Lease, held []wire.StepRun) error {
if err != nil {
return err
}
+ if s.Withdrawn {
+ // Its runner holds nothing of it and verified none survives:
+ // the withdrawn attempt is over, and the next one is placed.
+ if err := t.withdrawnEnded(&k, &s); err != nil {
+ return err
+ }
+ continue
+ }
now := t.now()
s.State, s.Reason, s.Terminated, s.FinishedAt = wire.StepFailed, "interrupted", true, &now
if k.CancelRequested {
@@ -1295,7 +1324,8 @@ func (s *Store) RetryTask(ctx context.Context, person, id string) (attempt int64
if st.Specialist == wire.SpecialistMerge {
st.MergeSHA, st.MergeInto, st.MergeStrategy = "", "", ""
}
- if err := t.dispatchStep(k, &st); err != nil {
+ st.Withdrawn, st.RefusedBy = false, ""
+ if err := t.dispatchStep(&k, &st); err != nil {
return err
}
k.Stage = wire.StageInProgress
diff --git a/internal/equipo/chat/transfers.go b/internal/equipo/chat/transfers.go
index af391996..2c8579a0 100644
--- a/internal/equipo/chat/transfers.go
+++ b/internal/equipo/chat/transfers.go
@@ -112,6 +112,10 @@ func (t *txn) blob(l Lease, v *wire.Blob) error {
if s.Attempt != tr.Attempt || s.Withdrawn || wire.FinalStage(k.Stage) || k.CancelRequested || tr.Direction == wire.TransferInbound && wire.StepTerminal(s.State) {
return errTransferRefused("attempt not current")
}
+ if v.Total > wire.MaxTransferChunks {
+ // Declared too large to relay: the checks cannot run on that runner.
+ return t.tooLarge(&k, &s, tr)
+ }
data, err := base64.StdEncoding.DecodeString(v.Data)
if err != nil || len(v.Data) > wire.MaxBlobData || !hexDigest.MatchString(v.SHA256) || v.Total < 1 || v.Index < 0 || v.Index >= v.Total {
return errTransferRefused("bad chunk")
@@ -120,18 +124,7 @@ func (t *txn) blob(l Lease, v *wire.Blob) error {
return errTransferRefused("chunk out of order")
}
if tr.Bytes+int64(len(data)) > wire.MaxTransferBytes {
- tr.State = transferClosed
- if err := t.dropChunks(tr); err != nil {
- return err
- }
- if err := t.db.Model(&transferRecord{}).Where("id = ?", tr.ID).Update("state", transferClosed).Error; err != nil {
- return err
- }
- // Too large to relay: the checks cannot run on that runner.
- if tr.Direction == wire.TransferInbound && !wire.StepTerminal(s.State) {
- return t.withdrawResolving(&k, &s, "checks_unavailable")
- }
- return nil
+ return t.tooLarge(&k, &s, tr)
}
tr.Total, tr.SHA256, tr.Received, tr.Bytes = v.Total, v.SHA256, tr.Received+1, tr.Bytes+int64(len(data))
if tr.Received == tr.Total {
@@ -149,6 +142,21 @@ func (t *txn) blob(l Lease, v *wire.Blob) error {
return nil
}
+// tooLarge closes a transfer past the bound; inbound, its checks end as
+// not run (checks_unavailable).
+func (t *txn) tooLarge(k *taskRecord, s *stepRecord, tr transferRecord) error {
+ if err := t.dropChunks(tr); err != nil {
+ return err
+ }
+ if err := t.db.Model(&transferRecord{}).Where("id = ?", tr.ID).Update("state", transferClosed).Error; err != nil {
+ return err
+ }
+ if tr.Direction == wire.TransferInbound && !wire.StepTerminal(s.State) {
+ return t.withdrawResolving(k, s, "checks_unavailable")
+ }
+ return nil
+}
+
// blobAcked closes a transfer once its receiver acked the last chunk.
func (t *txn) blobAcked(body string) error {
var v wire.Blob
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index 17909829..b628ae62 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -1236,6 +1236,8 @@ var pageCopy = map[string]string{
// COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"runner.title": "Machines",
// COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "runner.needs_primary": "This Mac can only run checks for your main runner. Add your main runner first, then open this Mac's link again.",
+ // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"runner.add_title": "Add %s to your team",
// COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"runner.platform": "Platform",
diff --git a/internal/equipo/enrolment.go b/internal/equipo/enrolment.go
index c12ea364..51b9ee14 100644
--- a/internal/equipo/enrolment.go
+++ b/internal/equipo/enrolment.go
@@ -18,6 +18,9 @@ import (
var (
ErrEnrolmentPending = &refusal{copyRunnerPending, ErrConflict}
ErrRunnerRateLimited = &refusal{copyRunnerRateLimited, ErrForbidden}
+ // ErrRunnerNeedsPrimary: a Mac runs checks for a person's primary
+ // runner, so it cannot be their first.
+ ErrRunnerNeedsPrimary = &refusal{pageCopy["runner.needs_primary"], ErrConflict}
)
func runnerSecret() string {
@@ -91,10 +94,10 @@ func (s *Store) enrolments() *setup.Enrolments {
return true, err
}, SaveResult: func(tx *gorm.DB, ctx context.Context, out Runner) error {
return personapi.SaveResult(tx, ctx, out, ErrConflict)
- }, Write: s.write, Now: s.runnerClock.Now, Instance: runnerInstance, Rate: runnerRateAt, Secret: runnerSecret, Hash: runnerHash, Member: currentRunnerMember, Audit: appendAudit, Error: storeError, Runner: runnerAt, Mint: mintRunnerCredential, Invalid: ErrInvalid, Forbidden: ErrForbidden, Conflict: ErrConflict, RunnerRateLimited: ErrRunnerRateLimited, EnrolmentPending: ErrEnrolmentPending}
+ }, Write: s.write, Now: s.runnerClock.Now, Instance: runnerInstance, Rate: runnerRateAt, Secret: runnerSecret, Hash: runnerHash, Member: currentRunnerMember, Audit: appendAudit, Error: storeError, Runner: runnerAt, Mint: mintRunnerCredential, Invalid: ErrInvalid, Forbidden: ErrForbidden, Conflict: ErrConflict, RunnerRateLimited: ErrRunnerRateLimited, EnrolmentPending: ErrEnrolmentPending, NeedsPrimary: ErrRunnerNeedsPrimary}
}
-func (s *Store) BeginEnrolment(ctx context.Context, key, label string) (runnerproto.DeviceCode, error) {
- return s.enrolments().BeginEnrolment(ctx, key, label)
+func (s *Store) BeginEnrolment(ctx context.Context, key, label string, workerOnly ...bool) (runnerproto.DeviceCode, error) {
+ return s.enrolments().BeginEnrolment(ctx, key, label, workerOnly...)
}
func (s *Store) ApproveEnrolment(ctx context.Context, a Actor, code string) error {
return s.enrolments().ApproveEnrolment(ctx, a, code)
diff --git a/internal/equipo/migrations/0055_thin_checks_sandbox.sql b/internal/equipo/migrations/0055_thin_checks_sandbox.sql
index 545de0a7..d3a371a3 100644
--- a/internal/equipo/migrations/0055_thin_checks_sandbox.sql
+++ b/internal/equipo/migrations/0055_thin_checks_sandbox.sql
@@ -1 +1,2 @@
ALTER TABLE chat_steps ADD COLUMN checks_sandbox text;
+ALTER TABLE runner_enrolments ADD COLUMN worker_only numeric;
diff --git a/internal/equipo/migrations/schema.sql b/internal/equipo/migrations/schema.sql
index 9c80eaf2..eb0442a9 100644
--- a/internal/equipo/migrations/schema.sql
+++ b/internal/equipo/migrations/schema.sql
@@ -430,6 +430,7 @@ CREATE TABLE onboarding_states (
completed text
);
ALTER TABLE runner_enrolments ADD COLUMN created_at datetime;
+ALTER TABLE runner_enrolments ADD COLUMN worker_only numeric;
CREATE TABLE account_setups (
id text PRIMARY KEY,
person text,
diff --git a/internal/equipo/runner_handlers.go b/internal/equipo/runner_handlers.go
index 9676e6e8..bd39c977 100644
--- a/internal/equipo/runner_handlers.go
+++ b/internal/equipo/runner_handlers.go
@@ -99,7 +99,7 @@ func (a *application) beginEnrolment(w http.ResponseWriter, r *http.Request) {
runnerFailure(w, ErrInvalid)
return
}
- result, err := a.store.BeginEnrolment(r.Context(), input.MachinePublicKey, input.Label)
+ result, err := a.store.BeginEnrolment(r.Context(), input.MachinePublicKey, input.Label, input.WorkerOnly)
if err != nil {
runnerFailure(w, err)
return
@@ -229,6 +229,10 @@ func (a *application) revokeRunner(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/runners/enrol", http.StatusSeeOther)
}
func (a *application) runnerFormFailure(w http.ResponseWriter, r *http.Request, err error) {
+ if errors.Is(err, ErrRunnerNeedsPrimary) {
+ renderStatus(w, http.StatusConflict, "form_error", pageData{Nav: Navigation(), Key: "connections", Title: "runner.title", ErrorKey: "runner.needs_primary", Back: "/runners/enrol"})
+ return
+ }
if !errors.Is(err, ErrRunnerRateLimited) {
a.failure(w, r, err)
return
diff --git a/internal/equipo/setup/enrolment.go b/internal/equipo/setup/enrolment.go
index 2ebfbdc9..72df1dc9 100644
--- a/internal/equipo/setup/enrolment.go
+++ b/internal/equipo/setup/enrolment.go
@@ -27,9 +27,12 @@ type Enrolments struct {
Runner func(*gorm.DB, string, string) (RunnerRecord, error)
Mint func(*gorm.DB, RunnerRecord, time.Time) (runnerproto.RunnerCredential, error)
Invalid, Forbidden, Conflict, RunnerRateLimited, EnrolmentPending error
+ // NeedsPrimary refuses a worker-only machine (a Mac) for a person who
+ // has no primary runner: it would be made their primary.
+ NeedsPrimary error
}
-func (s *Enrolments) BeginEnrolment(ctx context.Context, machinePublicKey, label string) (runnerproto.DeviceCode, error) {
+func (s *Enrolments) BeginEnrolment(ctx context.Context, machinePublicKey, label string, workerOnly ...bool) (runnerproto.DeviceCode, error) {
if (runnerproto.BeginEnrolmentRequest{Version: 1, MachinePublicKey: machinePublicKey, Label: label}).Validate() != nil {
return runnerproto.DeviceCode{}, s.Invalid
}
@@ -60,7 +63,7 @@ func (s *Enrolments) BeginEnrolment(ctx context.Context, machinePublicKey, label
rand.Read(userBytes)
userCode := base32.NewEncoding("0123456789ABCDEFGHJKMNPQRSTVWXYZ").WithPadding(base32.NoPadding).EncodeToString(userBytes)[:10]
secret := s.Secret()
- grant := EnrolmentRecord{ID: rand.Text(), InstanceID: instance, Audience: runnerproto.DeviceAudience, MachinePublicKey: machinePublicKey, MachineKeyHash: hash, Label: label, CreatedAt: now, DeviceSecretHash: s.Hash(runnerproto.DeviceAudience, secret), UserCodeHash: s.Hash(instance, userCode), Challenge: s.Secret(), ExpiresAt: now.Add(10 * time.Minute), NextPollAt: now}
+ grant := EnrolmentRecord{ID: rand.Text(), InstanceID: instance, Audience: runnerproto.DeviceAudience, MachinePublicKey: machinePublicKey, MachineKeyHash: hash, Label: label, CreatedAt: now, DeviceSecretHash: s.Hash(runnerproto.DeviceAudience, secret), UserCodeHash: s.Hash(instance, userCode), Challenge: s.Secret(), ExpiresAt: now.Add(10 * time.Minute), NextPollAt: now, WorkerOnly: len(workerOnly) == 1 && workerOnly[0]}
if err := tx.Create(&grant).Error; err != nil {
return s.Error(err)
}
@@ -132,6 +135,18 @@ func (s *Enrolments) ApproveOrInspect(ctx context.Context, actor Actor, userCode
return err
}
result = Runner{Person: member.Address, MachineKeyHash: grant.MachineKeyHash, Label: grant.Label, RequestedAt: grant.CreatedAt, Revision: 1}
+ // A person's first runner is the primary; later ones are workers.
+ // Replacing a primary means revoking it first. A machine that can
+ // only be a worker is refused, shown or approved, until the person
+ // has a primary: it would become one.
+ var primaries int64
+ if err := tx.Model(&RunnerRecord{}).Where("instance_id=? AND person=? AND revoked_at IS NULL AND coalesce(role,'') IN ('primary','')", instance, member.Address).Count(&primaries).Error; err != nil {
+ return s.Error(err)
+ }
+ if grant.WorkerOnly && primaries == 0 && s.NeedsPrimary != nil {
+ denied = s.NeedsPrimary
+ return nil
+ }
if !approve {
return nil
}
@@ -143,12 +158,6 @@ func (s *Enrolments) ApproveOrInspect(ctx context.Context, actor Actor, userCode
return s.Conflict
}
result.ID = rand.Text()
- // A person's first runner is the primary; later ones are workers.
- // Replacing a primary means revoking it first.
- var primaries int64
- if err := tx.Model(&RunnerRecord{}).Where("instance_id=? AND person=? AND revoked_at IS NULL AND coalesce(role,'') IN ('primary','')", instance, member.Address).Count(&primaries).Error; err != nil {
- return s.Error(err)
- }
result.Role = RolePrimary
if primaries != 0 {
result.Role = RoleWorker
diff --git a/internal/equipo/setup/runner_models.go b/internal/equipo/setup/runner_models.go
index b0de3c46..f26fdc15 100644
--- a/internal/equipo/setup/runner_models.go
+++ b/internal/equipo/setup/runner_models.go
@@ -60,6 +60,8 @@ type EnrolmentRecord struct {
ApprovedAt *time.Time
ConsumedAt *time.Time
RevokedAt *time.Time
+ // WorkerOnly: the machine said it can only be a worker (a Mac).
+ WorkerOnly bool
}
func (EnrolmentRecord) TableName() string { return "runner_enrolments" }
diff --git a/internal/equipotest/enrolment_link_test.go b/internal/equipotest/enrolment_link_test.go
index 15e63486..2038a474 100644
--- a/internal/equipotest/enrolment_link_test.go
+++ b/internal/equipotest/enrolment_link_test.go
@@ -46,3 +46,45 @@ func TestEnrolmentLinkIsOneTap(t *testing.T) {
t.Fatal("a wrong code showed a machine")
}
}
+
+// A Mac can only be a worker: for a person with no primary runner its
+// link says so in words and it cannot be added (it would become their
+// primary). Once they have a primary, the same kind of link adds it, as
+// a worker.
+func TestMacEnrolmentNeedsAPrimary(t *testing.T) {
+ f := newEnrolHTTP(t)
+ c := signinClient(t, f.server.URL)
+ signinEmail(t, c, f.server.URL, testOrigin, f.mail, ownerAddress)
+ begin := func(label string, worker bool) runnerproto.DeviceCode {
+ t.Helper()
+ pub, _ := machine(t)
+ status, body := enrolJSON(t, f.server.Client(), f.server.URL+"/api/enrolments", runnerproto.BeginEnrolmentRequest{Version: 1, MachinePublicKey: pub, Label: label, WorkerOnly: worker}, "")
+ if status != 201 {
+ t.Fatalf("begin HTTP: %d %s", status, body)
+ }
+ var code runnerproto.DeviceCode
+ if err := json.Unmarshal(body, &code); err != nil {
+ t.Fatal(err)
+ }
+ return code
+ }
+ mac := begin("Tito Studio", true)
+ res, err := c.Get(f.server.URL + "/runners/enrol?code=" + url.QueryEscape(mac.UserCode))
+ if err != nil {
+ t.Fatal(err)
+ }
+ page := readBody(t, res)
+ if strings.Contains(page, `value="approve"`) || !strings.Contains(page, "Add your main runner first") {
+ t.Fatalf("a Mac offered as a first runner (%d):\n%s", res.StatusCode, page)
+ }
+ res = clientPost(t, c, f.server.URL+"/runners/enrol", testOrigin, url.Values{"user_code": {mac.UserCode}, "action": {"inspect"}})
+ if body := readBody(t, res); strings.Contains(body, `value="approve"`) {
+ t.Fatal("inspect offered to add a Mac with no primary")
+ }
+ main := begin("docs-t1", false)
+ view := taskGet(t, c, f.server.URL, "/runners/enrol?code="+url.QueryEscape(main.UserCode), 200)
+ pagePost(t, c, f.server.URL, "/runners/enrol", testOrigin, formFields(t, view, "/runners/enrol"), 303)
+ if view := taskGet(t, c, f.server.URL, "/runners/enrol?code="+url.QueryEscape(mac.UserCode), 200); !strings.Contains(view, "Add Tito Studio to your team") {
+ t.Fatal("a Mac not offered once there is a primary")
+ }
+}
diff --git a/internal/headless/m8_test.go b/internal/headless/m8_test.go
index dbb3ac3b..747a26f1 100644
--- a/internal/headless/m8_test.go
+++ b/internal/headless/m8_test.go
@@ -109,7 +109,13 @@ func oldBinary(t *testing.T) string {
if err := os.WriteFile(overlay, raw, 0600); err != nil {
t.Fatal(err)
}
- build := exec.Command("go", "test", "-c", "-overlay", overlay, "-o", bin+".tmp", "./internal/headless")
+ // Niced, two compile jobs: the build must not starve the packages
+ // testing beside it.
+ args := []string{"go", "test", "-c", "-p", "2", "-overlay", overlay, "-o", bin + ".tmp", "./internal/headless"}
+ if nice, err := exec.LookPath("nice"); err == nil {
+ args = append([]string{nice, "-n", "15"}, args...)
+ }
+ build := exec.Command(args[0], args[1:]...)
build.Dir = src
build.Env = append(os.Environ(), "CGO_ENABLED=0", "GOFLAGS=-mod=readonly")
if out, err := build.CombinedOutput(); err != nil {
diff --git a/internal/runner/enrol.go b/internal/runner/enrol.go
index d367eb0d..360caffb 100644
--- a/internal/runner/enrol.go
+++ b/internal/runner/enrol.go
@@ -142,7 +142,7 @@ func Enrol(ctx context.Context, c Config, output io.Writer) (resultErr error) {
}
if err != nil || !pending.usable(c.Origin, c.InstanceID) {
var code runnerproto.DeviceCode
- _, err = post("/api/enrolments", runnerproto.BeginEnrolmentRequest{Version: 1, MachinePublicKey: base64.RawURLEncoding.EncodeToString(ed25519.PrivateKey(key).Public().(ed25519.PublicKey)), Label: label}, &code)
+ _, err = post("/api/enrolments", runnerproto.BeginEnrolmentRequest{Version: 1, MachinePublicKey: base64.RawURLEncoding.EncodeToString(ed25519.PrivateKey(key).Public().(ed25519.PublicKey)), Label: label, WorkerOnly: c.WorkerOnly}, &code)
if err != nil {
return err
}
diff --git a/internal/runner/enrol_worker_test.go b/internal/runner/enrol_worker_test.go
index 443f6664..1f7b3e8c 100644
--- a/internal/runner/enrol_worker_test.go
+++ b/internal/runner/enrol_worker_test.go
@@ -2,12 +2,14 @@ package runner
import (
"context"
+ "encoding/json"
"net"
"net/http"
"path/filepath"
"sync"
"testing"
+ "amadan.net/oficina/equipo/internal/runnerproto"
"amadan.net/oficina/equipo/internal/wire"
)
@@ -28,6 +30,7 @@ func TestWorkerEnrolRefusesAnOlderInstance(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
var mu sync.Mutex
var paths []string
+ var begun runnerproto.BeginEnrolmentRequest
l, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
t.Fatal(err)
@@ -36,6 +39,9 @@ func TestWorkerEnrolRefusesAnOlderInstance(t *testing.T) {
mu.Lock()
paths = append(paths, r.Method+" "+r.URL.Path)
mu.Unlock()
+ if r.URL.Path == "/api/enrolments" {
+ _ = json.NewDecoder(r.Body).Decode(&begun)
+ }
if r.URL.Path == wire.RunnerProtocolPath && tc.protocol != "" {
_, _ = w.Write([]byte(tc.protocol))
return
@@ -58,6 +64,11 @@ func TestWorkerEnrolRefusesAnOlderInstance(t *testing.T) {
if code == "runner.instance_older_than_worker" || len(paths) < 2 {
t.Fatalf("protocol 2 instance refused: %q %v", code, paths)
}
+ // It says it can only be a worker, so the instance refuses to
+ // make it anyone's first (primary) runner.
+ if !begun.WorkerOnly {
+ t.Fatal("a worker-only machine did not say so")
+ }
})
}
}
diff --git a/internal/runner/thin/link.go b/internal/runner/thin/link.go
index b6999646..3310b7b5 100644
--- a/internal/runner/thin/link.go
+++ b/internal/runner/thin/link.go
@@ -27,6 +27,24 @@ var ErrRevoked = errors.New("runner credential refused")
// instance) and tries again later.
var ErrInstanceTooOld = errors.New("the instance speaks only protocol 1, which has no workers: update the instance first")
+// ErrRoleMismatch means the instance welcomed a worker as something else:
+// a runner the instance once made a worker stays one (only a new
+// enrolment makes a primary), so it does not serve.
+var ErrRoleMismatch = errors.New("this runner is a worker and the instance welcomed it as a primary")
+
+// metaRole keeps the role the instance gave this runner, in its state.
+const metaRole = "role"
+
+// workerOnly: this runner can only be a worker, by its platform or
+// because the instance made it one.
+func (l *Link) workerOnly(ctx context.Context) bool {
+ if l.WorkerOnly {
+ return true
+ }
+ role, err := l.State.meta(ctx, metaRole)
+ return err != nil || role == wire.RoleWorker
+}
+
// olderRetry is how long a worker waits before asking an older instance
// again.
var olderRetry = time.Minute
@@ -312,7 +330,7 @@ func (l *Link) Run(ctx context.Context) error {
}
return err
}
- if errors.Is(err, ErrInstanceTooOld) {
+ if errors.Is(err, ErrInstanceTooOld) || errors.Is(err, ErrRoleMismatch) {
retry = olderRetry
if l.Logger != nil {
l.Logger.Error("runner refused: this runner is a worker and the instance is an older release", "origin", l.Origin, "err", err)
@@ -378,7 +396,7 @@ func (l *Link) session(ctx context.Context) (time.Duration, error) {
if offer < wire.Protocol2 || websocket.CloseStatus(err) != websocket.StatusPolicyViolation {
return 0, err
}
- if l.WorkerOnly {
+ if l.workerOnly(ctx) {
return 0, ErrInstanceTooOld
}
if l.Logger != nil {
@@ -430,10 +448,21 @@ func (l *Link) handshake(ctx context.Context, offer int) (*websocket.Conn, *wire
if welcome.Protocol == 0 {
spoken, role = wire.Protocol1, wire.RolePrimary
}
- if spoken < wire.Protocol2 && l.WorkerOnly {
+ worker := l.workerOnly(ctx)
+ if spoken < wire.Protocol2 && worker {
c.CloseNow()
return nil, nil, ErrInstanceTooOld
}
+ if worker && role != wire.RoleWorker {
+ c.CloseNow()
+ return nil, nil, ErrRoleMismatch
+ }
+ if role == wire.RoleWorker {
+ if err := l.State.setMeta(ctx, metaRole, wire.RoleWorker); err != nil {
+ c.CloseNow()
+ return nil, nil, err
+ }
+ }
l.mu.Lock()
l.proto, l.role = min(spoken, offer), role
l.mu.Unlock()
diff --git a/internal/runner/thin/mac.go b/internal/runner/thin/mac.go
index bf55a458..535ec663 100644
--- a/internal/runner/thin/mac.go
+++ b/internal/runner/thin/mac.go
@@ -267,11 +267,27 @@ func executable(p string) bool {
return err == nil && info.Mode().IsRegular() && info.Mode().Perm()&0111 != 0
}
-func execTool(ctx context.Context, name string, args ...string) (string, error) {
- out, err := exec.CommandContext(ctx, name, args...).Output()
+// run runs a tool with the runner's own environment but its PATH: the
+// runner's Node and ripgrep first (srt starts through `env node` and
+// looks for rg there), then the system's. launchd gives an agent only
+// the system PATH.
+func (h *macHost) run(ctx context.Context, name string, args ...string) (string, error) {
+ cmd := exec.CommandContext(ctx, name, args...)
+ cmd.Env = withPath(os.Environ(), gatePath(h.tools))
+ out, err := cmd.Output()
return string(out), err
}
+func withPath(env []string, path string) []string {
+ out := []string{"PATH=" + path}
+ for _, kv := range env {
+ if !strings.HasPrefix(kv, "PATH=") {
+ out = append(out, kv)
+ }
+ }
+ return out
+}
+
// gatePath is a gate's fixed PATH: the system's, Homebrew's, and Node's
// directory (srt runs on Node).
func gatePath(t mac.Tools) string {
@@ -295,7 +311,11 @@ func contains(list []string, s string) bool {
return false
}
-func newMacHost(c runner.Config, o Options, getenv func(string) string) (*macHost, error) {
+func newMacHost(c runner.Config, o Options) (*macHost, error) {
+ getenv := o.Getenv
+ if getenv == nil {
+ getenv = os.Getenv
+ }
home, err := os.UserHomeDir()
if err != nil {
return nil, err
@@ -310,7 +330,7 @@ func newMacHost(c runner.Config, o Options, getenv func(string) string) (*macHos
h.tools = macTools(h.paths.InstallDir, home, getenv)
h.env = []string{"HOME=" + home, "PATH=" + gatePath(h.tools), "CI=1", "LANG=en_US.UTF-8"}
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
- if out, err := execTool(ctx, "/usr/bin/xcode-select", "-p"); err == nil && filepath.IsAbs(strings.TrimSpace(out)) {
+ if out, err := h.run(ctx, "/usr/bin/xcode-select", "-p"); err == nil && filepath.IsAbs(strings.TrimSpace(out)) {
h.env = append(h.env, "DEVELOPER_DIR="+strings.TrimSpace(out))
}
cancel()
@@ -318,7 +338,7 @@ func newMacHost(c runner.Config, o Options, getenv func(string) string) (*macHos
return mac.ChecksSettings(mac.ChecksInput{Paths: h.paths, Tree: tree, Attempt: attempt, Mach: mac.CheckMachServices})
}
booted := func(ctx context.Context) []string {
- out, err := execTool(ctx, h.tools.Xcrun, "simctl", "list", "-j", "devices", "booted")
+ out, err := h.run(ctx, h.tools.Xcrun, "simctl", "list", "-j", "devices", "booted")
var udids []string
if err == nil {
for _, s := range mac.ParseSimulators([]byte(out)) {
@@ -332,7 +352,7 @@ func newMacHost(c runner.Config, o Options, getenv func(string) string) (*macHos
shutdown := func(ctx context.Context, udid string) {
c, cancel := context.WithTimeout(ctx, time.Minute)
defer cancel()
- _, _ = execTool(c, h.tools.Xcrun, "simctl", "shutdown", udid)
+ _, _ = h.run(c, h.tools.Xcrun, "simctl", "shutdown", udid)
}
gate := func(srt, label string) *mac.Gate {
g := &mac.Gate{SRT: srt, Env: h.env, Caffeinate: "/usr/bin/caffeinate", Booted: booted, Shutdown: shutdown, Lines: wire.MaxChecksLines, Sandbox: label}
@@ -346,7 +366,7 @@ func newMacHost(c runner.Config, o Options, getenv func(string) string) (*macHos
}, func() string { return srtFingerprint(h.tools) })
h.checks = &macChecks{probes: h.probes, srt: h.tools.SRT, sandboxed: gate(h.tools.SRT, wire.SandboxSeatbelt), unproven: gate(h.tools.SRT, wire.SandboxNone), bare: gate("", wire.SandboxNone)}
h.caps = func(ctx context.Context) wire.Capabilities {
- caps := mac.Capabilities(ctx, execTool, h.tools)
+ caps := mac.Capabilities(ctx, h.run, h.tools)
if probes := h.probes.report().Probes; len(probes) > 0 {
caps.Probes = probes
}
@@ -356,7 +376,7 @@ func newMacHost(c runner.Config, o Options, getenv func(string) string) (*macHos
}
func (h *macHost) probeHost(version string, gate func(string, string) *mac.Gate) mac.ProbeHost {
- return mac.ProbeHost{Exec: execTool, Tools: h.tools, Paths: h.paths, Scratch: filepath.Join(h.scratch, "probes"), UID: os.Getuid(), Version: version,
+ return mac.ProbeHost{Exec: h.run, Tools: h.tools, Paths: h.paths, Scratch: filepath.Join(h.scratch, "probes"), UID: os.Getuid(), Version: version,
Gate: func(sandboxed bool) *mac.Gate {
if sandboxed {
return gate(h.tools.SRT, wire.SandboxSeatbelt)
@@ -390,20 +410,12 @@ func (h *macHost) find(dir string) (gate, string, bool) {
return gate{name: mac.XcodeGateName, argv: argv}, reason, true
}
-// exportPath puts the runner's own Node and ripgrep first on its PATH:
-// srt starts through `#!/usr/bin/env node` and looks for rg there, and
-// launchd gives an agent only the system's PATH.
-func (h *macHost) exportPath() {
- _ = os.Setenv("PATH", gatePath(h.tools)+":"+os.Getenv("PATH"))
-}
-
// runMac serves the instance as a Mac worker.
func runMac(ctx context.Context, c runner.Config, o Options) error {
- h, err := newMacHost(c, o, os.Getenv)
+ h, err := newMacHost(c, o)
if err != nil {
return err
}
- h.exportPath()
if o.Logger != nil && h.tools.SRT == "" {
o.Logger.Warn("srt is not installed: checks run outside the sandbox and say so")
}
@@ -426,11 +438,10 @@ func ProbeRequest(c runner.Config) string { return filepath.Join(c.StateDir, "pr
// asking, and asks the running worker to run its own: only a worker's
// own run decides how it confines checks.
func RunProbes(ctx context.Context, c runner.Config, o Options) (mac.Report, error) {
- h, err := newMacHost(c, o, os.Getenv)
+ h, err := newMacHost(c, o)
if err != nil {
return mac.Report{}, err
}
- h.exportPath()
r := h.probes.run(ctx)
if err := ctx.Err(); err != nil {
return r, err
diff --git a/internal/runner/thin/mac_test.go b/internal/runner/thin/mac_test.go
index 573568a3..4ba06719 100644
--- a/internal/runner/thin/mac_test.go
+++ b/internal/runner/thin/mac_test.go
@@ -272,7 +272,9 @@ func TestMacHostPaths(t *testing.T) {
was := macUsers
macUsers = users
defer func() { macUsers = was }()
- h, err := newMacHost(c, Options{Version: "v1", AccountsRoot: filepath.Join(root, "accounts")}, func(k string) string { return tools[k] })
+ // The tools come from the runner's own environment (its env file),
+ // not the process's.
+ h, err := newMacHost(c, OptionsFromEnv(func(k string) string { return tools[k] }))
if err != nil {
t.Fatal(err)
}
@@ -293,10 +295,10 @@ func TestMacHostPaths(t *testing.T) {
// srt starts through `env node` and looks for rg on the PATH: the
// runner's own Node and ripgrep come first, for the runner and its gates.
t.Setenv("PATH", "/usr/bin:/bin")
- h.exportPath()
- path := strings.Split(os.Getenv("PATH"), ":")
- if !slices.Contains(path[:2], filepath.Dir(tools["EQUIPO_NODE_PATH"])) || !slices.Contains(path[:2], filepath.Dir(tools["EQUIPO_RG_PATH"])) {
- t.Fatalf("PATH %v", path)
+ out, err := h.run(context.Background(), "/bin/sh", "-c", "echo $PATH")
+ path := strings.Split(strings.TrimSpace(out), ":")
+ if err != nil || !slices.Contains(path[:2], filepath.Dir(tools["EQUIPO_NODE_PATH"])) || !slices.Contains(path[:2], filepath.Dir(tools["EQUIPO_RG_PATH"])) {
+ t.Fatalf("a tool's PATH %v %v", path, err)
}
if !strings.Contains(strings.Join(h.env, " "), "PATH="+filepath.Dir(tools["EQUIPO_RG_PATH"])+":"+filepath.Dir(tools["EQUIPO_NODE_PATH"])+":") {
t.Fatalf("gate env %v", h.env)
diff --git a/internal/runner/thin/protocol_test.go b/internal/runner/thin/protocol_test.go
index 306811ca..5c51c557 100644
--- a/internal/runner/thin/protocol_test.go
+++ b/internal/runner/thin/protocol_test.go
@@ -130,3 +130,61 @@ func TestLinkSpeaksProtocol2(t *testing.T) {
t.Fatalf("spoken %d %q", p, role)
}
}
+
+// A runner the instance made a worker stays one, whatever its OS: the
+// role is kept in its state; refused by an older instance it does not fall
+// back to protocol 1, and it never accepts a primary's welcome.
+func TestWorkerIdentityPersists(t *testing.T) {
+ defer func(d time.Duration) { olderRetry = d }(olderRetry)
+ olderRetry = time.Hour
+ inst := newFakeInstance(t)
+ logs := &syncBuffer{}
+ link, state, _, _ := startLink(t, inst.url, &stubCoordinator{})
+ link.Logger = slog.New(slog.NewTextHandler(logs, nil))
+ c := <-inst.conns
+ read(t, c, wire.FrameHello)
+ write(t, c, wiretest.Fixture("frames/welcome-worker.json"))
+ read(t, c, wire.FrameSync)
+ if role, _ := state.meta(context.Background(), "role"); role != wire.RoleWorker {
+ t.Fatalf("role not kept: %q", role)
+ }
+ write(t, c, wiretest.Fixture("frames/drain.json"))
+ older := <-inst.conns
+ if refused, _ := olderInstance(t, older); !refused {
+ t.Fatal("the worker's hello was not protocol 2")
+ }
+ select {
+ case again := <-inst.conns:
+ ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
+ defer cancel()
+ _, raw, _ := again.Read(ctx)
+ t.Fatalf("a worker fell back to protocol 1: %s", raw)
+ case <-time.After(1500 * time.Millisecond):
+ }
+}
+
+func TestWorkerRefusesAPrimaryWelcome(t *testing.T) {
+ defer func(d time.Duration) { olderRetry = d }(olderRetry)
+ olderRetry = time.Hour
+ inst := newFakeInstance(t)
+ _, _, _, _ = startLink(t, inst.url, &stubCoordinator{}, func(s *State) {
+ if err := s.setMeta(context.Background(), "role", wire.RoleWorker); err != nil {
+ t.Fatal(err)
+ }
+ })
+ c := <-inst.conns
+ read(t, c, wire.FrameHello)
+ raw, _ := json.Marshal(wire.Frame{ID: "w-p", Type: wire.FrameWelcome, Data: json.RawMessage(`{"generation":3,"runner_id":"RUNNER1","protocol":2,"role":"primary"}`)})
+ write(t, c, raw)
+ ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
+ defer cancel()
+ for {
+ _, msg, err := c.Read(ctx)
+ if err != nil {
+ return
+ }
+ if f, _, _ := wire.ParseFrame(msg); f.Type == wire.FrameSync {
+ t.Fatalf("a worker served as primary: %s", msg)
+ }
+ }
+}
diff --git a/internal/runner/thin/relay.go b/internal/runner/thin/relay.go
index 8024d1ec..b3aa726c 100644
--- a/internal/runner/thin/relay.go
+++ b/internal/runner/thin/relay.go
@@ -120,6 +120,10 @@ func (s *State) pack(ctx context.Context, want wire.TransferHeader) ([]byte, err
if total == -1 {
total, digest = tot, sum
}
+ if tot > wire.MaxTransferChunks {
+ // Declared too large to relay.
+ return nil, errPackRefused
+ }
if idx != n || tot != total || sum != digest || int64(buf.Len()+len(data)) > wire.MaxTransferBytes {
return nil, errPackRefused
}
@@ -175,7 +179,7 @@ func (s *State) queueUpload(ctx context.Context, h wire.TransferHeader, pack []b
if int64(len(pack)) > wire.MaxTransferBytes {
// Too large to relay: one chunk says so (the instance refuses a
// total past the bound and the checks end as not run).
- total = int(wire.MaxTransferBytes/wire.MaxBlobChunk) + 2
+ total = wire.MaxTransferChunks + 1
pack = pack[:wire.MaxBlobChunk]
}
return s.tx(ctx, func(t *sql.Tx) error {
diff --git a/internal/runner/thin/relay_test.go b/internal/runner/thin/relay_test.go
index 996591f1..c4ec0c03 100644
--- a/internal/runner/thin/relay_test.go
+++ b/internal/runner/thin/relay_test.go
@@ -238,3 +238,32 @@ func TestRelayRefusesAWrongCommit(t *testing.T) {
t.Fatalf("wrong commit %+v", reps)
}
}
+
+// A pack too large to relay is declared by a chunk count past the shared
+// bound, which the instance refuses at once; the worker refuses it too.
+func TestRelayDeclaresOversize(t *testing.T) {
+ r := newRelayRig(t)
+ h := r.header()
+ if err := r.e.O.State.AcceptUpload(context.Background(), "up-1", wire.SendPackCommand{Transfer: h, Have: []string{}}); err != nil {
+ t.Fatal(err)
+ }
+ big := make([]byte, wire.MaxTransferBytes+10)
+ if err := r.e.O.State.queueUpload(context.Background(), h, big); err != nil {
+ t.Fatal(err)
+ }
+ frames, _, _ := r.e.O.State.Unacked(context.Background(), 0)
+ if len(frames) != 1 {
+ t.Fatalf("%d chunks for an oversized pack", len(frames))
+ }
+ var b wire.Blob
+ json.Unmarshal(frames[0].Data, &b)
+ if b.Total <= wire.MaxTransferChunks {
+ t.Fatalf("declared total %d is within the bound %d", b.Total, wire.MaxTransferChunks)
+ }
+ if err := r.e.O.State.AcceptChunk(context.Background(), "in-1", b); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := r.e.O.State.pack(context.Background(), h); !errors.Is(err, errPackRefused) {
+ t.Fatalf("the receiver took a declared oversize: %v", err)
+ }
+}
diff --git a/internal/runner/thin/run.go b/internal/runner/thin/run.go
index b6ce394f..b86b4b93 100644
--- a/internal/runner/thin/run.go
+++ b/internal/runner/thin/run.go
@@ -66,6 +66,9 @@ type Options struct {
// build's fake Mac worker; any other build refuses it. FakeBin is put
// first on its gates' PATH (the fake xcodebuild).
FakePlatform, FakeBin string
+ // Getenv is the environment the runner was started with, its env
+ // file (--env-file) included; nil is the process's.
+ Getenv func(string) string
// FakeSandbox is what the fake worker says confined its checks
// (EQUIPO_FAKE_SANDBOX): none unless a scenario plays a Mac whose
// probe P2 denied (seatbelt). Test build only, like the fake itself.
@@ -79,7 +82,7 @@ type Options struct {
// OptionsFromEnv reads the runner's optional thin settings.
func OptionsFromEnv(getenv func(string) string) Options {
- return Options{FakePlatform: getenv("EQUIPO_FAKE_PLATFORM"), FakeBin: getenv("EQUIPO_FAKE_BIN"), FakeSandbox: getenv("EQUIPO_FAKE_SANDBOX"), NoCreate: getenv("EQUIPO_RUNNER_CREATE_REPOS") == "0", Home: getenv("EQUIPO_RUNNER_HOME_NAMESPACE"), NoMoveIn: getenv("EQUIPO_RUNNER_MOVE_IN") == "0", IndexPace: 4 * time.Second, AccountsRoot: getenv("EQUIPO_ACCOUNTS_ROOT")}
+ return Options{Getenv: getenv, FakePlatform: getenv("EQUIPO_FAKE_PLATFORM"), FakeBin: getenv("EQUIPO_FAKE_BIN"), FakeSandbox: getenv("EQUIPO_FAKE_SANDBOX"), NoCreate: getenv("EQUIPO_RUNNER_CREATE_REPOS") == "0", Home: getenv("EQUIPO_RUNNER_HOME_NAMESPACE"), NoMoveIn: getenv("EQUIPO_RUNNER_MOVE_IN") == "0", IndexPace: 4 * time.Second, AccountsRoot: getenv("EQUIPO_ACCOUNTS_ROOT")}
}
// SessionRoot is where durable coordinator transcripts live by default:
diff --git a/internal/runnerproto/types.go b/internal/runnerproto/types.go
index 0355622f..4a6b31f1 100644
--- a/internal/runnerproto/types.go
+++ b/internal/runnerproto/types.go
@@ -20,6 +20,9 @@ type BeginEnrolmentRequest struct {
Version int `json:"version"`
MachinePublicKey string `json:"machine_public_key"`
Label string `json:"label"`
+ // WorkerOnly: the machine can only be a worker (a Mac). The instance
+ // refuses to approve it for a person with no primary runner.
+ WorkerOnly bool `json:"worker_only,omitempty"`
}
type DeviceCode struct {
diff --git a/internal/thintest/review1_contract_test.go b/internal/thintest/review1_contract_test.go
new file mode 100644
index 00000000..a1823a5e
--- /dev/null
+++ b/internal/thintest/review1_contract_test.go
@@ -0,0 +1,256 @@
+package thintest
+
+import (
+ "context"
+ "strings"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/equipo"
+ "amadan.net/oficina/equipo/internal/equipo/chat"
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// revoke revokes a runner as the owner.
+func (r *runnersRig) revoke(id string) {
+ r.t.Helper()
+ var revision int64
+ if err := r.inst.DB.Writer().QueryRow("SELECT revision FROM runners WHERE id = ?", id).Scan(&revision); err != nil {
+ r.t.Fatal(err)
+ }
+ if err := r.inst.Store.RevokeRunner(r.ctx, equipo.Actor{Address: Owner}, id, revision); err != nil {
+ r.t.Fatal(err)
+ }
+}
+
+// A revoked primary keeps its attempts until their termination is
+// proven: its unacked dispatch is not sent to the replacement (a lost ack
+// may mean it runs), its running step stays its own, the replacement's
+// empty sync ends neither, and Retry stays refused.
+func TestContractRevokedPrimaryKeepsItsAttempts(t *testing.T) {
+ r := newRunnersRig(t)
+ ctx := r.ctx
+ old := r.runner.Welcome.RunnerID
+ running := taskID(t, r.call("v1", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Running when revoked", "brief": "b"}))
+ r.call("v2", wire.ToolStartTask, map[string]string{"task": running, "brief": "go"})
+ _, body := r.expect(wire.FrameDispatch)
+ d := body.(*wire.DispatchCommand)
+ r.step("v-run", wire.StepReport{TaskID: running, StepID: d.StepID, Attempt: 1, State: wire.StepRunning, BaseSHA: strings.Repeat("1", 40), Findings: []wire.Finding{}})
+ unacked := taskID(t, r.call("v3", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Dispatched, never acked", "brief": "b"}))
+ r.call("v4", wire.ToolStartTask, map[string]string{"task": unacked, "brief": "go"})
+ r.runner.Close()
+ r.revoke(old)
+
+ token := r.inst.EnrolRunner(t).Token
+ p, err := DialRunnerHello(ctx, r.inst.URL, token, primaryHello(0))
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer p.Close()
+ if p.Welcome.Role != wire.RolePrimary {
+ t.Fatalf("replacement welcome %+v", p.Welcome)
+ }
+ np := &peer{t: t, r: r.toolRig, fr: p}
+ np.send(wire.FrameSync, wire.Sync{Sessions: []wire.SessionState{}, Runs: []wire.Run{}, Steps: []wire.StepRun{}, Asks: []wire.AskRun{}})
+ np.send(wire.FrameStep, wire.StepReport{TaskID: running, StepID: d.StepID, Attempt: 1, State: wire.StepRunning, Findings: []wire.Finding{}})
+ for _, id := range []string{running, unacked} {
+ k, err := r.client.Task(ctx, id)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if s := k.Steps[0]; wire.StepTerminal(s.State) || s.Terminated || s.RunnerID != old {
+ t.Fatalf("the replacement took the revoked primary's attempt %s: %+v", id, s)
+ }
+ if _, err := r.client.RetryTask(ctx, id); Status(err) != 409 {
+ t.Fatalf("retry of an unproven attempt: %v", err)
+ }
+ }
+ np.none(wire.FrameDispatch, 100*time.Millisecond)
+}
+
+// Never-dispatched waiting checks end on Cancel, locally: nothing is
+// sent to an empty runner id, and the task is cancelled at once.
+func TestContractCancelWaitingSteps(t *testing.T) {
+ r := newRunnersRig(t)
+ w, _ := r.newWorker("Tito Studio")
+ w.fr.Close()
+ time.Sleep(100 * time.Millisecond)
+ task, _ := r.candidate("iOS waiting", true)
+ if s := r.checksStep(task); s.Placement != wire.PlacementWaiting {
+ t.Fatalf("not waiting %+v", s)
+ }
+ if _, err := r.client.CancelTask(r.ctx, task); err != nil {
+ t.Fatal(err)
+ }
+ k, _ := r.client.Task(r.ctx, task)
+ s := r.checksStep(task)
+ if k.Stage != wire.StageCancelled || s.State != wire.StepCancelled || !s.Terminated {
+ t.Fatalf("cancel of a waiting step: task %s step %+v", k.Stage, s)
+ }
+ var n int
+ if err := r.inst.DB.Writer().QueryRow("SELECT count(*) FROM runner_commands WHERE coalesce(runner_id, '') = '' AND kind IN (?, ?)", wire.FrameCancelStep, wire.FrameDispatch).Scan(&n); err != nil || n != 0 {
+ t.Fatalf("%d commands to nobody: %v", n, err)
+ }
+}
+
+// Engineering's pin survives the step's own save: a new task records the
+// runner its Engineering ran on.
+func TestContractEngineeringPinKept(t *testing.T) {
+ r := newRunnersRig(t)
+ task, _ := r.candidate("Pinned", false)
+ k, err := r.client.Task(r.ctx, task)
+ if err != nil || k.EngineeringRunner != r.runner.Welcome.RunnerID {
+ t.Fatalf("pin %q, want %q: %v", k.EngineeringRunner, r.runner.Welcome.RunnerID, err)
+ }
+}
+
+// startedOnWorker places checks on the only worker, starts the attempt,
+// takes the worker away for the offline limit (a fake clock), and has the
+// sweep withdraw the started attempt; the worker comes back to its cancel.
+func (r *runnersRig) startedOnWorker(title string) (task, step string, w *peer, sha string) {
+ r.t.Helper()
+ w, token := r.newWorker("Tito Studio")
+ task, sha = r.candidate(title, true)
+ _, body := w.expect(wire.FrameDispatch)
+ d := body.(*wire.DispatchCommand)
+ if !w.lease(d.StepID, 1) {
+ r.t.Fatal("start refused")
+ }
+ gen := w.fr.Welcome.Generation
+ w.fr.Close()
+ later := time.Now().UTC().Add(chat.OfflineLimit + time.Minute)
+ r.inst.Store.Chat().SetClock(func() time.Time { return later })
+ if err := r.inst.Store.Chat().Place(r.ctx); err != nil {
+ r.t.Fatal(err)
+ }
+ r.inst.Store.Chat().SetClock(func() time.Time { return time.Now().UTC() })
+ w = r.dialWorker(token, "Tito Studio", gen)
+ _, body = w.expect(wire.FrameCancelStep)
+ if c := body.(*wire.CancelStepCommand); c.StepID != d.StepID || c.Attempt != 1 {
+ r.t.Fatalf("cancel %+v", c)
+ }
+ return task, d.StepID, w, sha
+}
+
+// Withdrawal comes first (M6): a withdrawn attempt's delayed success does
+// not count; a failure without proof waits for the proof, and the proof
+// then places the next attempt; Retry works on that next attempt.
+func TestContractWithdrawnAttemptReports(t *testing.T) {
+ r := newRunnersRig(t)
+ task, step, w, sha := r.startedOnWorker("Withdrawn, then passed")
+ w.send(wire.FrameStep, passed(task, step, 1, sha))
+ s := r.checksStep(task)
+ if s.Checks == wire.ChecksPassed || s.Attempt != 2 {
+ t.Fatalf("a withdrawn attempt's delayed success counted: %+v", s)
+ }
+ _, body := w.expect(wire.FrameDispatch)
+ if d := body.(*wire.DispatchCommand); d.StepID != step || d.Attempt != 2 {
+ t.Fatalf("next attempt %+v", d)
+ }
+ // Attempt 2 fails normally (with its proof): Retry gives attempt 3,
+ // which may start.
+ if !w.lease(step, 2) {
+ t.Fatal("attempt 2 refused")
+ }
+ w.send(wire.FrameStep, wire.StepReport{TaskID: task, StepID: step, Attempt: 2, State: wire.StepFailed, Reason: "provider_failed", Termination: true, Findings: []wire.Finding{}})
+ if acc, err := r.client.RetryTask(r.ctx, task); err != nil || acc.Attempt != 3 {
+ t.Fatalf("retry after withdrawal %+v %v", acc, err)
+ }
+ w.expect(wire.FrameDispatch)
+ if !w.lease(step, 3) {
+ t.Fatal("attempt 3 refused after Retry")
+ }
+}
+
+func TestContractWithdrawnProofAfterFailure(t *testing.T) {
+ r := newRunnersRig(t)
+ task, step, w, _ := r.startedOnWorker("Withdrawn, failed, proven")
+ w.send(wire.FrameStep, wire.StepReport{TaskID: task, StepID: step, Attempt: 1, State: wire.StepCancelled, Reason: "cancelled", Findings: []wire.Finding{}})
+ if s := r.checksStep(task); s.Attempt != 1 || s.Terminated {
+ t.Fatalf("before the proof %+v", s)
+ }
+ w.send(wire.FrameStep, wire.StepReport{TaskID: task, StepID: step, Attempt: 1, State: wire.StepCancelled, Reason: "cancelled", Termination: true, TerminationKind: wire.TerminationProcessGroup, Findings: []wire.Finding{}})
+ _, body := w.expect(wire.FrameDispatch)
+ if d := body.(*wire.DispatchCommand); d.StepID != step || d.Attempt != 2 {
+ t.Fatalf("the proof did not place the next attempt: %+v", d)
+ }
+}
+
+// The primary may publish before the worker's final report: that report
+// keeps the primary's publication, and checks follow.
+func TestContractPublishedBeforeWorkerDone(t *testing.T) {
+ r := newRunnersRig(t)
+ w, _ := r.newWorker("Mac A")
+ task := taskID(t, r.call("c-early", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Published early", "brief": "b"}))
+ r.pinWorker(task, w)
+ r.call("s-early", wire.ToolStartTask, map[string]string{"task": task, "brief": "go"})
+ _, body := w.expect(wire.FrameDispatch)
+ d := body.(*wire.DispatchCommand)
+ if !w.lease(d.StepID, d.Attempt) {
+ t.Fatal("start refused")
+ }
+ sha := strings.Repeat("c", 40)
+ w.send(wire.FrameStep, wire.StepReport{TaskID: task, StepID: d.StepID, Attempt: 1, State: wire.StepRunning, BaseSHA: strings.Repeat("1", 40), Findings: []wire.Finding{}})
+ w.send(wire.FrameStep, wire.StepReport{TaskID: task, StepID: d.StepID, Attempt: 1, State: wire.StepRunning, CandidateSHA: sha, Phase: "committed", Findings: []wire.Finding{}})
+ _, body = w.expect(wire.FrameSendPack)
+ h := body.(*wire.SendPackCommand).Transfer
+ w.send(wire.FrameBlob, chunk(h, []byte("PACK commit")))
+ _, body = r.primary.expect(wire.FramePublish)
+ pub := body.(*wire.PublishCommand)
+ r.primary.send(wire.FramePublished, wire.PublishedReport{Publication: pub.Publication, TaskID: task, StepID: d.StepID, Attempt: 1, CandidateSHA: sha, Pushed: true})
+ w.send(wire.FrameStep, wire.StepReport{TaskID: task, StepID: d.StepID, Attempt: 1, State: wire.StepDone, CandidateSHA: sha, Termination: true, Findings: []wire.Finding{}})
+ k, _ := r.client.Task(r.ctx, task)
+ if !k.Steps[0].Pushed || k.Steps[0].Publication != wire.PublicationPublished || k.CandidateSHA != sha {
+ t.Fatalf("the worker's report cleared the publication: %+v", k.Steps[0])
+ }
+ _, body = r.expect(wire.FrameDispatch)
+ if c := body.(*wire.DispatchCommand); c.Specialist != wire.SpecialistChecks || c.CandidateSHA != sha {
+ t.Fatalf("checks %+v", c)
+ }
+}
+
+// A pack too large to relay is declared by its chunk count, and both ends
+// read it the same way: the checks end as not run (checks_unavailable).
+func TestContractTransferDeclaredTooLarge(t *testing.T) {
+ r := newRunnersRig(t)
+ w, _ := r.newWorker("Mac A")
+ task, _ := r.candidate("iOS huge", true)
+ _, body := r.primary.expect(wire.FrameSendPack)
+ h := body.(*wire.SendPackCommand).Transfer
+ w.expect(wire.FrameDispatch)
+ c := chunk(h, []byte("PACK"))
+ c.Total = wire.MaxTransferChunks + 1
+ r.primary.send(wire.FrameBlob, c)
+ s := r.checksStep(task)
+ if s.State != wire.StepDone || s.Checks != wire.ChecksCannotRun || s.Reason != "checks_unavailable" {
+ t.Fatalf("declared oversize %+v", s)
+ }
+ if n := r.relayed(w); n != 0 {
+ t.Fatal("an oversized chunk was relayed")
+ }
+}
+
+// Asking a specialist whose runner is offline is answered at once: the
+// runner is offline (runner_offline), nothing queues.
+func TestContractAskOfflineRunner(t *testing.T) {
+ r := newToolRig(t)
+ id, _, _ := r.askableTask("o", strings.Repeat("1", 40), strings.Repeat("2", 40))
+ r.runner.Close()
+ deadline := time.Now().Add(5 * time.Second)
+ for {
+ runners, err := r.client.Runners(context.Background())
+ if err == nil && len(runners.Items) == 1 && !runners.Items[0].Online {
+ break
+ }
+ if time.Now().After(deadline) {
+ t.Fatalf("runner still online: %+v %v", runners, err)
+ }
+ time.Sleep(50 * time.Millisecond)
+ }
+ if _, err := r.client.Ask(r.ctx, id, "What did you change?", "", "off-1"); Status(err) != 409 || !strings.Contains(err.Error(), "runner_offline") {
+ t.Fatalf("ask of an offline runner: %v", err)
+ }
+ if k, _ := r.client.Task(r.ctx, id); len(k.Questions) != 0 {
+ t.Fatalf("a question queued for an offline runner: %+v", k.Questions)
+ }
+}
diff --git a/internal/wire/runners.go b/internal/wire/runners.go
index 9c42fd49..f517901e 100644
--- a/internal/wire/runners.go
+++ b/internal/wire/runners.go
@@ -232,6 +232,10 @@ const (
MaxBlobChunk = MaxBlobData / 4 * 3
MaxTransferBytes = 64 << 20
TransferTTL = 24 * time.Hour
+ // MaxTransferChunks is the most chunks a transfer within the bound
+ // has. A sender declares a pack too large to relay by a total past it,
+ // and the receiver refuses such a transfer at its first chunk.
+ MaxTransferChunks = (MaxTransferBytes + MaxBlobChunk - 1) / MaxBlobChunk
)
// Protocol 2 frames.
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json
index a0aaafdc..c054d0c8 100644
--- a/scripts/runner-reference-allowlist.json
+++ b/scripts/runner-reference-allowlist.json
@@ -11906,27 +11906,6 @@
"count": 5,
"reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
},
- {
- "path": "cmd/equipo-runner/install_mac_test.go",
- "line_sha256": "f5f0d45448122e74aff841b8d235ae19315f82d12d3d93948f4be12794d45ff9",
- "match": "equipo-runner",
- "count": 1,
- "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
- },
- {
- "path": "cmd/equipo-runner/install_mac_test.go",
- "line_sha256": "f5f0d45448122e74aff841b8d235ae19315f82d12d3d93948f4be12794d45ff9",
- "match": "node",
- "count": 1,
- "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
- },
- {
- "path": "cmd/equipo-runner/install_mac_test.go",
- "line_sha256": "f5f0d45448122e74aff841b8d235ae19315f82d12d3d93948f4be12794d45ff9",
- "match": "npm",
- "count": 2,
- "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
- },
{
"path": "cmd/equipo-runner/install_mac_test.go",
"line_sha256": "fa801fa5bbeebd55bd3144ad9349d9ce9305196ccc9ee74d673a1a75f61c76f1",
@@ -12102,20 +12081,6 @@
"count": 4,
"reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
},
- {
- "path": "internal/runner/thin/mac.go",
- "line_sha256": "60c21e4b953aec0d9d2e3baa3be353328482ca842a8c5e6540e3a01eb4412f92",
- "match": "Node",
- "count": 1,
- "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
- },
- {
- "path": "internal/runner/thin/mac.go",
- "line_sha256": "94c2767d250b479a23386fed2ba3f21c309bd93c6d0619998d217d4d6729d676",
- "match": "node",
- "count": 1,
- "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
- },
{
"path": "internal/runner/thin/mac_test.go",
"line_sha256": "30d2608e97db6f869b56244581473df7ea0012b1a4dd9ac9e8a503c0719db2cc",
@@ -12123,13 +12088,6 @@
"count": 1,
"reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
},
- {
- "path": "internal/runner/thin/mac_test.go",
- "line_sha256": "77413ef0640dd5c60c7e7e9f81ef2f1e48c3a99bf765f15915106f3f14d7b7d2",
- "match": "NODE",
- "count": 1,
- "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
- },
{
"path": "internal/runner/thin/mac_test.go",
"line_sha256": "80cd65a8b6cb8b1a01559cf1222095ea504d393d443930e16843f55470b1d5bf",
@@ -12269,5 +12227,96 @@
"match": "node",
"count": 1,
"reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "cmd/equipo-runner/install_mac_test.go",
+ "line_sha256": "074770425a8494e5f4a30a0626184c59e459aa86b691eeb664cad6eda8461888",
+ "match": "npm",
+ "count": 2,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "cmd/equipo-runner/install_mac_test.go",
+ "line_sha256": "56b904f0bc380ff9c9aea7abf98cfd05a3e0e0fcf4b6ec2e9a3ca8fa30524139",
+ "match": "npm",
+ "count": 2,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "cmd/equipo-runner/install_mac_test.go",
+ "line_sha256": "692588f6fae47f7c0040a7ce28773296800a75ac6815122ab53d37973f5940ff",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "cmd/equipo-runner/install_mac_test.go",
+ "line_sha256": "aa31e89835c64ee9af93ec3edc913f3be69107008695f9f27be74df70fa8c506",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "cmd/equipo-runner/install_mac_test.go",
+ "line_sha256": "aa31e89835c64ee9af93ec3edc913f3be69107008695f9f27be74df70fa8c506",
+ "match": "node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "cmd/equipo-runner/install_mac_test.go",
+ "line_sha256": "aa31e89835c64ee9af93ec3edc913f3be69107008695f9f27be74df70fa8c506",
+ "match": "npm",
+ "count": 2,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "cmd/equipo-runner/install_mac_test.go",
+ "line_sha256": "f33b494398db4ef39fe58e521efddc4a520662b11256141d67bab2d3d3038044",
+ "match": "npm",
+ "count": 2,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "docs/superpowers/plans/DARWIN-PROGRESS.md",
+ "line_sha256": "1cda0dbeca065e87e52e7fafaa597966ee82924ea66ea17dd90c02c6690a318e",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "docs/superpowers/plans/DARWIN-PROGRESS.md",
+ "line_sha256": "4f653c22c76491c8885721fe77927ff45b74af99be435160050778fe6715425a",
+ "match": "Node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "docs/superpowers/plans/DARWIN-PROGRESS.md",
+ "line_sha256": "c17fec302bcc992e6f904c368f5dd06f876e622d1850b9a0451c34dd9eda57f7",
+ "match": "Node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "internal/runner/thin/mac.go",
+ "line_sha256": "b1b804c0ea749dc032f95ddcc0b8bbee293fc546559d50dc08f61b11a7a22074",
+ "match": "Node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "internal/runner/thin/mac.go",
+ "line_sha256": "b1b804c0ea749dc032f95ddcc0b8bbee293fc546559d50dc08f61b11a7a22074",
+ "match": "node",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
+ },
+ {
+ "path": "internal/runner/thin/mac_test.go",
+ "line_sha256": "ba26e2d09fae9396e195c1b0d9c91d33a53b9f35ea68f57f2b2254782121bb07",
+ "match": "NODE",
+ "count": 1,
+ "reason": "Mac runner (darwin worker): the runner executable, its launchd agent, install paths, the pinned srt package and Node it needs, and their tests and docs."
}
]