renderer: ship renderer.tar.gz, install it beside the runner, verify it
Task 7 of dynamic specialists slice 1 (half 1a).
What changed:
- build-instance-release.sh embeds renderer.tar.gz (amd64). The asset
reader allows that one name up to 384 MiB (RendererArchiveMax), the
rest 128 MiB. Install assets serve it with the Linux runner when its
MANIFEST (first member) is the renderer_sha256 the release recorded;
otherwise the release is unavailable, as for a changed runner. No
Mac renderer is served.
- release.InstallRenderer unpacks the archive in Go to
<runner dir>/renderer/<first 12 of pin>/ through a temporary directory
beside it and a rename. MANIFEST must come first and hash to the pin
before anything else is written. Then only dirs, files and symlinks
are allowed. Each path must be clean and relative, with its parent an
earlier dir of the archive, so nothing is written through a link.
Modes come from the headers exactly (fchmod/chmod, never the umask):
no group or world write, setuid, setgid or sticky. Hard links,
devices, fifos, repeats, link targets that leave the tree, and
archives over 2 GiB or 50,000 entries are refused. The tree is
VerifyRenderer'd before the rename. renderer/ is made 0755 and must
be this user's or root's and not writable by others. A verified tree
is kept without reading the archive. Other trees are removed by exact
name (12 hex digits, not the current one), never by glob.
- equipo-runner install-renderer <archive>: the above, beside the
runner's own executable, for its linked pin (Linux amd64 only).
- verify-installed, on Linux amd64, now also verifies the tree beside
the runner against the linked pin, then renders the fixture page.
This runs after bubblewrap is checked. render.CheckFixture is a
static page embedded in the runner, rendered at the desktop viewport.
It must render with no error code and one page, and six sampled
pixels must match the block and background exactly. verify-installed
prints the error's detail too. Mac and Linux arm64 do neither.
- setup/install.go (install-v1.sh's runner install) fetches the archive.
Its MANIFEST must be the linked pin and the recorded one. It is
unpacked and verified before any runner file is written. A retry
with a verified tree fetches nothing. The second fetch preallocates
to Content-Length.
- upgrade-thin.sh, cutover-thin.sh, cutover-finish-thin.sh: the
preflight checks that renderer.tar.gz's MANIFEST sha256 is linked
into the staged runner. The staged runner runs install-renderer
before verify-installed, and the script refuses on failure.
staging-thin.py installs it the same way. Headers and usage ranges
are updated.
- renderertest builds archives in the build script's layout.
runner-reference-allowlist.json classifies this task's lines.
Tests:
CGO_ENABLED=0 go test ./internal/release/... ./internal/runner/setup/ \
./cmd/equipo-runner/ ./internal/runner/render/ -count=1 ok
CGO_ENABLED=0 go test ./internal/equipotest -run 'TestRelease|...' ok
python3 scripts/staging-thin-test.py OK
EQUIPO_RENDERER_REAL_RELEASE=1 go test ./cmd/equipo-runner \
-run TestRendererFromARealRelease (gated; run once): PASS 67.6 s.
The real build-renderer-tree.py made 230,650,088 B, pin 8f27c7ad..dae8
(55 s). The runner was built with the pin linked. install-renderer
took 3.6 s, and 0.45 s again with the tree kept. verify-installed's
renderer check rendered the fixture in real Chromium under bwrap in
2.1 s, with exact pixels.
Cross gates (darwin/arm64 build and vet) pass. budget size passes.
RED, before the code (stubs returning errors or nothing):
- InstallRenderer tests: all fail ("not refused as a mismatch: not yet").
- Install assets: "renderer archive 404", "available with missing,
another tree, not an archive", 384 MiB "release_manifest_unverified".
- setup: "no verified renderer beside the runner: renderer missing",
"installed with another archive" (and every other case).
- render: "not missing: <nil>", "a capture with no block passed".
- cmd: "fixture renders [], want one", "Linux amd64 verified with no
renderer", "install-renderer: not yet".
- Scripts: all three tests fail for all three scripts. Staging: 1
failure.
Mutations (guard broken, test that failed, restored):
CAUGHT
- InstallRenderer: unpinned, absolute runner dir, safe parent, keep
verified tree, verify before rename, old trees by name, parent is an
earlier dir, duplicate, dir mode, file mode, byte and entry bounds,
MANIFEST first/only, clean relative path, link target, early MANIFEST
pin, file and dir modes from headers, only dirs/files/links, temp dir
removed, parent 0755 regardless of umask, archive pin's first member
(TestInstallRenderer*, TestRendererArchivePin).
- Assets: archive pin, 384 MiB cap, served name.
- Setup: recorded pin, no refetch, install failure refuses, installed.
- cmd: amd64 only, tree verified, fixture result, verify-installed
calls it, install-renderer platform, absolute path.
- Fixture: sampled colour, capture size, scratch removed.
- Scripts: each preflight line and each install line (x3), the
linked-pin grep (x3).
- Staging install. Bundle: renderer.tar.gz dropped from the copy list
fails TestReleasePinsAndProvenance/release/clean (Error 96).
LAYERED (same refusal from a later check)
- setup's empty-pin check (no archive has an empty pin).
- setup's archive pin compare (InstallRenderer's own MANIFEST check
gives the same checksum refusal).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 files changed,
+2,265
−74
cmd/equipo-runner/install.go+8 −2cmd/equipo-runner/install_renderer.go+92 −0cmd/equipo-runner/main.go+10 −0cmd/equipo-runner/renderer_install_test.go+196 −0cmd/equipo-runner/renderer_release_linux_test.go+107 −0cmd/equipo-runner/verify_installed_test.go+1 −0internal/equipotest/runner_release_test.go+1 −1internal/release/cutover_finish_test.go+2 −1internal/release/cutover_test.go+2 −1internal/release/embedded_install_test.go+8 −2internal/release/install_assets.go+23 −2internal/release/renderer_assets_test.go+132 −0internal/release/renderer_install.go+297 −0internal/release/renderer_install_linux_test.go+397 −0internal/release/renderer_scripts_test.go+110 −0internal/release/renderertest/renderertest.go+123 −0internal/release/upgrade_test.go+2 −1internal/runner/render/driver_real_linux_test.go+16 −0internal/runner/render/fixture.go+104 −0internal/runner/render/fixture_linux_test.go+32 −0internal/runner/render/fixture_test.go+50 −0internal/runner/setup/install.go+45 −10internal/runner/setup/install_test.go+8 −2internal/runner/setup/renderer_install_test.go+114 −0scripts/build-instance-release.sh+3 −1scripts/cutover-finish-thin.sh+24 −3scripts/cutover-thin.sh+24 −4scripts/runner-reference-allowlist.json+283 −38scripts/staging-thin-test.py+20 −0scripts/staging-thin.py+4 −0scripts/upgrade-thin.sh+27 −6
CI failed — run details
CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/specialists-slice-1: Type Size Avail | ext4 96G 84G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type Size Avail | ext4 96G 84G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 1.5s
ci-box: codex: fetched and verified in 3.4s
ci-box: codex-code-mode-host: fetched and verified in 1.3s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 10.3s
ci-box: pi: installed and verified in 7.5s
ci-box: opencode: installed and verified in 2.3s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.8s
ci-box: clone deepened in 5.1s
ci-box: file times set from content: 3342 files, 218 directories
ci-box: ready in 18.7s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
ok amadan.net/oficina/equipo/internal/equipotest 0.150s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
5.5s
+ go list -export -test -tags testbuild -f ./...
5.3s
+ go list -export -test -tags browser,testbuild -f ./internal/equipo ./internal/equipotest ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
3.6s
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -version
staticcheck 2026.1 (v0.7.0)
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 -version
Go: go1.26.11
Scanner: govulncheck@v1.8.0
DB: https://vuln.go.dev
DB updated: 2026-11-24 15:56:00 +0000 UTC
go run github.com/zricethezav/gitleaks/v8@v8.30.1 version
version is set by build process
=== check ===
--- shard 0 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-work: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$' ./internal/headless
receipt: test step 1m19.983s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m17.464s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m17.46s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 67.58, cpu waiting 39.80%, memory waiting 0.00%, io waiting 0.45%
--- shard 1 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-review: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$' ./internal/headless
receipt: test step 1m20.174s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m18.057s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m18.06s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 67.58, cpu waiting 39.67%, memory waiting 0.00%, io waiting 0.43%
--- shard 2 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-connections: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$' ./internal/headless
receipt: test step 1m20.775s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m18.296s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m8.69s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.15s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.45s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 67.58, cpu waiting 39.67%, memory waiting 0.00%, io waiting 0.43%
--- shard 3 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-mac: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$' ./internal/headless
receipt: test step 1m18.33s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m16.02s amadan.net/oficina/equipo/internal/headless
receipt: slow test 38.58s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 19.21s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.13s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
receipt: slow test 9.09s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
machine: 32 CPUs, load 68.59, cpu waiting 39.80%, memory waiting 0.00%, io waiting 0.45%
--- shard 4 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-guards: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_step_refused$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
receipt: test step 1m35.564s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m33.639s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m3.49s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.38s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 8.39s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 7.35s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 5.03s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 63.88, cpu waiting 37.73%, memory waiting 0.00%, io waiting 0.33%
--- shard 5 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane headless-rest: ./internal/headless
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestHeadless$/^4c_rebase$|^TestHeadless$/^4b_ask$|^TestHeadless$/^4c_checks_card$|^TestHeadless$/^4_step_crash$|^TestHeadless$/^4_review$|^TestHeadless$/^2b_access$|^TestHeadless$/^runner_crash$|^TestHeadless$/^2b_first_message$|^TestHeadless$/^4_checks_honest$|^TestHeadless$/^7_stream_resume$|^TestHeadless$/^2b_notebook$|^TestHeadless$/^2b_move_in$|^TestHeadless$/^2b_desk_failure$|^TestHeadless$/^cancel$|^TestHeadlessConnections$|^TestHeadlessTokenPasteEndToEnd$|^TestHeadlessTokenConnection$|^TestMacWorker$|^TestHeadlessAttachments$|^TestHeadlessPrewarm$|^TestHeadless$/^1_first_token$|^TestHeadless$/^6_quick_messages$|^TestHeadless$/^8_instance_restart$|^TestHeadless$/^3_runner_offline$|^TestHeadlessCopyRotation$|^TestHeadlessPolicyGuards$|^TestHeadlessRunnerKillLeavesNoCopies$|^TestHeadlessNewHouseRuleStartsFresh$|^TestHeadless$/^3_engineering$|^TestHeadless$/^3_step_cancel$|^TestHeadless$/^3_step_contained$|^TestHeadless$/^3_step_refused$|^TestHeadless$/^3_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
receipt: test step 2m58.714s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2m56.157s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m39.79s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 20.24s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.15s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 7.23s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistantAttachments
receipt: slow test 6.8s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
machine: 32 CPUs, load 24.75, cpu waiting 10.23%, memory waiting 0.00%, io waiting 0.08%
--- shard 6 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest
receipt: test step 2m16.369s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2m14.184s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 10.08s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.75s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 4.19s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
receipt: slow test 4.04s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 2.62s amadan.net/oficina/equipo/internal/thintest TestContractTeamUpdatePersonNeeds
machine: 32 CPUs, load 41.02, cpu waiting 20.52%, memory waiting 0.00%, io waiting 0.16%
--- shard 7 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest-contract: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest
receipt: test step 1m57.953s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m56.05s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.5s amadan.net/oficina/equipo/internal/thintest TestContractRetryPreviewUnverifiedMerge
receipt: slow test 9.11s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 4.95s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 4.56s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 3.01s amadan.net/oficina/equipo/internal/thintest TestContractPausedJob
machine: 32 CPUs, load 49.65, cpu waiting 27.45%, memory waiting 0.00%, io waiting 0.23%
--- shard 8 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-thin: ./internal/runner/thin
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/runner/thin
budget note: internal/runner/thin took 5m14.193s, over the 45s its record on line 44 allows; reported only, timing fails on CI
receipt: test step 5m19.847s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 5m14.193s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 37.04s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeAnsweredByAnotherModel
receipt: slow test 36.89s amadan.net/oficina/equipo/internal/runner/thin TestModelsEngineeringProbesThenRunsTheStrongest
receipt: slow test 36.82s amadan.net/oficina/equipo/internal/runner/thin TestModelsUnhealthyRetriedOnDemand
receipt: slow test 18.48s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 9.94s amadan.net/oficina/equipo/internal/runner/thin TestTimeoutKeepsNothingForAnOlderInstance
machine: 32 CPUs, load 3.99, cpu waiting 0.95%, memory waiting 0.00%, io waiting 0.00%
--- shard 9 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-bug: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$' ./internal/runner
receipt: test step 51.909s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 50.971s amadan.net/oficina/equipo/internal/runner
receipt: slow test 30.94s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.03s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 51.88, cpu waiting 34.57%, memory waiting 0.00%, io waiting 0.70%
--- shard 10 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-plans: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
receipt: test step 1m1.685s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m0.381s amadan.net/oficina/equipo/internal/runner
receipt: slow test 50.35s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 45.62s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.44s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.58s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 64.08, cpu waiting 38.62%, memory waiting 0.00%, io waiting 0.61%
--- shard 11 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-rest: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$|^TestPlanWorkflowCandidateOrder$|^TestPlanWorkflowFeature$|^TestCoordinatorRecoveryCallRefusalKeepsServing$|^TestCoordinatorRefusalMatrix$' ./internal/runner
receipt: test step 36.315s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 35.468s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.14s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.17s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.17s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 3.13s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestReportPostsRetryExactRequest
machine: 32 CPUs, load 35.73, cpu waiting 22.22%, memory waiting 0.00%, io waiting 0.92%
--- shard 12 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-a started 30s late; cpu waiting 40.6%, load 27.35
test lane equipotest-a: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[A-D]|^TestQ' ./internal/equipotest
--- FAIL amadan.net/oficina/equipo/internal/equipotest TestDirectDeadReferencesRepository
=== RUN TestDirectDeadReferencesRepository
direct_cutover_test.go:221: repository reference inventory: exit status 1
docs/superpowers/plans/2026-11-28-dynamic-specialists-slice-1.md:109:5: unclassified equipo-runner
docs/superpowers/plans/CONTROLLER-BRIEF-specialists-slice-1.md:84:25: unclassified Paseo
docs/superpowers/specs/2026-11-28-dynamic-specialists.md:224:15: unclassified equipo-runner
internal/runner/render/driver.go:302:3: unclassified Node
internal/runner/render/driver.go:302:13: unclassified Node
internal/runner/render/driver.go:302:25: unclassified node
internal/runner/render/driver.go:307:39: unclassified Node
internal/runner/render/driver_test.go:89:30: unclassified node
internal/runner/render/driver_test.go:90:20: unclassified node
internal/runner/render/driver_test.go:91:20: unclassified node
internal/runner/render/page.go:351:6: unclassified Node
internal/runner/render/page.go:351:18: unclassified node
internal/runner/render/page.go:352:8: unclassified Node
internal/runner/render/page.go:353:2: unclassified Node
internal/runner/render/page.go:353:27: unclassified node
internal/runner/render/page.go:376:9: unclassified Node
internal/runner/render/page.go:376:26: unclassified node
internal/runner/render/page.go:379:7: unclassified Node
internal/runner/render/page.go:383:62: unclassified node
internal/runner/render/page.go:384:66: unclassified node
internal/runner/render/page.go:388:24: unclassified node
internal/runner/render/page.go:390:14: unclassified node
internal/runner/render/page.go:390:24: unclassified Node
internal/runner/render/page.go:391:9: unclassified node
internal/runner/render/page.go:391:23: unclassified Node
internal/runner/render/page.go:392:3: unclassified node
internal/runner/render/page.go:392:16: unclassified node
internal/runner/render/page.go:392:28: unclassified Node
internal/runner/render/page.go:394:36: unclassified node
internal/runner/render/page.go:395:20: unclassified node
internal/runner/render/page.go:396:24: unclassified Node
internal/runner/render/page.go:396:43: unclassified Node
internal/runner/render/page.go:397:12: unclassified Node
internal/runner/render/page.go:401:20: unclassified node
internal/runner/render/page.go:414:27: unclassified node
internal/runner/render/page.go:424:8: unclassified node
internal/runner/render/page.go:448:24: unclassified Node
internal/runner/render/page_test.go:197:77: unclassified Node
internal/runner/render/page_test.go:198:9: unclassified Node
internal/runner/render/page_test.go:198:14: unclassified Node
internal/runner/render/page_test.go:208:41: unclassified node
internal/runner/render/page_test.go:211:2: unclassified node
internal/runner/render/page_test.go:211:15: unclassified Node
internal/runner/render/page_test.go:221:23: unclassified node
internal/runner/render/page_test.go:227:13: unclassified Node
internal/runner/render/page_test.go:245:11: unclassified node
internal/runner/render/page_test.go:246:14: unclassified Node
internal/runner/render/report.go:151:44: unclassified node
reference scan: 3054 text files, 3316 matches, 48 failures
--- FAIL: TestDirectDeadReferencesRepository (2.38s)
--- FAIL amadan.net/oficina/equipo/internal/equipotest (package output)
FAIL
rastrillo-budget/v1 ran 1m7.673s
FAIL amadan.net/oficina/equipo/internal/equipotest 67.987s
receipt: test step 1m10.046s against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 0 cached, 0 without tests, 1 failed
receipt: slow package 1m7.673s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 28.76s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 28.7s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 26.54s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 23.75s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 23.59s amadan.net/oficina/equipo/internal/equipotest TestAuthorityUsesLiveRoster
rastrillo: budget test: go test failed
exit status 1
+ go test -tags testbuild -timeout 15m -run '^Test[A-D]|^TestQ' -v -run '^TestDirectDeadReferencesRepository$' -count=1 ./internal/equipotest (retry, once)
FAILED TWICE ./internal/equipotest:TestDirectDeadReferencesRepository equipotest-a
=== RUN TestDirectDeadReferencesRepository
direct_cutover_test.go:221: repository reference inventory: exit status 1
docs/superpowers/plans/2026-11-28-dynamic-specialists-slice-1.md:109:5: unclassified equipo-runner
docs/superpowers/plans/CONTROLLER-BRIEF-specialists-slice-1.md:84:25: unclassified Paseo
docs/superpowers/specs/2026-11-28-dynamic-specialists.md:224:15: unclassified equipo-runner
internal/runner/render/driver.go:302:3: unclassified Node
internal/runner/render/driver.go:302:13: unclassified Node
internal/runner/render/driver.go:302:25: unclassified node
internal/runner/render/driver.go:307:39: unclassified Node
internal/runner/render/driver_test.go:89:30: unclassified node
internal/runner/render/driver_test.go:90:20: unclassified node
internal/runner/render/driver_test.go:91:20: unclassified node
internal/runner/render/page.go:351:6: unclassified Node
internal/runner/render/page.go:351:18: unclassified node
internal/runner/render/page.go:352:8: unclassified Node
internal/runner/render/page.go:353:2: unclassified Node
internal/runner/render/page.go:353:27: unclassified node
internal/runner/render/page.go:376:9: unclassified Node
internal/runner/render/page.go:376:26: unclassified node
internal/runner/render/page.go:379:7: unclassified Node
internal/runner/render/page.go:383:62: unclassified node
internal/runner/render/page.go:384:66: unclassified node
internal/runner/render/page.go:388:24: unclassified node
internal/runner/render/page.go:390:14: unclassified node
internal/runner/render/page.go:390:24: unclassified Node
internal/runner/render/page.go:391:9: unclassified node
internal/runner/render/page.go:391:23: unclassified Node
internal/runner/render/page.go:392:3: unclassified node
internal/runner/render/page.go:392:16: unclassified node
internal/runner/render/page.go:392:28: unclassified Node
internal/runner/render/page.go:394:36: unclassified node
internal/runner/render/page.go:395:20: unclassified node
internal/runner/render/page.go:396:24: unclassified Node
internal/runner/render/page.go:396:43: unclassified Node
internal/runner/render/page.go:397:12: unclassified Node
internal/runner/render/page.go:401:20: unclassified node
internal/runner/render/page.go:414:27: unclassified node
internal/runner/render/page.go:424:8: unclassified node
internal/runner/render/page.go:448:24: unclassified Node
internal/runner/render/page_test.go:197:77: unclassified Node
internal/runner/render/page_test.go:198:9: unclassified Node
internal/runner/render/page_test.go:198:14: unclassified Node
internal/runner/render/page_test.go:208:41: unclassified node
internal/runner/render/page_test.go:211:2: unclassified node
internal/runner/render/page_test.go:211:15: unclassified Node
internal/runner/render/page_test.go:221:23: unclassified node
internal/runner/render/page_test.go:227:13: unclassified Node
internal/runner/render/page_test.go:245:11: unclassified node
internal/runner/render/page_test.go:246:14: unclassified Node
internal/runner/render/report.go:151:44: unclassified node
reference scan: 3054 text files, 3316 matches, 48 failures
--- FAIL: TestDirectDeadReferencesRepository (2.30s)
FAIL
rastrillo-budget/v1 ran 2.296s
FAIL amadan.net/oficina/equipo/internal/equipotest 2.461s
FAIL
machine: 32 CPUs, load 59.97, cpu waiting 34.89%, memory waiting 0.00%, io waiting 0.30%
make: *** [Makefile:113: ci-shard] Error 1
amadan: step check shard 12 of 29 failed: exit status 2
--- shard 13 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-e started 30s late; cpu waiting 40.6%, load 27.35
test lane equipotest-e: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[E-P]' ./internal/equipotest
receipt: test step 2m14.829s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2m12.684s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 21.06s amadan.net/oficina/equipo/internal/equipotest TestProjectWritesRequireCurrentOwner
receipt: slow test 21.05s amadan.net/oficina/equipo/internal/equipotest TestProjectsFailuresRollBack
receipt: slow test 21.01s amadan.net/oficina/equipo/internal/equipotest TestProjectRejectsUnsafeBinding
receipt: slow test 20.99s amadan.net/oficina/equipo/internal/equipotest TestProjectsReopen
receipt: slow test 20.99s amadan.net/oficina/equipo/internal/equipotest TestProjectBindingUniqueness
machine: 32 CPUs, load 28.00, cpu waiting 12.92%, memory waiting 0.00%, io waiting 0.10%
--- shard 14 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-r started 30s late; cpu waiting 40.6%, load 27.35
test lane equipotest-r: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestR' ./internal/equipotest
budget note: internal/equipotest took 5m33.426s, over the 5m0s its record on line 15 allows; reported only, timing fails on CI
receipt: test step 5m39.069s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 5m33.426s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 4m41.19s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 13.57s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 10.54s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 10.52s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 7.44s amadan.net/oficina/equipo/internal/equipotest TestRosterProtectsLastOwner
machine: 32 CPUs, load 2.61, cpu waiting 0.42%, memory waiting 0.00%, io waiting 0.00%
--- shard 15 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: equipotest-rest started 30s late; cpu waiting 40.6%, load 27.35
test lane equipotest-rest: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test[A-D]|^TestQ|^Test[E-P]|^TestR' ./internal/equipotest
receipt: test step 1m10.202s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m7.966s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 26.52s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 26.01s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 25.97s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 24.12s amadan.net/oficina/equipo/internal/equipotest TestSpecialistSettingsCurrentOwner
receipt: slow test 24s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedOnce
machine: 32 CPUs, load 59.97, cpu waiting 35.97%, memory waiting 0.00%, io waiting 0.31%
--- shard 16 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: plan3test started 30s late; cpu waiting 40.6%, load 27.35
test lane plan3test: ./internal/plan3test
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./internal/plan3test
receipt: test step 56.306s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 53.697s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 3.87s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.49s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.63s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.53s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.37s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorMessageSourcesUpgrade
machine: 32 CPUs, load 68.34, cpu waiting 39.30%, memory waiting 0.00%, io waiting 0.39%
--- shard 17 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: rest started 30s late; cpu waiting 40.6%, load 27.35
test lane rest: ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/diffscan ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./internal/equipo/github ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/pause ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/release/renderertest ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/claude/realcli ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/render ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/forgekey ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m ./cmd/equipo ./cmd/equipo-runner ./cmd/equipo-tool-proxy ./internal/advice ./internal/attach ./internal/attach/attachtest ./internal/chatmarkdown ./internal/chatsend ./internal/chatstream ./internal/coordinator ./internal/coordinatorcontract ./internal/coordinatormail ./internal/copydesk ./internal/diffscan ./internal/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./internal/equipo/github ./internal/equipo/housekeeping ./internal/equipo/icons ./internal/equipo/identity ./internal/equipo/kernel ./internal/equipo/library ./internal/equipo/mergegate ./internal/equipo/notifications ./internal/equipo/oficina ./internal/equipo/oficina/oficinatest ./internal/equipo/oficinaid ./internal/equipo/ownermode ./internal/equipo/pause ./internal/equipo/personapi ./internal/equipo/planning ./internal/equipo/push ./internal/equipo/setup ./internal/equipo/team ./internal/equipo/teamcontract ./internal/equipo/triage ./internal/fakeclaude ./internal/fakecodex ./internal/fakeopencode ./internal/fakepi ./internal/idtest ./internal/ownermodetest ./internal/release ./internal/release/renderertest ./internal/runner/checks ./internal/runner/connect ./internal/runner/containment ./internal/runner/containment/sysunix ./internal/runner/egress ./internal/runner/forge ./internal/runner/forge/forgetest ./internal/runner/heartbeat ./internal/runner/mac ./internal/runner/mcpresource ./internal/runner/metered ./internal/runner/planflow ./internal/runner/provider ./internal/runner/provider/claude ./internal/runner/provider/claude/realcli ./internal/runner/provider/codex ./internal/runner/provider/gotoolchain ./internal/runner/provider/opencode ./internal/runner/provider/pi ./internal/runner/render ./internal/runner/setup ./internal/runner/transporttest ./internal/runner/webread ./internal/runner/workspace ./internal/runnerproto ./internal/schedule ./internal/sealbox ./internal/specialist ./internal/stagingtest ./internal/taskplan ./internal/testci ./internal/toolproxy ./internal/websource ./internal/wire ./internal/wire/forgekey ./internal/wire/wireschema ./internal/wire/wiretest ./tools/drive
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/forge: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude/realcli: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/webread: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runnerproto: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/workspace: its inputs changed
--- FAIL amadan.net/oficina/equipo/internal/runner/provider/claude TestClaudeTerminalErrors
=== RUN TestClaudeTerminalErrors
--- FAIL: TestClaudeTerminalErrors (2.63s)
--- FAIL amadan.net/oficina/equipo/internal/runner/provider/claude TestClaudeTerminalErrors/rate
=== RUN TestClaudeTerminalErrors/rate
launcher_test.go:556: claude_turn_uncertain
--- FAIL: TestClaudeTerminalErrors/rate (0.75s)
--- FAIL amadan.net/oficina/equipo/internal/runner/provider/claude (package output)
FAIL
rastrillo-budget/v1 ran 32.863s
FAIL amadan.net/oficina/equipo/internal/runner/provider/claude 33.874s
--- FAIL amadan.net/oficina/equipo/internal/runner/webread TestTimeouts
=== RUN TestTimeouts
fetch_test.go:537: s1: {Source:s1 Origin:paul Parent: URL:https://shop.example.com/slow-body Hops:[{URL:https://shop.example.com/slow-body Address:151.101.1.1 Status:200}] Address:151.101.1.1 Status:200 Type:text/plain Bytes:5 SHA256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 Millis:307 Reason: File:s001.txt}
--- FAIL: TestTimeouts (0.63s)
--- FAIL amadan.net/oficina/equipo/internal/runner/webread (package output)
FAIL
rastrillo-budget/v1 ran 2.163s
FAIL amadan.net/oficina/equipo/internal/runner/webread 2.196s
budget note: internal/equipo took 2m23.182s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/chat took 23.667s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/github took 40.581s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/equipo/setup took 11.943s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/idtest took 2m1.417s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/release took 42.416s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/runner/containment took 1m1.182s, over the 15s its record on line 40 allows; reported only, timing fails on CI
budget note: internal/runner/forge took 25.322s, over the 20s its record on line 35 allows; reported only, timing fails on CI
budget note: internal/runner/provider/claude/realcli took 14s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/runner/provider/pi took 1m22.251s, over the 1m0s its record on line 27 allows; reported only, timing fails on CI
budget note: internal/runner/render took 1m20.083s, over the 10s the default allows; reported only, timing fails on CI
receipt: test step 2m29.29s against a 60s target (the gate's other steps are not in this figure)
receipt: 28 packages ran, 40 cached, 17 without tests, 2 failed
receipt: slow package 2m23.182s amadan.net/oficina/equipo/internal/equipo
receipt: slow package 2m1.417s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 1m22.251s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 1m20.083s amadan.net/oficina/equipo/internal/runner/render
receipt: slow package 1m12.626s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow test 57.01s amadan.net/oficina/equipo/internal/idtest TestDoorRemembersOficinaID
receipt: slow test 48.53s amadan.net/oficina/equipo/internal/idtest TestDoorStepUpIsLocal
receipt: slow test 48.27s amadan.net/oficina/equipo/internal/idtest TestDoorOficinaSettingsUnreadableIsNoLoop
receipt: slow test 48.08s amadan.net/oficina/equipo/internal/idtest TestDoorForgetsOficinaIDForARefusedSession
receipt: slow test 46.11s amadan.net/oficina/equipo/internal/idtest TestDoorNeverJudgesANativeSession
rastrillo: budget test: go test failed
exit status 1
+ go test -tags testbuild -timeout 15m -v -run '^TestClaudeTerminalErrors$/^rate$' -count=1 ./internal/runner/provider/claude (retry, once)
##############################################################################
FLAKE ./internal/runner/provider/claude:TestClaudeTerminalErrors/rate rest a3a7f652fce78e06a0d8742bbad1d68f8f77ee05 0.75s 23.01
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
+ go test -tags testbuild -timeout 15m -v -run '^TestTimeouts$' -count=1 ./internal/runner/webread (retry, once)
##############################################################################
FLAKE ./internal/runner/webread:TestTimeouts rest a3a7f652fce78e06a0d8742bbad1d68f8f77ee05 0.63s 23.01
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 23.01, cpu waiting 9.57%, memory waiting 0.00%, io waiting 0.07%
--- shard 18 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-chat: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$' ./internal/headless
receipt: test step 1m25.693s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m23.96s amadan.net/oficina/equipo/internal/headless
receipt: slow test 38.85s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 14.81s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 10.52s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.37s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 6.64s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 68.34, cpu waiting 39.25%, memory waiting 0.00%, io waiting 0.38%
--- shard 19 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-work: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$' ./internal/headless
receipt: test step 1m32.908s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m31.12s amadan.net/oficina/equipo/internal/headless
receipt: slow test 29.02s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 21.22s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 13.66s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 9.46s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 8.9s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 63.88, cpu waiting 38.40%, memory waiting 0.00%, io waiting 0.34%
--- shard 20 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-connections: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
receipt: test step 1m53.983s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m52.026s amadan.net/oficina/equipo/internal/headless
receipt: slow test 14.2s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 13.47s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 12.97s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 11.23s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 11.18s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsSignInEmail
machine: 32 CPUs, load 53.02, cpu waiting 29.20%, memory waiting 0.00%, io waiting 0.24%
--- shard 21 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-rest: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserCardAnswerSettlesAtBottom|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInEmail|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
receipt: test step 1m39.039s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m37.241s amadan.net/oficina/equipo/internal/headless
receipt: slow test 15.15s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 12.85s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 10.72s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 9.48s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 7.47s amadan.net/oficina/equipo/internal/headless TestBrowserRefreshRace
machine: 32 CPUs, load 59.97, cpu waiting 35.97%, memory waiting 0.00%, io waiting 0.31%
--- shard 22 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-rest: ./internal/equipo
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserPreviewBlocksNavigation|TestBrowserPreviewPassExchange)$' ./internal/equipo
receipt: test step 4.416s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2.461s amadan.net/oficina/equipo/internal/equipo
receipt: slow test 1.84s amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewPassExchange
receipt: slow test 620ms amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewBlocksNavigation
browser lane browser-rest: ./internal/equipotest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserGitHubManifestCSP)$' ./internal/equipotest
receipt: test step 8.024s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 6.374s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 6.37s amadan.net/oficina/equipo/internal/equipotest TestBrowserGitHubManifestCSP
browser lane browser-rest: ./internal/idtest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserOficinaIDDoor|TestBrowserSmartDoor)$' ./internal/idtest
budget note: internal/idtest took 10.756s, over the 10s the default allows; reported only, timing fails on CI
receipt: test step 12.475s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 10.756s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 8.46s amadan.net/oficina/equipo/internal/idtest TestBrowserSmartDoor
receipt: slow test 2.29s amadan.net/oficina/equipo/internal/idtest TestBrowserOficinaIDDoor
browser lane browser-rest: ./internal/plan3test
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestTeamsHierarchyBrowser)$' ./internal/plan3test
receipt: test step 4.003s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2.394s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 2.39s amadan.net/oficina/equipo/internal/plan3test TestTeamsHierarchyBrowser
browser lane browser-rest: ./internal/thintest
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAccessEmojiByline|TestBrowserAccessFinalOutcomes|TestBrowserAccessRequest|TestBrowserAccessReview|TestBrowserActivitySubjects|TestBrowserAutonomySettings|TestBrowserCoordinatorQueue|TestBrowserEmptyConversation|TestBrowserEndedNoteStaysGone|TestBrowserHousekeeping|TestBrowserInnerGallery|TestBrowserInnerScreens|TestBrowserInstantThinking|TestBrowserInstantThinkingQueued|TestBrowserMachines|TestBrowserPausedWork|TestBrowserPhoneIndex|TestBrowserPlacementQuestionAndPending|TestBrowserProjectPlacement|TestBrowserProjectsList|TestBrowserReportActionFeedback|TestBrowserReportNextSteps|TestBrowserReportThread|TestBrowserRhythm|TestBrowserRollup|TestBrowserRosterAlignment|TestBrowserRosterDecisionStates|TestBrowserRosterQuietDay|TestBrowserRosterReports|TestBrowserRosterSetAside|TestBrowserRosterSubchat|TestBrowserRosterThinking|TestBrowserRosterVisual|TestBrowserSettingsHousekeepingGroups|TestBrowserSettingsMenu|TestBrowserSettingsRail|TestBrowserSettingsSaveBar|TestBrowserSettingsShots|TestBrowserSettingsStayOnPage|TestBrowserSettingsTeams|TestBrowserShipsButtons|TestBrowserSpecialistRows|TestBrowserSpendFollowsAnswers|TestBrowserTaskRows|TestBrowserTeamPanel|TestBrowserThinkingCycles|TestBrowserThinkingLinesClear|TestBrowserThinkingSteady|TestBrowserThinkingWords|TestBrowserTokenRowEmail|TestBrowserTrackPulse|TestBrowserTrackStarCentre|TestBrowserTryAgain)$' ./internal/thintest
receipt: test step 3m34.906s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 3m32.333s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 25.88s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.4s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 12.11s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
receipt: slow test 10.62s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 9.02s amadan.net/oficina/equipo/internal/thintest TestBrowserRhythm
machine: 32 CPUs, load 9.05, cpu waiting 3.29%, memory waiting 0.00%, io waiting 0.02%
--- shard 23 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 23: make test-quarantine
python3 scripts/ci-test.py quarantine
quarantine: 12 tests from scripts/ci-quarantine.txt; a failure is retried once, and a pass on the retry is reported as a flake
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^A5_cancel_and_sign_out$|^TestHeadlessConnections$/^C4_claude_sign_in$|^TestHeadlessConnections$/^C5_engineering_failover$|^TestHeadlessConnections$/^C5_engineering_to_codex$|^TestHeadlessConnections$/^C5_engineering_waits$' ./internal/headless (54s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 4.87s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.22s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 8.94s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.10s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 27.24s
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^C5_review_auth$|^TestHeadlessConnections$/^C5_review_failover$|^TestHeadlessConnections$/^C5_review_on_codex$|^TestHeadlessConnections$/^C5_review_other_family_first$' ./internal/headless (58s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 13.80s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 12.34s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 9.90s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 19.55s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless (22s)
ok ./internal/headless TestMixedVersions 19.84s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks (2s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.90s
+ go test -tags testbuild -timeout 15m -v -run '^TestRunnerCancelAndSupersede$' ./internal/runner/thin (2s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.06s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 64.08, cpu waiting 37.83%, memory waiting 0.00%, io waiting 0.63%
--- shard 24 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 24: make runner-host
python3 scripts/runner-prerequisites.py
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run 'TestDirect|TestProvider|TestCheckSandbox' -count=1 ./internal/runner/provider/... ./internal/runner/checks
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run 'TestDirect|TestProvider|TestCheckSandbox' -count=1 ./internal/runner/provider/... ./internal/runner/checks
receipt: test step 13.146s against a 60s target (the gate's other steps are not in this figure)
receipt: 4 packages ran, 0 cached, 4 without tests, 0 failed
receipt: slow package 7.609s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 188ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 71ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 0s amadan.net/oficina/equipo/internal/runner/provider/claude/realcli
receipt: slow test 5.35s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.73s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 410ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 190ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxToolchain
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run '^TestNamespace' -count=1 ./internal/runner/containment
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run '^TestNamespace' -count=1 ./internal/runner/containment
receipt: test step 4.323s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 3.227s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 290ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 200ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 140ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReapsOrphans
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceExitStatus
machine: 32 CPUs, load 15.11, cpu waiting 11.38%, memory waiting 0.00%, io waiting 1.24%
--- shard 25 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: runner-dead-references started 30s late; cpu waiting 40.6%, load 27.35
shard 25: make runner-dead-references lanes-check build vet fmt-check spacing budget migration-check
python3 scripts/runner-dead-references.py
docs/superpowers/plans/2026-11-28-dynamic-specialists-slice-1.md:109:5: unclassified equipo-runner
docs/superpowers/plans/CONTROLLER-BRIEF-specialists-slice-1.md:84:25: unclassified Paseo
docs/superpowers/specs/2026-11-28-dynamic-specialists.md:224:15: unclassified equipo-runner
internal/runner/render/driver.go:302:3: unclassified Node
internal/runner/render/driver.go:302:13: unclassified Node
internal/runner/render/driver.go:302:25: unclassified node
internal/runner/render/driver.go:307:39: unclassified Node
internal/runner/render/driver_test.go:89:30: unclassified node
internal/runner/render/driver_test.go:90:20: unclassified node
internal/runner/render/driver_test.go:91:20: unclassified node
internal/runner/render/page.go:351:6: unclassified Node
internal/runner/render/page.go:351:18: unclassified node
internal/runner/render/page.go:352:8: unclassified Node
internal/runner/render/page.go:353:2: unclassified Node
internal/runner/render/page.go:353:27: unclassified node
internal/runner/render/page.go:376:9: unclassified Node
internal/runner/render/page.go:376:26: unclassified node
internal/runner/render/page.go:379:7: unclassified Node
internal/runner/render/page.go:383:62: unclassified node
internal/runner/render/page.go:384:66: unclassified node
internal/runner/render/page.go:388:24: unclassified node
internal/runner/render/page.go:390:14: unclassified node
internal/runner/render/page.go:390:24: unclassified Node
internal/runner/render/page.go:391:9: unclassified node
internal/runner/render/page.go:391:23: unclassified Node
internal/runner/render/page.go:392:3: unclassified node
internal/runner/render/page.go:392:16: unclassified node
internal/runner/render/page.go:392:28: unclassified Node
internal/runner/render/page.go:394:36: unclassified node
internal/runner/render/page.go:395:20: unclassified node
internal/runner/render/page.go:396:24: unclassified Node
internal/runner/render/page.go:396:43: unclassified Node
internal/runner/render/page.go:397:12: unclassified Node
internal/runner/render/page.go:401:20: unclassified node
internal/runner/render/page.go:414:27: unclassified node
internal/runner/render/page.go:424:8: unclassified node
internal/runner/render/page.go:448:24: unclassified Node
internal/runner/render/page_test.go:197:77: unclassified Node
internal/runner/render/page_test.go:198:9: unclassified Node
internal/runner/render/page_test.go:198:14: unclassified Node
internal/runner/render/page_test.go:208:41: unclassified node
internal/runner/render/page_test.go:211:2: unclassified node
internal/runner/render/page_test.go:211:15: unclassified Node
internal/runner/render/page_test.go:221:23: unclassified node
internal/runner/render/page_test.go:227:13: unclassified Node
internal/runner/render/page_test.go:245:11: unclassified node
internal/runner/render/page_test.go:246:14: unclassified Node
internal/runner/render/report.go:151:44: unclassified node
reference scan: 3054 text files, 3316 matches, 48 failures
make[1]: *** [Makefile:238: runner-dead-references] Error 1
machine: 32 CPUs, load 27.35, cpu waiting 18.56%, memory waiting 0.00%, io waiting 0.98%
make: *** [Makefile:113: ci-shard] Error 2
amadan: step check shard 25 of 29 failed: exit status 2
--- shard 26 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: staticcheck started 30s late; cpu waiting 40.6%, load 27.35
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 58.78, cpu waiting 35.90%, memory waiting 0.00%, io waiting 0.68%
--- shard 27 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: govulncheck started 30s late; cpu waiting 40.6%, load 27.35
shard 27: make govulncheck
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./...
=== Symbol Results ===
No vulnerabilities found.
Your code is affected by 0 vulnerabilities.
This scan also found 1 vulnerability in packages you import and 10
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use '-show verbose' for more details.
machine: 32 CPUs, load 58.78, cpu waiting 35.90%, memory waiting 0.00%, io waiting 0.68%
--- shard 28 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: gitleaks started 30s late; cpu waiting 40.9%, load 27.35
shard 28: make gitleaks
[90m7:46PM[0m [32mINF[0m [1mUnknown SCM platform. Use --platform to include links in findings.[0m [36mhost=[0mamadan.net
[90m7:46PM[0m [32mINF[0m [1m1277 commits scanned.[0m
[90m7:46PM[0m [32mINF[0m [1mscanned ~69264646 bytes (69.26 MB) in 26.2s[0m
[90m7:46PM[0m [32mINF[0m [1mno leaks found[0m
machine: 32 CPUs, load 58.78, cpu waiting 36.98%, memory waiting 0.00%, io waiting 0.65%
amadan: job failed at step check shards 12, 25 of 29 — its output is above, not at the tail of this log
diff --git a/cmd/equipo-runner/install.go b/cmd/equipo-runner/install.go| index 02540126..91cfca9e 100644 |
| --- a/cmd/equipo-runner/install.go |
| +++ b/cmd/equipo-runner/install.go |
| @@ -102,7 +102,8 @@ var errScanner = errors.New("preview_scanner_unverified") |
| // codex, its code mode host and the tool proxy built with this runner, |
| // and the preview scanner (gitleaks) beside the runner's executable, where |
| // the runner looks for it, to the hash linked into this build. Without |
| -// that scanner every preview fails (preview_scanner). |
| +// that scanner every preview fails (preview_scanner). On Linux amd64 the |
| +// page renderer beside it, too (verifyRenderer). |
| // The installer runs it before enrolling, and staging and the production |
| // cutover run it (equipo-runner verify-installed) before starting a unit. |
| func verifyInstalled(m release.Manifest, cfg runner.Config) error { |
| @@ -121,7 +122,12 @@ func verifyInstalled(m release.Manifest, cfg runner.Config) error { |
| return err |
| } |
| } |
| - return m.VerifyInstalled(map[string]string{"bwrap": cfg.Bwrap(), "claude": cfg.ClaudePath, "codex": cfg.CodexPath, "codex-code-mode-host": cfg.CodexCodeModeHostPath, "equipo-tool-proxy": cfg.ToolProxy()}) |
| + if err := m.VerifyInstalled(map[string]string{"bwrap": cfg.Bwrap(), "claude": cfg.ClaudePath, "codex": cfg.CodexPath, "codex-code-mode-host": cfg.CodexCodeModeHostPath, "equipo-tool-proxy": cfg.ToolProxy()}); err != nil { |
| + return err |
| + } |
| + // Last, once bubblewrap is the pinned one: on Linux amd64 the page |
| + // renderer beside the runner, to its linked pin, and a fixture render. |
| + return verifyRenderer(cfg, goos(), goarch()) |
| } |
| func installManifest(args []string, out io.Writer) int { |
| if len(args) != 1 { |
diff --git a/cmd/equipo-runner/install_renderer.go b/cmd/equipo-runner/install_renderer.go| new file mode 100644 |
| index 00000000..78d033d1 |
| --- /dev/null |
| +++ b/cmd/equipo-runner/install_renderer.go |
| @@ -0,0 +1,92 @@ |
| +package main |
| + |
| +import ( |
| + "context" |
| + "errors" |
| + "fmt" |
| + "io" |
| + "os" |
| + "path/filepath" |
| + |
| + "amadan.net/oficina/equipo/internal/release" |
| + "amadan.net/oficina/equipo/internal/runner" |
| + "amadan.net/oficina/equipo/internal/runner/render" |
| +) |
| + |
| +// rendererPin is the renderer pin linked into this build ("" for none); |
| +// tests replace it. |
| +var rendererPin = func() string { |
| + pin, _ := release.RendererPin() |
| + return pin |
| +} |
| + |
| +// fixtureRender renders the fixture page; tests replace it. |
| +var fixtureRender = render.CheckFixture |
| + |
| +// rendererPlatform is where a runner has the page renderer: Linux amd64. |
| +// A Mac runner and a Linux arm64 one neither install nor check one. |
| +func rendererPlatform(goos, goarch string) bool { return goos == "linux" && goarch == "amd64" } |
| + |
| +// verifyRenderer is verify-installed's renderer check, on Linux amd64 |
| +// only: the tree beside the runner's executable |
| +// (<dir>/renderer/<first 12 of pin>/) is exactly the one the pin linked |
| +// into this build names, and it renders the fixture page, through the |
| +// bubblewrap of this configuration (checked before this runs) and the |
| +// runner's own binary, with its scratch in <dir>/renderer/. |
| +func verifyRenderer(cfg runner.Config, goos, goarch string) error { |
| + if !rendererPlatform(goos, goarch) { |
| + return nil |
| + } |
| + pin := rendererPin() |
| + dir := filepath.Dir(cfg.Executable) |
| + tree := release.RendererTree(dir, pin) |
| + if err := release.VerifyRenderer(tree, pin); err != nil { |
| + return err |
| + } |
| + return fixtureRender(context.Background(), render.LaunchConfig{Bwrap: cfg.Bwrap(), Binary: cfg.Executable, Tree: tree, Pin: pin}, filepath.Join(dir, "renderer")) |
| +} |
| + |
| +// installRendererCommand is `equipo-runner install-renderer <archive>`: |
| +// the release's renderer.tar.gz, unpacked beside this runner's own |
| +// executable as the tree for the pin linked into it (release. |
| +// InstallRenderer), and that tree's path printed. The production scripts |
| +// run it from the installed runner, then verify-installed, which renders |
| +// the fixture page with it. |
| +func installRendererCommand(args []string, out, errout io.Writer) int { |
| + if len(args) != 1 || !filepath.IsAbs(args[0]) { |
| + fmt.Fprintln(errout, "usage: equipo-runner install-renderer <absolute path of renderer.tar.gz>") |
| + return 2 |
| + } |
| + exe, err := os.Executable() |
| + if err == nil { |
| + var tree string |
| + if tree, err = installRendererOn(goos(), goarch(), filepath.Dir(exe), args[0], rendererPin()); err == nil { |
| + fmt.Fprintln(out, tree) |
| + return 0 |
| + } |
| + } |
| + fmt.Fprintln(errout, "equipo-runner: the renderer could not be installed:", err) |
| + return 1 |
| +} |
| + |
| +func installRendererOn(goos, goarch, runnerDir, archive, pin string) (string, error) { |
| + if !rendererPlatform(goos, goarch) { |
| + return "", errors.New("the renderer runs only on Linux amd64") |
| + } |
| + if !filepath.IsAbs(archive) { |
| + return "", fmt.Errorf("%q is not an absolute path", archive) |
| + } |
| + f, err := os.Open(archive) |
| + if err != nil { |
| + return "", err |
| + } |
| + defer f.Close() |
| + info, err := f.Stat() |
| + if err != nil { |
| + return "", err |
| + } |
| + if !info.Mode().IsRegular() || info.Size() > release.RendererArchiveMax { |
| + return "", fmt.Errorf("%s is not a renderer archive", archive) |
| + } |
| + return release.InstallRenderer(runnerDir, f, pin) |
| +} |
diff --git a/cmd/equipo-runner/main.go b/cmd/equipo-runner/main.go| index 21458d7d..b558e57e 100644 |
| --- a/cmd/equipo-runner/main.go |
| +++ b/cmd/equipo-runner/main.go |
| @@ -89,6 +89,11 @@ func run(ctx context.Context, args []string, input io.Reader, output, errorOutpu |
| if len(args) > 0 && args[0] == "install-pi" { |
| return installPi(ctx, args[1:], output, errorOutput) |
| } |
| + // The page renderer beside this runner (Linux amd64), from the |
| + // release's renderer.tar.gz: the production scripts run it. |
| + if len(args) > 0 && args[0] == "install-renderer" { |
| + return installRendererCommand(args[1:], output, errorOutput) |
| + } |
| if len(args) > 0 && args[0] == "install-opencode" { |
| return installOpenCode(ctx, args[1:], output, errorOutput) |
| } |
| @@ -159,6 +164,11 @@ func run(ctx context.Context, args []string, input io.Reader, output, errorOutpu |
| } |
| case "verify-installed": |
| err = verifyInstalled(release.BuildManifest(), cfg) |
| + // What differs, for the operator whose script stopped here (a |
| + // renderer's diagnostic names the entry). |
| + if err != nil { |
| + _, _ = fmt.Fprintln(errorOutput, "verify-installed:", err) |
| + } |
| case "preflight": |
| var reports any |
| reports, err = runner.Preflight(ctx, cfg) |
diff --git a/cmd/equipo-runner/renderer_install_test.go b/cmd/equipo-runner/renderer_install_test.go| new file mode 100644 |
| index 00000000..cc8eac8d |
| --- /dev/null |
| +++ b/cmd/equipo-runner/renderer_install_test.go |
| @@ -0,0 +1,196 @@ |
| +package main |
| + |
| +import ( |
| + "bytes" |
| + "context" |
| + "errors" |
| + "os" |
| + "path/filepath" |
| + "runtime" |
| + "strings" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/release" |
| + "amadan.net/oficina/equipo/internal/release/renderertest" |
| + "amadan.net/oficina/equipo/internal/runner" |
| + "amadan.net/oficina/equipo/internal/runner/render" |
| + "amadan.net/oficina/equipo/internal/wire" |
| +) |
| + |
| +// fixtureCall is one fixture render verify-installed asked for. |
| +type fixtureCall struct { |
| + cfg render.LaunchConfig |
| + scratch string |
| +} |
| + |
| +// installedRenderer installs a small renderer tree beside the runner in |
| +// dir, links its pin into this build, and stands in for the fixture |
| +// render (a real one needs Chromium: TestRendererFromARealRelease). |
| +func installedRenderer(t *testing.T, dir string) (string, *[]fixtureCall, *error) { |
| + t.Helper() |
| + archive, pin := renderertest.Archive(renderertest.Small()) |
| + if runtime.GOOS == "linux" { |
| + if err := os.Chmod(dir, 0o700); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := release.InstallRenderer(dir, bytes.NewReader(archive), pin); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + oldPin, oldRender := rendererPin, fixtureRender |
| + calls, fail := new([]fixtureCall), new(error) |
| + rendererPin = func() string { return pin } |
| + fixtureRender = func(_ context.Context, cfg render.LaunchConfig, scratch string) error { |
| + *calls = append(*calls, fixtureCall{cfg, scratch}) |
| + return *fail |
| + } |
| + t.Cleanup(func() { rendererPin, fixtureRender = oldPin, oldRender }) |
| + return pin, calls, fail |
| +} |
| + |
| +// verify-installed holds the renderer beside the runner to the pin linked |
| +// into this build and renders the fixture page with it, through the |
| +// verified bubblewrap and the runner's own binary: a tree missing or |
| +// changed, no pin, or a fixture render that fails, refuses. |
| +func TestVerifyInstalledHoldsTheRendererBesideTheRunner(t *testing.T) { |
| + if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { |
| + t.Skip("the renderer is Linux amd64's") |
| + } |
| + m, cfg, _ := installedFixture(t) |
| + dir := filepath.Dir(cfg.Executable) |
| + pin, calls, fail := installedRenderer(t, dir) |
| + tree := filepath.Join(dir, "renderer", pin[:12]) |
| + if err := verifyInstalled(m, cfg); err != nil { |
| + t.Fatalf("the release's own renderer refused: %v", err) |
| + } |
| + want := fixtureCall{render.LaunchConfig{Bwrap: cfg.Bwrap(), Binary: cfg.Executable, Tree: tree, Pin: pin}, filepath.Join(dir, "renderer")} |
| + if len(*calls) != 1 || (*calls)[0] != want { |
| + t.Fatalf("fixture renders %+v, want one %+v", *calls, want) |
| + } |
| + *fail = errors.New("the capture is not the fixture page") |
| + if verifyInstalled(m, cfg) == nil { |
| + t.Fatal("verified with a failed fixture render") |
| + } |
| + *fail = nil |
| + rendererPin = func() string { return "" } |
| + if err := verifyInstalled(m, cfg); release.RendererHealth(err) != wire.ToolUnpinned { |
| + t.Fatalf("a build with no renderer pin verified: %v", err) |
| + } |
| + rendererPin = func() string { return pin } |
| + conf := filepath.Join(tree, "usr/share/fonts.conf") |
| + if err := os.WriteFile(conf, []byte("changed"), 0o644); err != nil { |
| + t.Fatal(err) |
| + } |
| + *calls = nil |
| + if err := verifyInstalled(m, cfg); release.RendererHealth(err) != wire.ToolMismatch || len(*calls) != 0 { |
| + t.Fatalf("a changed tree verified or rendered: %v %d", err, len(*calls)) |
| + } |
| + if err := os.RemoveAll(tree); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := verifyInstalled(m, cfg); release.RendererHealth(err) != wire.ToolMissing || len(*calls) != 0 { |
| + t.Fatalf("no tree verified or rendered: %v %d", err, len(*calls)) |
| + } |
| +} |
| + |
| +// A Mac, or a Linux arm64 machine, has no renderer: verify-installed |
| +// neither looks for a tree nor renders, with no tree and no pin. |
| +func TestVerifyInstalledNeedsNoRendererOffLinuxAmd64(t *testing.T) { |
| + dir := t.TempDir() |
| + cfg := runner.Config{Executable: filepath.Join(dir, "equipo-runner")} |
| + oldPin, oldRender := rendererPin, fixtureRender |
| + t.Cleanup(func() { rendererPin, fixtureRender = oldPin, oldRender }) |
| + rendererPin = func() string { return "" } |
| + fixtureRender = func(context.Context, render.LaunchConfig, string) error { |
| + t.Error("a fixture render off Linux amd64") |
| + return errors.New("no renderer here") |
| + } |
| + for _, p := range [][2]string{{"darwin", "arm64"}, {"linux", "arm64"}} { |
| + if err := verifyRenderer(cfg, p[0], p[1]); err != nil { |
| + t.Fatalf("%s/%s: %v", p[0], p[1], err) |
| + } |
| + } |
| + if err := verifyRenderer(cfg, "linux", "amd64"); err == nil { |
| + t.Fatal("Linux amd64 verified with no renderer") |
| + } |
| + if names, _ := os.ReadDir(dir); len(names) != 0 { |
| + t.Fatalf("wrote %v", names) |
| + } |
| +} |
| + |
| +// A Mac install fetches no renderer and unpacks none. |
| +func TestInstallMacFetchesNoRenderer(t *testing.T) { |
| + x := newMacRig(t) |
| + if code, _, errout := x.install(); code != 0 { |
| + t.Fatalf("code %d: %s", code, errout) |
| + } |
| + for _, url := range x.fetched { |
| + if strings.Contains(url, "renderer") { |
| + t.Fatalf("a Mac fetched %s", url) |
| + } |
| + } |
| + if _, err := os.Stat(filepath.Join(x.home, ".local/lib/equipo-runner/renderer")); !os.IsNotExist(err) { |
| + t.Fatalf("a Mac has a renderer: %v", err) |
| + } |
| +} |
| + |
| +// equipo-runner install-renderer <archive> unpacks the release's archive |
| +// beside the runner's own executable, the tree for the pin linked into |
| +// it; another archive, a relative path, or a machine that is not Linux |
| +// amd64, installs nothing. |
| +func TestInstallRendererCommand(t *testing.T) { |
| + if runtime.GOOS != "linux" { |
| + t.Skip("the renderer is Linux's") |
| + } |
| + archive, pin := renderertest.Archive(renderertest.Small()) |
| + other, _ := renderertest.Archive(renderertest.Small()[:4]) |
| + scratch := t.TempDir() |
| + path, otherPath := filepath.Join(scratch, "renderer.tar.gz"), filepath.Join(scratch, "other.tar.gz") |
| + for p, b := range map[string][]byte{path: archive, otherPath: other} { |
| + if err := os.WriteFile(p, b, 0o600); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + runnerDir := func() string { |
| + dir := filepath.Join(t.TempDir(), "releases", "v1") |
| + if err := os.MkdirAll(dir, 0o700); err != nil { |
| + t.Fatal(err) |
| + } |
| + return dir |
| + } |
| + dir := runnerDir() |
| + tree, err := installRendererOn("linux", "amd64", dir, path, pin) |
| + if err != nil || tree != filepath.Join(dir, "renderer", pin[:12]) || release.VerifyRenderer(tree, pin) != nil { |
| + t.Fatalf("install-renderer: %s %v", tree, err) |
| + } |
| + for name, run := range map[string]func(dir string) error{ |
| + "another archive": func(dir string) error { _, err := installRendererOn("linux", "amd64", dir, otherPath, pin); return err }, |
| + "relative path": func(dir string) error { |
| + _, err := installRendererOn("linux", "amd64", dir, "renderer.tar.gz", pin) |
| + return err |
| + }, |
| + "no archive": func(dir string) error { |
| + _, err := installRendererOn("linux", "amd64", dir, path+".missing", pin) |
| + return err |
| + }, |
| + "no pin": func(dir string) error { _, err := installRendererOn("linux", "amd64", dir, path, ""); return err }, |
| + "a Mac": func(dir string) error { _, err := installRendererOn("darwin", "arm64", dir, path, pin); return err }, |
| + "Linux arm64": func(dir string) error { _, err := installRendererOn("linux", "arm64", dir, path, pin); return err }, |
| + } { |
| + dir := runnerDir() |
| + if run(dir) == nil { |
| + t.Fatalf("installed with %s", name) |
| + } |
| + if _, err := os.Stat(filepath.Join(dir, "renderer", pin[:12])); !os.IsNotExist(err) { |
| + t.Fatalf("a tree with %s: %v", name, err) |
| + } |
| + } |
| + // The command itself: one absolute archive path, the tree printed. |
| + var out, errout bytes.Buffer |
| + if code := installRendererCommand([]string{"renderer.tar.gz"}, &out, &errout); code != 2 { |
| + t.Fatalf("relative path: %d", code) |
| + } |
| + if code := installRendererCommand(nil, &out, &errout); code != 2 { |
| + t.Fatalf("no path: %d", code) |
| + } |
| +} |
diff --git a/cmd/equipo-runner/renderer_release_linux_test.go b/cmd/equipo-runner/renderer_release_linux_test.go| new file mode 100644 |
| index 00000000..96bb0f6f |
| --- /dev/null |
| +++ b/cmd/equipo-runner/renderer_release_linux_test.go |
| @@ -0,0 +1,107 @@ |
| +//go:build linux |
| + |
| +package main |
| + |
| +import ( |
| + "os" |
| + "os/exec" |
| + "path/filepath" |
| + "runtime" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/oficina/equipo/internal/release" |
| + "amadan.net/oficina/equipo/internal/runner" |
| + "amadan.net/oficina/equipo/internal/runner/render" |
| +) |
| + |
| +// One install from a release built by the real scripts: renderer.tar.gz |
| +// from scripts/build-renderer-tree.py (the pinned packages, about 164 MB |
| +// fetched), a runner built with its pin linked as make release-runner |
| +// links it, that runner's install-renderer, and verify-installed's |
| +// renderer check with the real fixture render in the real Chromium, |
| +// under bubblewrap. Opt in with EQUIPO_RENDERER_REAL_RELEASE=1 (Linux |
| +// amd64, bubblewrap that can make namespaces); everything is under the |
| +// test's temporary directory ($TMPDIR). |
| +func TestRendererFromARealRelease(t *testing.T) { |
| + if os.Getenv("EQUIPO_RENDERER_REAL_RELEASE") != "1" { |
| + t.Skip("set EQUIPO_RENDERER_REAL_RELEASE=1 to build renderer.tar.gz with scripts/build-renderer-tree.py (about 164 MB fetched) and install it from a runner linked with its pin") |
| + } |
| + if runtime.GOARCH != "amd64" { |
| + t.Skip("the renderer is Linux amd64's") |
| + } |
| + bwrap, err := exec.LookPath("bwrap") |
| + if err != nil { |
| + t.Skip("bubblewrap is not installed") |
| + } |
| + if out, err := exec.Command(bwrap, "--unshare-all", "--ro-bind", "/", "/", "true").CombinedOutput(); err != nil { |
| + t.Skip("bubblewrap cannot make namespaces here: " + strings.TrimSpace(string(out))) |
| + } |
| + scratch, err := filepath.EvalSymlinks(t.TempDir()) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + staged := filepath.Join(scratch, "releases", "equipo-runner-linux-amd64-real") |
| + runnerDir := filepath.Join(scratch, "equipo-runner", "releases", "real") |
| + for _, d := range []string{staged, runnerDir} { |
| + if err := os.MkdirAll(d, 0o700); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + archive := filepath.Join(staged, release.RendererArchive) |
| + began := time.Now() |
| + build := exec.Command("python3", "../../scripts/build-renderer-tree.py", "../../internal/release/renderer.json", archive) |
| + build.Stderr = os.Stderr |
| + out, err := build.Output() |
| + if err != nil { |
| + t.Fatalf("build-renderer-tree.py: %v", err) |
| + } |
| + pin := strings.TrimSpace(string(out)) |
| + info, err := os.Stat(archive) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + t.Logf("renderer.tar.gz: %d bytes, pin %s, built in %v", info.Size(), pin, time.Since(began).Round(time.Second)) |
| + if info.Size() > release.RendererArchiveMax { |
| + t.Fatalf("the archive is over the %d bytes the instance serves", release.RendererArchiveMax) |
| + } |
| + |
| + binary := filepath.Join(runnerDir, "equipo-runner") |
| + gobuild := exec.Command("go", "build", "-trimpath", "-ldflags", "-X amadan.net/oficina/equipo/internal/release.rendererSHA256="+pin, "-o", binary, ".") |
| + gobuild.Env = append(os.Environ(), "CGO_ENABLED=0") |
| + if out, err := gobuild.CombinedOutput(); err != nil { |
| + t.Fatalf("go build: %v\n%s", err, out) |
| + } |
| + |
| + install := func() { |
| + t.Helper() |
| + began := time.Now() |
| + out, err := exec.Command(binary, "install-renderer", archive).CombinedOutput() |
| + if err != nil || strings.TrimSpace(string(out)) != release.RendererTree(runnerDir, pin) { |
| + t.Fatalf("install-renderer: %v\n%s", err, out) |
| + } |
| + t.Logf("install-renderer in %v", time.Since(began).Round(time.Millisecond)) |
| + } |
| + install() |
| + tree := release.RendererTree(runnerDir, pin) |
| + if err := release.VerifyRenderer(tree, pin); err != nil { |
| + t.Fatalf("the installed tree does not verify: %v", err) |
| + } |
| + // Again, as a retried script does: the verified tree is kept. |
| + install() |
| + |
| + // verify-installed's renderer check, with the real fixture render: |
| + // the installed runner is the sandbox's first process. |
| + oldPin, oldRender := rendererPin, fixtureRender |
| + t.Cleanup(func() { rendererPin, fixtureRender = oldPin, oldRender }) |
| + rendererPin, fixtureRender = func() string { return pin }, render.CheckFixture |
| + began = time.Now() |
| + if err := verifyRenderer(runner.Config{Executable: binary, BwrapPath: bwrap}, "linux", "amd64"); err != nil { |
| + t.Fatalf("the installed renderer does not render the fixture page: %v", err) |
| + } |
| + t.Logf("verified and rendered the fixture page in %v", time.Since(began).Round(time.Millisecond)) |
| + if left, _ := os.ReadDir(filepath.Join(runnerDir, "renderer")); len(left) != 1 { |
| + t.Fatalf("left beside the tree: %v", left) |
| + } |
| +} |
diff --git a/cmd/equipo-runner/verify_installed_test.go b/cmd/equipo-runner/verify_installed_test.go| index 07f7b733..9b8840bd 100644 |
| --- a/cmd/equipo-runner/verify_installed_test.go |
| +++ b/cmd/equipo-runner/verify_installed_test.go |
| @@ -79,6 +79,7 @@ func installedFixture(t *testing.T) (release.Manifest, runner.Config, map[string |
| old := scannerPin |
| scannerPin = func() string { return fmt.Sprintf("%x", sha256.Sum256([]byte("scanner"))) } |
| t.Cleanup(func() { scannerPin = old }) |
| + installedRenderer(t, dir) |
| return m, cfg, paths |
| } |
diff --git a/internal/equipotest/runner_release_test.go b/internal/equipotest/runner_release_test.go| index 945b2e7b..38173252 100644 |
| --- a/internal/equipotest/runner_release_test.go |
| +++ b/internal/equipotest/runner_release_test.go |
| @@ -90,7 +90,7 @@ func runnerPackagingScenarios(t *testing.T, target string, scenarios []string) { |
| "git": "#!/bin/sh\ncase \"$1\" in diff) [ \"$SCENARIO\" != dirty ];; rev-parse) echo abc1234;; ls-files) if [ \"$SCENARIO\" = untracked ]; then echo unsafe.go; fi;; status) if [ \"$SCENARIO\" = dirty ]; then echo ' M tracked'; fi; if [ \"$SCENARIO\" = untracked ]; then echo '?? unsafe.go'; fi; if [ -e changed-during-build ]; then echo '?? changed-during-build'; fi;; clone) for a; do last=$a; done; mkdir -p \"$last\" && cp -R . \"$last\";; esac\n", |
| // Each build writes its own bytes, so every artifact has its own digest. |
| // go version -m reports the commit a binary says it was built from. |
| - "go": "#!/bin/sh\ncase \"$1\" in env) echo go1.26.11;; version) rev=abc1234; mod=false; if [ \"$SCENARIO\" = vcs_revision ]; then rev=def5678; fi; if [ \"$SCENARIO\" = vcs_modified ]; then mod=true; fi; if [ \"$SCENARIO\" != vcs_missing ]; then printf '%s: go1.26.11\\n\\tpath\\tfixture\\n\\tbuild\\tvcs.revision=%s\\n\\tbuild\\tvcs.modified=%s\\n' \"$3\" \"$rev\" \"$mod\"; fi;; test) [ \"$SCENARIO\" != copy ];; build) if [ \"$SCENARIO\" = changed_during_build ]; then touch changed-during-build; fi; 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; printf 'built %s for %s\\n' \"$1\" \"$GOOS/$GOARCH\" > \"$1\"; fi; shift; done;; esac\n", |
| + "go": "#!/bin/sh\ncase \"$1\" in env) echo go1.26.11;; version) rev=abc1234; mod=false; if [ \"$SCENARIO\" = vcs_revision ]; then rev=def5678; fi; if [ \"$SCENARIO\" = vcs_modified ]; then mod=true; fi; if [ \"$SCENARIO\" != vcs_missing ]; then printf '%s: go1.26.11\\n\\tpath\\tfixture\\n\\tbuild\\tvcs.revision=%s\\n\\tbuild\\tvcs.modified=%s\\n' \"$3\" \"$rev\" \"$mod\"; fi;; test) [ \"$SCENARIO\" != copy ];; build) if [ \"$SCENARIO\" = changed_during_build ]; then touch changed-during-build; fi; if [ \"$GOOS/$GOARCH\" = linux/arm64 ]; then test -f internal/release/bundled/install-manifest.json || exit 97; test -f internal/release/bundled/renderer.tar.gz || exit 96; fi; printf '%s\\n' \"$GOOS/$GOARCH\" \"$@\" >> \"$CAPTURE\"; while [ $# -gt 0 ]; do if [ \"$1\" = -o ]; then shift; printf 'built %s for %s\\n' \"$1\" \"$GOOS/$GOARCH\" > \"$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", |
diff --git a/internal/release/cutover_finish_test.go b/internal/release/cutover_finish_test.go| index 81c86987..c218f52d 100644 |
| --- a/internal/release/cutover_finish_test.go |
| +++ b/internal/release/cutover_finish_test.go |
| @@ -38,8 +38,9 @@ func newFinishRig(t *testing.T) *finishRig { |
| r.write(filepath.Join(r.repo, "scripts", name), string(src), 0700) |
| } |
| release := filepath.Join(r.repo, "releases", "equipo-runner-linux-amd64-"+finishVersion) |
| - runner := "#!/bin/sh\nif [ \"$1\" = verify-installed ]; then echo \"equipo-runner verify-installed $EQUIPO_TOOL_PROXY_PATH\" >> " + r.log + "; exit; fi\necho \"equipo-runner $1 $EQUIPO_INSTANCE_ID $EQUIPO_ORIGIN\" >> " + r.log + "\n[ -e " + filepath.Join(root, "enrolfail") + " ] && exit 1\n# The running runner holds the state lock enrol needs.\n[ -e " + filepath.Join(root, "active") + " ] && { echo state locked >&2; exit 1; }\necho new > \"$EQUIPO_RUNNER_STATE_DIR/credentials.json\"\n" + linkedScanner |
| + runner := "#!/bin/sh\n" + rendererStub(r.log) + "if [ \"$1\" = verify-installed ]; then echo \"equipo-runner verify-installed $EQUIPO_TOOL_PROXY_PATH\" >> " + r.log + "; exit; fi\necho \"equipo-runner $1 $EQUIPO_INSTANCE_ID $EQUIPO_ORIGIN\" >> " + r.log + "\n[ -e " + filepath.Join(root, "enrolfail") + " ] && exit 1\n# The running runner holds the state lock enrol needs.\n[ -e " + filepath.Join(root, "active") + " ] && { echo state locked >&2; exit 1; }\necho new > \"$EQUIPO_RUNNER_STATE_DIR/credentials.json\"\n" + linkedScanner + linkedRenderer |
| r.write(filepath.Join(release, "equipo-runner"), runner, 0700) |
| + r.write(filepath.Join(release, RendererArchive), string(rendererArchiveBytes), 0600) |
| r.write(filepath.Join(release, "equipo-tool-proxy"), "proxy", 0700) |
| r.write(filepath.Join(release, "gitleaks"), scannerBytes, 0700) |
| sum := func(s string) string { h := sha256.Sum256([]byte(s)); return hex.EncodeToString(h[:]) } |
diff --git a/internal/release/cutover_test.go b/internal/release/cutover_test.go| index 2e268c53..60e85f50 100644 |
| --- a/internal/release/cutover_test.go |
| +++ b/internal/release/cutover_test.go |
| @@ -39,7 +39,8 @@ func newCutoverRig(t *testing.T) *cutoverRig { |
| release := filepath.Join(repo, "releases", "equipo-runner-linux-amd64-"+cutoverVersion) |
| // The staged runner's enrol records the instance id it was given. |
| // It also answers verify-installed, with the tool proxy it was told to use. |
| - r.write(filepath.Join(release, "equipo-runner"), "#!/bin/sh\nif [ \"$1\" = verify-installed ]; then echo \"equipo-runner verify-installed $EQUIPO_TOOL_PROXY_PATH\" >> "+r.log+"; [ ! -e "+filepath.Join(root, "verifyfail")+" ]; exit; fi\necho \"equipo-runner $1\" >> "+r.log+"\necho \"$EQUIPO_INSTANCE_ID\" > "+filepath.Join(root, "enrolled")+"\necho new > \"$EQUIPO_RUNNER_STATE_DIR/credentials.json\"\n"+linkedScanner, 0700) |
| + r.write(filepath.Join(release, "equipo-runner"), "#!/bin/sh\n"+rendererStub(r.log)+"if [ \"$1\" = verify-installed ]; then echo \"equipo-runner verify-installed $EQUIPO_TOOL_PROXY_PATH\" >> "+r.log+"; [ ! -e "+filepath.Join(root, "verifyfail")+" ]; exit; fi\necho \"equipo-runner $1\" >> "+r.log+"\necho \"$EQUIPO_INSTANCE_ID\" > "+filepath.Join(root, "enrolled")+"\necho new > \"$EQUIPO_RUNNER_STATE_DIR/credentials.json\"\n"+linkedScanner+linkedRenderer, 0700) |
| + r.write(filepath.Join(release, RendererArchive), string(rendererArchiveBytes), 0600) |
| r.write(filepath.Join(release, "equipo-tool-proxy"), "proxy", 0700) |
| r.write(filepath.Join(release, "gitleaks"), scannerBytes, 0700) |
| r.serviceEnv = []byte("EQUIPO_ORIGIN=\"https://equipo.bds.oncarlos.com\"\nEQUIPO_INSTANCE_ID=\"" + oldInstanceID + "\"\nEQUIPO_TOOL_PROXY_PATH=\"/old/equipo-tool-proxy\"\nEQUIPO_RUNNER_STATE_DIR=\"" + filepath.Join(r.runner, "state") + "\"\nEQUIPO_SCRATCH_ROOT=\"/old/scratch\"\nEQUIPO_WORKSPACE_ROOT=\"/old/work\"\n") |
diff --git a/internal/release/embedded_install_test.go b/internal/release/embedded_install_test.go| index 9c845d24..9d28b599 100644 |
| --- a/internal/release/embedded_install_test.go |
| +++ b/internal/release/embedded_install_test.go |
| @@ -167,11 +167,17 @@ func TestBundledInstallAssets(t *testing.T) { |
| if !a.CachedAvailable() { |
| t.Fatal("bundled release unavailable") |
| } |
| - for _, name := range installAssetNames { |
| + names := installAssetNames |
| + // The renderer the Linux runner installs beside itself (amd64). |
| + if m.Targets[TargetLinux].RendererSHA256 == "" { |
| + t.Fatal("the bundled release names no renderer") |
| + } |
| + names = append(names[:len(names):len(names)], RendererArchive) |
| + for _, name := range names { |
| w := httptest.NewRecorder() |
| a.ServeHTTP(w, httptest.NewRequest("GET", "/releases/"+m.Version+"/"+name, nil)) |
| want, e := fs.ReadFile(files, name) |
| - if e != nil || w.Code != 200 || w.Body.String() != string(want) { |
| + if e != nil || w.Code != 200 || sha256.Sum256(w.Body.Bytes()) != sha256.Sum256(want) { |
| t.Fatal("bundled HTTP asset", name, w.Code, e) |
| } |
| } |
diff --git a/internal/release/install_assets.go b/internal/release/install_assets.go| index 98034449..35ae39f7 100644 |
| --- a/internal/release/install_assets.go |
| +++ b/internal/release/install_assets.go |
| @@ -75,8 +75,11 @@ func (a *InstallAssets) open(name string) (installFile, error) { |
| } |
| i, e := f.Stat() |
| limit := int64(128 << 20) |
| - if name == "install-manifest.json" || name == "install-v1.sh" { |
| + switch name { |
| + case "install-manifest.json", "install-v1.sh": |
| limit = 1 << 20 |
| + case RendererArchive: |
| + limit = RendererArchiveMax |
| } |
| if e != nil || !i.Mode().IsRegular() || i.Size() > limit { |
| f.Close() |
| @@ -179,6 +182,24 @@ func (a *InstallAssets) Available() bool { |
| return false |
| } |
| } |
| + // The renderer the Linux runner installs beside itself: its MANIFEST, |
| + // the archive's first member, is the pin the release recorded (and |
| + // linked into the runner, which checks the whole tree against it). |
| + if want := m.Targets[TargetLinux].RendererSHA256; want != "" { |
| + f, err := a.open(RendererArchive) |
| + if err != nil { |
| + return false |
| + } |
| + files[RendererArchive] = f |
| + got, err := RendererArchivePin(f) |
| + if err != nil || got != want { |
| + return false |
| + } |
| + infos[RendererArchive], err = f.Stat() |
| + if err != nil { |
| + return false |
| + } |
| + } |
| // The Mac worker: listed, present and matching, or not served at all. |
| if t, e := m.DarwinTarget(a.Version); e == nil { |
| mac := map[string]installFile{} |
| @@ -224,7 +245,7 @@ func (a *InstallAssets) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| prefix := "/releases/" + a.Version + "/" |
| name := strings.TrimPrefix(r.URL.Path, prefix) |
| mac := slices.Contains(darwinAssetNames, name) |
| - if !strings.HasPrefix(r.URL.Path, prefix) || (r.Method != "GET" && r.Method != "HEAD") || (name != "install-v1.sh" && name != "install-manifest.json" && name != "equipo-runner" && name != "equipo-tool-proxy" && name != "gitleaks" && !mac) { |
| + if !strings.HasPrefix(r.URL.Path, prefix) || (r.Method != "GET" && r.Method != "HEAD") || (name != "install-v1.sh" && name != "install-manifest.json" && name != "equipo-runner" && name != "equipo-tool-proxy" && name != "gitleaks" && name != RendererArchive && !mac) { |
| w.WriteHeader(http.StatusNotFound) |
| return |
| } |
diff --git a/internal/release/renderer_assets_test.go b/internal/release/renderer_assets_test.go| new file mode 100644 |
| index 00000000..a7c76217 |
| --- /dev/null |
| +++ b/internal/release/renderer_assets_test.go |
| @@ -0,0 +1,132 @@ |
| +package release |
| + |
| +import ( |
| + "crypto/sha256" |
| + "encoding/json" |
| + "fmt" |
| + "net/http/httptest" |
| + "os" |
| + "path/filepath" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/release/renderertest" |
| + "amadan.net/oficina/equipo/internal/runner/provider" |
| +) |
| + |
| +// rendererAssets is a release directory as the instance serves one, its |
| +// Linux target naming the renderer archive beside the runner. |
| +func rendererAssets(t *testing.T) (*InstallAssets, string, []byte) { |
| + t.Helper() |
| + root := t.TempDir() |
| + write := func(name string, b []byte) { |
| + t.Helper() |
| + if err := os.MkdirAll(filepath.Dir(filepath.Join(root, name)), 0o700); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := os.WriteFile(filepath.Join(root, name), b, 0o600); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + runner, proxy, scanner := []byte("linux runner"), []byte("fixture proxy"), []byte("linux scanner") |
| + archive, pin := renderertest.Archive(renderertest.Small()) |
| + m := fixtureManifest(proxy) |
| + sum := func(b []byte) string { return fmt.Sprintf("%x", sha256.Sum256(b)) } |
| + manifest := InstallManifest{Version: "fixture-16", Target: TargetLinux, RunnerSHA256: sum(runner), NamespaceArgs: provider.NamespaceArguments(), Release: m, |
| + Targets: map[string]InstallTarget{ |
| + TargetLinux: {RunnerSHA256: sum(runner), ToolProxySHA256: sum(proxy), GitleaksSHA256: sum(scanner), RendererSHA256: pin}, |
| + TargetDarwin: {RunnerSHA256: sum([]byte("mac runner"))}, |
| + }} |
| + raw, err := json.Marshal(manifest) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + write("install-manifest.json", raw) |
| + write("install-v1.sh", []byte("#!/bin/sh\n")) |
| + write("equipo-runner", runner) |
| + write("equipo-tool-proxy", proxy) |
| + write("gitleaks", scanner) |
| + write(RendererArchive, archive) |
| + write("darwin-arm64/equipo-runner", []byte("mac runner")) |
| + return &InstallAssets{Root: root, Version: "fixture-16", Manifest: m}, root, archive |
| +} |
| + |
| +func getAsset(a *InstallAssets, name string) (int, string) { |
| + w := httptest.NewRecorder() |
| + a.ServeHTTP(w, httptest.NewRequest("GET", "/releases/fixture-16/"+name, nil)) |
| + return w.Code, w.Body.String() |
| +} |
| + |
| +// The instance serves renderer.tar.gz with the Linux runner when its |
| +// MANIFEST is the pin the release recorded; a Mac worker has none. |
| +func TestInstallAssetsServeTheRendererOnLinux(t *testing.T) { |
| + a, _, archive := rendererAssets(t) |
| + if code, body := getAsset(a, RendererArchive); code != 200 || body != string(archive) { |
| + t.Fatalf("renderer archive %d", code) |
| + } |
| + if code, _ := getAsset(a, "darwin-arm64/equipo-runner"); code != 200 { |
| + t.Fatalf("mac runner %d", code) |
| + } |
| + if code, _ := getAsset(a, "darwin-arm64/"+RendererArchive); code != 404 { |
| + t.Fatalf("a Mac renderer served: %d", code) |
| + } |
| +} |
| + |
| +// A renderer archive that is missing, or whose MANIFEST is not the pin |
| +// the release recorded, makes the release unavailable, as a changed |
| +// runner does. |
| +func TestInstallAssetsRefuseAnotherRenderer(t *testing.T) { |
| + for name, change := range map[string]func(root string) error{ |
| + "missing": func(root string) error { return os.Remove(filepath.Join(root, RendererArchive)) }, |
| + "another tree": func(root string) error { |
| + other, _ := renderertest.Archive(renderertest.Small()[:4]) |
| + return os.WriteFile(filepath.Join(root, RendererArchive), other, 0o600) |
| + }, |
| + "not an archive": func(root string) error { |
| + return os.WriteFile(filepath.Join(root, RendererArchive), []byte("not gzip"), 0o600) |
| + }, |
| + } { |
| + t.Run(name, func(t *testing.T) { |
| + a, root, _ := rendererAssets(t) |
| + if !a.Available() { |
| + t.Fatal("the fixture release is unavailable") |
| + } |
| + if err := change(root); err != nil { |
| + t.Fatal(err) |
| + } |
| + if a.Available() { |
| + t.Fatal("available with", name) |
| + } |
| + if code, _ := getAsset(a, RendererArchive); code != 503 { |
| + t.Fatalf("served with %s: %d", name, code) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// The asset reader allows renderer.tar.gz up to 384 MiB and every other |
| +// file the usual 128 MiB. |
| +func TestInstallAssetsBoundTheRendererAt384MiB(t *testing.T) { |
| + a, root, _ := rendererAssets(t) |
| + for _, c := range []struct { |
| + name string |
| + size int64 |
| + ok bool |
| + }{ |
| + {RendererArchive, 384 << 20, true}, |
| + {RendererArchive, 384<<20 + 1, false}, |
| + {"equipo-runner", 128 << 20, true}, |
| + {"equipo-runner", 128<<20 + 1, false}, |
| + {"gitleaks", 200 << 20, false}, |
| + } { |
| + if err := os.Truncate(filepath.Join(root, c.name), c.size); err != nil { |
| + t.Fatal(err) |
| + } |
| + f, err := a.open(c.name) |
| + if (err == nil) != c.ok { |
| + t.Fatalf("%s at %d bytes: %v", c.name, c.size, err) |
| + } |
| + if f != nil { |
| + f.Close() |
| + } |
| + } |
| +} |
diff --git a/internal/release/renderer_install.go b/internal/release/renderer_install.go| new file mode 100644 |
| index 00000000..5ed9d48c |
| --- /dev/null |
| +++ b/internal/release/renderer_install.go |
| @@ -0,0 +1,297 @@ |
| +package release |
| + |
| +import ( |
| + "archive/tar" |
| + "compress/gzip" |
| + "crypto/sha256" |
| + "encoding/hex" |
| + "errors" |
| + "fmt" |
| + "io" |
| + "io/fs" |
| + "os" |
| + "path" |
| + "path/filepath" |
| + "regexp" |
| + "strings" |
| + "syscall" |
| + "unicode/utf8" |
| + |
| + "amadan.net/oficina/equipo/internal/wire" |
| +) |
| + |
| +// RendererArchive is the renderer a release ships beside the Linux |
| +// runner (scripts/build-renderer-tree.py), and RendererArchiveMax bounds |
| +// it wherever it is read whole: served by the instance, fetched by the |
| +// installer. The real one is about 230 MB. |
| +const ( |
| + RendererArchive = "renderer.tar.gz" |
| + RendererArchiveMax = 384 << 20 |
| +) |
| + |
| +// Bounds on an unpacked archive: the real tree is about 560 MB in 2,316 |
| +// entries. Tests lower them. |
| +var ( |
| + rendererUnpackedMax int64 = 2 << 30 |
| + rendererEntriesMax int64 = 50000 |
| +) |
| + |
| +// RendererTree is where a runner whose executable is in runnerDir keeps |
| +// the tree pin names: <runnerDir>/renderer/<first 12 of pin>. It is "" |
| +// for a malformed pin. |
| +func RendererTree(runnerDir, pin string) string { |
| + if !sha256Hex(pin) { |
| + return "" |
| + } |
| + return filepath.Join(runnerDir, "renderer", pin[:12]) |
| +} |
| + |
| +// oldTree is the name of a tree RendererTree would give another pin. |
| +var oldTree = regexp.MustCompile(`^[0-9a-f]{12}$`) |
| + |
| +// InstallRenderer installs the renderer archive (renderer.tar.gz) at |
| +// RendererTree(runnerDir, pin) and returns that path. A tree there that |
| +// already verifies is kept and the archive is not read. Otherwise the |
| +// archive is unpacked into a new directory beside the tree's place, |
| +// verified (VerifyRenderer) and renamed into place, replacing whatever |
| +// was there. Then every other tree in <runnerDir>/renderer/, a |
| +// directory named as another pin's first 12 hex digits, is removed; |
| +// nothing else there is touched. |
| +// |
| +// The archive must be what the build writes: MANIFEST first, its SHA-256 |
| +// the pin (checked before anything else is written), then only |
| +// directories, regular files and symbolic links, each a clean relative |
| +// path whose directory came earlier in the archive, so nothing is |
| +// written through a link. Modes are the headers' exactly, never the |
| +// umask's: no group or world write, setuid, setgid or sticky bit. A hard |
| +// link, a device, a fifo, an absolute or climbing path or link target, |
| +// a repeated name, or more bytes or entries than any real tree has, is |
| +// refused. <runnerDir>/renderer/ is created 0755 and must be a directory |
| +// owned by this user or root that nobody else can write, as render.Launch |
| +// requires of a tree's parent. |
| +// |
| +// It returns a *RendererError (unpinned for a malformed pin, mismatch |
| +// for an archive or tree that is not the pinned one) or the error of the |
| +// disk. |
| +func InstallRenderer(runnerDir string, archive io.Reader, pin string) (string, error) { |
| + if !sha256Hex(pin) { |
| + return "", &RendererError{Health: wire.ToolUnpinned, Reason: "no renderer pin is linked into this runner"} |
| + } |
| + if !filepath.IsAbs(runnerDir) || filepath.Clean(runnerDir) != runnerDir { |
| + return "", rendererMismatch("", "%q is not an absolute, clean path", runnerDir) |
| + } |
| + parent := filepath.Join(runnerDir, "renderer") |
| + if err := rendererParent(parent); err != nil { |
| + return "", err |
| + } |
| + final := RendererTree(runnerDir, pin) |
| + if VerifyRenderer(final, pin) == nil { |
| + removeOldTrees(parent, filepath.Base(final)) |
| + return final, nil |
| + } |
| + tmp, err := os.MkdirTemp(parent, ".install-") |
| + if err != nil { |
| + return "", err |
| + } |
| + defer func() { |
| + if tmp != "" { |
| + os.RemoveAll(tmp) |
| + } |
| + }() |
| + if err = unpackRenderer(tmp, archive, pin); err != nil { |
| + return "", err |
| + } |
| + if err = os.Chmod(tmp, 0o755); err != nil { |
| + return "", err |
| + } |
| + if err = VerifyRenderer(tmp, pin); err != nil { |
| + return "", err |
| + } |
| + if err = os.RemoveAll(final); err != nil { |
| + return "", err |
| + } |
| + if err = os.Rename(tmp, final); err != nil { |
| + return "", err |
| + } |
| + tmp = "" |
| + if d, err := os.Open(parent); err == nil { |
| + d.Sync() |
| + d.Close() |
| + } |
| + removeOldTrees(parent, filepath.Base(final)) |
| + return final, nil |
| +} |
| + |
| +// rendererParent makes <runner dir>/renderer/ (0755, whatever the umask) |
| +// unless it exists, and checks it is a directory, not a link, owned by |
| +// this user or root, that nobody else can write. |
| +func rendererParent(dir string) error { |
| + if err := os.Mkdir(dir, 0o755); err == nil { |
| + if err = os.Chmod(dir, 0o755); err != nil { |
| + return err |
| + } |
| + } else if !errors.Is(err, fs.ErrExist) { |
| + return err |
| + } |
| + info, err := os.Lstat(dir) |
| + if err != nil { |
| + return err |
| + } |
| + st, ok := info.Sys().(*syscall.Stat_t) |
| + if !info.IsDir() || info.Mode().Perm()&0o022 != 0 || !ok || st.Uid != uint32(os.Geteuid()) && st.Uid != 0 { |
| + return rendererMismatch("", "%s is not a directory only this user can write", dir) |
| + } |
| + return nil |
| +} |
| + |
| +// removeOldTrees removes, by exact name, every tree in dir but keep. |
| +func removeOldTrees(dir, keep string) { |
| + entries, err := os.ReadDir(dir) |
| + if err != nil { |
| + return |
| + } |
| + for _, e := range entries { |
| + if name := e.Name(); name != keep && oldTree.MatchString(name) { |
| + os.RemoveAll(filepath.Join(dir, name)) |
| + } |
| + } |
| +} |
| + |
| +// unpackRenderer writes the archive's members into dir, as |
| +// InstallRenderer says. |
| +func unpackRenderer(dir string, archive io.Reader, pin string) error { |
| + gz, err := gzip.NewReader(archive) |
| + if err != nil { |
| + return rendererMismatch("", "not a gzip archive: %v", err) |
| + } |
| + defer gz.Close() |
| + root, err := os.OpenRoot(dir) |
| + if err != nil { |
| + return err |
| + } |
| + defer root.Close() |
| + tr := tar.NewReader(gz) |
| + kinds := map[string]byte{} |
| + var total, count int64 |
| + for first := true; ; first = false { |
| + h, err := tr.Next() |
| + if err == io.EOF && !first { |
| + return nil |
| + } |
| + if err != nil { |
| + return rendererMismatch("", "reading the archive: %v", err) |
| + } |
| + if count++; count > rendererEntriesMax { |
| + return rendererMismatch("", "more than %d entries", rendererEntriesMax) |
| + } |
| + name, err := memberName(h, first) |
| + if err != nil { |
| + return err |
| + } |
| + if dir := path.Dir(name); dir != "." && kinds[dir] != 'd' { |
| + return rendererMismatch(name, "its directory is not an earlier directory of the archive") |
| + } |
| + if _, ok := kinds[name]; ok { |
| + return rendererMismatch(name, "is in the archive twice") |
| + } |
| + perm := h.Mode |
| + switch h.Typeflag { |
| + case tar.TypeDir: |
| + if perm&^0o755 != 0 || perm&0o700 != 0o700 { |
| + return rendererMismatch(name, "mode %04o is not one the tree may hold", perm) |
| + } |
| + if err = root.Mkdir(name, 0o700); err != nil { |
| + return err |
| + } |
| + if err = root.Chmod(name, fs.FileMode(perm)); err != nil { |
| + return err |
| + } |
| + kinds[name] = 'd' |
| + case tar.TypeReg: |
| + if perm&^0o755 != 0 || perm&0o400 == 0 { |
| + return rendererMismatch(name, "mode %04o is not one the tree may hold", perm) |
| + } |
| + if total += h.Size; h.Size < 0 || total > rendererUnpackedMax || first && h.Size > rendererManifestMax { |
| + return rendererMismatch(name, "more bytes than any renderer tree holds") |
| + } |
| + if err = unpackFile(root, name, tr, h.Size, fs.FileMode(perm), first, pin); err != nil { |
| + return err |
| + } |
| + kinds[name] = 'f' |
| + case tar.TypeSymlink: |
| + target := h.Linkname |
| + if to := path.Join(path.Dir(name), target); target == "" || strings.HasPrefix(target, "/") || to == ".." || strings.HasPrefix(to, "../") { |
| + return rendererMismatch(name, "link target %q leaves the tree", target) |
| + } |
| + if err = root.Symlink(target, name); err != nil { |
| + return err |
| + } |
| + kinds[name] = 'l' |
| + default: |
| + return rendererMismatch(name, "a member of type %q: the tree holds only directories, files and links", h.Typeflag) |
| + } |
| + } |
| +} |
| + |
| +// memberName is a member's path in the tree: MANIFEST first and only |
| +// first, then clean relative paths (a directory's trailing slash, as |
| +// tar writes it, dropped). |
| +func memberName(h *tar.Header, first bool) (string, error) { |
| + name := h.Name |
| + if h.Typeflag == tar.TypeDir { |
| + name = strings.TrimSuffix(name, "/") |
| + } |
| + if first != (name == "MANIFEST") { |
| + return "", rendererMismatch(name, "MANIFEST must be the archive's first member, and only it") |
| + } |
| + if !first && (!utf8.ValidString(name) || !rendererPath(name)) { |
| + return "", rendererMismatch("", "%q is not a clean relative path", name) |
| + } |
| + return name, nil |
| +} |
| + |
| +// unpackFile writes one regular file, created new, its mode set on the |
| +// descriptor. MANIFEST must have the pin's hash before anything else is |
| +// written. |
| +func unpackFile(root *os.Root, name string, r io.Reader, size int64, mode fs.FileMode, manifest bool, pin string) error { |
| + f, err := root.OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o600) |
| + if err != nil { |
| + return err |
| + } |
| + defer f.Close() |
| + h := sha256.New() |
| + n, err := io.Copy(io.MultiWriter(f, h), r) |
| + if err != nil || n != size { |
| + return rendererMismatch(name, "reading the archive: %d of %d bytes: %v", n, size, err) |
| + } |
| + if manifest && hex.EncodeToString(h.Sum(nil)) != pin { |
| + return rendererMismatch("MANIFEST", "its SHA-256 is %x, the pin is %s", h.Sum(nil), pin) |
| + } |
| + if err = f.Chmod(mode); err != nil { |
| + return err |
| + } |
| + return f.Close() |
| +} |
| + |
| +// RendererArchivePin is the SHA-256 of a renderer archive's MANIFEST, |
| +// its first member, read without the rest: the pin the archive is for. |
| +func RendererArchivePin(archive io.Reader) (string, error) { |
| + gz, err := gzip.NewReader(archive) |
| + if err != nil { |
| + return "", err |
| + } |
| + defer gz.Close() |
| + tr := tar.NewReader(gz) |
| + h, err := tr.Next() |
| + if err != nil { |
| + return "", err |
| + } |
| + if h.Name != "MANIFEST" || h.Typeflag != tar.TypeReg || h.Size < 0 || h.Size > rendererManifestMax { |
| + return "", fmt.Errorf("the archive's first member is %q, not its MANIFEST", h.Name) |
| + } |
| + sum := sha256.New() |
| + if n, err := io.Copy(sum, tr); err != nil || n != h.Size { |
| + return "", fmt.Errorf("reading MANIFEST: %v", err) |
| + } |
| + return hex.EncodeToString(sum.Sum(nil)), nil |
| +} |
diff --git a/internal/release/renderer_install_linux_test.go b/internal/release/renderer_install_linux_test.go| new file mode 100644 |
| index 00000000..271319c7 |
| --- /dev/null |
| +++ b/internal/release/renderer_install_linux_test.go |
| @@ -0,0 +1,397 @@ |
| +//go:build linux |
| + |
| +package release |
| + |
| +import ( |
| + "archive/tar" |
| + "bytes" |
| + "errors" |
| + "io" |
| + "os" |
| + "path/filepath" |
| + "strings" |
| + "syscall" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/release/renderertest" |
| + "amadan.net/oficina/equipo/internal/wire" |
| +) |
| + |
| +// installDir is a runner's release directory: private, as the |
| +// installers make it. |
| +func installDir(t *testing.T) string { |
| + t.Helper() |
| + dir, err := filepath.EvalSymlinks(t.TempDir()) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if err = os.Chmod(dir, 0o700); err != nil { |
| + t.Fatal(err) |
| + } |
| + return dir |
| +} |
| + |
| +// leftovers is what an install left in <runner dir>/renderer/ beside the |
| +// tree it names, temporary directories included. |
| +func leftovers(t *testing.T, runnerDir, keep string) []string { |
| + t.Helper() |
| + names, err := os.ReadDir(filepath.Join(runnerDir, "renderer")) |
| + if errors.Is(err, os.ErrNotExist) { |
| + return nil |
| + } |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + var out []string |
| + for _, n := range names { |
| + if n.Name() != keep { |
| + out = append(out, n.Name()) |
| + } |
| + } |
| + return out |
| +} |
| + |
| +// The archive becomes <runner dir>/renderer/<first 12 of pin>/, every |
| +// mode the tar header's whatever the umask, the tree VerifyRenderer |
| +// accepts, and nothing else left beside it. |
| +func TestInstallRendererUnpacksTheArchive(t *testing.T) { |
| + for _, umask := range []int{0o077, 0o000, 0o022} { |
| + old := syscall.Umask(umask) |
| + dir := installDir(t) |
| + archive, pin := renderertest.Archive(renderertest.Small()) |
| + tree, err := InstallRenderer(dir, bytes.NewReader(archive), pin) |
| + syscall.Umask(old) |
| + if err != nil { |
| + t.Fatalf("umask %04o: %v", umask, err) |
| + } |
| + if want := filepath.Join(dir, "renderer", pin[:12]); tree != want || RendererTree(dir, pin) != want { |
| + t.Fatalf("tree %s, want %s", tree, want) |
| + } |
| + if err = VerifyRenderer(tree, pin); err != nil { |
| + t.Fatalf("umask %04o: the installed tree does not verify: %v", umask, err) |
| + } |
| + at := "renderer/" + pin[:12] |
| + for path, want := range map[string]os.FileMode{ |
| + "renderer": 0o755 | os.ModeDir, at: 0o755 | os.ModeDir, at + "/MANIFEST": 0o644, |
| + at + "/usr/lib/chromium": 0o755 | os.ModeDir, at + "/usr/lib/chromium/chromium-headless-shell": 0o755, |
| + at + "/usr/share/fonts.conf": 0o644, |
| + } { |
| + info, err := os.Lstat(filepath.Join(dir, path)) |
| + if err != nil || info.Mode() != want { |
| + t.Fatalf("umask %04o: %s is %v (%v), want %v", umask, path, info.Mode(), err, want) |
| + } |
| + } |
| + if target, err := os.Readlink(filepath.Join(tree, "usr/bin/chromium")); err != nil || target != "../lib/chromium/chromium-headless-shell" { |
| + t.Fatalf("link %q %v", target, err) |
| + } |
| + if left := leftovers(t, dir, pin[:12]); len(left) != 0 { |
| + t.Fatalf("left beside the tree: %v", left) |
| + } |
| + } |
| +} |
| + |
| +// failReader fails the test if anything reads it. |
| +type failReader struct{ t *testing.T } |
| + |
| +func (f failReader) Read([]byte) (int, error) { |
| + f.t.Error("the archive was read for a tree already installed") |
| + return 0, io.ErrUnexpectedEOF |
| +} |
| + |
| +// A tree that already verifies is kept as it is, and the archive is not |
| +// read; one that differs is replaced. |
| +func TestInstallRendererKeepsAVerifiedTreeAndReplacesAnother(t *testing.T) { |
| + dir := installDir(t) |
| + archive, pin := renderertest.Archive(renderertest.Small()) |
| + tree, err := InstallRenderer(dir, bytes.NewReader(archive), pin) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + before, _ := os.Stat(filepath.Join(tree, "MANIFEST")) |
| + if _, err = InstallRenderer(dir, failReader{t}, pin); err != nil { |
| + t.Fatal(err) |
| + } |
| + after, _ := os.Stat(filepath.Join(tree, "MANIFEST")) |
| + if !os.SameFile(before, after) { |
| + t.Fatal("a verified tree was written again") |
| + } |
| + if err = os.WriteFile(filepath.Join(tree, "usr/share/fonts.conf"), []byte("changed"), 0o644); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err = os.WriteFile(filepath.Join(tree, "extra"), []byte("extra"), 0o644); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err = InstallRenderer(dir, bytes.NewReader(archive), pin); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err = VerifyRenderer(tree, pin); err != nil { |
| + t.Fatalf("the changed tree was not replaced: %v", err) |
| + } |
| + if left := leftovers(t, dir, pin[:12]); len(left) != 0 { |
| + t.Fatalf("left beside the tree: %v", left) |
| + } |
| +} |
| + |
| +// Old trees are removed by name: a directory named as another pin's |
| +// first 12 hex digits goes; nothing else in renderer/ is touched. |
| +func TestInstallRendererRemovesOldTreesByName(t *testing.T) { |
| + dir := installDir(t) |
| + keep := []string{"notes", "0123456789a", "0123456789abc", "0123456789AB"} |
| + for _, name := range append([]string{"0123456789ab", "ffffffffffff"}, keep...) { |
| + if err := os.MkdirAll(filepath.Join(dir, "renderer", name, "usr"), 0o755); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + if err := os.Chmod(filepath.Join(dir, "renderer"), 0o755); err != nil { |
| + t.Fatal(err) |
| + } |
| + archive, pin := renderertest.Archive(renderertest.Small()) |
| + if _, err := InstallRenderer(dir, bytes.NewReader(archive), pin); err != nil { |
| + t.Fatal(err) |
| + } |
| + left := leftovers(t, dir, pin[:12]) |
| + if strings.Join(left, " ") != "0123456789AB 0123456789a 0123456789abc notes" { |
| + t.Fatalf("left %v", left) |
| + } |
| +} |
| + |
| +// member is one tar member for an archive the build never writes. |
| +type member struct { |
| + h tar.Header |
| + body string |
| +} |
| + |
| +func manifestFirst(entries []renderertest.Entry, extra ...member) ([]byte, string) { |
| + manifest := renderertest.Manifest(entries) |
| + headers := []*tar.Header{{Name: "MANIFEST", Typeflag: tar.TypeReg, Mode: 0o644, Size: int64(len(manifest))}} |
| + bodies := [][]byte{manifest} |
| + for _, e := range entries { |
| + switch e.Kind { |
| + case "dir": |
| + headers = append(headers, &tar.Header{Name: e.Path + "/", Typeflag: tar.TypeDir, Mode: 0o755}) |
| + bodies = append(bodies, nil) |
| + case "file": |
| + headers = append(headers, &tar.Header{Name: e.Path, Typeflag: tar.TypeReg, Mode: e.Mode, Size: int64(len(e.Body))}) |
| + bodies = append(bodies, []byte(e.Body)) |
| + } |
| + } |
| + for _, m := range extra { |
| + h := m.h |
| + if h.Typeflag == tar.TypeReg { |
| + h.Size = int64(len(m.body)) |
| + } |
| + headers = append(headers, &h) |
| + bodies = append(bodies, []byte(m.body)) |
| + } |
| + return renderertest.Raw(headers, bodies), renderertest.Pin(manifest) |
| +} |
| + |
| +// Anything but a directory, a regular file or a symlink, any path that |
| +// is absolute, climbs or goes through a link, any mode the tree may not |
| +// hold, a MANIFEST that is not first or not the pin, and any tree that |
| +// does not verify: refused, with nothing left behind and nothing in |
| +// place of the tree. |
| +func TestInstallRendererRefusesWhatTheBuildNeverWrites(t *testing.T) { |
| + base := []renderertest.Entry{{Path: "usr", Kind: "dir"}, {Path: "usr/f", Kind: "file", Mode: 0o644, Body: "f"}} |
| + escape := filepath.Join(t.TempDir(), "escaped") |
| + cases := map[string]func() ([]byte, string){ |
| + "absolute path": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: escape, Typeflag: tar.TypeReg, Mode: 0o644}, body: "x"}) |
| + }, |
| + "climbing path": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/../../escaped", Typeflag: tar.TypeReg, Mode: 0o644}, body: "x"}) |
| + }, |
| + "dot path": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "./usr/g", Typeflag: tar.TypeReg, Mode: 0o644}, body: "x"}) |
| + }, |
| + "empty part": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr//g", Typeflag: tar.TypeReg, Mode: 0o644}, body: "x"}) |
| + }, |
| + "hard link": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/hard", Typeflag: tar.TypeLink, Linkname: "usr/f"}}) |
| + }, |
| + "char device": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/null", Typeflag: tar.TypeChar, Mode: 0o644, Devmajor: 1, Devminor: 3}}) |
| + }, |
| + "block device": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/sda", Typeflag: tar.TypeBlock, Mode: 0o644, Devmajor: 8}}) |
| + }, |
| + "fifo": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/fifo", Typeflag: tar.TypeFifo, Mode: 0o644}}) |
| + }, |
| + "through a link": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/here", Typeflag: tar.TypeSymlink, Linkname: "."}}, |
| + member{h: tar.Header{Name: "usr/here/g", Typeflag: tar.TypeReg, Mode: 0o644}, body: "x"}) |
| + }, |
| + "parent not listed": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "lib/g", Typeflag: tar.TypeReg, Mode: 0o644}, body: "x"}) |
| + }, |
| + "absolute link": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/abs", Typeflag: tar.TypeSymlink, Linkname: "/etc/passwd"}}) |
| + }, |
| + "link out of the tree": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/up", Typeflag: tar.TypeSymlink, Linkname: "../../x"}}) |
| + }, |
| + "duplicate": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/f", Typeflag: tar.TypeReg, Mode: 0o644}, body: "again"}) |
| + }, |
| + "setuid": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/s", Typeflag: tar.TypeReg, Mode: 0o4755}, body: "x"}) |
| + }, |
| + "group writable file": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/w", Typeflag: tar.TypeReg, Mode: 0o664}, body: "x"}) |
| + }, |
| + "world writable dir": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/d/", Typeflag: tar.TypeDir, Mode: 0o757}}) |
| + }, |
| + "sticky dir": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/d/", Typeflag: tar.TypeDir, Mode: 0o1755}}) |
| + }, |
| + "extra file": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "usr/extra", Typeflag: tar.TypeReg, Mode: 0o644}, body: "x"}) |
| + }, |
| + "other pin": func() ([]byte, string) { |
| + // Refused at MANIFEST, before the member after it is read. |
| + archive, _ := manifestFirst(base, member{h: tar.Header{Name: "usr/hard", Typeflag: tar.TypeLink, Linkname: "usr/f"}}) |
| + return archive, renderertest.Pin([]byte("dir usr\n")) |
| + }, |
| + "manifest not first": func() ([]byte, string) { |
| + manifest := renderertest.Manifest(base[:1]) |
| + return renderertest.Raw([]*tar.Header{{Name: "usr/", Typeflag: tar.TypeDir, Mode: 0o755}, {Name: "MANIFEST", Typeflag: tar.TypeReg, Mode: 0o644, Size: int64(len(manifest))}}, [][]byte{nil, manifest}), renderertest.Pin(manifest) |
| + }, |
| + "second manifest": func() ([]byte, string) { |
| + return manifestFirst(base, member{h: tar.Header{Name: "MANIFEST", Typeflag: tar.TypeReg, Mode: 0o644}, body: "dir usr\n"}) |
| + }, |
| + "not gzip": func() ([]byte, string) { |
| + return []byte("not an archive"), renderertest.Pin([]byte("dir usr\n")) |
| + }, |
| + "truncated": func() ([]byte, string) { |
| + archive, pin := renderertest.Archive(renderertest.Small()) |
| + return archive[:len(archive)/2], pin |
| + }, |
| + } |
| + // Each is refused by its own check, named in the reason. |
| + why := map[string]string{ |
| + "absolute path": "not a clean relative path", "climbing path": "not a clean relative path", "dot path": "not a clean relative path", "empty part": "not a clean relative path", |
| + "hard link": "a member of type", "char device": "a member of type", "block device": "a member of type", "fifo": "a member of type", |
| + "through a link": "not an earlier directory", "parent not listed": "not an earlier directory", |
| + "absolute link": "leaves the tree", "link out of the tree": "leaves the tree", "duplicate": "twice", |
| + "setuid": "mode", "group writable file": "mode", "world writable dir": "mode", "sticky dir": "mode", |
| + "extra file": "not in MANIFEST", "other pin": "SHA-256", "manifest not first": "first member", "second manifest": "first member", |
| + "not gzip": "gzip", "truncated": "reading the archive", |
| + } |
| + for name, build := range cases { |
| + t.Run(name, func(t *testing.T) { |
| + dir := installDir(t) |
| + archive, pin := build() |
| + _, err := InstallRenderer(dir, bytes.NewReader(archive), pin) |
| + var re *RendererError |
| + if !errors.As(err, &re) || re.Health != wire.ToolMismatch { |
| + t.Fatalf("not refused as a mismatch: %v", err) |
| + } |
| + if !strings.Contains(re.Error(), why[name]) || why[name] == "" { |
| + t.Fatalf("refused for another reason than %q: %v", why[name], err) |
| + } |
| + if _, err := os.Lstat(RendererTree(dir, pin)); !errors.Is(err, os.ErrNotExist) { |
| + t.Fatalf("a tree is in place after a refusal: %v", err) |
| + } |
| + if left := leftovers(t, dir, ""); len(left) != 0 { |
| + t.Fatalf("left behind: %v", left) |
| + } |
| + if _, err := os.Lstat(escape); !errors.Is(err, os.ErrNotExist) { |
| + t.Fatal("wrote outside the tree") |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// An archive larger, once unpacked, than any the build writes, or with |
| +// more entries, is refused before it fills the disk. |
| +func TestInstallRendererBoundsTheArchive(t *testing.T) { |
| + for name, set := range map[string]func(){ |
| + "bytes": func() { rendererUnpackedMax = 4 }, |
| + "entries": func() { rendererEntriesMax = 3 }, |
| + } { |
| + t.Run(name, func(t *testing.T) { |
| + oldBytes, oldEntries := rendererUnpackedMax, rendererEntriesMax |
| + t.Cleanup(func() { rendererUnpackedMax, rendererEntriesMax = oldBytes, oldEntries }) |
| + set() |
| + dir := installDir(t) |
| + archive, pin := renderertest.Archive(renderertest.Small()) |
| + if _, err := InstallRenderer(dir, bytes.NewReader(archive), pin); RendererHealth(err) != wire.ToolMismatch { |
| + t.Fatalf("not refused: %v", err) |
| + } |
| + if left := leftovers(t, dir, ""); len(left) != 0 { |
| + t.Fatalf("left behind: %v", left) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +// The tree's directory, <runner dir>/renderer/, must be a directory |
| +// nobody else can write (render.Launch refuses another): a link there, |
| +// or one group writable, is refused; no pin installs nothing. |
| +func TestInstallRendererRefusesAnUnsafeParentOrNoPin(t *testing.T) { |
| + archive, pin := renderertest.Archive(renderertest.Small()) |
| + t.Run("group writable", func(t *testing.T) { |
| + dir := installDir(t) |
| + if err := os.Mkdir(filepath.Join(dir, "renderer"), 0o775); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := os.Chmod(filepath.Join(dir, "renderer"), 0o775); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := InstallRenderer(dir, bytes.NewReader(archive), pin); err == nil { |
| + t.Fatal("installed under a group writable directory") |
| + } |
| + }) |
| + t.Run("link", func(t *testing.T) { |
| + dir := installDir(t) |
| + elsewhere := installDir(t) |
| + if err := os.Symlink(elsewhere, filepath.Join(dir, "renderer")); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := InstallRenderer(dir, bytes.NewReader(archive), pin); err == nil { |
| + t.Fatal("installed through a link") |
| + } |
| + if names, _ := os.ReadDir(elsewhere); len(names) != 0 { |
| + t.Fatal("wrote through the link") |
| + } |
| + }) |
| + t.Run("relative runner dir", func(t *testing.T) { |
| + t.Chdir(installDir(t)) |
| + if err := os.MkdirAll("releases/v", 0o700); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := InstallRenderer("releases/v", bytes.NewReader(archive), pin); err == nil { |
| + t.Fatal("installed under a relative path") |
| + } |
| + if _, err := os.Stat("releases/v/renderer"); !errors.Is(err, os.ErrNotExist) { |
| + t.Fatalf("wrote under a relative path: %v", err) |
| + } |
| + }) |
| + t.Run("unpinned", func(t *testing.T) { |
| + dir := installDir(t) |
| + if _, err := InstallRenderer(dir, bytes.NewReader(archive), ""); RendererHealth(err) != wire.ToolUnpinned { |
| + t.Fatalf("not unpinned: %v", err) |
| + } |
| + if left := leftovers(t, dir, ""); len(left) != 0 { |
| + t.Fatalf("left behind: %v", left) |
| + } |
| + }) |
| +} |
| + |
| +// The served archive's MANIFEST is read from its first member alone. |
| +func TestRendererArchivePin(t *testing.T) { |
| + archive, pin := renderertest.Archive(renderertest.Small()) |
| + if got, err := RendererArchivePin(bytes.NewReader(archive)); err != nil || got != pin { |
| + t.Fatalf("pin %q %v, want %s", got, err, pin) |
| + } |
| + late := renderertest.Raw([]*tar.Header{{Name: "usr/", Typeflag: tar.TypeDir, Mode: 0o755}, {Name: "MANIFEST", Typeflag: tar.TypeReg, Mode: 0o644}}, [][]byte{nil, nil}) |
| + other := renderertest.Raw([]*tar.Header{{Name: "NOTES", Typeflag: tar.TypeReg, Mode: 0o644, Size: 1}}, [][]byte{[]byte("x")}) |
| + for name, raw := range map[string][]byte{"not gzip": []byte("x"), "manifest not first": late, "another first file": other} { |
| + if _, err := RendererArchivePin(bytes.NewReader(raw)); err == nil { |
| + t.Fatal("a pin for", name) |
| + } |
| + } |
| +} |
diff --git a/internal/release/renderer_scripts_test.go b/internal/release/renderer_scripts_test.go| new file mode 100644 |
| index 00000000..9eaae7be |
| --- /dev/null |
| +++ b/internal/release/renderer_scripts_test.go |
| @@ -0,0 +1,110 @@ |
| +package release |
| + |
| +import ( |
| + "os" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/release/renderertest" |
| +) |
| + |
| +// The rigs' renderer archive, and the line that links its pin into their |
| +// stub runners, as the release build links it into equipo-runner. |
| +var rendererArchiveBytes, rendererArchivePin = renderertest.Archive(renderertest.Small()) |
| + |
| +var linkedRenderer = "# renderer " + rendererArchivePin + "\n" |
| + |
| +// rendererStub is the stub runner's install-renderer: it logs the |
| +// archive it was given and fails while rendererfail exists beside log. |
| +func rendererStub(log string) string { |
| + return "if [ \"$1\" = install-renderer ]; then echo \"equipo-runner install-renderer $2\" >> " + log + "; [ ! -e " + filepath.Join(filepath.Dir(log), "rendererfail") + " ]; exit; fi\n" |
| +} |
| + |
| +// The runner renders pages with the tree beside its own executable, held |
| +// to the pin linked into it. Each script that installs a production |
| +// runner checks in its preflight that the staged renderer.tar.gz is that |
| +// pin's, has the staged runner unpack it beside itself |
| +// (install-renderer), then verify-installed, which checks the tree and |
| +// renders the fixture page. |
| +func TestThinScriptsInstallTheRendererBesideTheRunner(t *testing.T) { |
| + for name, rig := range scannerRigs(t) { |
| + t.Run(name, func(t *testing.T) { |
| + r := rig() |
| + archive := filepath.Join(r.release, RendererArchive) |
| + out, err := r.plan() |
| + if err != nil { |
| + t.Fatalf("plan: %v\n%s", err, out) |
| + } |
| + inOrder(t, out, "== ", archive+": its MANIFEST's sha256 is linked into "+filepath.Join(r.release, "equipo-runner"), |
| + "install -m 0700 "+filepath.Join(r.release, "equipo-runner"), |
| + filepath.Join(r.installed, "equipo-runner")+" install-renderer "+archive, |
| + "verify-installed") |
| + if out, err = r.execute(); err != nil { |
| + t.Fatalf("execute: %v\n%s", err, out) |
| + } |
| + raw, _ := os.ReadFile(r.log) |
| + inOrder(t, string(raw), "equipo-runner install-renderer "+archive+"\n", "equipo-runner verify-installed") |
| + }) |
| + } |
| +} |
| + |
| +// A staged release without the renderer archive, with another tree's, or |
| +// with one that is not an archive, is refused in the preflight, before |
| +// anything changes. |
| +func TestThinScriptsRefuseWithoutTheLinkedRenderer(t *testing.T) { |
| + other, _ := renderertest.Archive(renderertest.Small()[:4]) |
| + for name, rig := range scannerRigs(t) { |
| + for fault, set := range map[string]func(archive string) error{ |
| + "missing": os.Remove, |
| + "another tree": func(a string) error { return os.WriteFile(a, other, 0o600) }, |
| + "not an archive": func(a string) error { return os.WriteFile(a, []byte("not gzip"), 0o600) }, |
| + } { |
| + t.Run(name+"/"+fault, func(t *testing.T) { |
| + r := rig() |
| + if err := set(filepath.Join(r.release, RendererArchive)); err != nil { |
| + t.Fatal(err) |
| + } |
| + out, err := r.execute() |
| + if err == nil || !strings.Contains(out, "refused: ") || !strings.Contains(out, RendererArchive) { |
| + t.Fatalf("not refused for the renderer: %v\n%s", err, out) |
| + } |
| + raw, _ := os.ReadFile(r.log) |
| + for _, change := range []string{"db pull", "env set", "env unset", "daemon-reload", "deploy", "enrol", "restart", "stop", "install-renderer"} { |
| + if strings.Contains(string(raw), change) { |
| + t.Fatalf("changed something (%s) before refusing:\n%s", change, raw) |
| + } |
| + } |
| + if _, err := os.Stat(r.installed); !os.IsNotExist(err) { |
| + t.Fatalf("installed something before refusing: %v", err) |
| + } |
| + }) |
| + } |
| + } |
| +} |
| + |
| +// A renderer that does not install stops the script before the runner's |
| +// configuration or unit changes, or anything starts. |
| +func TestThinScriptsStopWhenTheRendererDoesNotInstall(t *testing.T) { |
| + for name, rig := range scannerRigs(t) { |
| + t.Run(name, func(t *testing.T) { |
| + r := rig() |
| + if err := os.WriteFile(filepath.Join(filepath.Dir(r.log), "rendererfail"), nil, 0o600); err != nil { |
| + t.Fatal(err) |
| + } |
| + out, err := r.execute() |
| + if err == nil { |
| + t.Fatalf("went on after install-renderer failed:\n%s", out) |
| + } |
| + raw, _ := os.ReadFile(r.log) |
| + if !strings.Contains(string(raw), "install-renderer") { |
| + t.Fatalf("install-renderer never ran:\n%s", raw) |
| + } |
| + for _, change := range []string{"verify-installed", "daemon-reload", "enrol", "restart", "start"} { |
| + if strings.Contains(string(raw), change) { |
| + t.Fatalf("went on (%s) after install-renderer failed:\n%s", change, raw) |
| + } |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/release/renderertest/renderertest.go b/internal/release/renderertest/renderertest.go| new file mode 100644 |
| index 00000000..62038e3c |
| --- /dev/null |
| +++ b/internal/release/renderertest/renderertest.go |
| @@ -0,0 +1,123 @@ |
| +// Package renderertest builds renderer archives for tests, in the layout |
| +// scripts/build-renderer-tree.py writes: MANIFEST first, then every entry |
| +// in path order, directories with a trailing slash, PAX headers, no |
| +// owner and no times. |
| +package renderertest |
| + |
| +import ( |
| + "archive/tar" |
| + "bytes" |
| + "compress/gzip" |
| + "crypto/sha256" |
| + "encoding/hex" |
| + "fmt" |
| + "sort" |
| + "strings" |
| +) |
| + |
| +// Entry is one member of the tree: Kind is "dir", "file" or "link". |
| +// Mode is a file's (0644 or 0755); Body is a file's bytes, Target a |
| +// link's target. |
| +type Entry struct { |
| + Path, Kind string |
| + Mode int64 |
| + Body, Target string |
| +} |
| + |
| +// Small is a tree of a few entries of each kind, links among them. |
| +func Small() []Entry { |
| + return []Entry{ |
| + {Path: "etc", Kind: "dir"}, |
| + {Path: "etc/fonts", Kind: "dir"}, |
| + {Path: "etc/fonts/fonts.conf", Kind: "link", Target: "../../usr/share/fonts.conf"}, |
| + {Path: "usr", Kind: "dir"}, |
| + {Path: "usr/bin", Kind: "dir"}, |
| + {Path: "usr/bin/chromium", Kind: "link", Target: "../lib/chromium/chromium-headless-shell"}, |
| + {Path: "usr/lib", Kind: "dir"}, |
| + {Path: "usr/lib/chromium", Kind: "dir"}, |
| + {Path: "usr/lib/chromium/chromium-headless-shell", Kind: "file", Mode: 0o755, Body: "browser"}, |
| + {Path: "usr/share", Kind: "dir"}, |
| + {Path: "usr/share/fonts.conf", Kind: "file", Mode: 0o644, Body: "<fontconfig/>"}, |
| + } |
| +} |
| + |
| +// Manifest is the MANIFEST of entries, as the build writes it. |
| +func Manifest(entries []Entry) []byte { |
| + sorted := append([]Entry(nil), entries...) |
| + sort.Slice(sorted, func(i, j int) bool { return sorted[i].Path < sorted[j].Path }) |
| + var b strings.Builder |
| + for _, e := range sorted { |
| + switch e.Kind { |
| + case "dir": |
| + fmt.Fprintf(&b, "dir %s\n", e.Path) |
| + case "link": |
| + fmt.Fprintf(&b, "link %s %s\n", e.Path, e.Target) |
| + default: |
| + sum := sha256.Sum256([]byte(e.Body)) |
| + fmt.Fprintf(&b, "file %s %s %04o\n", e.Path, hex.EncodeToString(sum[:]), e.Mode) |
| + } |
| + } |
| + return []byte(b.String()) |
| +} |
| + |
| +// Pin is the SHA-256 of a MANIFEST: the renderer pin. |
| +func Pin(manifest []byte) string { |
| + sum := sha256.Sum256(manifest) |
| + return hex.EncodeToString(sum[:]) |
| +} |
| + |
| +// Archive is renderer.tar.gz for entries, with their MANIFEST, and its |
| +// pin. |
| +func Archive(entries []Entry) ([]byte, string) { |
| + manifest := Manifest(entries) |
| + return ArchiveOf(entries, manifest), Pin(manifest) |
| +} |
| + |
| +// ArchiveOf is renderer.tar.gz for entries with the given MANIFEST, which |
| +// may list other bytes than the entries hold. |
| +func ArchiveOf(entries []Entry, manifest []byte) []byte { |
| + headers := []*tar.Header{{Name: "MANIFEST", Typeflag: tar.TypeReg, Mode: 0o644, Size: int64(len(manifest))}} |
| + bodies := [][]byte{manifest} |
| + sorted := append([]Entry(nil), entries...) |
| + sort.Slice(sorted, func(i, j int) bool { return sorted[i].Path < sorted[j].Path }) |
| + for _, e := range sorted { |
| + switch e.Kind { |
| + case "dir": |
| + headers = append(headers, &tar.Header{Name: e.Path + "/", Typeflag: tar.TypeDir, Mode: 0o755}) |
| + bodies = append(bodies, nil) |
| + case "link": |
| + headers = append(headers, &tar.Header{Name: e.Path, Typeflag: tar.TypeSymlink, Mode: 0o777, Linkname: e.Target}) |
| + bodies = append(bodies, nil) |
| + default: |
| + headers = append(headers, &tar.Header{Name: e.Path, Typeflag: tar.TypeReg, Mode: e.Mode, Size: int64(len(e.Body))}) |
| + bodies = append(bodies, []byte(e.Body)) |
| + } |
| + } |
| + return Raw(headers, bodies) |
| +} |
| + |
| +// Raw is a tar.gz of exactly these headers and bodies, in order, so a |
| +// test can write any member the build never would. |
| +func Raw(headers []*tar.Header, bodies [][]byte) []byte { |
| + var b bytes.Buffer |
| + gz := gzip.NewWriter(&b) |
| + tw := tar.NewWriter(gz) |
| + for i, h := range headers { |
| + h.Format = tar.FormatPAX |
| + if err := tw.WriteHeader(h); err != nil { |
| + panic(err) |
| + } |
| + if len(bodies[i]) > 0 { |
| + if _, err := tw.Write(bodies[i]); err != nil { |
| + panic(err) |
| + } |
| + } |
| + } |
| + if err := tw.Close(); err != nil { |
| + panic(err) |
| + } |
| + if err := gz.Close(); err != nil { |
| + panic(err) |
| + } |
| + return b.Bytes() |
| +} |
diff --git a/internal/release/upgrade_test.go b/internal/release/upgrade_test.go| index 46c63a91..af721b39 100644 |
| --- a/internal/release/upgrade_test.go |
| +++ b/internal/release/upgrade_test.go |
| @@ -43,8 +43,9 @@ func newUpgradeRig(t *testing.T) *upgradeRig { |
| r.write(filepath.Join(repo, "scripts", "runner-config.py"), string(helper), 0700) |
| r.write(filepath.Join(repo, "releases", "equipo-linux-arm64-"+upgradeTo), "instance", 0600) |
| release := filepath.Join(repo, "releases", "equipo-runner-linux-amd64-"+upgradeTo) |
| - runner := "#!/bin/sh\nif [ \"$1\" = verify-installed ]; then echo \"equipo-runner verify-installed $EQUIPO_TOOL_PROXY_PATH\" >> " + r.log + "; [ ! -e " + filepath.Join(root, "verifyfail") + " ]; exit; fi\necho \"equipo-runner $1\" >> " + r.log + "\n" + linkedScanner |
| + runner := "#!/bin/sh\n" + rendererStub(r.log) + "if [ \"$1\" = verify-installed ]; then echo \"equipo-runner verify-installed $EQUIPO_TOOL_PROXY_PATH\" >> " + r.log + "; [ ! -e " + filepath.Join(root, "verifyfail") + " ]; exit; fi\necho \"equipo-runner $1\" >> " + r.log + "\n" + linkedScanner + linkedRenderer |
| r.write(filepath.Join(release, "equipo-runner"), runner, 0700) |
| + r.write(filepath.Join(release, RendererArchive), string(rendererArchiveBytes), 0600) |
| r.write(filepath.Join(release, "equipo-tool-proxy"), "proxy", 0700) |
| r.write(filepath.Join(release, "gitleaks"), scannerBytes, 0700) |
| sum := sha256.Sum256([]byte(runner)) |
diff --git a/internal/runner/render/driver_real_linux_test.go b/internal/runner/render/driver_real_linux_test.go| index 48b5b151..b0e1d0e6 100644 |
| --- a/internal/runner/render/driver_real_linux_test.go |
| +++ b/internal/runner/render/driver_real_linux_test.go |
| @@ -240,3 +240,19 @@ func TestRenderOverMemoryIsCrashed(t *testing.T) { |
| } |
| t.Logf("%v", err) |
| } |
| + |
| +// The fixture render that install and verify-installed run: the real |
| +// browser paints the embedded page, and CheckFixture leaves nothing in |
| +// its scratch directory. |
| +func TestCheckFixtureRealBrowser(t *testing.T) { |
| + cfg, _ := realConfig(t) |
| + scratch := tempDir(t) |
| + began := time.Now() |
| + if err := CheckFixture(context.Background(), cfg, scratch); err != nil { |
| + t.Fatal(err) |
| + } |
| + t.Logf("fixture render in %v", time.Since(began)) |
| + if left, _ := os.ReadDir(scratch); len(left) != 0 { |
| + t.Fatalf("left in scratch: %v", left) |
| + } |
| +} |
diff --git a/internal/runner/render/fixture.go b/internal/runner/render/fixture.go| new file mode 100644 |
| index 00000000..8e88cd89 |
| --- /dev/null |
| +++ b/internal/runner/render/fixture.go |
| @@ -0,0 +1,104 @@ |
| +package render |
| + |
| +import ( |
| + "context" |
| + "fmt" |
| + "image" |
| + "image/color" |
| + "image/png" |
| + "os" |
| + "path/filepath" |
| +) |
| + |
| +// FixturePage is the page the installers and verify-installed render to |
| +// show the renderer works (spec section 3, "Pin and provisioning"): one |
| +// block of fixtureColour at fixtureBlock on fixtureBackground, static, |
| +// with nothing to load, so every render of it paints the same pixels. |
| +const FixturePage = `<!doctype html> |
| +<html lang="en"> |
| +<head> |
| +<meta charset="utf-8"> |
| +<title>Renderer check</title> |
| +<style> |
| +html, body { margin: 0; background: #ffffff; } |
| +#block { position: absolute; left: 100px; top: 100px; width: 200px; height: 200px; background: #1e6b52; } |
| +</style> |
| +</head> |
| +<body><div id="block"></div></body> |
| +</html> |
| +` |
| + |
| +// What FixturePage paints at the desktop viewport (CSS pixels are |
| +// device pixels there). |
| +var ( |
| + fixtureBlock = image.Rect(100, 100, 300, 300) |
| + fixtureColour = color.RGBA{0x1e, 0x6b, 0x52, 0xff} |
| + fixtureBackground = color.RGBA{0xff, 0xff, 0xff, 0xff} |
| +) |
| + |
| +// CheckFixture renders FixturePage at the desktop viewport with cfg's |
| +// renderer (cfg.Site is replaced by the fixture's own site) and checks |
| +// the capture: no error code, one page, and the sampled pixels the |
| +// page's. The site and output directories are made in scratch, a |
| +// directory only this user can write, and removed again. A tree that |
| +// does not verify is the launch's *release.RendererError. |
| +func CheckFixture(ctx context.Context, cfg LaunchConfig, scratch string) error { |
| + dir, err := os.MkdirTemp(scratch, ".fixture-") |
| + if err != nil { |
| + return err |
| + } |
| + defer os.RemoveAll(dir) |
| + site, out := filepath.Join(dir, "site"), filepath.Join(dir, "out") |
| + if err = os.Mkdir(site, 0o700); err != nil { |
| + return err |
| + } |
| + if err = os.WriteFile(filepath.Join(site, "index.html"), []byte(FixturePage), 0o600); err != nil { |
| + return err |
| + } |
| + if err = os.Mkdir(out, 0o700); err != nil { |
| + return err |
| + } |
| + // Mkdir's mode follows the umask: Render wants its output private. |
| + if err = os.Chmod(out, 0o700); err != nil { |
| + return err |
| + } |
| + cfg.Site = site |
| + report, err := Render(ctx, cfg, out, []Page{{Path: "/", Viewport: Desktop}}) |
| + if err != nil { |
| + return err |
| + } |
| + if report.Error != "" || len(report.Pages) != 1 || report.Pages[0].Capture != "page-1.png" { |
| + return fmt.Errorf("render: the fixture page rendered as %+v", report) |
| + } |
| + f, err := os.Open(filepath.Join(out, report.Pages[0].Capture)) |
| + if err != nil { |
| + return err |
| + } |
| + defer f.Close() |
| + img, err := png.Decode(f) |
| + if err != nil { |
| + return fmt.Errorf("render: the fixture capture: %w", err) |
| + } |
| + return checkFixtureCapture(img) |
| +} |
| + |
| +// checkFixtureCapture samples a capture of FixturePage: the viewport's |
| +// size, the block's colour at its corners and centre, the background's |
| +// just outside it and far from it. |
| +func checkFixtureCapture(img image.Image) error { |
| + w, h, _ := Desktop.Size() |
| + if b := img.Bounds(); b != image.Rect(0, 0, w, h) { |
| + return fmt.Errorf("render: the fixture capture is %v, not %dx%d", b, w, h) |
| + } |
| + in := fixtureBlock |
| + samples := map[image.Point]color.RGBA{ |
| + in.Min: fixtureColour, {in.Max.X - 1, in.Max.Y - 1}: fixtureColour, {(in.Min.X + in.Max.X) / 2, (in.Min.Y + in.Max.Y) / 2}: fixtureColour, |
| + {in.Min.X - 1, in.Min.Y}: fixtureBackground, {in.Max.X, in.Max.Y - 1}: fixtureBackground, {w - 1, h - 1}: fixtureBackground, |
| + } |
| + for p, want := range samples { |
| + if got := color.RGBAModel.Convert(img.At(p.X, p.Y)).(color.RGBA); got != want { |
| + return fmt.Errorf("render: the fixture capture is not the fixture page: %v at %v, want %v", got, p, want) |
| + } |
| + } |
| + return nil |
| +} |
diff --git a/internal/runner/render/fixture_linux_test.go b/internal/runner/render/fixture_linux_test.go| new file mode 100644 |
| index 00000000..7155766c |
| --- /dev/null |
| +++ b/internal/runner/render/fixture_linux_test.go |
| @@ -0,0 +1,32 @@ |
| +//go:build linux |
| + |
| +package render |
| + |
| +import ( |
| + "context" |
| + "os" |
| + "path/filepath" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/release" |
| + "amadan.net/oficina/equipo/internal/wire" |
| +) |
| + |
| +// A tree that is not there is the launch's RendererError, and the |
| +// fixture's site and output are removed again. |
| +func TestCheckFixtureRefusesAMissingTree(t *testing.T) { |
| + scratch := tempDir(t) |
| + self, err := os.Executable() |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + pin := "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" |
| + cfg := LaunchConfig{Bwrap: "/usr/bin/bwrap", Binary: self, Tree: filepath.Join(scratch, "renderer", pin[:12]), Pin: pin} |
| + err = CheckFixture(context.Background(), cfg, scratch) |
| + if release.RendererHealth(err) != wire.ToolMissing { |
| + t.Fatalf("not missing: %v", err) |
| + } |
| + if left, _ := os.ReadDir(scratch); len(left) != 0 { |
| + t.Fatalf("left in scratch: %v", left) |
| + } |
| +} |
diff --git a/internal/runner/render/fixture_test.go b/internal/runner/render/fixture_test.go| new file mode 100644 |
| index 00000000..36329a73 |
| --- /dev/null |
| +++ b/internal/runner/render/fixture_test.go |
| @@ -0,0 +1,50 @@ |
| +package render |
| + |
| +import ( |
| + "image" |
| + "image/color" |
| + "image/draw" |
| + "strings" |
| + "testing" |
| +) |
| + |
| +// fixtureImage is a capture as the fixture page paints it, with the |
| +// block in colour c. |
| +func fixtureImage(w, h int, c color.Color) *image.RGBA { |
| + img := image.NewRGBA(image.Rect(0, 0, w, h)) |
| + draw.Draw(img, img.Bounds(), image.NewUniform(fixtureBackground), image.Point{}, draw.Src) |
| + draw.Draw(img, fixtureBlock, image.NewUniform(c), image.Point{}, draw.Src) |
| + return img |
| +} |
| + |
| +// A capture passes only as the fixture page paints it at the desktop |
| +// viewport: the block in its colour, the rest in the background. |
| +func TestFixtureCaptureIsSampled(t *testing.T) { |
| + w, h, _ := Desktop.Size() |
| + if err := checkFixtureCapture(fixtureImage(w, h, fixtureColour)); err != nil { |
| + t.Fatalf("the fixture's own capture refused: %v", err) |
| + } |
| + blank := image.NewRGBA(image.Rect(0, 0, w, h)) |
| + draw.Draw(blank, blank.Bounds(), image.NewUniform(fixtureBackground), image.Point{}, draw.Src) |
| + for name, img := range map[string]image.Image{ |
| + "no block": blank, |
| + "other colour": fixtureImage(w, h, color.RGBA{0x1e, 0x6b, 0x53, 0xff}), |
| + "all block": fixtureImage(w, h, fixtureColour).SubImage(fixtureBlock), |
| + "smaller": fixtureImage(w-1, h, fixtureColour), |
| + "larger": fixtureImage(w, h+1, fixtureColour), |
| + } { |
| + if checkFixtureCapture(img) == nil { |
| + t.Errorf("a capture with %s passed", name) |
| + } |
| + } |
| +} |
| + |
| +// The page is static: no script, no external load, nothing that could |
| +// make two renders differ. |
| +func TestFixturePageIsStatic(t *testing.T) { |
| + for _, banned := range []string{"<script", "http:", "https:", "@import", "url(", "<img", "<link"} { |
| + if strings.Contains(strings.ToLower(FixturePage), banned) { |
| + t.Errorf("the fixture page has %q", banned) |
| + } |
| + } |
| +} |
diff --git a/internal/runner/setup/install.go b/internal/runner/setup/install.go| index d23a294a..70bd784c 100644 |
| --- a/internal/runner/setup/install.go |
| +++ b/internal/runner/setup/install.go |
| @@ -1,6 +1,7 @@ |
| package runnersetup |
| import ( |
| + "bytes" |
| "context" |
| "crypto/sha256" |
| "encoding/hex" |
| @@ -31,14 +32,14 @@ type InstallResult struct { |
| var errUnavailable = errors.New("runner.install.unavailable") |
| type installHost struct { |
| - scannerPin string |
| - manifest release.Manifest |
| - home, goos, goarch string |
| - fetch func(context.Context, string, int64) ([]byte, error) |
| - preflight func(context.Context, string, release.InstallManifest) []string |
| - service func(context.Context, string) error |
| - lingering func(context.Context) (bool, error) |
| - serviceAvailable func(context.Context) bool |
| + scannerPin, rendererPin string |
| + manifest release.Manifest |
| + home, goos, goarch string |
| + fetch func(context.Context, string, int64) ([]byte, error) |
| + preflight func(context.Context, string, release.InstallManifest) []string |
| + service func(context.Context, string) error |
| + lingering func(context.Context) (bool, error) |
| + serviceAvailable func(context.Context) bool |
| } |
| func InstallUser(ctx context.Context, opts InstallOptions) (InstallResult, error) { |
| @@ -46,7 +47,8 @@ func InstallUser(ctx context.Context, opts InstallOptions) (InstallResult, error |
| if err != nil { |
| return InstallResult{State: "unavailable", Missing: []string{"runner.install.destination"}}, errUnavailable |
| } |
| - return installUser(ctx, opts, installHost{scannerPin: release.GitleaksSHA256(), manifest: release.BuildManifest(), home: home, goos: runtime.GOOS, goarch: runtime.GOARCH, fetch: fetchRelease, preflight: containmentPreflight, service: enableService, lingering: readLingering, serviceAvailable: userServiceAvailable}) |
| + rendererPin, _ := release.RendererPin() |
| + return installUser(ctx, opts, installHost{scannerPin: release.GitleaksSHA256(), rendererPin: rendererPin, manifest: release.BuildManifest(), home: home, goos: runtime.GOOS, goarch: runtime.GOARCH, fetch: fetchRelease, preflight: containmentPreflight, service: enableService, lingering: readLingering, serviceAvailable: userServiceAvailable}) |
| } |
| func installUser(ctx context.Context, o InstallOptions, h installHost) (r InstallResult, err error) { |
| r = InstallResult{Version: o.Release, State: "unavailable"} |
| @@ -136,9 +138,36 @@ func installUser(ctx context.Context, o InstallOptions, h installHost) (r Instal |
| return fail("runner.install.checksum") |
| } |
| dir := filepath.Join(o.Root, "releases", o.Release) |
| + // The page renderer, unpacked beside the runner: its MANIFEST must be |
| + // the pin linked into this runner and the one the release recorded. |
| + // A tree already there that verifies (the second run, after |
| + // enrolment) is kept and nothing is fetched for it. |
| + if h.rendererPin == "" || h.rendererPin != m.Targets[release.TargetLinux].RendererSHA256 { |
| + return fail("runner.install.checksum") |
| + } |
| + var renderer []byte |
| + if release.VerifyRenderer(release.RendererTree(dir, h.rendererPin), h.rendererPin) != nil { |
| + renderer, e = h.fetch(ctx, base+release.RendererArchive, release.RendererArchiveMax) |
| + if e != nil { |
| + return fail("runner.install.release") |
| + } |
| + if pin, pe := release.RendererArchivePin(bytes.NewReader(renderer)); pe != nil || pin != h.rendererPin { |
| + return fail("runner.install.checksum") |
| + } |
| + } |
| if !privateDirectory(dir) { |
| return fail("runner.install.destination") |
| } |
| + // Unpacked and verified before any of the runner's files is written. |
| + if renderer != nil { |
| + if _, e = release.InstallRenderer(dir, bytes.NewReader(renderer), h.rendererPin); e != nil { |
| + var mismatch *release.RendererError |
| + if errors.As(e, &mismatch) { |
| + return fail("runner.install.checksum") |
| + } |
| + return fail("runner.install.destination") |
| + } |
| + } |
| r.BinaryPath = filepath.Join(dir, "equipo-runner") |
| if e = writeOwned(r.BinaryPath, binary, 0700); e != nil { |
| return fail("runner.install.destination") |
| @@ -285,7 +314,13 @@ func fetchRelease(ctx context.Context, url string, limit int64) ([]byte, error) |
| if resp.StatusCode != http.StatusOK { |
| return nil, errUnavailable |
| } |
| - b, e := io.ReadAll(io.LimitReader(resp.Body, limit+1)) |
| + // One buffer of the announced size (the renderer is about 230 MB). |
| + var buf bytes.Buffer |
| + if resp.ContentLength > 0 && resp.ContentLength <= limit { |
| + buf.Grow(int(resp.ContentLength) + 1) |
| + } |
| + _, e = buf.ReadFrom(io.LimitReader(resp.Body, limit+1)) |
| + b := buf.Bytes() |
| if e != nil || int64(len(b)) > limit { |
| return nil, errUnavailable |
| } |
diff --git a/internal/runner/setup/install_test.go b/internal/runner/setup/install_test.go| index 72cc396c..b9cd4961 100644 |
| --- a/internal/runner/setup/install_test.go |
| +++ b/internal/runner/setup/install_test.go |
| @@ -11,6 +11,7 @@ import ( |
| "testing" |
| "amadan.net/oficina/equipo/internal/release" |
| + "amadan.net/oficina/equipo/internal/release/renderertest" |
| "amadan.net/oficina/equipo/internal/runner/provider" |
| "golang.org/x/sys/unix" |
| ) |
| @@ -44,16 +45,21 @@ func installFixture(t *testing.T) (InstallOptions, installHost, *int) { |
| // What a release build records: the tool proxy built beside the runner. |
| built := release.BuildManifest() |
| built.Binaries = append(built.Binaries[:4:4], release.BinaryDigest{Name: "equipo-tool-proxy", Version: built.LauncherVersion, SHA256: proxySum}) |
| - m := release.InstallManifest{Version: "fixture-16", Target: "linux/amd64", RunnerSHA256: runnerSum, NamespaceArgs: provider.NamespaceArguments(), Release: built, Targets: map[string]release.InstallTarget{release.TargetLinux: {RunnerSHA256: runnerSum, ToolProxySHA256: proxySum, GitleaksSHA256: runnerSum}}} |
| + // And the renderer archive, whose MANIFEST is the pin linked into the runner. |
| + archive, rendererPin := renderertest.Archive(renderertest.Small()) |
| + m := release.InstallManifest{Version: "fixture-16", Target: "linux/amd64", RunnerSHA256: runnerSum, NamespaceArgs: provider.NamespaceArguments(), Release: built, Targets: map[string]release.InstallTarget{release.TargetLinux: {RunnerSHA256: runnerSum, ToolProxySHA256: proxySum, GitleaksSHA256: runnerSum, RendererSHA256: rendererPin}}} |
| raw, err := json.Marshal(m) |
| if err != nil { |
| t.Fatal(err) |
| } |
| calls := new(int) |
| - h := installHost{scannerPin: runnerSum, manifest: m.Release, home: home, goos: "linux", goarch: "amd64", fetch: func(_ context.Context, url string, _ int64) ([]byte, error) { |
| + h := installHost{scannerPin: runnerSum, rendererPin: rendererPin, manifest: m.Release, home: home, goos: "linux", goarch: "amd64", fetch: func(_ context.Context, url string, _ int64) ([]byte, error) { |
| if strings.HasSuffix(url, "install-manifest.json") { |
| return raw, nil |
| } |
| + if strings.HasSuffix(url, "/"+release.RendererArchive) { |
| + return archive, nil |
| + } |
| if strings.HasSuffix(url, "equipo-tool-proxy") { |
| return []byte("fixture tool proxy"), nil |
| } |
diff --git a/internal/runner/setup/renderer_install_test.go b/internal/runner/setup/renderer_install_test.go| new file mode 100644 |
| index 00000000..e7ab1075 |
| --- /dev/null |
| +++ b/internal/runner/setup/renderer_install_test.go |
| @@ -0,0 +1,114 @@ |
| +//go:build linux |
| + |
| +package runnersetup |
| + |
| +import ( |
| + "context" |
| + "encoding/json" |
| + "os" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/release" |
| + "amadan.net/oficina/equipo/internal/release/renderertest" |
| +) |
| + |
| +// The installer fetches renderer.tar.gz with the runner, holds its |
| +// MANIFEST to the pin linked into the runner and to the one the release |
| +// recorded, and unpacks it beside the runner as |
| +// renderer/<first 12 of pin>/, the tree VerifyRenderer accepts. |
| +func TestInstallIncludesVerifiedRenderer(t *testing.T) { |
| + o, h, _ := installFixture(t) |
| + r, err := installUser(context.Background(), o, h) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + tree := release.RendererTree(filepath.Dir(r.BinaryPath), h.rendererPin) |
| + if err = release.VerifyRenderer(tree, h.rendererPin); err != nil { |
| + t.Fatalf("no verified renderer beside the runner: %v", err) |
| + } |
| + // A retry (the installer runs twice: before enrolment and after) |
| + // finds the tree verified and fetches nothing for it. |
| + fetch := h.fetch |
| + h.fetch = func(ctx context.Context, url string, limit int64) ([]byte, error) { |
| + if strings.HasSuffix(url, "/"+release.RendererArchive) { |
| + t.Error("fetched the renderer again for a verified tree") |
| + } |
| + return fetch(ctx, url, limit) |
| + } |
| + if _, err = installUser(context.Background(), o, h); err != nil { |
| + t.Fatal(err) |
| + } |
| +} |
| + |
| +// Another archive, one whose files are not its MANIFEST's, a release |
| +// that recorded another pin or none, and a runner with no pin linked: |
| +// refused before the runner or the renderer is written. |
| +func TestInstallRendererRefusesAnotherTree(t *testing.T) { |
| + other, otherPin := renderertest.Archive(renderertest.Small()[:4]) |
| + // The pin's MANIFEST, over a file with other bytes than it lists. |
| + changed := renderertest.Small() |
| + changed[len(changed)-1].Body = "changed" |
| + tampered := renderertest.ArchiveOf(changed, renderertest.Manifest(renderertest.Small())) |
| + for name, change := range map[string]func(*installHost){ |
| + "another archive": func(h *installHost) { h.fetch = swap(h.fetch, release.RendererArchive, other) }, |
| + "not an archive": func(h *installHost) { h.fetch = swap(h.fetch, release.RendererArchive, []byte("not gzip")) }, |
| + "a changed file": func(h *installHost) { h.fetch = swap(h.fetch, release.RendererArchive, tampered) }, |
| + "recorded another pin": func(h *installHost) { |
| + h.fetch = editManifest(h.fetch, func(m *release.InstallManifest) { |
| + linux := m.Targets[release.TargetLinux] |
| + linux.RendererSHA256 = otherPin |
| + m.Targets[release.TargetLinux] = linux |
| + }) |
| + }, |
| + "recorded none": func(h *installHost) { |
| + h.fetch = editManifest(h.fetch, func(m *release.InstallManifest) { |
| + linux := m.Targets[release.TargetLinux] |
| + linux.RendererSHA256 = "" |
| + m.Targets[release.TargetLinux] = linux |
| + }) |
| + }, |
| + "runner linked another pin": func(h *installHost) { h.rendererPin = otherPin }, |
| + "runner linked none": func(h *installHost) { h.rendererPin = "" }, |
| + } { |
| + t.Run(name, func(t *testing.T) { |
| + o, h, calls := installFixture(t) |
| + pin := h.rendererPin |
| + change(&h) |
| + r, err := installUser(context.Background(), o, h) |
| + if err == nil || r.State != "unavailable" || strings.Join(r.Missing, ",") != "runner.install.checksum" || *calls != 0 { |
| + t.Fatalf("installed with %s: %+v %v", name, r, err) |
| + } |
| + dir := filepath.Join(o.Root, "releases", o.Release) |
| + for _, p := range []string{release.RendererTree(dir, pin), release.RendererTree(dir, otherPin), filepath.Join(dir, "equipo-runner")} { |
| + if _, err := os.Lstat(p); !os.IsNotExist(err) { |
| + t.Fatalf("a renderer tree at %s: %v", p, err) |
| + } |
| + } |
| + }) |
| + } |
| +} |
| + |
| +func swap(fetch func(context.Context, string, int64) ([]byte, error), name string, body []byte) func(context.Context, string, int64) ([]byte, error) { |
| + return func(ctx context.Context, url string, limit int64) ([]byte, error) { |
| + if strings.HasSuffix(url, "/"+name) { |
| + return body, nil |
| + } |
| + return fetch(ctx, url, limit) |
| + } |
| +} |
| + |
| +func editManifest(fetch func(context.Context, string, int64) ([]byte, error), edit func(*release.InstallManifest)) func(context.Context, string, int64) ([]byte, error) { |
| + return func(ctx context.Context, url string, limit int64) ([]byte, error) { |
| + b, err := fetch(ctx, url, limit) |
| + if err == nil && strings.HasSuffix(url, "/install-manifest.json") { |
| + var m release.InstallManifest |
| + if err = json.Unmarshal(b, &m); err == nil { |
| + edit(&m) |
| + b, err = json.Marshal(m) |
| + } |
| + } |
| + return b, err |
| + } |
| +} |
diff --git a/scripts/build-instance-release.sh b/scripts/build-instance-release.sh| index 7843d530..b9fe40ab 100755 |
| --- a/scripts/build-instance-release.sh |
| +++ b/scripts/build-instance-release.sh |
| @@ -10,7 +10,9 @@ bundle=internal/release/bundled |
| mkdir "$bundle" |
| trap 'rm -rf "$bundle"' EXIT |
| trap 'exit 1' HUP INT TERM |
| -for name in install-manifest.json equipo-runner equipo-tool-proxy gitleaks install-v1.sh; do |
| +# renderer.tar.gz is the page renderer the Linux (amd64) runner installs |
| +# beside itself; the asset reader allows it 384 MiB. |
| +for name in install-manifest.json equipo-runner equipo-tool-proxy gitleaks renderer.tar.gz install-v1.sh; do |
| cp "$source/$name" "$bundle/$name" |
| done |
| # The Mac worker's runner, served under darwin-arm64/ (it has no tool proxy). |
diff --git a/scripts/cutover-finish-thin.sh b/scripts/cutover-finish-thin.sh| index 310f927b..70a23bb6 100755 |
| --- a/scripts/cutover-finish-thin.sh |
| +++ b/scripts/cutover-finish-thin.sh |
| @@ -20,8 +20,9 @@ |
| # and the public origin, on both routes; staged runner bytes |
| # 7 config EQUIPO_DATABASE unset, so the configuration says what runs; |
| # then the instance serves that version and the same id again |
| -# 8 runner the runner's files recorded once; the staged runner beside |
| -# the old one; service.env and unit written from that record |
| +# 8 runner the runner's files recorded once; the staged runner (and |
| +# its page renderer, install-renderer) beside the old one; |
| +# service.env and unit written from that record |
| # (scripts/runner-config.py); the old state moved aside |
| # 9 enrol the written and loaded configuration checked, then |
| # verify-installed, enrol (the owner approves the link) |
| @@ -58,7 +59,7 @@ case "${1:-} ${2:-}" in |
| "--execute ") execute=1 ;; |
| "rollback ") mode=rollback ;; |
| "rollback --execute") mode=rollback execute=1 ;; |
| -*) sed -n '2,35p' "$0"; exit 2 ;; |
| +*) sed -n '2,36p' "$0"; exit 2 ;; |
| esac |
| die() { echo "refused: $*" >&2; exit 1; } |
| @@ -124,6 +125,22 @@ scanner() { |
| die "$1/gitleaks is missing, cannot run, or is not the scanner equipo-runner was built with" |
| fi |
| } |
| +# The runner renders pages with the renderer tree beside its own |
| +# executable, held to the pin linked into the runner (the sha256 of the |
| +# tree's MANIFEST). $1 is a runner release directory: the MANIFEST of its |
| +# renderer.tar.gz has the sha256 linked into its equipo-runner. |
| +renderer_linked() { |
| + local sum |
| + [[ -f $1/renderer.tar.gz && ! -L $1/renderer.tar.gz ]] || return 1 |
| + sum=$(tar -xzOf "$1/renderer.tar.gz" MANIFEST | sha256sum | cut -d ' ' -f 1) || return 1 |
| + grep -qaF "$sum" "$1/equipo-runner" |
| +} |
| +renderer() { |
| + echo " $1/renderer.tar.gz: its MANIFEST's sha256 is linked into $1/equipo-runner" |
| + if ((execute)) && ! renderer_linked "$1"; then |
| + die "$1/renderer.tar.gz is missing, or is not the renderer equipo-runner was built with" |
| + fi |
| +} |
| # A hash from the green staging record of $version (empty if there is none). |
| staged_sha() { python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); print(d["sha256"][sys.argv[2]] if d.get("staging") == "PASS" else "")' "$RELEASES/staged/$version.json" "$1" 2>/dev/null || true; } |
| @@ -221,6 +238,7 @@ run curl -fsS "$ORIGIN/api/version" |
| echo " $ORIGIN/install.sh and $PUBLIC_ORIGIN/install.sh must end: sh -s -- '$PUBLIC_ORIGIN' '$version' '$old_id'" |
| echo " the staged runner, tool proxy and gitleaks must have the hashes in $RELEASES/staged/$version.json" |
| scanner "$runner_release" |
| +renderer "$runner_release" |
| if ((execute)) && ! done_step identity; then |
| [[ $(curl -fsS "$ORIGIN/api/version") == "$version" ]] || die "production does not serve $version" |
| identity |
| @@ -261,6 +279,9 @@ if ! done_step runner; then |
| echo " $UNIT is $RUNNER_ROOT/equipo-runner.service with state $RUNNER_ROOT/state; its files recorded once in $snap" |
| run install -d -m 0700 "$new" |
| run install -m 0700 "$runner_release/equipo-runner" "$runner_release/equipo-tool-proxy" "$runner_release/gitleaks" "$new/" |
| + # The page renderer beside it, unpacked by the staged runner itself and |
| + # held to the pin linked into it; verify-installed then renders a page. |
| + run "$new/equipo-runner" install-renderer "$runner_release/renderer.tar.gz" |
| run python3 "$REPO/scripts/runner-config.py" render "$snap" "$RUNNER_ROOT" "${config[@]}" |
| if ((execute)); then move_state; else |
| run mv "$RUNNER_ROOT/state" "$kept" |
diff --git a/scripts/cutover-thin.sh b/scripts/cutover-thin.sh| index d529a3ba..ba9cf3b9 100755 |
| --- a/scripts/cutover-thin.sh |
| +++ b/scripts/cutover-thin.sh |
| @@ -26,8 +26,8 @@ |
| # platform replica; it must exist and differ from the old one. |
| # Nothing on the runner has changed yet, so a failure here |
| # still rolls back cleanly. |
| -# 7 runner install the staged runner, tool proxy and gitleaks (the |
| -# preview scanner) beside the old one, new service.env |
| +# 7 runner install the staged runner, tool proxy, gitleaks (the |
| +# preview scanner) and page renderer beside the old one, new service.env |
| # (tool proxy path, new instance id) and unit |
| # (RestartPreventExitStatus=3), old state moved aside |
| # 8 enrol the runner enrols with the new instance, the owner approves |
| @@ -106,6 +106,22 @@ scanner() { |
| die "$1/gitleaks is missing, cannot run, or is not the scanner equipo-runner was built with" |
| fi |
| } |
| +# The runner renders pages with the renderer tree beside its own |
| +# executable, held to the pin linked into the runner (the sha256 of the |
| +# tree's MANIFEST). $1 is a runner release directory: the MANIFEST of its |
| +# renderer.tar.gz has the sha256 linked into its equipo-runner. |
| +renderer_linked() { |
| + local sum |
| + [[ -f $1/renderer.tar.gz && ! -L $1/renderer.tar.gz ]] || return 1 |
| + sum=$(tar -xzOf "$1/renderer.tar.gz" MANIFEST | sha256sum | cut -d ' ' -f 1) || return 1 |
| + grep -qaF "$sum" "$1/equipo-runner" |
| +} |
| +renderer() { |
| + echo " $1/renderer.tar.gz: its MANIFEST's sha256 is linked into $1/equipo-runner" |
| + if ((execute)) && ! renderer_linked "$1"; then |
| + die "$1/renderer.tar.gz is missing, or is not the renderer equipo-runner was built with" |
| + fi |
| +} |
| overlaps() { case "$1/" in "$2"/*) return 0 ;; esac; case "$2/" in "$1"/*) return 0 ;; esac; return 1; } |
| if [[ $mode == rollback ]]; then |
| @@ -163,6 +179,7 @@ run test -f "$instance" |
| run test -x "$runner_release/equipo-runner" |
| run test -x "$runner_release/equipo-tool-proxy" |
| scanner "$runner_release" |
| +renderer "$runner_release" |
| run test -f "$RUNNER_ROOT/equipo-runner.service" |
| run test -f "$RUNNER_ROOT/service.env" |
| run carlos apps list --account "$ACCOUNT" --console "$CONSOLE" |
| @@ -263,6 +280,9 @@ step "7 install the staged runner beside the old one" |
| if ! done_step runner; then |
| run install -d -m 0700 "$RUNNER_ROOT/releases/$version" |
| run install -m 0700 "$runner_release/equipo-runner" "$runner_release/equipo-tool-proxy" "$runner_release/gitleaks" "$RUNNER_ROOT/releases/$version/" |
| + # The page renderer beside it, unpacked by the staged runner itself and |
| + # held to the pin linked into it; verify-installed then renders a page. |
| + run "$RUNNER_ROOT/releases/$version/equipo-runner" install-renderer "$runner_release/renderer.tar.gz" |
| run sed -i -e "s|^EQUIPO_TOOL_PROXY_PATH=.*|EQUIPO_TOOL_PROXY_PATH=\"$RUNNER_ROOT/releases/$version/equipo-tool-proxy\"|" -e "s|^EQUIPO_INSTANCE_ID=.*|EQUIPO_INSTANCE_ID=\"${new_id:-NEW_INSTANCE_ID}\"|" -e "s|^EQUIPO_ORIGIN=.*|EQUIPO_ORIGIN=\"$PUBLIC_ORIGIN\"|" "$RUNNER_ROOT/service.env" |
| run sed -i -e "s|^ExecStart=.*|ExecStart=$RUNNER_ROOT/releases/$version/equipo-runner run|" -e '/^RestartPreventExitStatus=/d' -e '/^RestartSec=/a RestartPreventExitStatus=3' "$RUNNER_ROOT/equipo-runner.service" |
| if ((execute)); then |
| @@ -279,8 +299,8 @@ step "8 enrol the runner with the new instance: open the printed link as the own |
| if ! done_step enrol; then |
| # Before anything of the new runner starts, it holds every program in |
| # its new configuration (bubblewrap, claude, codex and its code mode |
| - # host, the staged tool proxy) and the gitleaks beside it to the |
| - # digests of its release. |
| + # host, the staged tool proxy) and the gitleaks and renderer beside it |
| + # to the digests of its release, and renders a fixture page. |
| run bash -c "set -a; . '$RUNNER_ROOT/service.env'; set +a; '$RUNNER_ROOT/releases/$version/equipo-runner' verify-installed" |
| run bash -c "set -a; . '$RUNNER_ROOT/service.env'; set +a; '$RUNNER_ROOT/releases/$version/equipo-runner' enrol" |
| run systemctl --user start "$UNIT" |
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json| index 9cc5811e..427a0f23 100644 |
| --- a/scripts/runner-reference-allowlist.json |
| +++ b/scripts/runner-reference-allowlist.json |
| @@ -10888,7 +10888,7 @@ |
| "path": "scripts/cutover-thin.sh", |
| "line_sha256": "81b1e42ababb4c8a2db709de57c9d811b5a663cbfac90c557d1558d3b8c36ea5", |
| "match": "equipo-runner", |
| - "count": 1, |
| + "count": 2, |
| "reason": "Thin v1 production cutover script (not run by agents): stops, reinstalls and re-enrols the runner unit and its release binaries, and rolls them back (spec 8)." |
| }, |
| { |
| @@ -15812,20 +15812,6 @@ |
| "count": 1, |
| "reason": "Fable follow-up: pinned runner scanner packaging and existing runtime integration." |
| }, |
| - { |
| - "path": "internal/release/install_assets.go", |
| - "line_sha256": "5b1c39eda80a58debe54efeb61a6c7a6bb813ce7b0af92beccadfbab3a1f9e25", |
| - "match": "equipo-runner", |
| - "count": 1, |
| - "reason": "Fable follow-up: pinned runner scanner packaging and existing runtime integration." |
| - }, |
| - { |
| - "path": "scripts/build-instance-release.sh", |
| - "line_sha256": "773bdf97410e36ff1f295fc71b95c17cb3601f95631211612bcfae4e3cbbdb0a", |
| - "match": "equipo-runner", |
| - "count": 1, |
| - "reason": "Fable follow-up: pinned runner scanner packaging and existing runtime integration." |
| - }, |
| { |
| "path": "scripts/build-instance-release.sh", |
| "line_sha256": "879a2a900e435d2821bf6381088fe2ef83dbe507607708f6b86ecf782580dd05", |
| @@ -16243,7 +16229,7 @@ |
| "path": "scripts/upgrade-thin.sh", |
| "line_sha256": "81b1e42ababb4c8a2db709de57c9d811b5a663cbfac90c557d1558d3b8c36ea5", |
| "match": "equipo-runner", |
| - "count": 1, |
| + "count": 2, |
| "reason": "Thin v1 production upgrade script (not run by agents): installs the staged runner beside the current one, switches the runner unit to it and rolls it back." |
| }, |
| { |
| @@ -16323,13 +16309,6 @@ |
| "count": 1, |
| "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME." |
| }, |
| - { |
| - "path": "internal/release/upgrade_test.go", |
| - "line_sha256": "ba6202d9aeb4ddaa637fa6bad709cf332089d3ac108f66960f1ad9f601628cf2", |
| - "match": "equipo-runner", |
| - "count": 2, |
| - "reason": "Test of the production upgrade script: a stub runner release, runner unit and runner paths under a temporary HOME." |
| - }, |
| { |
| "path": "scripts/cutover-finish-thin.sh", |
| "line_sha256": "7fb4566fa4fc2de31d0e2c1245476f07f24c1f24124736a943c2e97277b02a27", |
| @@ -16390,7 +16369,7 @@ |
| "path": "scripts/cutover-finish-thin.sh", |
| "line_sha256": "81b1e42ababb4c8a2db709de57c9d811b5a663cbfac90c557d1558d3b8c36ea5", |
| "match": "equipo-runner", |
| - "count": 1, |
| + "count": 2, |
| "reason": "Thin v1 production cutover finish on the kept database (not run by agents): installs and enrols the staged runner, switches its unit and rolls it back." |
| }, |
| { |
| @@ -16498,13 +16477,6 @@ |
| "count": 1, |
| "reason": "Test of the production cutover script: a stub runner release, runner unit and runner paths under a temporary HOME." |
| }, |
| - { |
| - "path": "internal/release/cutover_test.go", |
| - "line_sha256": "067aec9acffc841e8e138e54e08ba645f284c2c1db0305e56d543bbf0ebaa0ff", |
| - "match": "equipo-runner", |
| - "count": 3, |
| - "reason": "Cutover script test: the stub runner root, unit and release the script installs and restores." |
| - }, |
| { |
| "path": "scripts/runner-config.py", |
| "line_sha256": "e6c2e9a9db79b4caf6f0fd8d1e8dce5cffe97583e553702e9af870b155e0bee2", |
| @@ -16526,13 +16498,6 @@ |
| "count": 1, |
| "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME." |
| }, |
| - { |
| - "path": "internal/release/cutover_finish_test.go", |
| - "line_sha256": "0dda907d05922fa70b4f9141498a58ddb4d9edad024f1a3ab95d5e9f11a63458", |
| - "match": "equipo-runner", |
| - "count": 2, |
| - "reason": "Test of the cutover finish script: a stub runner release, runner unit and runner paths under a temporary HOME." |
| - }, |
| { |
| "path": "scripts/staging-thin-test.py", |
| "line_sha256": "99b79586c4d1c052acee032b83484c87e24096a161c7ec863a7e2a6af4ab6341", |
| @@ -18394,5 +18359,285 @@ |
| "match": "Node", |
| "count": 1, |
| "reason": "Go AST traversal type for the API error copy guard." |
| + }, |
| + { |
| + "path": "cmd/equipo-runner/install_renderer.go", |
| + "line_sha256": "55dfa168be4606b3fd8337a037b6f076b40f60d3d3f1910f98edeca72587111b", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "cmd/equipo-runner/install_renderer.go", |
| + "line_sha256": "c6166846e6f034fedea1c247cc7d0d5d69ffff1fd94509be236f48d8b5234508", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "cmd/equipo-runner/install_renderer.go", |
| + "line_sha256": "d485cd02307216eba650535b42beacc4bc1f67b730bcff04f8148ea43b41db04", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "cmd/equipo-runner/renderer_install_test.go", |
| + "line_sha256": "893b9f139d5a6309e472c76583eb9bed7f4db15bfa19e325c7fa612cdcad1121", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "cmd/equipo-runner/renderer_install_test.go", |
| + "line_sha256": "f333136b126a904fa9f3c1e70f6166570bf534cbefefb50d0cdcdb4eda98da1e", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "cmd/equipo-runner/renderer_install_test.go", |
| + "line_sha256": "fe1aaaad5f08861498ccdb8137a0a126c39f2e8d1d48dceef824294f47bda845", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "cmd/equipo-runner/renderer_release_linux_test.go", |
| + "line_sha256": "23d554e23370f8187ff4e2ca704f94fd52acd71905230989f40a765ab6ee8f31", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "cmd/equipo-runner/renderer_release_linux_test.go", |
| + "line_sha256": "5846f8749d9db20183a1ebe894f68f3e5e5d76036159e6c01642f7c81db401e4", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "cmd/equipo-runner/renderer_release_linux_test.go", |
| + "line_sha256": "bd1f85c2c8712fe78ebe26a69697e4e184da03d615b174293da7a53583df882a", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/cutover_finish_test.go", |
| + "line_sha256": "82c18f031e7b98f5984f4d595df3f1c7f23157d443b03bd6654af0625b955572", |
| + "match": "equipo-runner", |
| + "count": 2, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/cutover_test.go", |
| + "line_sha256": "2f42eb846fca306e0291a521416bd6fa2fac5ab295f803ad6bde7d4f14b15683", |
| + "match": "equipo-runner", |
| + "count": 3, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/install_assets.go", |
| + "line_sha256": "c8dbe720dff22aba3fe4ba0d6a0e280d824a0c24266344068dc83739a2d2e388", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/renderer_assets_test.go", |
| + "line_sha256": "793696f062e772771c1536cee1c07d79aa404de6e573a9fe87fe87a8fbf3c58c", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/renderer_assets_test.go", |
| + "line_sha256": "9370c39559592bf4e9d27e65094c3822a10982811e65971536d54a0a7d4ae725", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/renderer_assets_test.go", |
| + "line_sha256": "a7c6f0d0fccc139c3a24dcdef8c391bc4029b2a5ee6afa9958f4b49f5f1a912b", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/renderer_assets_test.go", |
| + "line_sha256": "df34cc4089b8428d633fca94405d1e002ed8f6bbbcdbe158e139a05466fa1298", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/renderer_assets_test.go", |
| + "line_sha256": "e15a665cf2a0e2e2a46c038cbd1ac1b78cd941dff69462a05fc68c6e03b03a9c", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/renderer_scripts_test.go", |
| + "line_sha256": "12b6510ce8fbbe65cc5ab76d99e21b3a4f7b61664ac56401cc2f67e0e2d9ef3e", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/renderer_scripts_test.go", |
| + "line_sha256": "482ffc60b51dcfae1ced1910a437cc9904bb01fc11ed3595e8b3c87e9b309a5e", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/renderer_scripts_test.go", |
| + "line_sha256": "a867b0f0e82e4eb86cd6e90275f17c4a11bb88a8150a9da644b709ad81ee16ca", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/renderer_scripts_test.go", |
| + "line_sha256": "e6920ffcfeb30c2d1cf5b1a38f2527bde8e39fad28d8eada1581d5ddec08770b", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/renderer_scripts_test.go", |
| + "line_sha256": "e8963b8990143f97b22cef994c4221ac3165572f3750d6c766485d062bd777b1", |
| + "match": "equipo-runner", |
| + "count": 2, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/renderer_scripts_test.go", |
| + "line_sha256": "e96c99b6f633e04caad1154aaae2ccb4e14dedab8c2364309818c2d0545345eb", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/release/upgrade_test.go", |
| + "line_sha256": "b149d42aa54af304c1ad39f8b9f11a96d4af3045986f99f98bbca8e11180077d", |
| + "match": "equipo-runner", |
| + "count": 2, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "internal/runner/setup/renderer_install_test.go", |
| + "line_sha256": "fbd348f6f2f52db4d12a71bce238fb52d3e1e5ccfc4a162290f9976af5e172e7", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/build-instance-release.sh", |
| + "line_sha256": "530a58ef9d90985f55337003d8187d629df9d63e3b70ed347faca8c12311cdc0", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/cutover-finish-thin.sh", |
| + "line_sha256": "12260be6ca928cae632e2bdf2195fe44fc00e11cf2ee2680ed7e01c217e839be", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/cutover-finish-thin.sh", |
| + "line_sha256": "c766ceb067b3c7c482d68832e4ac91a5e9114260411126321e9a04e8e72f4c1c", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/cutover-finish-thin.sh", |
| + "line_sha256": "d0d72d2fdbc8797f054973e75294660143f3d671f35f739990c6c503198b9193", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/cutover-finish-thin.sh", |
| + "line_sha256": "eef10cf6cb7a7cd8f80b5d26052dffca612f0ca627cf1e8593e2d4d50269d56c", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/cutover-thin.sh", |
| + "line_sha256": "12260be6ca928cae632e2bdf2195fe44fc00e11cf2ee2680ed7e01c217e839be", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/cutover-thin.sh", |
| + "line_sha256": "a5115022701036c49cc967bbfafeda02293f685081ffdce1612ab25ee3a18cfa", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/cutover-thin.sh", |
| + "line_sha256": "d0d72d2fdbc8797f054973e75294660143f3d671f35f739990c6c503198b9193", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/cutover-thin.sh", |
| + "line_sha256": "eef10cf6cb7a7cd8f80b5d26052dffca612f0ca627cf1e8593e2d4d50269d56c", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/staging-thin.py", |
| + "line_sha256": "0c8c2cb081a78882e8678e89719608f8bd2572afa6fee63aa74ed896816545ea", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/staging-thin-test.py", |
| + "line_sha256": "4bfdbdfc446082debb3015067a44f748edd0f28daef7b17b00d2750f99686612", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/upgrade-thin.sh", |
| + "line_sha256": "12260be6ca928cae632e2bdf2195fe44fc00e11cf2ee2680ed7e01c217e839be", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/upgrade-thin.sh", |
| + "line_sha256": "c766ceb067b3c7c482d68832e4ac91a5e9114260411126321e9a04e8e72f4c1c", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/upgrade-thin.sh", |
| + "line_sha256": "d0d72d2fdbc8797f054973e75294660143f3d671f35f739990c6c503198b9193", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| + }, |
| + { |
| + "path": "scripts/upgrade-thin.sh", |
| + "line_sha256": "eef10cf6cb7a7cd8f80b5d26052dffca612f0ca627cf1e8593e2d4d50269d56c", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Dynamic specialists slice 1 task 7: the page renderer the release ships beside the runner, installed by install-renderer and checked by verify-installed." |
| } |
| ] |
diff --git a/scripts/staging-thin-test.py b/scripts/staging-thin-test.py| index f9ddbf0e..503cd4aa 100644 |
| --- a/scripts/staging-thin-test.py |
| +++ b/scripts/staging-thin-test.py |
| @@ -335,6 +335,26 @@ class ReleaseTest(unittest.TestCase): |
| self.assertEqual(scanner.read_bytes(), (built / 'gitleaks').read_bytes()) |
| self.assertTrue(os.access(scanner, os.X_OK)) |
| + def test_build_installs_the_renderer_beside_the_runner(self): |
| + # The staged runner unpacks the release's renderer.tar.gz beside |
| + # itself (install-renderer); verify-installed then checks the tree |
| + # and renders the fixture page with it. |
| + with scratch() as folder: |
| + repo, root = Path(folder) / 'repo', Path(folder) / 'root' |
| + built = self.release(repo, 'abc1234') |
| + prod = Path(folder) / 'prod.env' |
| + prod.write_text('EQUIPO_CLAUDE_PATH="/bin/claude"\n') |
| + with patch.multiple(staging, REPO=repo, ROOT=root, PROD_ENV=prod), \ |
| + patch.object(staging, 'head', return_value='abc1234'), \ |
| + patch.object(staging, 'run', return_value='') as run: |
| + staging.build() |
| + calls = [c.args[0] for c in run.call_args_list] |
| + install = [str(root / 'releases/abc1234/equipo-runner'), 'install-renderer', str(built / 'renderer.tar.gz')] |
| + self.assertIn(install, calls) |
| + # After the provenance check, which holds the runner to the release. |
| + verify = ['python3', 'scripts/staged-artifacts.py', 'verify', 'abc1234'] |
| + self.assertLess(calls.index(verify), calls.index(install)) |
| + |
| def test_provenance_holds_the_scanner_to_the_release(self): |
| with scratch() as folder: |
| repo, root = Path(folder) / 'repo', Path(folder) / 'root' |
diff --git a/scripts/staging-thin.py b/scripts/staging-thin.py| index 97f517e8..be80f6fb 100755 |
| --- a/scripts/staging-thin.py |
| +++ b/scripts/staging-thin.py |
| @@ -204,6 +204,10 @@ def build(): |
| for name in ('equipo-runner', 'equipo-tool-proxy', 'gitleaks'): |
| shutil.copy2(release / name, runner / name) |
| provenance(sha) |
| + # And the page renderer beside it, unpacked by the staged runner from |
| + # the release's archive and held to the pin linked into it (both |
| + # staging runners use it); verify-installed renders a page with it. |
| + run([str(runner / 'equipo-runner'), 'install-renderer', str(release / 'renderer.tar.gz')]) |
| print(f'built {sha}: {instance_binary(sha)} and {runner}') |
| return sha |
diff --git a/scripts/upgrade-thin.sh b/scripts/upgrade-thin.sh| index 07735a18..e49e4ebd 100755 |
| --- a/scripts/upgrade-thin.sh |
| +++ b/scripts/upgrade-thin.sh |
| @@ -26,9 +26,10 @@ |
| # state (served version, runner service.env and unit) |
| # 2 backup carlos db pull, integrity-checked, counted, hashed, read-only. |
| # The upgrade changes no configuration: the same database. |
| -# 3 runner the staged runner, tool proxy and gitleaks (the preview |
| -# scanner) beside the current one, checked by |
| -# verify-installed; service.env and unit written from the |
| +# 3 runner the staged runner, tool proxy, gitleaks (the preview |
| +# scanner) and page renderer (install-renderer) beside the |
| +# current one, checked by verify-installed, which renders a |
| +# fixture page; service.env and unit written from the |
| # preflight's record (scripts/runner-config.py); nothing in |
| # flight on a reading just before the restart (a short window, |
| # not a drain: Equipo has no maintenance mode); the restart |
| @@ -75,7 +76,7 @@ version=${1:-} |
| execute=0 |
| [[ ${2:-} == --execute ]] && execute=1 |
| if [[ $mode == upgrade && ! $version =~ ^[0-9a-f]{7,12}$ ]]; then |
| - sed -n '2,43p' "$0" |
| + sed -n '2,44p' "$0" |
| exit 2 |
| fi |
| @@ -146,6 +147,22 @@ scanner() { |
| die "$1/gitleaks is missing, cannot run, or is not the scanner equipo-runner was built with" |
| fi |
| } |
| +# The runner renders pages with the renderer tree beside its own |
| +# executable, held to the pin linked into the runner (the sha256 of the |
| +# tree's MANIFEST). $1 is a runner release directory: the MANIFEST of its |
| +# renderer.tar.gz has the sha256 linked into its equipo-runner. |
| +renderer_linked() { |
| + local sum |
| + [[ -f $1/renderer.tar.gz && ! -L $1/renderer.tar.gz ]] || return 1 |
| + sum=$(tar -xzOf "$1/renderer.tar.gz" MANIFEST | sha256sum | cut -d ' ' -f 1) || return 1 |
| + grep -qaF "$sum" "$1/equipo-runner" |
| +} |
| +renderer() { |
| + echo " $1/renderer.tar.gz: its MANIFEST's sha256 is linked into $1/equipo-runner" |
| + if ((execute)) && ! renderer_linked "$1"; then |
| + die "$1/renderer.tar.gz is missing, or is not the renderer equipo-runner was built with" |
| + fi |
| +} |
| # The unit's main process runs the binary with sha256 $1. |
| runs() { |
| local pid |
| @@ -269,6 +286,7 @@ run test -f "$instance" |
| run test -x "$runner_release/equipo-runner" |
| run test -x "$runner_release/equipo-tool-proxy" |
| scanner "$runner_release" |
| +renderer "$runner_release" |
| run test -f "$RUNNER_ROOT/equipo-runner.service" |
| run test -f "$RUNNER_ROOT/service.env" |
| run carlos apps list --account "$ACCOUNT" --console "$CONSOLE" |
| @@ -334,9 +352,12 @@ config=(--exec "$new/equipo-runner" "EQUIPO_TOOL_PROXY_PATH=$new/equipo-tool-pro |
| if ! done_step runner; then |
| run install -d -m 0700 "$new" |
| run install -m 0700 "$runner_release/equipo-runner" "$runner_release/equipo-tool-proxy" "$runner_release/gitleaks" "$new/" |
| + # The page renderer beside it, unpacked by the staged runner itself and |
| + # held to the pin linked into it; verify-installed then renders a page. |
| + run "$new/equipo-runner" install-renderer "$runner_release/renderer.tar.gz" |
| # The staged runner holds every program its configuration names, its |
| - # own tool proxy and the gitleaks beside it, to its release's digests |
| - # before anything switches. |
| + # own tool proxy, the gitleaks and the renderer beside it, to its |
| + # release's digests before anything switches. |
| run bash -c "set -a; . '$RUNNER_ROOT/service.env'; set +a; EQUIPO_TOOL_PROXY_PATH='$new/equipo-tool-proxy' '$new/equipo-runner' verify-installed" |
| # Written from the preflight's record, never the live files, so a retry |
| # gives the same files; each key, ExecStart and RestartSec exactly once. |