oficina / equipo Public

CI: mac budget TestMain, release fake builds, fake worker label

- internal/runner/mac gets the budget TestMain every package has.
- The release contract's fake go took any arm64 build for the
  instance's; only linux/arm64 is. It appends its captures, and the
  test now asks for the darwin runner, stamped like the Linux one.
- The fake worker labels its checks none unless EQUIPO_FAKE_SANDBOX
  says seatbelt; TestMacWorker plays a Mac whose P2 denied, so its
  scenarios still end merged (checks outside the sandbox are asked
  about, which the contract test covers).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 05c5e14c99585650e8ccc2baf57c2ff4980f95e1 parent 24a55be
9 files changed, +50 −13
  • docs/superpowers/plans/DARWIN-PROGRESS.md +4 −1
  • internal/equipotest/runner_release_test.go +6 −1
  • internal/headless/env_test.go +3 −3
  • internal/headless/mac_test.go +5 −2
  • internal/runner/mac/budget_test.go +10 −0
  • internal/runner/thin/fakeworker.go +1 −1
  • internal/runner/thin/fakeworker_testbuild.go +8 −3
  • internal/runner/thin/run.go +6 −2
  • scripts/runner-reference-allowlist.json +7 −0

CI failed — run details

diff --git a/docs/superpowers/plans/DARWIN-PROGRESS.md b/docs/superpowers/plans/DARWIN-PROGRESS.md
index 06f78dab..f5587ce1 100644
--- a/docs/superpowers/plans/DARWIN-PROGRESS.md
+++ b/docs/superpowers/plans/DARWIN-PROGRESS.md
@@ -55,7 +55,10 @@ srt and xcodebuild, and the test build's fake worker. Conventions as in
version's and profile's, steps wait for them; `equipo-runner probe`
on demand; self-update to the instance's release (darwin target,
digest, swapped while no step runs, exit 75); `run --env-file`.
- The test build's fake worker now runs the Mac gate.
+ The test build's fake worker now runs the Mac gate; it labels its
+ checks none (it has no sandbox) unless `EQUIPO_FAKE_SANDBOX=seatbelt`
+ makes it play a Mac whose P2 denied, as `TestMacWorker` does so that
+ Equipo still merges its scenarios on its own.
5. **Install**: `install-v1.sh` dispatches on `uname` (Darwin/arm64:
refuses root, reads the darwin target with plutil, checks shasum);
`equipo-runner install` on a Mac refuses root, administrators, users
diff --git a/internal/equipotest/runner_release_test.go b/internal/equipotest/runner_release_test.go
index 0ac584f7..1d10492a 100644
--- a/internal/equipotest/runner_release_test.go
+++ b/internal/equipotest/runner_release_test.go
@@ -68,7 +68,7 @@ func runnerPackagingScenarios(t *testing.T, target string, scenarios []string) {
copyReleaseTrackedTree(t, root)
scripts := map[string]string{
"git": "#!/bin/sh\ncase \"$1\" in diff) [ \"$SCENARIO\" != dirty ];; rev-parse) echo abc1234;; ls-files) if [ \"$SCENARIO\" = untracked ]; then echo unsafe.go; fi;; esac\n",
- "go": "#!/bin/sh\ncase \"$1\" in test) [ \"$SCENARIO\" != copy ];; build) if [ \"$GOARCH\" = arm64 ]; then test -f internal/release/bundled/install-manifest.json || exit 97; fi; printf '%s\\n' \"$GOOS/$GOARCH\" \"$@\" > \"$CAPTURE\"; while [ $# -gt 0 ]; do if [ \"$1\" = -o ]; then shift; cp \"$EQUIPO_TOOL_PROXY_PATH\" \"$1\"; fi; shift; done;; esac\n",
+ "go": "#!/bin/sh\ncase \"$1\" in test) [ \"$SCENARIO\" != copy ];; build) if [ \"$GOOS/$GOARCH\" = linux/arm64 ]; then test -f internal/release/bundled/install-manifest.json || exit 97; fi; printf '%s\\n' \"$GOOS/$GOARCH\" \"$@\" >> \"$CAPTURE\"; while [ $# -gt 0 ]; do if [ \"$1\" = -o ]; then shift; cp \"$EQUIPO_TOOL_PROXY_PATH\" \"$1\"; fi; shift; done;; esac\n",
"codex": "#!/bin/sh\n[ \"$SCENARIO\" != codex ] && echo 'codex-cli 0.165.0'\n",
"bwrap": "#!/bin/sh\nif [ \"$SCENARIO\" = bwrap ]; then echo 'bubblewrap 0.10.0'; else echo 'bubblewrap 0.11.0'; fi\n",
"systemctl": "#!/bin/sh\nexit 98\n",
@@ -119,6 +119,11 @@ func runnerPackagingScenarios(t *testing.T, target string, scenarios []string) {
if !strings.Contains(string(raw), wantTarget) || !strings.Contains(string(raw), "BuildVersion=abc1234") {
t.Fatalf("wrong stamped build: %s", raw)
}
+ // Both runner targets (Mac runners spec §3.1): the Mac worker is
+ // built beside the Linux runner, stamped the same.
+ if !strings.Contains(string(raw), "darwin/arm64\nbuild\n-trimpath\n-ldflags\n-s -w -X amadan.net/rastrillo/rastrillo.BuildVersion=abc1234\n-o\nreleases/equipo-runner-linux-amd64-abc1234/darwin-arm64/equipo-runner") {
+ t.Fatalf("no Mac runner built: %s", raw)
+ }
shipped, err := os.ReadFile(filepath.Join(root, manifestPath))
executionMust(t, err)
source, err := os.ReadFile(filepath.Join(root, "internal/release/manifest.json"))
diff --git a/internal/headless/env_test.go b/internal/headless/env_test.go
index 28dfc0e2..d6db4c5d 100644
--- a/internal/headless/env_test.go
+++ b/internal/headless/env_test.go
@@ -380,7 +380,7 @@ type processConfig struct {
ClaudePath, CodexPath, CodexCodeModeHostPath, BwrapPath, GoRoot string
GoBinary, WorkspaceRoot, ScratchRoot, GitPath, AmadanPath, ToolProxy string
Digest, MoveInNote string
- MachineLabel, FakePlatform, FakeBin string
+ MachineLabel, FakePlatform, FakeBin, FakeSandbox string
CodexDigest, CodexHostDigest, AccountsRoot string
NoMoveIn bool
Idle, LockWait, MaxTurn, Margin time.Duration
@@ -399,7 +399,7 @@ func runnerProcess(path string) int {
cfg := runner.Config{MachineLabel: p.MachineLabel, Origin: p.Origin, InstanceID: p.InstanceID, StateDir: p.StateDir, AccountBindingsPath: p.AccountBindingsPath, AmadanCredentialPath: p.AmadanCredentialPath, ClaudePath: p.ClaudePath, CodexPath: p.CodexPath, CodexCodeModeHostPath: p.CodexCodeModeHostPath, BwrapPath: p.BwrapPath, GoRoot: p.GoRoot, GoBinary: p.GoBinary, WorkspaceRoot: p.WorkspaceRoot, ScratchRoot: p.ScratchRoot, GitPath: p.GitPath, AmadanPath: p.AmadanPath, ToolProxyPath: p.ToolProxy, Executable: self}
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGTERM, os.Interrupt)
defer stop()
- opts := thin.Options{Version: "test", Logger: slog.New(slog.NewTextHandler(os.Stderr, nil)), NoMoveIn: p.NoMoveIn, MergeEvery: time.Second, FakePlatform: p.FakePlatform, FakeBin: p.FakeBin}
+ opts := thin.Options{Version: "test", Logger: slog.New(slog.NewTextHandler(os.Stderr, nil)), NoMoveIn: p.NoMoveIn, MergeEvery: time.Second, FakePlatform: p.FakePlatform, FakeBin: p.FakeBin, FakeSandbox: p.FakeSandbox}
if p.Forge != nil {
opts.Forge = p.Forge.forge()
}
@@ -429,7 +429,7 @@ func (r *localRunner) startProcess(t *testing.T) {
if lf, ok := r.opts.Forge.(*localForge); ok {
fs = lf.state()
}
- raw, _ := json.Marshal(processConfig{Forge: fs, Origin: c.Origin, InstanceID: c.InstanceID, StateDir: c.StateDir, AccountBindingsPath: c.AccountBindingsPath, AmadanCredentialPath: c.AmadanCredentialPath, ClaudePath: c.ClaudePath, CodexPath: c.CodexPath, CodexCodeModeHostPath: c.CodexCodeModeHostPath, BwrapPath: c.BwrapPath, GoRoot: c.GoRoot, GoBinary: c.GoBinary, WorkspaceRoot: c.WorkspaceRoot, ScratchRoot: c.ScratchRoot, GitPath: c.GitPath, AmadanPath: c.AmadanPath, ToolProxy: c.ToolProxyPath, Digest: o.Digest, MoveInNote: o.MoveInNote, CodexDigest: r.opts.Codex.Digest, CodexHostDigest: r.opts.Codex.HostDigest, MachineLabel: c.MachineLabel, FakePlatform: r.opts.FakePlatform, FakeBin: r.opts.FakeBin, AccountsRoot: r.opts.AccountsRoot, NoMoveIn: r.opts.NoMoveIn, Idle: o.Idle, LockWait: o.LockWait, MaxTurn: o.MaxTurn, Margin: o.Margin})
+ raw, _ := json.Marshal(processConfig{Forge: fs, Origin: c.Origin, InstanceID: c.InstanceID, StateDir: c.StateDir, AccountBindingsPath: c.AccountBindingsPath, AmadanCredentialPath: c.AmadanCredentialPath, ClaudePath: c.ClaudePath, CodexPath: c.CodexPath, CodexCodeModeHostPath: c.CodexCodeModeHostPath, BwrapPath: c.BwrapPath, GoRoot: c.GoRoot, GoBinary: c.GoBinary, WorkspaceRoot: c.WorkspaceRoot, ScratchRoot: c.ScratchRoot, GitPath: c.GitPath, AmadanPath: c.AmadanPath, ToolProxy: c.ToolProxyPath, Digest: o.Digest, MoveInNote: o.MoveInNote, CodexDigest: r.opts.Codex.Digest, CodexHostDigest: r.opts.Codex.HostDigest, MachineLabel: c.MachineLabel, FakePlatform: r.opts.FakePlatform, FakeBin: r.opts.FakeBin, FakeSandbox: r.opts.FakeSandbox, AccountsRoot: r.opts.AccountsRoot, NoMoveIn: r.opts.NoMoveIn, Idle: o.Idle, LockWait: o.LockWait, MaxTurn: o.MaxTurn, Margin: o.Margin})
path := filepath.Join(r.root, "runner.json")
if err := os.WriteFile(path, raw, 0600); err != nil {
t.Fatal(err)
diff --git a/internal/headless/mac_test.go b/internal/headless/mac_test.go
index ae295b52..480c323a 100644
--- a/internal/headless/mac_test.go
+++ b/internal/headless/mac_test.go
@@ -54,7 +54,10 @@ func addWoodstar(t *testing.T, root string, f *localForge) {
// macWorker is the fake Mac worker: the real thin runner of the test
// build with EQUIPO_FAKE_PLATFORM, enrolled as the owner's second runner
// (a worker), its own roots, the fake xcodebuild first on its gates'
-// PATH, run as a process so it can be killed.
+// PATH, run as a process so it can be killed. It plays a Mac whose
+// probe P2 denied (checks labelled seatbelt), so Equipo merges on its
+// own; checks outside the sandbox are asked about instead
+// (TestContractChecksPlacedOnTheWorker).
func macWorker(t *testing.T, inst *thintest.Instance, primary *localRunner) (*localRunner, string) {
t.Helper()
root := private(t, filepath.Join(primary.root, "mac"))
@@ -67,7 +70,7 @@ func macWorker(t *testing.T, inst *thintest.Instance, primary *localRunner) (*lo
}
cfg := primary.cfg
cfg.StateDir, cfg.WorkspaceRoot, cfg.ScratchRoot, cfg.MachineLabel = state, filepath.Join(root, "work"), filepath.Join(root, "scratch"), "Tito Studio"
- w := &localRunner{inst: inst, root: root, cfg: cfg, subprocess: true, runnerID: cred.RunnerID, opts: thin.Options{Version: "test", Logger: slog.New(slog.NewTextHandler(io.Discard, nil)), FakePlatform: "darwin/arm64", FakeBin: bin, Claude: primary.opts.Claude}}
+ w := &localRunner{inst: inst, root: root, cfg: cfg, subprocess: true, runnerID: cred.RunnerID, opts: thin.Options{Version: "test", Logger: slog.New(slog.NewTextHandler(io.Discard, nil)), FakePlatform: "darwin/arm64", FakeBin: bin, FakeSandbox: wire.SandboxSeatbelt, Claude: primary.opts.Claude}}
t.Cleanup(func() { w.stop(t) })
return w, filepath.Join(bin, "xcodebuild")
}
diff --git a/internal/runner/mac/budget_test.go b/internal/runner/mac/budget_test.go
new file mode 100644
index 00000000..0ca99766
--- /dev/null
+++ b/internal/runner/mac/budget_test.go
@@ -0,0 +1,10 @@
+package mac
+
+import (
+ "os"
+ "testing"
+
+ "amadan.net/rastrillo/rastrillo/budget"
+)
+
+func TestMain(m *testing.M) { os.Exit(budget.Main(m)) }
diff --git a/internal/runner/thin/fakeworker.go b/internal/runner/thin/fakeworker.go
index a9be164d..78198300 100644
--- a/internal/runner/thin/fakeworker.go
+++ b/internal/runner/thin/fakeworker.go
@@ -12,7 +12,7 @@ type fakeMac interface {
marker() string
platform(spec string) (wire.Platform, bool)
capabilities(context.Context) wire.Capabilities
- gate(bin string) GateRunner
+ gate(bin, sandbox string) GateRunner
}
var fake fakeMac
diff --git a/internal/runner/thin/fakeworker_testbuild.go b/internal/runner/thin/fakeworker_testbuild.go
index 4fe8dce5..19de0aec 100644
--- a/internal/runner/thin/fakeworker_testbuild.go
+++ b/internal/runner/thin/fakeworker_testbuild.go
@@ -44,7 +44,12 @@ func (fakeWorker) capabilities(context.Context) wire.Capabilities {
// gate runs checks in a process group with an environment from scratch:
// HOME and TMPDIR the attempt's scratch, CI=1, a fixed PATH (bin first:
-// the fake xcodebuild).
-func (fakeWorker) gate(bin string) GateRunner {
- return macGate{g: &mac.Gate{Env: []string{"CI=1", "PATH=" + bin + ":/usr/local/bin:/usr/bin:/bin", "LANG=C"}, ScratchHome: true, Lines: wire.MaxChecksLines, Sandbox: wire.SandboxNone}}
+// the fake xcodebuild). Its label is none (it has no sandbox) unless the
+// scenario plays a Mac whose probe P2 denied (sandbox seatbelt).
+func (fakeWorker) gate(bin, sandbox string) GateRunner {
+ label := wire.SandboxNone
+ if sandbox == wire.SandboxSeatbelt {
+ label = wire.SandboxSeatbelt
+ }
+ return macGate{g: &mac.Gate{Env: []string{"CI=1", "PATH=" + bin + ":/usr/local/bin:/usr/bin:/bin", "LANG=C"}, ScratchHome: true, Lines: wire.MaxChecksLines, Sandbox: label}}
}
diff --git a/internal/runner/thin/run.go b/internal/runner/thin/run.go
index fcd0acff..f6df8118 100644
--- a/internal/runner/thin/run.go
+++ b/internal/runner/thin/run.go
@@ -63,6 +63,10 @@ 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
+ // 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.
+ FakeSandbox string
// AccountsRoot holds the homes of connections added from the app
// (EQUIPO_ACCOUNTS_ROOT; default ~/.local/share/equipo/accounts).
AccountsRoot string
@@ -72,7 +76,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"), 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{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:
@@ -95,7 +99,7 @@ func Run(ctx context.Context, c runner.Config, o Options) error {
if o.Logger != nil {
o.Logger.Warn("test build: the fake Mac worker runs checks in a process group without a sandbox", "build", fake.marker())
}
- return runWorker(ctx, c, o, platform, workerSetup{probe: fake.capabilities, gate: fake.gate(o.FakeBin)})
+ return runWorker(ctx, c, o, platform, workerSetup{probe: fake.capabilities, gate: fake.gate(o.FakeBin, o.FakeSandbox)})
}
if runtime.GOOS == "darwin" {
return runMac(ctx, c, o)
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json
index 3bf0afd9..1b2c5c7c 100644
--- a/scripts/runner-reference-allowlist.json
+++ b/scripts/runner-reference-allowlist.json
@@ -12045,5 +12045,12 @@
"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": "internal/equipotest/runner_release_test.go",
+ "line_sha256": "e865667d50f7fe1c6b142c269429bd82f5bb189954b7acda8f48c3db05a2df74",
+ "match": "equipo-runner",
+ "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."
}
]