Add the hub-only forge key and routing seam
Co-Authored-By: Codex GPT-6-Astra <noreply@openai.com>
54 files changed,
+1,357
−192
.rastrillo/budgets.txt+2 −2docs/superpowers/plans/2026-11-23-github-seam-assumptions.md+24 −0docs/superpowers/plans/2026-11-23-github-seam.md+29 −0docs/superpowers/plans/CONTROLLER-REPORT-github-seam.md+164 −0docs/superpowers/specs/2026-11-22-equipo-github-connector-probe.md+179 −0internal/equipo/chat/placement.go+2 −1internal/equipo/chat/placement_card.go+2 −1internal/equipo/chat/projects.go+4 −11internal/equipo/chat/tools.go+4 −6internal/equipo/setup/projects.go+5 −4internal/headless/access_resume_test.go+2 −2internal/headless/forge_seam_test.go+12 −0internal/headless/merge_test.go+1 −1internal/headless/projects_test.go+3 −3internal/runner/forge/branch.go+1 −1internal/runner/forge/credential_file.go+2 −1internal/runner/forge/forgetest/merge.go+16 −16internal/runner/forge/merge.go+15 −15internal/runner/forge/merge_detail_test.go+9 −9internal/runner/forge/merge_test.go+22 −22internal/runner/forge/merge_unborn_test.go+9 −9internal/runner/forge/publisher.go+2 −2internal/runner/forge/username_test.go+32 −0internal/runner/thin/access_catalog.go+1 −7internal/runner/thin/access_review_test.go+2 −2internal/runner/thin/ask.go+2 −1internal/runner/thin/claude.go+5 −4internal/runner/thin/copy_test.go+1 −1internal/runner/thin/create_test.go+3 −3internal/runner/thin/engineer.go+7 −3internal/runner/thin/forge.go+27 −22internal/runner/thin/forge_seam_fixtures_test.go+16 −0internal/runner/thin/forges.go+172 −0internal/runner/thin/forges_test.go+243 −0internal/runner/thin/index_empty_test.go+1 −1internal/runner/thin/judge.go+3 −2internal/runner/thin/judge_fetch_test.go+1 −1internal/runner/thin/judge_hosted.go+2 −1internal/runner/thin/mergedetail_test.go+2 −2internal/runner/thin/mergestep.go+3 −2internal/runner/thin/mergestep_test.go+20 −20internal/runner/thin/pistep.go+2 −1internal/runner/thin/proposal_seam_test.go+83 −0internal/runner/thin/relay.go+7 −3internal/runner/thin/relay_test.go+1 −1internal/runner/thin/research.go+2 −1internal/runner/thin/review_fixes_test.go+1 −1internal/runner/thin/run.go+8 −3internal/runner/thin/sandbox_masks_test.go+1 −1internal/runner/thin/worker.go+2 −1internal/runner/workspace/username_test.go+42 −0internal/runner/workspace/workspace.go+10 −2internal/wire/forgekey/key.go+85 −0internal/wire/forgekey/key_test.go+61 −0
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/github__seam: Type Size Avail | ext4 96G 85G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type Size Avail | ext4 96G 85G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 2.3s
ci-box: codex: fetched and verified in 4.5s
ci-box: codex-code-mode-host: fetched and verified in 1.5s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.4s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.8s
ci-box: pi: installed and verified in 7.3s
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 4.3s
ci-box: file times set from content: 2946 files, 192 directories
ci-box: ready in 18.9s
=== 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.146s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
4.8s
+ go list -export -test -tags testbuild -f ./...
4.9s
+ go list -export -test -tags browser,testbuild -f ./internal/equipo ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
3.1s
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-11 02:51:11 +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 1m15.411s 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 1m13.729s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m13.73s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 63.94, cpu waiting 39.33%, memory waiting 0.00%, io waiting 0.77%
--- 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 1m15.914s 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 1m14.11s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m14.11s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 64.43, cpu waiting 39.33%, memory waiting 0.00%, io waiting 0.77%
--- 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 1m17.256s 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 1m14.826s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m5.43s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.39s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 64.43, cpu waiting 39.33%, memory waiting 0.00%, io waiting 0.77%
--- 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 1m13.87s 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 1m11.833s amadan.net/oficina/equipo/internal/headless
receipt: slow test 35.81s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 18.73s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 8.81s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
receipt: slow test 8.48s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
machine: 32 CPUs, load 63.94, cpu waiting 39.41%, memory waiting 0.00%, io waiting 0.80%
--- 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 1m31.366s 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 1m29.009s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m0.66s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.17s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 8s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 6.76s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 4.42s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 60.39, cpu waiting 38.87%, memory waiting 0.00%, io waiting 0.59%
--- 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 2m50.766s 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 2m48.113s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m34.82s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 17.95s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 17.52s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 6.52s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
receipt: slow test 6.46s amadan.net/oficina/equipo/internal/headless TestHeadlessBatchAfterRefusedReply
machine: 32 CPUs, load 23.11, cpu waiting 11.61%, memory waiting 0.00%, io waiting 0.15%
--- 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 2m7.778s 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 2m5.907s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 8s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.71s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 4.55s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
receipt: slow test 3.76s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 3.35s amadan.net/oficina/equipo/internal/thintest TestContractTeamUpdatePersonNeeds
machine: 32 CPUs, load 40.51, cpu waiting 23.11%, memory waiting 0.00%, io waiting 0.32%
--- 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
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/thintest TestContractRetryAccountActions
=== RUN TestContractRetryAccountActions
retry_contract_test.go:296: sign in again
--- FAIL: TestContractRetryAccountActions (0.18s)
--- FAIL amadan.net/oficina/equipo/internal/thintest (package output)
FAIL
rastrillo-budget/v1 ran 1m27.15s
FAIL amadan.net/oficina/equipo/internal/thintest 87.393s
receipt: test step 1m29.69s 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 1m27.15s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.07s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 5.05s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 4.48s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 2.35s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotNow
receipt: slow test 2.35s amadan.net/oficina/equipo/internal/thintest TestContractPreview
exit status 1
+ go 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)' -v -run '^TestContractRetryAccountActions$' -count=1 ./internal/thintest (retry, once)
##############################################################################
FLAKE ./internal/thintest:TestContractRetryAccountActions thintest-contract ab21a6e4a4a04db5f4b256b35913660a07d84734 0.18s 60.39
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 57.47, cpu waiting 38.87%, memory waiting 0.00%, io waiting 0.59%
--- 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 4m43.506s, over the 45s its record on line 44 allows; reported only, timing fails on CI
receipt: test step 4m49.302s 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 4m43.506s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 36.96s amadan.net/oficina/equipo/internal/runner/thin TestModelsEngineeringProbesThenRunsTheStrongest
receipt: slow test 36.94s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeAnsweredByAnotherModel
receipt: slow test 36.79s amadan.net/oficina/equipo/internal/runner/thin TestModelsUnhealthyRetriedOnDemand
receipt: slow test 18.46s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 6.9s amadan.net/oficina/equipo/internal/runner/thin TestOpenCodeStepsRealOpenCode
machine: 32 CPUs, load 3.96, cpu waiting 1.62%, memory waiting 0.00%, io waiting 0.02%
--- 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.701s 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.641s amadan.net/oficina/equipo/internal/runner
receipt: slow test 30.61s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.03s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 60.62, cpu waiting 34.60%, memory waiting 0.00%, io waiting 1.16%
--- 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.091s 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 59.637s amadan.net/oficina/equipo/internal/runner
receipt: slow test 49.56s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 43.83s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.42s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.64s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 64.02, cpu waiting 38.16%, memory waiting 0.00%, io waiting 1.01%
--- 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.283s 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.251s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.13s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.61s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.12s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 2.39s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.62s amadan.net/oficina/equipo/internal/runner TestCoordinatorTransientRefusalKeepsServing
machine: 32 CPUs, load 29.96, cpu waiting 22.08%, memory waiting 0.00%, io waiting 1.51%
--- 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.4%, load 25.96
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
receipt: test step 1m8.433s 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 1m6.482s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 27.85s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 27.81s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 25.68s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 22.97s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 22.85s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelDuplicates
machine: 32 CPUs, load 57.59, cpu waiting 37.07%, memory waiting 0.00%, io waiting 0.53%
--- 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.4%, load 25.96
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
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/equipotest TestProjectRejectsUnsafeBinding
=== RUN TestProjectRejectsUnsafeBinding
=== PAUSE TestProjectRejectsUnsafeBinding
=== CONT TestProjectRejectsUnsafeBinding
projects_test.go:109: invalid input persisted
--- FAIL: TestProjectRejectsUnsafeBinding (19.84s)
--- FAIL amadan.net/oficina/equipo/internal/equipotest TestProjectRejectsUnsafeBinding/amadan.net/a
=== RUN TestProjectRejectsUnsafeBinding/amadan.net/a
projects_test.go:98: unsafe binding accepted: <nil>
--- FAIL: TestProjectRejectsUnsafeBinding/amadan.net/a (0.00s)
--- FAIL amadan.net/oficina/equipo/internal/equipotest (package output)
FAIL
rastrillo-budget/v1 ran 1m15.171s
FAIL amadan.net/oficina/equipo/internal/equipotest 75.543s
receipt: test step 1m17.141s 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 1m15.171s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 19.87s amadan.net/oficina/equipo/internal/equipotest TestProjectsFailuresRollBack
receipt: slow test 19.86s amadan.net/oficina/equipo/internal/equipotest TestProjectBindingUniqueness
receipt: slow test 19.84s amadan.net/oficina/equipo/internal/equipotest TestProjectRejectsUnsafeBinding
receipt: slow test 19.76s amadan.net/oficina/equipo/internal/equipotest TestProjectRequestActorAndUpdate
receipt: slow test 19.72s amadan.net/oficina/equipo/internal/equipotest TestProjectOwnersAreMembers
exit status 1
+ go test -tags testbuild -timeout 15m -run '^Test[E-P]' -v -run '^TestProjectRejectsUnsafeBinding$/^amadan\.net$/^a$' -count=1 ./internal/equipotest (retry, once)
FAILED TWICE ./internal/equipotest:TestProjectRejectsUnsafeBinding/amadan.net/a equipotest-e
=== RUN TestProjectRejectsUnsafeBinding
=== PAUSE TestProjectRejectsUnsafeBinding
=== CONT TestProjectRejectsUnsafeBinding
=== RUN TestProjectRejectsUnsafeBinding/amadan.net/a/b?token=secret
=== RUN TestProjectRejectsUnsafeBinding/amadan.net/a/b?
=== RUN TestProjectRejectsUnsafeBinding/amadan.net/a/b#x
=== RUN TestProjectRejectsUnsafeBinding/amadan.net/a/b#
=== RUN TestProjectRejectsUnsafeBinding/amadan.net
=== RUN TestProjectRejectsUnsafeBinding/amadan.net/a
projects_test.go:98: unsafe binding accepted: <nil>
=== RUN TestProjectRejectsUnsafeBinding/amadan.net/a/
=== RUN TestProjectRejectsUnsafeBinding/amadan.net/a/b/c
=== RUN TestProjectRejectsUnsafeBinding/amadan.net/a/..
=== RUN TestProjectRejectsUnsafeBinding/amadan.net/a/%2e%2e
=== RUN TestProjectRejectsUnsafeBinding/amadan.net/a/b%5cc
=== RUN TestProjectRejectsUnsafeBinding/amadan.net/a/b%252fc
=== NAME TestProjectRejectsUnsafeBinding
projects_test.go:109: invalid input persisted
--- FAIL: TestProjectRejectsUnsafeBinding (1.08s)
--- PASS: TestProjectRejectsUnsafeBinding/amadan.net/a/b?token=secret (0.00s)
--- PASS: TestProjectRejectsUnsafeBinding/amadan.net/a/b? (0.00s)
--- PASS: TestProjectRejectsUnsafeBinding/amadan.net/a/b#x (0.00s)
--- PASS: TestProjectRejectsUnsafeBinding/amadan.net/a/b# (0.00s)
--- PASS: TestProjectRejectsUnsafeBinding/amadan.net (0.00s)
--- FAIL: TestProjectRejectsUnsafeBinding/amadan.net/a (0.00s)
--- PASS: TestProjectRejectsUnsafeBinding/amadan.net/a/ (0.00s)
--- PASS: TestProjectRejectsUnsafeBinding/amadan.net/a/b/c (0.00s)
--- PASS: TestProjectRejectsUnsafeBinding/amadan.net/a/.. (0.00s)
--- PASS: TestProjectRejectsUnsafeBinding/amadan.net/a/%2e%2e (0.00s)
--- PASS: TestProjectRejectsUnsafeBinding/amadan.net/a/b%5cc (0.00s)
--- PASS: TestProjectRejectsUnsafeBinding/amadan.net/a/b%252fc (0.00s)
FAIL
rastrillo-budget/v1 ran 1.082s
FAIL amadan.net/oficina/equipo/internal/equipotest 1.244s
FAIL
machine: 32 CPUs, load 50.64, cpu waiting 31.77%, memory waiting 0.00%, io waiting 0.45%
make: *** [Makefile:113: ci-shard] Error 1
amadan: step check shard 13 of 29 failed: exit status 2
--- 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.4%, load 25.96
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
receipt: test step 1m13.893s 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 1m8.481s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 15.28s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 13.36s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 10.28s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 10.24s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 7.24s amadan.net/oficina/equipo/internal/equipotest TestRosterBootstrapOnce
machine: 32 CPUs, load 54.18, cpu waiting 33.93%, memory waiting 0.00%, io waiting 0.48%
--- 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.4%, load 25.96
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 1m9.077s 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.056s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 26.24s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 25.06s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 25.06s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 23.25s amadan.net/oficina/equipo/internal/equipotest TestSigninCSRF
receipt: slow test 23.17s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedOnce
machine: 32 CPUs, load 57.59, cpu waiting 36.02%, memory waiting 0.00%, io waiting 0.51%
--- 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.4%, load 25.96
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 54.033s 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 51.73s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 3.71s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.41s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.47s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.25s amadan.net/oficina/equipo/internal/plan3test TestInviteMigration
machine: 32 CPUs, load 61.03, cpu waiting 38.69%, memory waiting 0.00%, io waiting 0.67%
--- 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.4%, load 25.96
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/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./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/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/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/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/equipo ./internal/equipo/activity ./internal/equipo/assist ./internal/equipo/chat ./internal/equipo/conversation ./internal/equipo/conversation/chatstate ./internal/equipo/door ./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/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/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/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/runner/provider/opencode: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/copydesk: 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/testci: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/containment: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/pi: its inputs changed
budget: amadan.net/oficina/equipo/internal/wire/forgekey ran tests but printed no time: add func TestMain(m *testing.M) { os.Exit(budget.Main(m)) }
budget note: internal/equipo took 53.022s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/chat took 18.692s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/setup took 11.402s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/idtest took 1m50.056s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/release took 36.558s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/runner/containment took 46.401s, over the 15s its record on line 40 allows; reported only, timing fails on CI
budget note: internal/runner/forge took 20.636s, over the 20s its record on line 35 allows; reported only, timing fails on CI
budget note: internal/runner/provider/claude/realcli took 13.466s, over the 10s the default allows; reported only, timing fails on CI
receipt: test step 2m30.953s against a 60s target (the gate's other steps are not in this figure)
receipt: 27 packages ran, 37 cached, 18 without tests, 0 failed
receipt: slow package 1m50.056s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 1m8.18s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 53.667s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 53.022s amadan.net/oficina/equipo/internal/equipo
receipt: slow package 52.625s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow test 54.48s amadan.net/oficina/equipo/internal/idtest TestDoorRemembersOficinaID
receipt: slow test 46.23s amadan.net/oficina/equipo/internal/idtest TestDoorNeverJudgesANativeSession
receipt: slow test 46.2s amadan.net/oficina/equipo/internal/idtest TestDoorStepUpIsLocal
receipt: slow test 45.96s amadan.net/oficina/equipo/internal/idtest TestDoorOficinaSettingsUnreadableIsNoLoop
receipt: slow test 44.66s amadan.net/oficina/equipo/internal/idtest TestDoorForgetsOficinaIDForARefusedSession
rastrillo: budget test: 1 problem(s)
exit status 1
not retried: go test failed without naming a failed test (a build, a budget)
machine: 32 CPUs, load 18.53, cpu waiting 9.51%, memory waiting 0.00%, io waiting 0.12%
make: *** [Makefile:113: ci-shard] Error 1
amadan: step check shard 17 of 29 failed: exit status 2
--- 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 1m24.297s 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 1m22.429s amadan.net/oficina/equipo/internal/headless
receipt: slow test 38.75s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 14.96s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 9.97s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.07s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 6.62s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 61.03, cpu waiting 38.69%, memory waiting 0.00%, io waiting 0.67%
--- 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 1m28.682s 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 1m27.205s amadan.net/oficina/equipo/internal/headless
receipt: slow test 27.3s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 20.5s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 12.82s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 9.06s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 9.05s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 60.39, cpu waiting 38.94%, memory waiting 0.00%, io waiting 0.61%
--- 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 1m40.726s 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 1m38.887s amadan.net/oficina/equipo/internal/headless
receipt: slow test 13.71s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 13.21s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 11.97s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 11.07s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 10.6s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsOpenCodeGoLimitRequired
machine: 32 CPUs, load 57.59, cpu waiting 34.97%, memory waiting 0.00%, io waiting 0.50%
--- 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|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|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
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserCopyContinue
=== RUN TestBrowserCopyContinue
rastrillo: budget test: go test failed
time=2026-11-23T17:38:38.141Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-23T17:38:38.141Z level=INFO msg="startup phase done" phase=state_lock took=61µs
time=2026-11-23T17:38:38.141Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-23T17:38:38.141Z level=INFO msg="startup phase done" phase=claim_roots took=82µs
time=2026-11-23T17:38:38.141Z level=INFO msg="startup phase" phase=sweep
time=2026-11-23T17:38:38.172Z level=INFO msg="startup phase done" phase=sweep took=31.108ms
time=2026-11-23T17:38:38.172Z level=INFO msg="startup phase" phase=credentials
time=2026-11-23T17:38:38.172Z level=INFO msg="startup phase done" phase=credentials took=103µs
time=2026-11-23T17:38:38.172Z level=INFO msg="startup phase" phase=open_state
time=2026-11-23T17:38:38.215Z level=INFO msg="startup phase done" phase=open_state took=42.429ms
time=2026-11-23T17:38:38.215Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-23T17:38:38.217Z level=INFO msg=connecting host=127.0.0.1:39737 protocol=28
time=2026-11-23T17:38:38.219Z level=INFO msg=connected host=127.0.0.1:39737 took=963µs
time=2026-11-23T17:38:38.219Z level=INFO msg="capabilities gathering"
time=2026-11-23T17:38:38.221Z level=INFO msg="capabilities gathered" took=1.731ms tags=linux,claude,go
time=2026-11-23T17:38:38.224Z level=INFO msg="hello sent" protocol=28
time=2026-11-23T17:38:38.229Z level=INFO msg=welcome protocol=28 role=primary generation=1
browser_copy_test.go:90: waiting for !document.querySelector('[data-copy-continue]'): context deadline exceeded (last evaluation: context deadline exceeded)
--- FAIL: TestBrowserCopyContinue (6.32s)
--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m31.321s
FAIL amadan.net/oficina/equipo/internal/headless 91.544s
receipt: test step 1m32.82s 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 1m31.321s amadan.net/oficina/equipo/internal/headless
receipt: slow test 14.66s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 10.9s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 10.81s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 9.49s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 7.25s amadan.net/oficina/equipo/internal/headless TestBrowserRefreshRace
exit status 1
+ go test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|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$' -v -run '^TestBrowserCopyContinue$' -count=1 ./internal/headless (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserCopyContinue browser-headless-rest ab21a6e4a4a04db5f4b256b35913660a07d84734 6.32s 57.47
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 57.59, cpu waiting 37.07%, memory waiting 0.00%, io waiting 0.53%
--- 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)$' ./internal/equipo
receipt: test step 2.237s 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 605ms amadan.net/oficina/equipo/internal/equipo
receipt: slow test 600ms amadan.net/oficina/equipo/internal/equipo TestBrowserPreviewBlocksNavigation
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.287s, over the 10s the default allows; reported only, timing fails on CI
receipt: test step 11.591s 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.287s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 8.17s amadan.net/oficina/equipo/internal/idtest TestBrowserSmartDoor
receipt: slow test 2.12s 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 3.623s 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.022s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 2.02s 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|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 3m30.232s 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 3m28.638s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 22.25s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.38s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 12.06s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
receipt: slow test 10.52s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 8.77s amadan.net/oficina/equipo/internal/thintest TestBrowserRhythm
machine: 32 CPUs, load 9.55, cpu waiting 4.27%, memory waiting 0.00%, io waiting 0.08%
--- 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 (53s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 4.65s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.21s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 9.27s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 8.53s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 27.04s
+ 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 (65s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 11.98s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 11.43s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 10.18s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 28.62s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless (21s)
ok ./internal/headless TestMixedVersions 18.35s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks (2s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.82s
+ go test -tags testbuild -timeout 15m -v -run '^TestRunnerCancelAndSupersede$' ./internal/runner/thin (2s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.05s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 63.85, cpu waiting 38.47%, memory waiting 0.00%, io waiting 0.95%
--- 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.41s 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 8.14s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 259ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 135ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 3ms amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow test 5.82s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.84s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 350ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 260ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 130ms amadan.net/oficina/equipo/internal/runner/provider/codex TestDirectJournalAdapterBarrier
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 3.627s 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.258s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 300ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 210ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 130ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 130ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryCleansScratch
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceOpenCodeBinaryAfterAttestation
machine: 32 CPUs, load 20.95, cpu waiting 11.26%, memory waiting 0.00%, io waiting 2.05%
--- 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.4%, load 25.96
shard 25: make runner-dead-references lanes-check build vet fmt-check spacing budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 2659 text files, 3210 matches, 0 failures
python3 scripts/ci-test.py check
lanes: 18 lanes and 5 browser lanes run every test once; 20-check@29
CGO_ENABLED=0 go build ./...
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o /dev/null ./cmd/equipo-runner
go vet ./...
go vet -tags testbuild ./internal/runner/thin ./internal/headless
GOOS=darwin GOARCH=arm64 go vet ./cmd/equipo-runner/... ./internal/runner/... ./internal/wire/... ./internal/release/...
go tool fiesta spacing -skip tokens.css internal/equipo/static
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
budget size: 91 directories within budget
CGO_ENABLED=0 go test ./internal/equipo -run '^TestMigrationModels$' -count=1
ok amadan.net/oficina/equipo/internal/equipo 2.444s
machine: 32 CPUs, load 63.94, cpu waiting 39.41%, memory waiting 0.00%, io waiting 0.80%
--- 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.4%, load 25.96
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 60.62, cpu waiting 34.60%, memory waiting 0.00%, io waiting 1.16%
--- 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.4%, load 25.96
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 0 vulnerabilities in packages you import and 3
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 36.29, cpu waiting 23.71%, memory waiting 0.00%, io waiting 1.46%
--- 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.4%, load 25.96
shard 28: make gitleaks
[90m5:38PM[0m [32mINF[0m [1mUnknown SCM platform. Use --platform to include links in findings.[0m [36mhost=[0mamadan.net
[90m5:38PM[0m [32mINF[0m [1m1118 commits scanned.[0m
[90m5:38PM[0m [32mINF[0m [1mscanned ~64892555 bytes (64.89 MB) in 24.8s[0m
[90m5:38PM[0m [32mINF[0m [1mno leaks found[0m
machine: 32 CPUs, load 60.62, cpu waiting 36.05%, memory waiting 0.00%, io waiting 1.12%
amadan: job failed at step check shards 13, 17 of 29 — its output is above, not at the tail of this log
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index 28b7d3e4..e56c35ff 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -38,7 +38,7 @@ time internal/runner/provider 15s Plan 3 CI repair measured 10.346s for the full |
| perf GET /releases/* skip Verified runner release file downloads, not browser GET screens. |
| perf GET /install.sh skip Mac runners: the one-line bootstrap a terminal pipes to sh, not a browser screen. |
| time internal/runner/containment 15s Plan 3 loaded CI measured 10.817s; |
| -size internal/runner/thin 28244 22072 Fable follow-up gates and guards, main started at repo creation, refused tool requests counted per step; measured 28244/22072 source/test lines. |
| +size internal/runner/thin 28436 22414 Forge router, explicit read/push use, proposal seam and mutation regressions; measured 28436 source and 22414 test lines. |
| time internal/thintest 240s Thin contract and page tests, the Assistant's and the models' included, share one harness. Measured 202s on a shared 16 CPU box (2026-11-13); CI runs two lanes. |
| time internal/runner/mac 30s Mac runners (Darwin worker): real process groups killed after a grace and proven gone (SIGTERM, SIGKILL, the marker sweep), and the probes run end to end with fake srt and xcodebuild, P6 killing. |
| time internal/runner/thin 45s Thin v1 slice 4 review: real git repositories for the merge and squash checks, a stalled fetch, and a 16 MiB candidate streamed through the review diff and the checks pack (about 5s). |
| @@ -70,7 +70,7 @@ perf GET /api/v1/tasks/{id}/files/{file} skip Research kept images: bearer-only |
| perf GET /tasks/{id}/files/{file} skip Research kept images: the bytes of one image, shown on the task page; a file, not a screen. |
| perf GET /api/v1/runners skip Mac runners person API: bearer-only JSON for devices; the browser shows runners in the Team section. |
| time cmd/equipo-runner 60s TestReleaseRunnerHasNoFakeWorker builds the release runner and the thin package under testbuild (about 12s locally). |
| -size internal/headless - 11337 Fable follow-up gates, preview isolation and provenance guards; live staging witnesses; refused step requests stop tools_refused; measured 0/11337 test lines. |
| +size internal/headless - 11349 Forge Host/Propose fixtures for the explicit-use interface; measured 11349 test lines, existing assertions unchanged. |
| size internal/thintest - 34019 Device project cards, exact negation and old-runner pass-through regressions, and tools_refused delivery; measured 34019 test lines. |
| perf GET /api/v1/projects/{id}/merge-policy skip Merge authority person API: bearer-only JSON for devices; the browser reads the policy on /projects/{id}. |
diff --git a/docs/superpowers/plans/2026-11-23-github-seam-assumptions.md b/docs/superpowers/plans/2026-11-23-github-seam-assumptions.md| new file mode 100644 |
| index 00000000..22195898 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-23-github-seam-assumptions.md |
| @@ -0,0 +1,24 @@ |
| +# Hub assumptions at the forge seam |
| + |
| +This maps all 15 rows in the approved connector spec against github/seam. |
| +Paths are repository-relative; line numbers name this branch's implementation. |
| +The original spec's references describe an older base. No GitHub runtime is |
| +registered, and recognition by forgekey alone grants no work or access. |
| + |
| +| Assumption | Current locations | Step 2 disposition | |
| +| --- | --- | --- | |
| +| Repository keys | `internal/wire/forgekey/key.go:27`; `internal/runner/thin/forge.go:74`; `internal/runner/forge/publisher.go:420`; `internal/runner/forge/credential_file.go:79`; `internal/runner/thin/research.go:63`; `internal/equipo/chat/tools.go:556`; `internal/equipo/chat/projects.go:243`; `internal/equipo/chat/projects.go:246`; `internal/equipo/chat/projects.go:469`; `internal/equipo/chat/tools.go:957`; `internal/equipo/setup/projects.go:87`; `internal/runner/thin/forge.go:179` | Shared grammar/display helpers. Hub-only admission stays in place; legacy prefix checks explicitly preserve their old policy. Remote URL is still HTTPS plus key. | |
| +| Credential files | `internal/runner/config.go:46`; `internal/runner/config.go:46`; `internal/runner/forge/credential_file.go:19`; `internal/runner/workspace/workspace.go:45`; `internal/runner/workspace/workspace.go:59`; `internal/runner/thin/run.go:197`; `internal/runner/thin/forge.go:106` | Same standing agent file, optional repository overrides, CLI and sandbox exclusions. Real hub is registered behind Forges; no GitHub credentials. | |
| +| Clone and fetch | `internal/runner/thin/forge.go:153`; `internal/runner/thin/forge.go:170`; `internal/runner/thin/forge.go:411`; `internal/runner/thin/forge.go:491`; `internal/runner/thin/forge.go:631`; `internal/runner/thin/access_catalog.go:91`; `internal/runner/workspace/workspace.go:33` | Explicit Read or Push authority; username defaults to x. Existing URLs/passwords unchanged; read grants cannot write. | |
| +| Reachability | `internal/runner/thin/forge.go:101`; `internal/runner/thin/forge.go:187`; `internal/runner/thin/access_catalog.go:18`; `internal/runner/thin/index.go:123`; `internal/wire/frames.go:348`; `internal/runner/thin/run.go:339`; `internal/wire/frames.go:318` | Same 55-second ETag hub list, checked read grants, 100-repository shallow catalog and hello fields. Router combines only each forge's own host entries. | |
| +| Branch push | `internal/runner/thin/engineer.go:434`; `internal/runner/forge/branch.go:216`; `internal/wire/tasks.go:627`; `internal/runner/thin/engineer.go:495`; `internal/runner/thin/relay.go:485`; `internal/runner/thin/forges.go:166` | Same equipo branch rule, default protection and lease confirmation. Propose follows successful pushes and returns the hub branch URL without a request. Initial main uses Push authority too. | |
| +| Hosted CI | `internal/runner/forge/ci.go:66`; `internal/runner/forge/ci.go:81`; `internal/runner/thin/forge.go:334`; `internal/runner/thin/judge_hosted.go:19`; `internal/runner/thin/judge.go:233`; `internal/runner/thin/forges.go:129` | HostedCI shape and hub transport unchanged; router forwards per host. Feedback stays separate from trusted checks certificates. | |
| +| Merge | `internal/runner/thin/mergestep.go:44`; `internal/runner/forge/merge.go:353`; `internal/runner/forge/merge.go:109`; `internal/runner/forge/merge.go:129`; `internal/runner/thin/forge.go:320`; `internal/runner/thin/mergestep.go:155`; `internal/wire/tasks.go:1026`; `internal/runner/thin/merge.go:118` | Only request/result type names lose Hub; every field and hub response/reason stays. Plain-git merge watch unchanged. | |
| +| Repository creation | `internal/runner/thin/bridge.go:83`; `internal/runner/thin/forge.go:279`; `internal/runner/thin/forge.go:543` | Existing hub POST and first-commit behavior; no GitHub creation. Shared new-name validator preserves hub rules. | |
| +| Project add and star | `internal/equipo/chat/http.go:89`; `internal/equipo/chat/http.go:86`; `internal/equipo/chat/projects.go:479`; `internal/equipo/chat/tools.go:756`; `internal/equipo/chat/stars.go:230`; `internal/equipo/app.go:328` | Hub allowlist and owner checks unchanged. Spec's missing device-star route was already delivered by the projects slice; PUT /api/v1/projects/{id}/star exists on this base. | |
| +| Access requests | `internal/equipo/chat/access_request.go:12`; `internal/equipo/chat/tools.go:1013`; `internal/runner/thin/access_forge.go:28`; `internal/runner/thin/access_forge.go:44`; `internal/wire/access.go:63`; `internal/equipo/templates/chat.html:23`; `internal/equipo/chat_page.go:102` | AccessForge and existing command/link validation unchanged. Hostless access targets still belong to the hub; router delegates only to its hub service. | |
| +| Links | `internal/equipo/chat/tasks.go:406`; `internal/equipo/work_pages.go:220`; `internal/equipo/task_merge.go:14` | Hub branch and repository URLs and approved merge-reference host unchanged. ProposalRef is local only; no proposal wire field yet. | |
| +| Prompts | `internal/runner/thin/claude.go:874`; `internal/runner/thin/engineer.go:604`; `internal/runner/thin/judge.go:984` | Shared display function retains exactly the old hub-prefix removal. Future non-hub names keep their host visible. | |
| +| Audit | `internal/runner/forge/publisher.go:376`; `internal/runnerproto/report_validation.go:68`; `internal/equipo/chat/mergeauth.go:65`; `internal/equipo/chat/merge.go:224` | Legacy publication provider and every merge decision audit unchanged. | |
| +| Previews | `internal/runner/thin/preview.go:52`; `internal/runner/thin/preview_devbox.go:35` | No forge dependency added. Existing runner tree, devbox and Carloku paths untouched. | |
| +| Old engine | `internal/runner/forge/publisher.go:51`; `internal/runner/forge/description.go:28`; `internal/runner/forge/description_transport.go:31`; `internal/runner/runtime_workflow.go:138` | Still hub-only; no GitHub extension. Key validation delegates to the same shared hub grammar. | |
diff --git a/docs/superpowers/plans/2026-11-23-github-seam.md b/docs/superpowers/plans/2026-11-23-github-seam.md| new file mode 100644 |
| index 00000000..06cb9d16 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-23-github-seam.md |
| @@ -0,0 +1,29 @@ |
| +# GitHub connector step 2: forge key and seam |
| + |
| +Base: origin/main 00d09aa7. Scope: hub compatibility, no GitHub service, |
| +credentials, project behavior, migrations or new wire fields. |
| + |
| +1. Record the controller's completed scratch probe, exact calls and sanitized |
| + observed answers. Keep full merge table and CARLOS egress open. |
| +2. Add wire/forgekey tests before code: closed hosts, bare hub keys, |
| + case-preserving GitHub keys and case-insensitive equality, rejected URL |
| + decorations and path escapes, shared display and existing hub rules. |
| +3. Add runner seam tests before code: host routing with no fallback, explicit |
| + read/push use, optional CI/access forwarding, hub branch proposal without |
| + writes, git username default and explicit username. Rename merge types |
| + without changing their fields or existing assertions. |
| +4. Route the production hub through Forges. Replace hub key parsing/display |
| + duplication with forgekey while retaining hub-only admission boundaries. |
| + Document every assumption in the approved spec with current file and line. |
| +5. Break each new guard deliberately, observe its regression fail, restore it. |
| + Record test commands and mutation outcomes in the controller report. |
| +6. Run pinned formatting, leaks, measured budgets, migrations, copy release, |
| + lane and fixture checks; full equipo, chat, thintest and runner tests. |
| + Linux CI decides runner tests that macOS cannot build. |
| +7. Commit, run the postcommit dead-reference scan, push github/seam with the |
| + helper, wait for CI, and report the fixed SHA. Do not merge or deploy. |
| + |
| +No device API or runner wire additions are planned. New GitHub lease and |
| +proposal wire fields, a protocol bump and older-runner refusal tests belong |
| +with the later implementation that can dispatch GitHub work. This slice must |
| +continue to reject GitHub work at hub admission boundaries. |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-github-seam.md b/docs/superpowers/plans/CONTROLLER-REPORT-github-seam.md| new file mode 100644 |
| index 00000000..e8adbad9 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-github-seam.md |
| @@ -0,0 +1,164 @@ |
| +# Controller report: GitHub seam |
| + |
| +Base: `00d09aa7`, branch `github/seam`. Hub only; no GitHub client, |
| +credentials, migrations, device API changes or wire fields. The controller |
| +confirmed mechanical test substitutions are permitted and the protocol bump |
| +belongs with the future GitHub wire step. |
| + |
| +## Test preservation |
| + |
| +Every existing test name and assertion is unchanged apart from these approved |
| +mechanical substitutions. No test was deleted or renamed. |
| + |
| +- `HubMergeRequest` -> `MergeRequest`; `HubMergeResult` -> `MergeResult`. |
| +- Forge test-double `Remote` signatures add `Use` (or `thin.Use`). |
| +- Two old direct Remote calls add `Push`, preserving their prior write use. |
| +- The headless access wrapper forwards its new `use` argument. |
| +- New Host/Propose fixture methods are in new seam fixture files. |
| + |
| +Verification: read each old test from HEAD, apply only the substitutions |
| +above, run pinned gofmt, and compare the entire file byte for byte with the |
| +worktree. All 16 changed existing test files match. SHA-256 of each resulting |
| +file follows, so review can distinguish mechanical changes from new tests. |
| + |
| +| Existing test file | SHA-256 after mechanical substitution | |
| +| --- | --- | |
| +| `internal/headless/access_resume_test.go` | d0879525f43a2e6e66a8207207e8a80ca4ef91192fe8c5b4588c321eab3a71ba | |
| +| `internal/headless/merge_test.go` | 50cb66bcbbc11dd1085e7a9136d17b05c55e606a447ef1bdddffa171003d791e | |
| +| `internal/headless/projects_test.go` | 5f9234a1752fddb49a90c0a4f6b562e1aa08578aa36e8b326fb23faf1f9d3ea5 | |
| +| `internal/runner/forge/merge_detail_test.go` | 04b72e20e638d873b49be3d6f739c11a205fb1b4226e66a8419a1a044c34ffbb | |
| +| `internal/runner/forge/merge_test.go` | 0497d4e9d9b75e3c738e90707f94bab7e63dc6ad13d5ed68890d259d7a78cb86 | |
| +| `internal/runner/forge/merge_unborn_test.go` | 506a3b45ee16eb56ff795663978edcdfeac6076d7029faaa750488a81921ca5a | |
| +| `internal/runner/thin/access_review_test.go` | b275d965f9de779314a0eb0c5af24dd21ee96b31cdb3e8519a6ee85f7d806a42 | |
| +| `internal/runner/thin/copy_test.go` | fb58e71251109937899279bfad1fbdf24d5af572fc7ea2c19564da640fa81110 | |
| +| `internal/runner/thin/create_test.go` | c59d96f0ad8ff388ebac2f337483818111a17d793abfbb81377e267458700b25 | |
| +| `internal/runner/thin/index_empty_test.go` | d7f96a51d5ebf2037c90e4bda8ddc8ba1d25e49a12733c2c037c1f4ee249c1d0 | |
| +| `internal/runner/thin/judge_fetch_test.go` | a5a8fd366e67e1c22d7a22326da0cbbb02ad64e7223506c95428f419ed166d9d | |
| +| `internal/runner/thin/mergedetail_test.go` | 901ddcea525906ee9b0200490346b5a8bdc0507cb07b5f1f15c4e8c95469864c | |
| +| `internal/runner/thin/mergestep_test.go` | cc81279ce30d82f888b35e237a906b5865293e2adc1fe8ad1cf9f5aaf44dd860 | |
| +| `internal/runner/thin/relay_test.go` | ce1356717bc69d748b852bf018ec7c017c54d0822769c192f7810d68a9d2fe4c | |
| +| `internal/runner/thin/review_fixes_test.go` | 1affbe9ef6d9c91ad5669f3e51b03ea55b544c0a1f49e00ee975ba1a3c32c767 | |
| +| `internal/runner/thin/sandbox_masks_test.go` | 6abbae1bdf5f7a82e61ad25e4af375be55c4ab68a0ce4e5b5228ed5d63a87b83 | |
| + |
| +## New tests and test-first evidence |
| + |
| +- `go test ./internal/wire/forgekey`: failed with undefined Parse/Hub/Equal |
| + before implementation; passed after adding the package. |
| +- `go test ./internal/runner/thin -run 'TestForges|TestHubProposal|TestRemoteUsername'`: |
| + failed with undefined Use/Proposal/NewForges/MergeRequest before the seam; |
| + passed after implementation. |
| +- `TestEngineeringProposesAfterPush` and `TestRelayProposesAfterPush` both |
| + failed with zero proposals before inserting Propose calls; passed afterward. |
| +- `TestStartDefaultRequestsPushAuthority` failed with authority `[1]` (Read) |
| + before changing initialization to Push; passed afterward. |
| + |
| +## Package changes |
| + |
| +- `wire/forgekey`: closed host parsing, hub shorthand and normalization, |
| + host-aware display, GitHub spelling-preserving equality, shared hub-only |
| + admission and new-repository rules. Recognition grants no execution. |
| +- `runner/thin`: explicit read/push use, host router with no fallback, optional |
| + hosted-CI/access forwarding, hub proposal branch link without network writes, |
| + proposal calls after direct and relayed pushes, hub-only production wiring. |
| + Read grants still cannot obtain push credentials. |
| +- `runner/forge`: merge types renamed without field changes; shared hub key |
| + checks; explicit GitUsername in branch push authentication. Hub transport |
| + names, merge reasons, publication audit provider and old engine stay intact. |
| +- `runner/workspace`: optional GitUsername, defaulting to historical `x`, used |
| + for clone authentication. Thin clone/fetch and forge push use the same default. |
| +- `equipo/chat`, `equipo/setup`: shared parsing/display helpers, keeping hub-only |
| + admission. No database writes or user-visible behavior added. |
| +- `headless`: interface-only fixture substitutions and new fixture methods. |
| + |
| +## Copy |
| + |
| +No app-owned UI/model strings added or changed. One internal diagnostic is |
| +`forgekey.ErrKey`: `invalid repository key`. Reported to the controller. |
| + |
| +## Probe |
| + |
| +[Exact calls and sanitized answers](../specs/2026-11-22-equipo-github-connector-probe.md). |
| +Actions on App push is confirmed. Full merge table and CARLOS egress remain open. |
| + |
| +## Deliberate mutations |
| + |
| +Each mutation ran `GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 go test <package> -run ^<test>$ -count=1`. Every result was a failing test, not a compilation failure. Each original was restored in a finally block. The clean targeted suite runs after these mutations. |
| + |
| +| Guard broken | File | Killing regression | Result | |
| +| --- | --- | --- | --- | |
| +| closed-hosts | `internal/wire/forgekey/key.go` | `TestRejectInvalidKeys` | FAIL, guard restored | |
| +| path-segments | `internal/wire/forgekey/key.go` | `TestRejectInvalidKeys` | FAIL, guard restored | |
| +| github-case | `internal/wire/forgekey/key.go` | `TestEqualityKeepsForgeRules` | FAIL, guard restored | |
| +| hub-case | `internal/wire/forgekey/key.go` | `TestEqualityKeepsForgeRules` | FAIL, guard restored | |
| +| hub-admission | `internal/wire/forgekey/key.go` | `TestHubAdmissionAndCreation` | FAIL, guard restored | |
| +| new-name-rule | `internal/wire/forgekey/key.go` | `TestHubAdmissionAndCreation` | FAIL, guard restored | |
| +| registration-duplicate | `internal/runner/thin/forges.go` | `TestForgesRouteWithoutFallback` | FAIL, guard restored | |
| +| registration-host | `internal/runner/thin/forges.go` | `TestForgesRouteWithoutFallback` | FAIL, guard restored | |
| +| route-host | `internal/runner/thin/forges.go` | `TestForgesRouteWithoutFallback` | FAIL, guard restored | |
| +| route-use | `internal/runner/thin/forges.go` | `TestForgesRouteWithoutFallback` | FAIL, guard restored | |
| +| catalog-host | `internal/runner/thin/forges.go` | `TestForgesCatalogAndHubIdentity` | FAIL, guard restored | |
| +| hub-proposal-host | `internal/runner/thin/forges.go` | `TestHubProposalIsOnlyALink` | FAIL, guard restored | |
| +| hub-proposal-branch | `internal/runner/thin/forges.go` | `TestHubProposalIsOnlyALink` | FAIL, guard restored | |
| +| hub-use | `internal/runner/thin/forge.go` | `TestFileForgeRejectsUnknownUseBeforeIO` | FAIL, guard restored | |
| +| read-push-separation | `internal/runner/thin/forge.go` | `TestAccessReadGrantCannotWrite` | FAIL, guard restored | |
| +| initial-push-authority | `internal/runner/thin/forge.go` | `TestStartDefaultRequestsPushAuthority` | FAIL, guard restored | |
| +| engineering-proposal | `internal/runner/thin/engineer.go` | `TestEngineeringProposesAfterPush` | FAIL, guard restored | |
| +| relay-proposal | `internal/runner/thin/relay.go` | `TestRelayProposesAfterPush` | FAIL, guard restored | |
| +| explicit-username | `internal/runner/workspace/workspace.go` | `TestRemoteUsername` | FAIL, guard restored | |
| +| default-username | `internal/runner/workspace/workspace.go` | `TestRemoteUsername` | FAIL, guard restored | |
| +| branch-username | `internal/runner/forge/branch.go` | `TestBranchGitUsesRemoteUsername` | FAIL, restored | |
| +| workspace-username | `internal/runner/workspace/workspace.go` | `TestWorkspaceFetchUsesRemoteUsername` | FAIL, restored | |
| +| registration-nil | `internal/runner/thin/forges.go` | `TestForgesRouteWithoutFallback` | FAIL, restored | |
| +| missing-forge | `internal/runner/thin/forges.go` | `TestForgesRouteWithoutFallback` | FAIL, restored | |
| +| optional-hosted-ci | `internal/runner/thin/forges.go` | `TestForgesForwardOptionalHubServices` | FAIL, restored | |
| +| optional-ci-status | `internal/runner/thin/forges.go` | `TestForgesForwardOptionalHubServices` | FAIL, restored | |
| +| optional-access | `internal/runner/thin/forges.go` | `TestForgesForwardOptionalHubServices` | FAIL, restored | |
| +| optional-poll | `internal/runner/thin/forges.go` | `TestForgesForwardOptionalHubServices` | FAIL, restored | |
| + |
| +## Local verification |
| + |
| +Pinned toolchain `GOTOOLCHAIN=go1.26.11`, `CGO_ENABLED=0`; pinned gofmt on PATH. |
| +Tests use the repository's `-tags testbuild`. TMPDIR is its physical path on |
| +macOS so fixture security checks do not reject the /var -> /private/var alias. |
| +The first untagged broad run was diagnostic, not a pass; its hanging thin |
| +fixture was stopped before the corrected run. |
| + |
| +Passed: fmt-check, gitleaks (1117 commits, no leaks), budget, migration-check, |
| +copy-release-check, lanes-check (18 lanes plus 5 browser lanes), spacing, |
| +TestPersonAPI, TestPlan3Release, TestBudgetRecordsAreShort, and native fixtures |
| +(11 API fixtures, 3586 markdown fixtures, 32000 differential cases). |
| + |
| +Full equipo, chat and thintest suites passed (68.917s, 15.294s and 245.031s on this shared Mac). |
| +The full runner package tree was run: forge passed (139.352s), workspace |
| +passed (98.009s); several provider/setup packages fail macOS policy checks. |
| +The thin package's long-running HTTP fixture was stopped with SIGQUIT after |
| +214s, retaining its stack evidence. No platform guards or existing tests were |
| +changed to make these pass. Linux CI is the full runner gate, as requested. |
| + |
| +Budget changes are measured only: thin 28436 source / 22414 test lines; |
| +headless 11349 test lines. The reasons name the router, authority seam, |
| +proposal regressions and mechanical fixture additions. No time budget raised. |
| + |
| +Twenty-eight deliberate mutations were killed by runtime test failures. Clean |
| +focused regressions were rerun after restoration. Two username tests inspect |
| +the actual git process environment in workspace fetch and branch push. |
| + |
| +[All 15 mapped hub assumptions](2026-11-23-github-seam-assumptions.md) include |
| +current file and line locations, the existing projects device star route, |
| +and each unchanged hub transport, policy, prompt, audit and preview path. |
| + |
| +The clean hub-focused run passed in 67.985s: |
| + |
| +```sh |
| +GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 go test -tags testbuild \ |
| + ./internal/runner/thin \ |
| + -run 'Test.*(Forge|Merge|Hosted|Access|Propos|RemoteUsername|StartDefault)' -count=1 |
| +``` |
| + |
| +This includes existing forge, merge, hosted CI and access assertions plus the |
| +new routing/proposal regressions. The clean key and both git-username suites |
| +also passed after every mutation was restored. |
| + |
| +Linux headless compile also passed: |
| +`GOOS=linux GOARCH=amd64 go test -tags testbuild -c ./internal/headless` |
| +(with its output artifact kept in TMPDIR, outside the repository). |
diff --git a/docs/superpowers/specs/2026-11-22-equipo-github-connector-probe.md b/docs/superpowers/specs/2026-11-22-equipo-github-connector-probe.md| new file mode 100644 |
| index 00000000..dfdaba24 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/2026-11-22-equipo-github-connector-probe.md |
| @@ -0,0 +1,179 @@ |
| +# GitHub connector probe, 2026-11-23 |
| + |
| +Gate 1 evidence for the [approved connector spec](2026-11-22-equipo-github-connector.md). |
| +Controller ran the probes against scratch organisation `oficina-equipo-test`, |
| +repositories `probe` and `probe-other`, private App `oficina-equipo-probe-acbafc` |
| +(id `5891080`). This document records the supplied sanitized reports; the seam |
| +implementation did not rerun the probes or read their credentials. |
| + |
| +Scripts outside this repository: `agent-tools/github-probe/probe.py` and |
| +`agent-tools/github-probe/probe_actions.py`. The full probe report below is the |
| +fresh run saved at 2026-11-23 17:16:51 UTC. The Actions report was saved at |
| +17:16:21 UTC. Credentials, JWTs and installation tokens are deliberately absent. |
| + |
| +## Calls and checks |
| + |
| +All REST calls use `https://api.github.com`, API version `2022-11-28`, Accept |
| +`application/vnd.github+json`, User-Agent `equipo-probe`. App authentication |
| +is a short RS256 JWT. Installation-token calls use the minted token. |
| +`{installation}`, `{first_sha}`, `{judged_sha}`, `{merge_sha}`, `{pr}` and |
| +`{graphql_id}` below are response-derived identifiers. They are placeholders, |
| +not invented captured values: the report does not retain these identifiers. |
| + |
| +| Call or operation | Request and exact reported answer | |
| +| --- | --- | |
| +| `GET /orgs/oficina-equipo-test/installation` | `200`; permissions exactly contents/write, pull_requests/write, checks/read, statuses/read, actions/read, metadata/read; events `[]`. | |
| +| `POST /app/installations/{installation}/access_tokens` | Body `{"repositories":["probe"],"permissions":{"contents":"write","pull_requests":"write","checks":"read","statuses":"read","actions":"read"}}`; `201`, lifetime `3600 s`, repository list `["probe"]`. | |
| +| `GET /repos/oficina-equipo-test/probe-other` | Scoped token: `404`. | |
| +| `GET /repos/oficina-equipo-test/probe` | Scoped token: `200`. | |
| +| `POST /app/installations/{installation}/access_tokens` | Read token body `{"repositories":["probe"],"permissions":{"contents":"read","pull_requests":"read"}}`. Its response status was not separately retained. | |
| +| `GET /repos/oficina-equipo-test/probe/git/ref/heads/main` | Fetch the SHA used by the read-token branch attempt; response status not separately retained. | |
| +| `POST /repos/oficina-equipo-test/probe/git/refs` | Read token body `{"ref":"refs/heads/equipo/readonly-should-fail","sha":"{main_sha}"}`; `403`. | |
| +| `git clone -q https://github.com/oficina-equipo-test/probe.git` | Installation token through a private askpass file, username `x-access-token`; exit 0. Helpers disabled. | |
| +| First branch push | `git checkout -q -b equipo/probe-1795454216`; write `probe.txt` containing `first\n`; commit `Probe: first change`; `git push -q origin equipo/probe-1795454216`: exit 0. Git's PR-link answer is preserved below. | |
| +| Workflow push | Add `.github/workflows/equipo-{unix_time}.yml`, contents `on: push\njobs: {}\n`; commit `Probe: workflow change should be refused`; same push: nonzero, exact last stderr line below. Reset to `{first_sha}` afterward. The refreshed script uses an existing-directory-safe mkdir and a fresh filename because the repository now contains a real workflow. | |
| +| `POST /repos/oficina-equipo-test/probe/pulls` | Body `{"title":"Probe: draft PR","head":"equipo/probe-1795454216","base":"main","body":"Equipo connector probe.","draft":true}`; `201 draft=True`. | |
| +| Second push | `probe.txt` becomes `first\nsecond\n`; commit `Probe: second change`; push the same branch, obtain `{judged_sha}`. | |
| +| `PATCH /repos/oficina-equipo-test/probe/pulls/{pr}` | Body `{"draft":false}`; attempted by script but status not retained and not the proof of readiness. | |
| +| `POST /graphql` | Query `mutation($id:ID!){markPullRequestReadyForReview(input:{pullRequestId:$id}){pullRequest{isDraft}}}`, variables `{"id":"{graphql_id}"}`; `graphql status 200`. The script checks HTTP success, not the GraphQL errors field or returned isDraft. Controller reports the PR was marked ready. | |
| +| `PUT /repos/oficina-equipo-test/probe/pulls/{pr}/merge` | Body `{"sha":"{first_sha}","merge_method":"merge"}`; `409 Head branch was modified. Review and try the merge again.` | |
| +| `GET /repos/oficina-equipo-test/probe/commits/{judged_sha}/check-runs` | `200`. | |
| +| `GET /repos/oficina-equipo-test/probe/commits/{judged_sha}/status` | `200`. | |
| +| `GET /repos/oficina-equipo-test/probe/actions/runs?per_page=1` | `200`. | |
| +| `PUT /repos/oficina-equipo-test/probe/pulls/{pr}/merge` | Body `{"sha":"{judged_sha}","merge_method":"merge"}`; `200`, script also checks `merged == true`. | |
| +| `GET /repos/oficina-equipo-test/probe/commits/{merge_sha}` | `parents=2`. | |
| +| `DELETE /installation/token` | `204`. | |
| +| `GET /repos/oficina-equipo-test/probe` after revocation | `401` immediately. Read token also revoked; scratch directory removed. | |
| + |
| +## Actions on an App push: confirmed |
| + |
| +Paul installed `.github/workflows/probe.yml` through `gh`, since the App has |
| +no workflow write permission. It runs on pushes to non-main branches and on |
| +pull requests. The Actions script looks up the installation, then mints a |
| +one-repository token with contents/write, actions/read and checks/read. It |
| +clones, creates `equipo/actions-{unix_time}`, writes `a.txt` containing `x\n`, |
| +commits `Probe: does Actions run?`, and pushes with that token. It polls |
| +`GET /repos/oficina-equipo-test/probe/actions/runs?head_sha={sha}` every 10 |
| +seconds, up to 30 times, then reads |
| +`GET /repos/oficina-equipo-test/probe/commits/{sha}/check-runs` with the same |
| +token. Observed event `push`, completed/success; check `check`, completed/success. |
| +Finally it revokes the token and removes scratch. |
| + |
| +## Exact sanitized reports |
| + |
| +`probe-20261123T171651Z.txt`: |
| + |
| +```text |
| +{ |
| + "installation_found": { |
| + "ok": true, |
| + "detail": "status 200" |
| + }, |
| + "installation_permissions_match_G4": { |
| + "ok": true, |
| + "detail": "{\"checks\": \"read\", \"actions\": \"read\", \"contents\": \"write\", \"metadata\": \"read\", \"statuses\": \"read\", \"pull_requests\": \"write\"}" |
| + }, |
| + "no_webhook_events": { |
| + "ok": true, |
| + "detail": "[]" |
| + }, |
| + "scoped_token_minted": { |
| + "ok": true, |
| + "detail": "status 201" |
| + }, |
| + "token_lifetime_about_one_hour": { |
| + "ok": true, |
| + "detail": "3600 s" |
| + }, |
| + "token_scoped_to_one_repo": { |
| + "ok": true, |
| + "detail": "[\"probe\"]" |
| + }, |
| + "other_repo_unreachable": { |
| + "ok": true, |
| + "detail": "status 404" |
| + }, |
| + "own_repo_reachable": { |
| + "ok": true, |
| + "detail": "status 200" |
| + }, |
| + "read_token_cannot_create_branch": { |
| + "ok": true, |
| + "detail": "status 403" |
| + }, |
| + "clone_with_installation_token": { |
| + "ok": true, |
| + "detail": "" |
| + }, |
| + "push_branch_with_token": { |
| + "ok": true, |
| + "detail": "\nremote: Create a pull request for 'equipo/probe-1795454216' on GitHub by visiting: \nremote: https://github.com/oficina-equipo-test/probe/pull/new/equipo/probe-1795454216 \nremote: \n" |
| + }, |
| + "workflow_file_push_refused": { |
| + "ok": true, |
| + "detail": "error: failed to push some refs to 'https://github.com/oficina-equipo-test/probe.git'" |
| + }, |
| + "draft_pr_opened": { |
| + "ok": true, |
| + "detail": "status 201 draft=True" |
| + }, |
| + "draft_marked_ready": { |
| + "ok": true, |
| + "detail": "graphql status 200" |
| + }, |
| + "merge_refused_for_stale_sha": { |
| + "ok": true, |
| + "detail": "status 409 Head branch was modified. Review and try the merge again." |
| + }, |
| + "check_runs_readable": { |
| + "ok": true, |
| + "detail": "status 200" |
| + }, |
| + "commit_status_readable": { |
| + "ok": true, |
| + "detail": "status 200" |
| + }, |
| + "actions_runs_readable": { |
| + "ok": true, |
| + "detail": "status 200" |
| + }, |
| + "merge_pinned_to_judged_sha": { |
| + "ok": true, |
| + "detail": "status 200" |
| + }, |
| + "merge_commit_has_two_parents": { |
| + "ok": true, |
| + "detail": "parents=2" |
| + }, |
| + "token_revoked": { |
| + "ok": true, |
| + "detail": "status 204" |
| + }, |
| + "revoked_token_refused": { |
| + "ok": true, |
| + "detail": "status 401" |
| + } |
| +} |
| +PASS |
| +``` |
| + |
| +`probe-actions-20261123T171621Z.txt`: |
| + |
| +```text |
| +pushed True |
| +{ |
| + "actions_run_triggered_by_app_push": true, |
| + "status": "completed", |
| + "conclusion": "success", |
| + "event": "push" |
| +} |
| +check_runs_on_commit: 200 [('check', 'completed', 'success')] |
| +``` |
| + |
| +## Gate 1 items still open |
| + |
| +- Exercise every row of the merge response table, including review, branch |
| + protection, CI and merge queue cases, in the later merge implementation. |
| +- Confirm the Equipo instance on CARLOS can reach `api.github.com`. |
| + |
| +The completed checks above do not claim these two remaining gates passed. |
diff --git a/internal/equipo/chat/placement.go b/internal/equipo/chat/placement.go| index 171be6c3..d1d91b04 100644 |
| --- a/internal/equipo/chat/placement.go |
| +++ b/internal/equipo/chat/placement.go |
| @@ -2,6 +2,7 @@ package chat |
| import ( |
| "amadan.net/oficina/equipo/internal/wire" |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "context" |
| "encoding/json" |
| "errors" |
| @@ -53,7 +54,7 @@ func (t *txn) moveTask(person, id string, in wire.MoveTask, newProject bool) err |
| var p projectRecord |
| if newProject { |
| repo := NormalizeRepo(in.Repo) |
| - if !newRepo.MatchString(repo) { |
| + if !forgekey.NewHubRepo(repo) { |
| return ErrInvalid |
| } |
| h, err := t.hello(person) |
diff --git a/internal/equipo/chat/placement_card.go b/internal/equipo/chat/placement_card.go| index d1f50234..58d74110 100644 |
| --- a/internal/equipo/chat/placement_card.go |
| +++ b/internal/equipo/chat/placement_card.go |
| @@ -2,6 +2,7 @@ package chat |
| import ( |
| "amadan.net/oficina/equipo/internal/wire" |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "context" |
| "encoding/json" |
| "errors" |
| @@ -41,7 +42,7 @@ func (t *txn) askPlacement(r turnRecord, p wire.Placement) (wire.ToolResult, err |
| } |
| if p.NewRepo != "" { |
| data.NewRepo = NormalizeRepo(p.NewRepo) |
| - if !newRepo.MatchString(data.NewRepo) || slices.Contains(allowed, data.NewRepo) { |
| + if !forgekey.NewHubRepo(data.NewRepo) || slices.Contains(allowed, data.NewRepo) { |
| return refused("invalid", toolBadInput), nil |
| } |
| h, err := t.hello(r.Person) |
diff --git a/internal/equipo/chat/projects.go b/internal/equipo/chat/projects.go| index b2f8e834..1e9988d3 100644 |
| --- a/internal/equipo/chat/projects.go |
| +++ b/internal/equipo/chat/projects.go |
| @@ -1,6 +1,7 @@ |
| package chat |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "context" |
| "encoding/json" |
| "errors" |
| @@ -239,18 +240,10 @@ func (t *txn) projectHome(h wire.Hello) (string, error) { |
| // ProjectName drops the forge host: amadan.net/oficina/sample is |
| // oficina/sample. |
| -func ProjectName(repo string) string { return strings.TrimPrefix(repo, "amadan.net/") } |
| +func ProjectName(repo string) string { return forgekey.Display(repo) } |
| // NormalizeRepo turns what a person or the model typed into a forge key. |
| -func NormalizeRepo(raw string) string { |
| - r := strings.TrimSpace(raw) |
| - r = strings.TrimPrefix(r, "https://") |
| - r = strings.TrimSuffix(strings.TrimSuffix(r, "/"), ".git") |
| - if !strings.HasPrefix(r, "amadan.net/") { |
| - r = "amadan.net/" + r |
| - } |
| - return r |
| -} |
| +func NormalizeRepo(raw string) string { return forgekey.Normalize(raw) } |
| func (t *txn) projectView(p projectRecord) (wire.Project, error) { |
| title := p.Title |
| @@ -473,7 +466,7 @@ func (t *txn) allowed(person string) ([]string, error) { |
| } |
| out := []string{} |
| for _, repo := range h.Repos { |
| - if strings.HasPrefix(repo, "amadan.net/") && !slices.Contains(out, repo) { |
| + if forgekey.HasHubPrefix(repo) && !slices.Contains(out, repo) { |
| out = append(out, repo) |
| } |
| } |
diff --git a/internal/equipo/chat/tools.go b/internal/equipo/chat/tools.go| index 43b570cd..a82c6fbd 100644 |
| --- a/internal/equipo/chat/tools.go |
| +++ b/internal/equipo/chat/tools.go |
| @@ -1,6 +1,7 @@ |
| package chat |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "encoding/json" |
| "errors" |
| "fmt" |
| @@ -165,9 +166,6 @@ var opTexts = map[string]string{ |
| "runner_too_old": toolJobsTooOld, |
| } |
| -// newRepo is the hub's rule for a new repository under the forge host. |
| -var newRepo = regexp.MustCompile(`^amadan\.net/[A-Za-z0-9_.-]+/[a-z0-9][a-z0-9.-]{1,38}$`) |
| - |
| // toolCall runs one coordinator tool for the lease's person, exactly once |
| // per call id, and queues the result for the runner. |
| func (t *txn) toolCall(l Lease, v *wire.ToolCall) error { |
| @@ -555,7 +553,7 @@ func (t *txn) runTool(l Lease, v *wire.ToolCall) (wire.ToolResult, error) { |
| var in struct { |
| Repo string `json:"repo"` |
| } |
| - if wire.Strict(v.Args, &in) != nil || !newRepo.MatchString(in.Repo) { |
| + if wire.Strict(v.Args, &in) != nil || !forgekey.NewHubRepo(in.Repo) { |
| return refused("invalid", toolBadInput), nil |
| } |
| if v.Name == wire.ToolCreateProject { |
| @@ -813,7 +811,7 @@ func (t *txn) authorizeCreate(r turnRecord, repo string) (wire.ToolResult, error |
| if err != nil { |
| return wire.ToolResult{}, err |
| } |
| - ns := strings.Split(strings.TrimPrefix(repo, "amadan.net/"), "/")[0] |
| + ns := strings.Split(forgekey.Display(repo), "/")[0] |
| if !slices.Contains(h.CreateIn, ns) { |
| return refused("no_create", toolNoCreate), nil |
| } |
| @@ -956,7 +954,7 @@ type hit struct { |
| func reachable(h wire.Hello) (entries []wire.RepoInfo, unread map[string]bool) { |
| entries, unread = slices.Clone(h.Catalog), map[string]bool{} |
| for _, repo := range h.Repos { |
| - if !strings.HasPrefix(repo, "amadan.net/") || slices.ContainsFunc(entries, func(e wire.RepoInfo) bool { return e.Repo == repo }) { |
| + if !forgekey.HasHubPrefix(repo) || slices.ContainsFunc(entries, func(e wire.RepoInfo) bool { return e.Repo == repo }) { |
| continue |
| } |
| entries = append(entries, wire.RepoInfo{Repo: repo, Names: []string{path.Base(repo)}, Hints: []string{}}) |
diff --git a/internal/equipo/setup/projects.go b/internal/equipo/setup/projects.go| index d8d480c2..1ee890a6 100644 |
| --- a/internal/equipo/setup/projects.go |
| +++ b/internal/equipo/setup/projects.go |
| @@ -2,6 +2,7 @@ package setup |
| import ( |
| "amadan.net/oficina/equipo/internal/equipo/kernel" |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "context" |
| "crypto/sha256" |
| "encoding/hex" |
| @@ -93,14 +94,14 @@ func CanonicalRepository(value string, invalid error) (string, error) { |
| value = "https://" + value |
| } |
| u, err := url.Parse(value) |
| - if err != nil || u.Scheme != "https" || u.Host != "amadan.net" || u.User != nil || u.Opaque != "" { |
| + if err != nil || u.Scheme != "https" || u.Host != forgekey.Hub || u.User != nil || u.Opaque != "" { |
| return "", invalid |
| } |
| - parts := strings.Split(strings.TrimPrefix(u.Path, "/"), "/") |
| - if len(parts) != 2 || !bindingSegment(parts[0]) || !bindingSegment(parts[1]) { |
| + key, err := forgekey.Parse(u.Host + u.Path) |
| + if err != nil { |
| return "", invalid |
| } |
| - return "amadan.net/" + parts[0] + "/" + parts[1], nil |
| + return key.String(), nil |
| } |
| // CanonicalBranch validates the short branch spelling used by saved projects |
diff --git a/internal/headless/access_resume_test.go b/internal/headless/access_resume_test.go| index 7136058b..4b5fb015 100644 |
| --- a/internal/headless/access_resume_test.go |
| +++ b/internal/headless/access_resume_test.go |
| @@ -118,10 +118,10 @@ func (f *accessResumeForge) Reachable(ctx context.Context) []string { |
| } |
| return out |
| } |
| -func (f *accessResumeForge) Remote(ctx context.Context, repo string) (workspace.Remote, error) { |
| +func (f *accessResumeForge) Remote(ctx context.Context, repo string, use thin.Use) (workspace.Remote, error) { |
| if repo == "amadan.net/carlos/platform" { |
| <-ctx.Done() |
| return workspace.Remote{}, ctx.Err() |
| } |
| - return f.localForge.Remote(ctx, repo) |
| + return f.localForge.Remote(ctx, repo, use) |
| } |
diff --git a/internal/headless/forge_seam_test.go b/internal/headless/forge_seam_test.go| new file mode 100644 |
| index 00000000..070ace6b |
| --- /dev/null |
| +++ b/internal/headless/forge_seam_test.go |
| @@ -0,0 +1,12 @@ |
| +package headless |
| + |
| +import ( |
| + "amadan.net/oficina/equipo/internal/runner/thin" |
| + "context" |
| + "net/url" |
| +) |
| + |
| +func (*localForge) Host() string { return "amadan.net" } |
| +func (*localForge) Propose(_ context.Context, p thin.Proposal) (thin.ProposalRef, error) { |
| + return thin.ProposalRef{URL: "https://" + p.Repo + "?branch=" + url.QueryEscape(p.Branch)}, nil |
| +} |
diff --git a/internal/headless/merge_test.go b/internal/headless/merge_test.go| index a080d76f..e76d50a3 100644 |
| --- a/internal/headless/merge_test.go |
| +++ b/internal/headless/merge_test.go |
| @@ -131,7 +131,7 @@ func scenarioChecksCard(t *testing.T, env *Env) { |
| t.Fatalf("after wait %+v", k) |
| } |
| // The person merges it on Amadan: done (the watch sees it). |
| - if res, err := forgetest.Merge(context.Background(), "git", bare, k.Branch, forge.HubMergeRequest{ExpectSHA: k.CandidateSHA, Strategy: wire.MergeCommit, KeepBranch: true}); err != nil || !res.Merged { |
| + if res, err := forgetest.Merge(context.Background(), "git", bare, k.Branch, forge.MergeRequest{ExpectSHA: k.CandidateSHA, Strategy: wire.MergeCommit, KeepBranch: true}); err != nil || !res.Merged { |
| t.Fatalf("person's merge %+v %v", res, err) |
| } |
| s.wait(t, "done by the person", time.Minute, func(c *thintest.Conversation) bool { return c.Tasks[id].Stage == wire.StageDone }) |
diff --git a/internal/headless/projects_test.go b/internal/headless/projects_test.go| index 6eaa44a2..7ee31af9 100644 |
| --- a/internal/headless/projects_test.go |
| +++ b/internal/headless/projects_test.go |
| @@ -174,7 +174,7 @@ func (f *localForge) Reachable(context.Context) []string { |
| return slices.Compact(out) |
| } |
| -func (f *localForge) Remote(ctx context.Context, repo string) (workspace.Remote, error) { |
| +func (f *localForge) Remote(ctx context.Context, repo string, use thin.Use) (workspace.Remote, error) { |
| if !slices.Contains(f.Reachable(ctx), repo) { |
| return workspace.Remote{}, workspace.ErrGitPassword |
| } |
| @@ -190,9 +190,9 @@ func (f *localForge) Recheck() {} |
| // Merge is the hub's merge API on the local forge: the same refusals |
| // (moved, conflicts, already merged) and a merge commit, branch deleted. |
| -func (f *localForge) Merge(ctx context.Context, repo, branch string, req forge.HubMergeRequest) (forge.HubMergeResult, error) { |
| +func (f *localForge) Merge(ctx context.Context, repo, branch string, req forge.MergeRequest) (forge.MergeResult, error) { |
| if !slices.Contains(f.Reachable(ctx), repo) { |
| - return forge.HubMergeResult{Status: 404, Reason: "not_found"}, nil |
| + return forge.MergeResult{Status: 404, Reason: "not_found"}, nil |
| } |
| f.mu.Lock() |
| hub := forgetest.Hub{CreatesUnbornDefault: f.hubUpdated} |
diff --git a/internal/runner/forge/branch.go b/internal/runner/forge/branch.go| index c2f4c170..c6f46358 100644 |
| --- a/internal/runner/forge/branch.go |
| +++ b/internal/runner/forge/branch.go |
| @@ -113,7 +113,7 @@ func (b BranchPush) git(ctx context.Context, dir string, remote *workspace.Remot |
| if remote != nil && remote.GitPassword != "" { |
| env["GIT_CONFIG_COUNT"] = "10" |
| env["GIT_CONFIG_KEY_9"] = "http.extraHeader" |
| - env["GIT_CONFIG_VALUE_9"] = "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte("x:"+remote.GitPassword)) |
| + env["GIT_CONFIG_VALUE_9"] = "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte(remote.Username()+":"+remote.GitPassword)) |
| } |
| for k, v := range env { |
| cmd.Env = append(cmd.Env, k+"="+v) |
diff --git a/internal/runner/forge/credential_file.go b/internal/runner/forge/credential_file.go| index 0658be58..309eff08 100644 |
| --- a/internal/runner/forge/credential_file.go |
| +++ b/internal/runner/forge/credential_file.go |
| @@ -1,6 +1,7 @@ |
| package forge |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "context" |
| "encoding/json" |
| "os" |
| @@ -75,7 +76,7 @@ func (f FileCredentials) Credential(_ context.Context, repo string) (Credential, |
| } |
| } |
| token := entry.API |
| - if !strings.HasPrefix(repo, "amadan.net/") || strings.ContainsAny(repo+token+entry.Git, "\r\n\x00") || token == "" || file.Agent == "" { |
| + if !forgekey.HasHubPrefix(repo) || strings.ContainsAny(repo+token+entry.Git, "\r\n\x00") || token == "" || file.Agent == "" { |
| return Credential{}, provider.ErrIdentity |
| } |
| return Credential{Remote: "https://" + repo, Agent: file.Agent, Bearer: token, GitPassword: entry.Git}, nil |
diff --git a/internal/runner/forge/forgetest/merge.go b/internal/runner/forge/forgetest/merge.go| index b9ffcfb1..1ad27339 100644 |
| --- a/internal/runner/forge/forgetest/merge.go |
| +++ b/internal/runner/forge/forgetest/merge.go |
| @@ -25,12 +25,12 @@ type Hub struct { |
| // Merge merges branch into the default branch of the bare repository at |
| // dir, as the hub would answer req. |
| -func Merge(ctx context.Context, git, dir, branch string, req forge.HubMergeRequest) (forge.HubMergeResult, error) { |
| +func Merge(ctx context.Context, git, dir, branch string, req forge.MergeRequest) (forge.MergeResult, error) { |
| return Hub{}.Merge(ctx, git, dir, branch, req) |
| } |
| // Merge is the hub's merge API on a local bare repository. |
| -func (h Hub) Merge(ctx context.Context, git, dir, branch string, req forge.HubMergeRequest) (forge.HubMergeResult, error) { |
| +func (h Hub) Merge(ctx context.Context, git, dir, branch string, req forge.MergeRequest) (forge.MergeResult, error) { |
| run := func(env []string, args ...string) (string, error) { |
| cmd := exec.CommandContext(ctx, git, append([]string{"--git-dir=" + dir}, args...)...) |
| cmd.Env = append([]string{"PATH=/usr/bin:/bin", "HOME=/nonexistent", "GIT_CONFIG_NOSYSTEM=1", "GIT_CONFIG_GLOBAL=/dev/null"}, env...) |
| @@ -39,50 +39,50 @@ func (h Hub) Merge(ctx context.Context, git, dir, branch string, req forge.HubMe |
| } |
| def, err := run(nil, "symbolic-ref", "--short", "HEAD") |
| if err != nil { |
| - return forge.HubMergeResult{}, err |
| + return forge.MergeResult{}, err |
| } |
| if strings.HasPrefix(def, "equipo/") { |
| // A rebuild pointed HEAD at a task branch; the hub's stored head, |
| // the default it was created with, is main. The hub before the |
| // update read HEAD itself. |
| if !h.CreatesUnbornDefault && def == branch { |
| - return forge.HubMergeResult{Status: http.StatusBadRequest, Reason: "is_default"}, nil |
| + return forge.MergeResult{Status: http.StatusBadRequest, Reason: "is_default"}, nil |
| } |
| def = "main" |
| } |
| head, err := run(nil, "rev-parse", "--verify", "--quiet", "refs/heads/"+branch) |
| if err != nil { |
| - return forge.HubMergeResult{Status: http.StatusNotFound, Reason: "no_such_branch"}, nil |
| + return forge.MergeResult{Status: http.StatusNotFound, Reason: "no_such_branch"}, nil |
| } |
| if head != req.ExpectSHA { |
| - return forge.HubMergeResult{Status: http.StatusConflict, Reason: "moved"}, nil |
| + return forge.MergeResult{Status: http.StatusConflict, Reason: "moved"}, nil |
| } |
| tip, err := run(nil, "rev-parse", "--verify", "refs/heads/"+def) |
| if err != nil { |
| // An unborn default: refused before the update, created at the |
| // branch's tip after it (create-only: someone else's is "moved"). |
| if !h.CreatesUnbornDefault { |
| - return forge.HubMergeResult{Status: http.StatusConflict, Reason: "unborn_default"}, nil |
| + return forge.MergeResult{Status: http.StatusConflict, Reason: "unborn_default"}, nil |
| } |
| if _, err := run(nil, "update-ref", "refs/heads/"+def, head, ""); err != nil { |
| - return forge.HubMergeResult{Status: http.StatusConflict, Reason: "moved"}, nil |
| + return forge.MergeResult{Status: http.StatusConflict, Reason: "moved"}, nil |
| } |
| // As the hub since 53d8125: HEAD names the new default, and the |
| // source branch is kept (branch_closed false). |
| if _, err := run(nil, "symbolic-ref", "HEAD", "refs/heads/"+def); err != nil { |
| - return forge.HubMergeResult{}, err |
| + return forge.MergeResult{}, err |
| } |
| - return forge.HubMergeResult{Status: http.StatusOK, Merged: true, SHA: head, Into: def, BranchClosed: false}, nil |
| + return forge.MergeResult{Status: http.StatusOK, Merged: true, SHA: head, Into: def, BranchClosed: false}, nil |
| } |
| if _, err := run(nil, "merge-base", "--is-ancestor", head, tip); err == nil { |
| - return forge.HubMergeResult{Status: http.StatusConflict, Reason: "up_to_date"}, nil |
| + return forge.MergeResult{Status: http.StatusConflict, Reason: "up_to_date"}, nil |
| } |
| out, err := run(nil, "merge-tree", "--write-tree", tip, head) |
| var exit *exec.ExitError |
| if errors.As(err, &exit) && exit.ExitCode() == 1 { |
| - return forge.HubMergeResult{Status: http.StatusConflict, Reason: "conflicts"}, nil |
| + return forge.MergeResult{Status: http.StatusConflict, Reason: "conflicts"}, nil |
| } else if err != nil { |
| - return forge.HubMergeResult{}, err |
| + return forge.MergeResult{}, err |
| } |
| tree := strings.SplitN(out, "\n", 2)[0] |
| who := []string{"GIT_AUTHOR_NAME=hub", "GIT_AUTHOR_EMAIL=hub@example.com", "GIT_COMMITTER_NAME=hub", "GIT_COMMITTER_EMAIL=hub@example.com"} |
| @@ -96,15 +96,15 @@ func (h Hub) Merge(ctx context.Context, git, dir, branch string, req forge.HubMe |
| } |
| sha, err := run(who, append(args, "-m", msg)...) |
| if err != nil { |
| - return forge.HubMergeResult{}, err |
| + return forge.MergeResult{}, err |
| } |
| if _, err := run(nil, "update-ref", "refs/heads/"+def, sha, tip); err != nil { |
| - return forge.HubMergeResult{Status: http.StatusConflict, Reason: "moved"}, nil |
| + return forge.MergeResult{Status: http.StatusConflict, Reason: "moved"}, nil |
| } |
| closed := false |
| if !req.KeepBranch { |
| _, err := run(nil, "update-ref", "-d", "refs/heads/"+branch, head) |
| closed = err == nil |
| } |
| - return forge.HubMergeResult{Status: http.StatusOK, Merged: true, SHA: sha, Into: def, BranchClosed: closed}, nil |
| + return forge.MergeResult{Status: http.StatusOK, Merged: true, SHA: sha, Into: def, BranchClosed: closed}, nil |
| } |
diff --git a/internal/runner/forge/merge.go b/internal/runner/forge/merge.go| index c6f0cc9f..e0c78c4d 100644 |
| --- a/internal/runner/forge/merge.go |
| +++ b/internal/runner/forge/merge.go |
| @@ -59,14 +59,14 @@ func (e *HubError) Error() string { |
| func (e *HubError) Unwrap() error { return e.Err } |
| -func hubError(res HubMergeResult, err error) error { |
| +func hubError(res MergeResult, err error) error { |
| return &HubError{Status: res.Status, Code: runnerproto.RedactDetail(res.Reason, 64), Message: runnerproto.RedactDetail(res.Message, runnerproto.DetailLimit), Err: err} |
| } |
| // uncertain is ErrMergeUncertain with what is known of why: the hub's |
| // answer when it gave one, else the cause's words. Only the words: a |
| // cause's own identity (a local refusal, say) never decides the outcome. |
| -func uncertain(res HubMergeResult, cause error) error { |
| +func uncertain(res MergeResult, cause error) error { |
| switch { |
| case res.Status != 0: |
| return hubError(res, ErrMergeUncertain) |
| @@ -102,11 +102,11 @@ func MergeDetail(err error) string { |
| // pageTag is markup in an answer that is not JSON (a proxy's error page). |
| var pageTag = regexp.MustCompile(`(?s)<(?:script|style)\b.*?</(?:script|style)>|<[^>]*>`) |
| -// HubMergeRequest is the hub's merge API body (POST /api/v1/repos/{ns}/ |
| +// MergeRequest is the hub's merge API body (POST /api/v1/repos/{ns}/ |
| // {repo}/branches/{name}/merge). ExpectSHA is the commit that was judged: |
| // the hub's instance compares it with the branch under its git lock, so a |
| // branch that moved is refused, never merged. |
| -type HubMergeRequest struct { |
| +type MergeRequest struct { |
| ExpectSHA string `json:"expect_sha"` |
| Message string `json:"message"` |
| KeepBranch bool `json:"keep_branch"` |
| @@ -122,11 +122,11 @@ type AgentMeta struct { |
| Host string `json:"host"` |
| } |
| -// HubMergeResult is the hub's answer: merged with the new commit on Into, |
| +// MergeResult is the hub's answer: merged with the new commit on Into, |
| // or a refusal with its machine-readable reason (conflicts, moved, |
| // ci_not_green with CIState, up_to_date, no_such_branch, ...) and its |
| // sentence (Message, redacted and bounded). |
| -type HubMergeResult struct { |
| +type MergeResult struct { |
| Status int |
| Merged bool |
| SHA string |
| @@ -150,22 +150,22 @@ type hubMergeBody struct { |
| // HubMerge sends one merge request to the hub with the agent's bearer. |
| // A transport failure or an unreadable answer is an error: the caller |
| // cannot know whether the merge happened. |
| -func HubMerge(ctx context.Context, client *http.Client, hub string, cred Credential, repo, branch string, req HubMergeRequest) (HubMergeResult, error) { |
| +func HubMerge(ctx context.Context, client *http.Client, hub string, cred Credential, repo, branch string, req MergeRequest) (MergeResult, error) { |
| if !validRepository(repo) || !validRef(branch) || cred.Bearer == "" || strings.ContainsAny(cred.Bearer, "\r\n") { |
| - return HubMergeResult{}, ErrMergeRefused |
| + return MergeResult{}, ErrMergeRefused |
| } |
| parts := strings.Split(strings.TrimPrefix(repo, "amadan.net/"), "/") |
| body, _ := json.Marshal(req) |
| hr, err := http.NewRequestWithContext(ctx, http.MethodPost, strings.TrimRight(hub, "/")+"/api/v1/repos/"+url.PathEscape(parts[0])+"/"+url.PathEscape(parts[1])+"/branches/"+url.PathEscape(branch)+"/merge", bytes.NewReader(body)) |
| if err != nil { |
| - return HubMergeResult{}, ErrMergeRefused |
| + return MergeResult{}, ErrMergeRefused |
| } |
| hr.Header.Set("Authorization", "Bearer "+cred.Bearer) |
| hr.Header.Set("Content-Type", "application/json") |
| hr.Header.Set("Accept", "application/json") |
| res, err := client.Do(hr) |
| if err != nil { |
| - return HubMergeResult{}, fmt.Errorf("%w: %v", ErrMergeUncertain, err) |
| + return MergeResult{}, fmt.Errorf("%w: %v", ErrMergeUncertain, err) |
| } |
| defer res.Body.Close() |
| var out hubMergeBody |
| @@ -174,13 +174,13 @@ func HubMerge(ctx context.Context, client *http.Client, hub string, cred Credent |
| // Not JSON (a proxy's page, say): its text is the sentence. |
| out = hubMergeBody{Error: html.UnescapeString(pageTag.ReplaceAllString(string(raw), " "))} |
| if res.StatusCode == http.StatusOK || res.StatusCode >= 500 { |
| - return HubMergeResult{Status: res.StatusCode, Message: runnerproto.RedactDetail(out.Error, runnerproto.DetailLimit)}, ErrMergeUncertain |
| + return MergeResult{Status: res.StatusCode, Message: runnerproto.RedactDetail(out.Error, runnerproto.DetailLimit)}, ErrMergeUncertain |
| } |
| } |
| // Merged only on a 200 that says so with a commit: anything else is a |
| // refusal, never a success. |
| merged := res.StatusCode == http.StatusOK && out.Merged && object.MatchString(out.SHA) |
| - return HubMergeResult{Status: res.StatusCode, Merged: merged, SHA: out.SHA, Into: out.Into, BranchClosed: out.BranchClosed, Reason: out.Reason, CIState: out.CIState, |
| + return MergeResult{Status: res.StatusCode, Merged: merged, SHA: out.SHA, Into: out.Into, BranchClosed: out.BranchClosed, Reason: out.Reason, CIState: out.CIState, |
| Message: runnerproto.RedactDetail(out.Error, runnerproto.DetailLimit)}, nil |
| } |
| @@ -222,7 +222,7 @@ type BranchMerge struct { |
| // Inspect reads the remote (ls-remote and, when needed, a fetch). |
| Inspect func(context.Context) (RemoteState, error) |
| // Request sends the merge to the hub. |
| - Request func(context.Context, HubMergeRequest) (HubMergeResult, error) |
| + Request func(context.Context, MergeRequest) (MergeResult, error) |
| // Confirm checks the execution lease right before the request. |
| Confirm func(context.Context) error |
| // beforeRequest runs right before the request (tests move the branch). |
| @@ -411,7 +411,7 @@ func MergeBranch(ctx context.Context, m BranchMerge) (MergeOutcome, error) { |
| if m.beforeRequest != nil { |
| m.beforeRequest() |
| } |
| - res, rerr := m.Request(ctx, HubMergeRequest{ExpectSHA: m.Commit, Message: m.Message, Strategy: m.Strategy, Agent: m.Agent}) |
| + res, rerr := m.Request(ctx, MergeRequest{ExpectSHA: m.Commit, Message: m.Message, Strategy: m.Strategy, Agent: m.Agent}) |
| if rerr == nil && res.Merged { |
| rec.Phase, rec.SHA, rec.Into = mergeMerged, res.SHA, firstOf(res.Into, st.Default) |
| if err := m.save(rec); err != nil { |
| @@ -460,7 +460,7 @@ func MergeBranch(ctx context.Context, m BranchMerge) (MergeOutcome, error) { |
| // refused records the hub's refusal (a new request may go later) and |
| // returns err. |
| -func (m BranchMerge) refused(rec mergeRecord, res HubMergeResult, err error) error { |
| +func (m BranchMerge) refused(rec mergeRecord, res MergeResult, err error) error { |
| rec.Phase, rec.Reason = mergeRefusedPh, res.Reason |
| if serr := m.save(rec); serr != nil { |
| return uncertain(res, nil) |
diff --git a/internal/runner/forge/merge_detail_test.go b/internal/runner/forge/merge_detail_test.go| index e4c6789e..c2d5478a 100644 |
| --- a/internal/runner/forge/merge_detail_test.go |
| +++ b/internal/runner/forge/merge_detail_test.go |
| @@ -21,7 +21,7 @@ func TestHubMergeKeepsTheAnswer(t *testing.T) { |
| })) |
| defer srv.Close() |
| cred := Credential{Agent: "equipo~p@example.com", Bearer: "token-1"} |
| - req := HubMergeRequest{ExpectSHA: strings.Repeat("a", 40), Message: "Fix typo", Strategy: "merge", Agent: AgentMeta{Session: "equipo-tk1", Harness: "equipo", Host: "test"}} |
| + req := MergeRequest{ExpectSHA: strings.Repeat("a", 40), Message: "Fix typo", Strategy: "merge", Agent: AgentMeta{Session: "equipo-tk1", Harness: "equipo", Host: "test"}} |
| for _, c := range []struct { |
| status int |
| body string |
| @@ -46,15 +46,15 @@ func TestHubMergeKeepsTheAnswer(t *testing.T) { |
| func TestMergeBranchKeepsTheHubAnswer(t *testing.T) { |
| secret := "Bearer s3cr3t-hub-token at https://agent:s3cr3t-pw@amadan.net/x" |
| for _, c := range []struct { |
| - res HubMergeResult |
| + res MergeResult |
| want error |
| }{ |
| - {HubMergeResult{Status: 409, Reason: "archived", Message: "archived; " + secret}, ErrMergeFailed}, |
| - {HubMergeResult{Status: 409, Reason: "conflicts", Message: "conflicts in README"}, ErrMergeConflict}, |
| - {HubMergeResult{Status: 502, Reason: "internal", Message: "could not reach the repo instance; " + secret}, ErrMergeUncertain}, |
| - {HubMergeResult{Status: 409, Reason: "archived", Message: strings.Repeat("long ", 400)}, ErrMergeFailed}, |
| + {MergeResult{Status: 409, Reason: "archived", Message: "archived; " + secret}, ErrMergeFailed}, |
| + {MergeResult{Status: 409, Reason: "conflicts", Message: "conflicts in README"}, ErrMergeConflict}, |
| + {MergeResult{Status: 502, Reason: "internal", Message: "could not reach the repo instance; " + secret}, ErrMergeUncertain}, |
| + {MergeResult{Status: 409, Reason: "archived", Message: strings.Repeat("long ", 400)}, ErrMergeFailed}, |
| } { |
| - h := &fakeHub{head: strings.Repeat("a", 40), answer: func(*fakeHub, HubMergeRequest) (HubMergeResult, error) { return c.res, nil }} |
| + h := &fakeHub{head: strings.Repeat("a", 40), answer: func(*fakeHub, MergeRequest) (MergeResult, error) { return c.res, nil }} |
| _, err := MergeBranch(context.Background(), newMerge(t, h)) |
| var he *HubError |
| if !errors.Is(err, c.want) || !errors.As(err, &he) || he.Status != c.res.Status || he.Code != c.res.Reason { |
| @@ -71,8 +71,8 @@ func TestMergeBranchKeepsTheHubAnswer(t *testing.T) { |
| } |
| // No answer at all: the cause in words, redacted; its own identity |
| // (here a local refusal) never decides the outcome. |
| - h := &fakeHub{head: strings.Repeat("a", 40), answer: func(*fakeHub, HubMergeRequest) (HubMergeResult, error) { |
| - return HubMergeResult{}, errors.Join(ErrMergeRefused, errors.New(secret)) |
| + h := &fakeHub{head: strings.Repeat("a", 40), answer: func(*fakeHub, MergeRequest) (MergeResult, error) { |
| + return MergeResult{}, errors.Join(ErrMergeRefused, errors.New(secret)) |
| }} |
| _, err := MergeBranch(context.Background(), newMerge(t, h)) |
| if !errors.Is(err, ErrMergeUncertain) || errors.Is(err, ErrMergeRefused) || !strings.Contains(err.Error(), "refused by validation") { |
diff --git a/internal/runner/forge/merge_test.go b/internal/runner/forge/merge_test.go| index b6c9cb3d..77a39300 100644 |
| --- a/internal/runner/forge/merge_test.go |
| +++ b/internal/runner/forge/merge_test.go |
| @@ -21,9 +21,9 @@ type fakeHub struct { |
| // unborn: the default branch has no commits yet (an empty |
| // repository): no tip, and its name is not advertised. |
| unborn bool |
| - requests []HubMergeRequest |
| + requests []MergeRequest |
| // answer decides the hub's reply; it may land the merge first. |
| - answer func(h *fakeHub, req HubMergeRequest) (HubMergeResult, error) |
| + answer func(h *fakeHub, req MergeRequest) (MergeResult, error) |
| } |
| func (h *fakeHub) inspect(context.Context) (RemoteState, error) { |
| @@ -35,7 +35,7 @@ func (h *fakeHub) inspect(context.Context) (RemoteState, error) { |
| return RemoteState{Head: h.head, Default: "main", Tip: strings.Repeat("9", 40), Landed: h.landed, MergeSHA: h.merge}, nil |
| } |
| -func (h *fakeHub) request(_ context.Context, req HubMergeRequest) (HubMergeResult, error) { |
| +func (h *fakeHub) request(_ context.Context, req MergeRequest) (MergeResult, error) { |
| h.mu.Lock() |
| defer h.mu.Unlock() |
| h.requests = append(h.requests, req) |
| @@ -44,15 +44,15 @@ func (h *fakeHub) request(_ context.Context, req HubMergeRequest) (HubMergeResul |
| // mergeNow lands the merge like the hub does: a merge commit, the branch |
| // deleted. |
| -func mergeNow(h *fakeHub, req HubMergeRequest) (HubMergeResult, error) { |
| +func mergeNow(h *fakeHub, req MergeRequest) (MergeResult, error) { |
| if h.landed { |
| - return HubMergeResult{Status: 409, Reason: "up_to_date"}, nil |
| + return MergeResult{Status: 409, Reason: "up_to_date"}, nil |
| } |
| if h.head != req.ExpectSHA { |
| - return HubMergeResult{Status: 409, Reason: "moved"}, nil |
| + return MergeResult{Status: 409, Reason: "moved"}, nil |
| } |
| h.landed, h.merge, h.head = true, strings.Repeat("8", 40), "" |
| - return HubMergeResult{Status: 200, Merged: true, SHA: h.merge, Into: "main", BranchClosed: true}, nil |
| + return MergeResult{Status: 200, Merged: true, SHA: h.merge, Into: "main", BranchClosed: true}, nil |
| } |
| func newMerge(t *testing.T, h *fakeHub) BranchMerge { |
| @@ -82,9 +82,9 @@ func TestMergeBranch(t *testing.T) { |
| // never arrived; the default branch shows the merge and no second request |
| // is ever sent. |
| func TestMergeBranchReconcilesALostAnswer(t *testing.T) { |
| - h := &fakeHub{head: strings.Repeat("a", 40), answer: func(h *fakeHub, req HubMergeRequest) (HubMergeResult, error) { |
| + h := &fakeHub{head: strings.Repeat("a", 40), answer: func(h *fakeHub, req MergeRequest) (MergeResult, error) { |
| mergeNow(h, req) |
| - return HubMergeResult{}, ErrMergeUncertain |
| + return MergeResult{}, ErrMergeUncertain |
| }} |
| m := newMerge(t, h) |
| out, err := MergeBranch(context.Background(), m) |
| @@ -104,13 +104,13 @@ func TestMergeBranchRecoversACrash(t *testing.T) { |
| h := &fakeHub{head: strings.Repeat("a", 40), answer: mergeNow} |
| m := newMerge(t, h) |
| crashed := m |
| - crashed.Request = func(ctx context.Context, req HubMergeRequest) (HubMergeResult, error) { |
| + crashed.Request = func(ctx context.Context, req MergeRequest) (MergeResult, error) { |
| if landed { |
| h.mu.Lock() |
| mergeNow(h, req) |
| h.mu.Unlock() |
| } |
| - return HubMergeResult{}, errors.New("process killed") |
| + return MergeResult{}, errors.New("process killed") |
| } |
| crashed.Inspect = func(ctx context.Context) (RemoteState, error) { |
| if rec, ok, _ := m.load(); ok && rec.Phase == mergeRequested { |
| @@ -160,19 +160,19 @@ func TestMergeBranchNeverMergesAMovedBranch(t *testing.T) { |
| func TestMergeBranchRefusals(t *testing.T) { |
| for _, c := range []struct { |
| - res HubMergeResult |
| + res MergeResult |
| want error |
| }{ |
| - {HubMergeResult{Status: 409, Reason: "conflicts"}, ErrMergeConflict}, |
| - {HubMergeResult{Status: 409, Reason: "ci_not_green", CIState: "running"}, ErrMergeCIPending}, |
| - {HubMergeResult{Status: 409, Reason: "ci_not_green", CIState: "pending"}, ErrMergeCIPending}, |
| - {HubMergeResult{Status: 409, Reason: "ci_not_green", CIState: "failure"}, ErrMergeCIFailed}, |
| - {HubMergeResult{Status: 403}, ErrMergeForbidden}, |
| - {HubMergeResult{Status: 404}, ErrMergeForbidden}, |
| - {HubMergeResult{Status: 409, Reason: "archived"}, ErrMergeFailed}, |
| - {HubMergeResult{Status: 502, Reason: "internal"}, ErrMergeUncertain}, |
| + {MergeResult{Status: 409, Reason: "conflicts"}, ErrMergeConflict}, |
| + {MergeResult{Status: 409, Reason: "ci_not_green", CIState: "running"}, ErrMergeCIPending}, |
| + {MergeResult{Status: 409, Reason: "ci_not_green", CIState: "pending"}, ErrMergeCIPending}, |
| + {MergeResult{Status: 409, Reason: "ci_not_green", CIState: "failure"}, ErrMergeCIFailed}, |
| + {MergeResult{Status: 403}, ErrMergeForbidden}, |
| + {MergeResult{Status: 404}, ErrMergeForbidden}, |
| + {MergeResult{Status: 409, Reason: "archived"}, ErrMergeFailed}, |
| + {MergeResult{Status: 502, Reason: "internal"}, ErrMergeUncertain}, |
| } { |
| - h := &fakeHub{head: strings.Repeat("a", 40), answer: func(*fakeHub, HubMergeRequest) (HubMergeResult, error) { return c.res, nil }} |
| + h := &fakeHub{head: strings.Repeat("a", 40), answer: func(*fakeHub, MergeRequest) (MergeResult, error) { return c.res, nil }} |
| m := newMerge(t, h) |
| if _, err := MergeBranch(context.Background(), m); !errors.Is(err, c.want) { |
| t.Fatalf("%+v: %v, want %v", c.res, err, c.want) |
| @@ -227,7 +227,7 @@ func TestHubMerge(t *testing.T) { |
| })) |
| defer srv.Close() |
| cred := Credential{Agent: "equipo~p@example.com", Bearer: "token-1"} |
| - req := HubMergeRequest{ExpectSHA: strings.Repeat("a", 40), Message: "Fix typo", Strategy: "merge", Agent: AgentMeta{Session: "equipo-tk1", Harness: "equipo", Host: "docs-t1"}} |
| + req := MergeRequest{ExpectSHA: strings.Repeat("a", 40), Message: "Fix typo", Strategy: "merge", Agent: AgentMeta{Session: "equipo-tk1", Harness: "equipo", Host: "docs-t1"}} |
| res, err := HubMerge(context.Background(), srv.Client(), srv.URL, cred, "amadan.net/oficina/sample", "equipo/tk1-fix-typo", req) |
| if err != nil || !res.Merged || res.SHA != strings.Repeat("8", 40) || res.Into != "main" || !res.BranchClosed { |
| t.Fatalf("%+v %v", res, err) |
diff --git a/internal/runner/forge/merge_unborn_test.go b/internal/runner/forge/merge_unborn_test.go| index 822ecf90..1151c0df 100644 |
| --- a/internal/runner/forge/merge_unborn_test.go |
| +++ b/internal/runner/forge/merge_unborn_test.go |
| @@ -16,8 +16,8 @@ import ( |
| // ordinary refusal, and the next merge is an ordinary one. |
| func TestMergeBranchUnbornDefaultBeforeTheHubUpdate(t *testing.T) { |
| commit := strings.Repeat("a", 40) |
| - for _, c := range []HubMergeResult{{Status: 409, Reason: "unborn_default"}, {Status: 400, Reason: "is_default"}, {Status: 409, Reason: "moved"}} { |
| - h := &fakeHub{head: commit, unborn: true, answer: func(*fakeHub, HubMergeRequest) (HubMergeResult, error) { return c, nil }} |
| + for _, c := range []MergeResult{{Status: 409, Reason: "unborn_default"}, {Status: 400, Reason: "is_default"}, {Status: 409, Reason: "moved"}} { |
| + h := &fakeHub{head: commit, unborn: true, answer: func(*fakeHub, MergeRequest) (MergeResult, error) { return c, nil }} |
| m := newMerge(t, h) |
| if _, err := MergeBranch(context.Background(), m); !errors.Is(err, ErrMergeUnbornDefault) || len(h.requests) != 1 { |
| t.Fatalf("%+v: %v (%d requests)", c, err, len(h.requests)) |
| @@ -26,9 +26,9 @@ func TestMergeBranchUnbornDefaultBeforeTheHubUpdate(t *testing.T) { |
| t.Fatalf("%+v: record %+v", c, rec) |
| } |
| } |
| - h := &fakeHub{head: commit, unborn: true, answer: func(h *fakeHub, _ HubMergeRequest) (HubMergeResult, error) { |
| + h := &fakeHub{head: commit, unborn: true, answer: func(h *fakeHub, _ MergeRequest) (MergeResult, error) { |
| h.unborn = false // someone created the default branch meanwhile |
| - return HubMergeResult{Status: 409, Reason: "moved"}, nil |
| + return MergeResult{Status: 409, Reason: "moved"}, nil |
| }} |
| if _, err := MergeBranch(context.Background(), newMerge(t, h)); !errors.Is(err, ErrMergeFailed) || errors.Is(err, ErrMergeUnbornDefault) { |
| t.Fatalf("default created meanwhile: %v", err) |
| @@ -40,12 +40,12 @@ func TestMergeBranchUnbornDefaultBeforeTheHubUpdate(t *testing.T) { |
| // commit). A second call reads the record, never asks again. |
| func TestMergeBranchUnbornDefaultAfterTheHubUpdate(t *testing.T) { |
| commit := strings.Repeat("a", 40) |
| - h := &fakeHub{head: commit, unborn: true, answer: func(h *fakeHub, req HubMergeRequest) (HubMergeResult, error) { |
| + h := &fakeHub{head: commit, unborn: true, answer: func(h *fakeHub, req MergeRequest) (MergeResult, error) { |
| if h.head != req.ExpectSHA { |
| - return HubMergeResult{Status: 409, Reason: "moved"}, nil |
| + return MergeResult{Status: 409, Reason: "moved"}, nil |
| } |
| h.unborn, h.landed, h.merge = false, true, req.ExpectSHA |
| - return HubMergeResult{Status: 200, Merged: true, SHA: req.ExpectSHA, Into: "main"}, nil |
| + return MergeResult{Status: 200, Merged: true, SHA: req.ExpectSHA, Into: "main"}, nil |
| }} |
| m := newMerge(t, h) |
| out, err := MergeBranch(context.Background(), m) |
| @@ -68,9 +68,9 @@ func TestMergeBranchUnbornDefaultAfterTheHubUpdate(t *testing.T) { |
| // the next call is answered by the record, never a second request. |
| func TestMergeBranchFirstMergeKeepsTheBranch(t *testing.T) { |
| commit := strings.Repeat("a", 40) |
| - h := &fakeHub{head: commit, unborn: true, answer: func(h *fakeHub, req HubMergeRequest) (HubMergeResult, error) { |
| + h := &fakeHub{head: commit, unborn: true, answer: func(h *fakeHub, req MergeRequest) (MergeResult, error) { |
| h.unborn, h.landed, h.merge = false, true, req.ExpectSHA |
| - return HubMergeResult{Status: 200, Merged: true, SHA: req.ExpectSHA, BranchClosed: false}, nil |
| + return MergeResult{Status: 200, Merged: true, SHA: req.ExpectSHA, BranchClosed: false}, nil |
| }} |
| m := newMerge(t, h) |
| out, err := MergeBranch(context.Background(), m) |
diff --git a/internal/runner/forge/publisher.go b/internal/runner/forge/publisher.go| index d292a66b..e9028e07 100644 |
| --- a/internal/runner/forge/publisher.go |
| +++ b/internal/runner/forge/publisher.go |
| @@ -1,6 +1,7 @@ |
| package forge |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "bytes" |
| "context" |
| "encoding/json" |
| @@ -56,7 +57,6 @@ type Publisher struct { |
| var _ team.Adapter = (*Publisher)(nil) |
| var object = regexp.MustCompile(`^(?:[0-9a-f]{40}|[0-9a-f]{64})$`) |
| -var repoName = regexp.MustCompile(`^amadan\.net/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$`) |
| func New(cfg Config) (*Publisher, error) { return newPublisher(cfg, nil) } |
| func newPublisher(cfg Config, local func(string) string) (*Publisher, error) { |
| @@ -418,7 +418,7 @@ func (p *Publisher) remoteHead(ctx context.Context, cred Credential, branch stri |
| } |
| func validRepository(repository string) bool { |
| - if !repoName.MatchString(repository) { |
| + if !forgekey.ValidHub(repository) { |
| return false |
| } |
| for _, part := range strings.Split(repository, "/")[1:] { |
diff --git a/internal/runner/forge/username_test.go b/internal/runner/forge/username_test.go| new file mode 100644 |
| index 00000000..fc0eb882 |
| --- /dev/null |
| +++ b/internal/runner/forge/username_test.go |
| @@ -0,0 +1,32 @@ |
| +package forge |
| + |
| +import ( |
| + "context" |
| + "encoding/base64" |
| + "os" |
| + "path/filepath" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/runner/workspace" |
| +) |
| + |
| +func TestBranchGitUsesRemoteUsername(t *testing.T) { |
| + dir := t.TempDir() |
| + script := filepath.Join(dir, "git") |
| + if err := os.WriteFile(script, []byte("#!/bin/sh\nprintf '%s' \"$GIT_CONFIG_VALUE_9\"\n"), 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + b := BranchPush{Git: script, GitDir: dir} |
| + for _, user := range []string{"", "x-access-token"} { |
| + remote := workspace.Remote{URL: "https://amadan.net/o/r", GitPassword: "fixture-password", GitUsername: user} |
| + got, err := b.git(context.Background(), dir, &remote, "push") |
| + wantUser := user |
| + if wantUser == "" { |
| + wantUser = "x" |
| + } |
| + want := "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte(wantUser+":fixture-password")) |
| + if err != nil || got != want { |
| + t.Fatalf("git authentication user %q: %q %v", user, got, err) |
| + } |
| + } |
| +} |
diff --git a/internal/runner/thin/access_catalog.go b/internal/runner/thin/access_catalog.go| index 1ce50236..433ee659 100644 |
| --- a/internal/runner/thin/access_catalog.go |
| +++ b/internal/runner/thin/access_catalog.go |
| @@ -89,11 +89,5 @@ func (s *State) accessReadTargets(ctx context.Context) ([]string, error) { |
| } |
| func readRemote(ctx context.Context, f Forge, repo string) (workspace.Remote, error) { |
| - if ff, ok := f.(*fileForge); ok { |
| - if !slices.Contains(ff.Reachable(ctx), repo) { |
| - return workspace.Remote{}, workspace.ErrGitPassword |
| - } |
| - return ff.remoteCredential(ctx, repo) |
| - } |
| - return f.Remote(ctx, repo) |
| + return f.Remote(ctx, repo, Read) |
| } |
diff --git a/internal/runner/thin/access_review_test.go b/internal/runner/thin/access_review_test.go| index 479c6b6d..2aaae838 100644 |
| --- a/internal/runner/thin/access_review_test.go |
| +++ b/internal/runner/thin/access_review_test.go |
| @@ -157,10 +157,10 @@ func TestAccessReadGrantCannotWrite(t *testing.T) { |
| if remote, err := readRemote(ctx, f, repo); err != nil || remote.GitPassword == "" { |
| t.Fatal("read grant cannot fetch", err) |
| } |
| - if _, err := f.Remote(ctx, repo); err == nil { |
| + if _, err := f.Remote(ctx, repo, Push); err == nil { |
| t.Fatal("read grant got write credential") |
| } |
| - if _, err := f.Merge(ctx, repo, "branch", forge.HubMergeRequest{}); !errors.Is(err, forge.ErrMergeRefused) { |
| + if _, err := f.Merge(ctx, repo, "branch", forge.MergeRequest{}); !errors.Is(err, forge.ErrMergeRefused) { |
| t.Fatal("read grant reached merge", err) |
| } |
| if _, err := f.ciCredential(ctx, repo); !errors.Is(err, forge.ErrCIRead) { |
diff --git a/internal/runner/thin/ask.go b/internal/runner/thin/ask.go| index b0e9c546..f0a2c57d 100644 |
| --- a/internal/runner/thin/ask.go |
| +++ b/internal/runner/thin/ask.go |
| @@ -1,6 +1,7 @@ |
| package thin |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "context" |
| "database/sql" |
| "encoding/json" |
| @@ -728,7 +729,7 @@ func (e *Engineer) answer(ctx context.Context, a askRow, progress func(wire.Answ |
| } |
| return rep |
| } |
| - if !slices.Contains(e.Owners, a.Person) || !repoKey.MatchString(a.Repo) || !wire.ValidTaskBranch(a.Branch) || !shaPattern.MatchString(a.CandidateSHA) || a.BaseSHA != "" && !shaPattern.MatchString(a.BaseSHA) { |
| + if !slices.Contains(e.Owners, a.Person) || !forgekey.ValidHub(a.Repo) || !wire.ValidTaskBranch(a.Branch) || !shaPattern.MatchString(a.CandidateSHA) || a.BaseSHA != "" && !shaPattern.MatchString(a.BaseSHA) { |
| return fail("policy_rejected") |
| } |
| kept, found, err := e.O.State.keptSessionFor(ctx, a.StepID) |
diff --git a/internal/runner/thin/claude.go b/internal/runner/thin/claude.go| index fd3d0b92..7acd47fa 100644 |
| --- a/internal/runner/thin/claude.go |
| +++ b/internal/runner/thin/claude.go |
| @@ -1,6 +1,7 @@ |
| package thin |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "bufio" |
| "context" |
| "crypto/rand" |
| @@ -870,7 +871,7 @@ func doneNote(done []string) string { |
| func namespacesOf(catalog []wire.RepoInfo) []string { |
| out := []string{} |
| for _, e := range catalog { |
| - ns, _, _ := strings.Cut(strings.TrimPrefix(e.Repo, "amadan.net/"), "/") |
| + ns, _, _ := strings.Cut(forgekey.Display(e.Repo), "/") |
| if ns != "" && !slices.Contains(out, ns) { |
| out = append(out, ns) |
| } |
| @@ -917,7 +918,7 @@ func explorePrompt(before, now []string, catalog []wire.RepoInfo) string { |
| if len(added) > 0 { |
| var in []wire.RepoInfo |
| for _, e := range catalog { |
| - ns, _, _ := strings.Cut(strings.TrimPrefix(e.Repo, "amadan.net/"), "/") |
| + ns, _, _ := strings.Cut(forgekey.Display(e.Repo), "/") |
| if slices.Contains(added, ns) { |
| in = append(in, e) |
| } |
| @@ -943,7 +944,7 @@ func catalogLines(catalog []wire.RepoInfo, limit int) string { |
| b.WriteString("(more: use find)\n") |
| break |
| } |
| - line := strings.TrimPrefix(e.Repo, "amadan.net/") |
| + line := forgekey.Display(e.Repo) |
| if len(e.Names) > 1 { |
| line += " [" + strings.Join(e.Names[1:min(len(e.Names), 5)], ", ") + "]" |
| } |
| @@ -981,7 +982,7 @@ func (c *coordBase) settled(kind string, ns []string, catalog []wire.RepoInfo) e |
| if err != nil { |
| return err |
| } |
| - es = append(es, wire.NotebookEntry{ID: id, Source: wire.NoteOwn, Repo: strings.TrimPrefix(e.Repo, "amadan.net/"), Text: clip(strings.TrimPrefix(e.Repo, "amadan.net/")+" is reachable: "+e.Summary, wire.MaxEntryBytes), At: time.Now().UTC()}) |
| + es = append(es, wire.NotebookEntry{ID: id, Source: wire.NoteOwn, Repo: forgekey.Display(e.Repo), Text: clip(forgekey.Display(e.Repo)+" is reachable: "+e.Summary, wire.MaxEntryBytes), At: time.Now().UTC()}) |
| } |
| if err := c.desk.SaveEntries(es); err != nil { |
| return err |
diff --git a/internal/runner/thin/copy_test.go b/internal/runner/thin/copy_test.go| index 2e828c52..791454c2 100644 |
| --- a/internal/runner/thin/copy_test.go |
| +++ b/internal/runner/thin/copy_test.go |
| @@ -166,7 +166,7 @@ func newCopyRigCandidate(t *testing.T, setup func(string), candidateText string) |
| os.WriteFile(filepath.Join(seed, "internal/equipo/copy.go"), []byte(candidateText), 0600) |
| gitOut(t, seed, "commit", "-qam", "candidate") |
| candidate := gitOut(t, seed, "rev-parse", "HEAD") |
| - err = forge.PushBranch(r.ctx, forge.BranchPush{Root: filepath.Join(r.e.root(), "publish"), Git: "/usr/bin/git", GitDir: filepath.Join(seed, ".git"), Repo: r.review.Repo, Branch: branch, Default: "main", Base: base, Commit: candidate, Key: "tkcopy/engineering/1", Person: connPerson, Owners: r.e.Owners, Remote: func(ctx context.Context) (workspace.Remote, error) { return r.e.Forge.Remote(ctx, r.review.Repo) }, Confirm: func(context.Context) error { return nil }}) |
| + err = forge.PushBranch(r.ctx, forge.BranchPush{Root: filepath.Join(r.e.root(), "publish"), Git: "/usr/bin/git", GitDir: filepath.Join(seed, ".git"), Repo: r.review.Repo, Branch: branch, Default: "main", Base: base, Commit: candidate, Key: "tkcopy/engineering/1", Person: connPerson, Owners: r.e.Owners, Remote: func(ctx context.Context) (workspace.Remote, error) { return r.e.Forge.Remote(ctx, r.review.Repo, Push) }, Confirm: func(context.Context) error { return nil }}) |
| if err != nil { |
| t.Fatal(err) |
| } |
diff --git a/internal/runner/thin/create_test.go b/internal/runner/thin/create_test.go| index 4649ed9b..e6d2605b 100644 |
| --- a/internal/runner/thin/create_test.go |
| +++ b/internal/runner/thin/create_test.go |
| @@ -20,12 +20,12 @@ func (f *countingForge) Repos() []string { return slices.Clon |
| func (f *countingForge) Reachable(context.Context) []string { return slices.Clone(f.repos) } |
| func (f *countingForge) CreateIn(context.Context) []string { return []string{"oficina"} } |
| func (f *countingForge) Agent() string { return "test" } |
| -func (f *countingForge) Remote(context.Context, string) (workspace.Remote, error) { |
| +func (f *countingForge) Remote(context.Context, string, Use) (workspace.Remote, error) { |
| return workspace.Remote{}, workspace.ErrGitPassword |
| } |
| func (f *countingForge) Recheck() {} |
| -func (f *countingForge) Merge(context.Context, string, string, forge.HubMergeRequest) (forge.HubMergeResult, error) { |
| - return forge.HubMergeResult{}, forge.ErrMergeRefused |
| +func (f *countingForge) Merge(context.Context, string, string, forge.MergeRequest) (forge.MergeResult, error) { |
| + return forge.MergeResult{}, forge.ErrMergeRefused |
| } |
| func (f *countingForge) Exists(_ context.Context, repo string) (bool, error) { |
diff --git a/internal/runner/thin/engineer.go b/internal/runner/thin/engineer.go| index 06770d02..ced41ae4 100644 |
| --- a/internal/runner/thin/engineer.go |
| +++ b/internal/runner/thin/engineer.go |
| @@ -1,6 +1,7 @@ |
| package thin |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "bufio" |
| "context" |
| "crypto/sha256" |
| @@ -172,7 +173,7 @@ func (e *Engineer) Exec(ctx context.Context, r stepRow, progress func(wire.StepR |
| // Only the push was left when the runner stopped. |
| return e.publish(ctx, r, rep) |
| } |
| - if !slices.Contains(e.Owners, r.Person) || !repoKey.MatchString(r.Repo) || !wire.ValidTaskBranch(r.Branch) || r.Specialist != wire.SpecialistEngineering { |
| + if !slices.Contains(e.Owners, r.Person) || !forgekey.ValidHub(r.Repo) || !wire.ValidTaskBranch(r.Branch) || r.Specialist != wire.SpecialistEngineering { |
| return fail("policy_rejected", true) |
| } |
| // The generation is an execution lease: nothing runs without it. |
| @@ -431,9 +432,12 @@ func (e *Engineer) publish(ctx context.Context, r stepRow, rep wire.StepReport) |
| err = fmt.Errorf("reading the default branch: %w", err) |
| } else { |
| err = forge.PushBranch(ctx, forge.BranchPush{ExpectedHead: expectedHead, Root: filepath.Join(e.root(), "publish"), Git: e.O.Runner.GitPath, GitDir: tree.GitDir, Repo: r.Repo, Branch: r.Branch, Default: def, Base: r.Base, Commit: r.Candidate, Key: r.TaskID + "/" + r.key(), Person: r.Person, Owners: e.Owners, |
| - Remote: func(ctx context.Context) (workspace.Remote, error) { return e.Forge.Remote(ctx, r.Repo) }, |
| + Remote: func(ctx context.Context) (workspace.Remote, error) { return e.Forge.Remote(ctx, r.Repo, Push) }, |
| Confirm: e.confirmFor(r)}) |
| } |
| + if err == nil { |
| + _, err = e.Forge.Propose(ctx, Proposal{Repo: r.Repo, Branch: r.Branch}) |
| + } |
| if err == nil || errors.Is(err, forge.ErrPushRefused) || errors.Is(err, forge.ErrPushConflict) || ctx.Err() != nil { |
| break |
| } |
| @@ -597,7 +601,7 @@ const stepGoChecks = "Use the read-only Go toolchain at /opt/go and module cache |
| // stepPrompt is the Engineering specialist's one user frame. |
| func (e *Engineer) stepPrompt(r stepRow, empty bool) string { |
| var b strings.Builder |
| - b.WriteString("[Equipo: engineering] You are Equipo's Engineering specialist, working for " + r.Person + " on " + strings.TrimPrefix(r.Repo, "amadan.net/") + ".\n") |
| + b.WriteString("[Equipo: engineering] You are Equipo's Engineering specialist, working for " + r.Person + " on " + forgekey.Display(r.Repo) + ".\n") |
| b.WriteString(engineeringDataRule) |
| b.WriteString("Coordinator task title: " + wire.QuotedData(r.Title) + "\n") |
| for _, words := range r.PersonWords { |
diff --git a/internal/runner/thin/forge.go b/internal/runner/thin/forge.go| index 2baf2817..156c80a3 100644 |
| --- a/internal/runner/thin/forge.go |
| +++ b/internal/runner/thin/forge.go |
| @@ -1,6 +1,7 @@ |
| package thin |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "bytes" |
| "context" |
| "crypto/sha256" |
| @@ -29,10 +30,12 @@ import ( |
| // on, how to reach them, and whether it may create one. Only the runner |
| // holds the credential; no token leaves this package. |
| type Forge interface { |
| + Host() string |
| + Propose(context.Context, Proposal) (ProposalRef, error) |
| // Repos is the allowlist the runner advertises in hello. |
| Repos() []string |
| // Remote resolves a repository for git: URL and git password. |
| - Remote(ctx context.Context, repo string) (workspace.Remote, error) |
| + Remote(ctx context.Context, repo string, use Use) (workspace.Remote, error) |
| // CreateIn lists namespaces the runner's agent may create repositories in. |
| CreateIn(ctx context.Context) []string |
| // Create makes a new private repository and adds it to Repos. One that |
| @@ -49,7 +52,7 @@ type Forge interface { |
| Recheck() |
| // Merge asks the hub to merge a task branch into the default branch |
| // (forge.MergeBranch decides when; this is the one request). |
| - Merge(ctx context.Context, repo, branch string, req forge.HubMergeRequest) (forge.HubMergeResult, error) |
| + Merge(ctx context.Context, repo, branch string, req forge.MergeRequest) (forge.MergeResult, error) |
| } |
| // ErrNoCreate means repositories cannot be created in that namespace. |
| @@ -64,18 +67,11 @@ var ErrAdopted = errors.New("the repository already exists; adopted") |
| // commits yet: no branch, nothing to read. It is not an access failure. |
| var ErrEmptyRepo = errors.New("the repository has no commits yet") |
| -var ( |
| - repoKey = regexp.MustCompile(`^amadan\.net/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$`) |
| - newName = regexp.MustCompile(`^[a-z0-9][a-z0-9.-]{1,38}$`) |
| - nsPrefix = "amadan.net/" |
| -) |
| +const nsPrefix = forgekey.Hub + "/" |
| // ValidNewRepo is the hub's rule for a new repository name, under the |
| // forge host: amadan.net/<namespace>/<name>. |
| -func ValidNewRepo(repo string) bool { |
| - parts := strings.Split(strings.TrimPrefix(repo, nsPrefix), "/") |
| - return strings.HasPrefix(repo, nsPrefix) && len(parts) == 2 && parts[0] != "" && newName.MatchString(parts[1]) && repoKey.MatchString(repo) |
| -} |
| +func ValidNewRepo(repo string) bool { return forgekey.NewHubRepo(repo) } |
| // fileForge reads the runner's forge credential file. Repositories the |
| // runner created are kept in its own state directory, never written into |
| @@ -116,7 +112,7 @@ func (f *fileForge) createdRepos() []string { |
| if err != nil || json.Unmarshal(raw, &out) != nil { |
| return nil |
| } |
| - return slices.DeleteFunc(out, func(r string) bool { return !repoKey.MatchString(r) }) |
| + return slices.DeleteFunc(out, func(r string) bool { return !forgekey.ValidHub(r) }) |
| } |
| // Repos is every repository the agent may work in: the credential |
| @@ -154,7 +150,16 @@ func (f *fileForge) Recheck() { |
| f.mu.Unlock() |
| } |
| -func (f *fileForge) Remote(ctx context.Context, repo string) (workspace.Remote, error) { |
| +func (f *fileForge) Remote(ctx context.Context, repo string, use Use) (workspace.Remote, error) { |
| + if use != Read && use != Push { |
| + return workspace.Remote{}, workspace.ErrGitPassword |
| + } |
| + if use == Read { |
| + if !slices.Contains(f.Reachable(ctx), repo) { |
| + return workspace.Remote{}, workspace.ErrGitPassword |
| + } |
| + return f.remoteCredential(ctx, repo) |
| + } |
| f.list(ctx) |
| if !slices.Contains(f.Repos(), repo) { |
| return workspace.Remote{}, workspace.ErrGitPassword |
| @@ -217,7 +222,7 @@ func (f *fileForge) list(ctx context.Context) ([]string, []string) { |
| if r.NS != "" && !slices.Contains(ns, r.NS) { |
| ns = append(ns, r.NS) |
| } |
| - if key := nsPrefix + r.NS + "/" + r.Name; repoKey.MatchString(key) { |
| + if key := nsPrefix + r.NS + "/" + r.Name; forgekey.ValidHub(key) { |
| repos = append(repos, key) |
| } |
| } |
| @@ -312,14 +317,14 @@ func (f *fileForge) adopt(repo string) error { |
| // Merge sends the hub the merge request with the agent's credential for |
| // repo (its own entry, or the agent-wide one). |
| -func (f *fileForge) Merge(ctx context.Context, repo, branch string, req forge.HubMergeRequest) (forge.HubMergeResult, error) { |
| +func (f *fileForge) Merge(ctx context.Context, repo, branch string, req forge.MergeRequest) (forge.MergeResult, error) { |
| f.list(ctx) |
| if !slices.Contains(f.Repos(), repo) { |
| - return forge.HubMergeResult{}, forge.ErrMergeRefused |
| + return forge.MergeResult{}, forge.ErrMergeRefused |
| } |
| c, err := f.creds.Credential(ctx, repo) |
| if err != nil { |
| - return forge.HubMergeResult{}, forge.ErrMergeRefused |
| + return forge.MergeResult{}, forge.ErrMergeRefused |
| } |
| return forge.HubMerge(ctx, f.client, f.hub, c, repo, branch, req) |
| } |
| @@ -406,7 +411,7 @@ func (c *Clones) Shallow(ctx context.Context, repo, branch string) error { |
| func (c *Clones) fetch(ctx context.Context, repo string, shallow bool, branch string) error { |
| c.mu.Lock() |
| defer c.mu.Unlock() |
| - if !repoKey.MatchString(repo) { |
| + if !forgekey.ValidHub(repo) { |
| return ErrNoCreate |
| } |
| remote, err := readRemote(ctx, c.Forge, repo) |
| @@ -497,7 +502,7 @@ func remoteEnv(remote workspace.Remote) (map[string]string, string, error) { |
| } |
| env["GIT_CONFIG_COUNT"] = "10" |
| env["GIT_CONFIG_KEY_9"] = "http.extraHeader" |
| - env["GIT_CONFIG_VALUE_9"] = "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte("x:"+remote.GitPassword)) |
| + env["GIT_CONFIG_VALUE_9"] = "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte(remote.Username()+":"+remote.GitPassword)) |
| return env, "https", nil |
| } |
| @@ -536,10 +541,10 @@ func lsRefs(out string) map[string]string { |
| // withdrawn when the forge allows (only while it is still the start), so |
| // no main unrelated to their work is left behind quietly. |
| func (c *Clones) StartDefault(ctx context.Context, repo string) error { |
| - if !repoKey.MatchString(repo) { |
| + if !forgekey.ValidHub(repo) { |
| return ErrNoCreate |
| } |
| - remote, err := readRemote(ctx, c.Forge, repo) |
| + remote, err := c.Forge.Remote(ctx, repo, Push) |
| if err != nil { |
| return err |
| } |
| @@ -686,7 +691,7 @@ func (c *Clones) lsRemote(ctx context.Context, remote workspace.Remote, args ... |
| } else if remote.GitPassword != "" { |
| env["GIT_CONFIG_COUNT"] = "10" |
| env["GIT_CONFIG_KEY_9"] = "http.extraHeader" |
| - env["GIT_CONFIG_VALUE_9"] = "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte("x:"+remote.GitPassword)) |
| + env["GIT_CONFIG_VALUE_9"] = "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte(remote.Username()+":"+remote.GitPassword)) |
| } |
| cmd := groupCommand(ctx, c.Git, append([]string{"-c", "protocol." + protocol + ".allow=always", "-c", "http.followRedirects=false", "ls-remote"}, args...)...) |
| cmd.Dir = c.Root |
diff --git a/internal/runner/thin/forge_seam_fixtures_test.go b/internal/runner/thin/forge_seam_fixtures_test.go| new file mode 100644 |
| index 00000000..06801aa6 |
| --- /dev/null |
| +++ b/internal/runner/thin/forge_seam_fixtures_test.go |
| @@ -0,0 +1,16 @@ |
| +package thin |
| + |
| +import "context" |
| + |
| +func (*countingForge) Host() string { return "amadan.net" } |
| +func (*countingForge) Propose(ctx context.Context, p Proposal) (ProposalRef, error) { |
| + return (&fileForge{}).Propose(ctx, p) |
| +} |
| +func (*hubForge) Host() string { return "amadan.net" } |
| +func (*hubForge) Propose(ctx context.Context, p Proposal) (ProposalRef, error) { |
| + return (&fileForge{}).Propose(ctx, p) |
| +} |
| +func (*pushForge) Host() string { return "amadan.net" } |
| +func (*pushForge) Propose(ctx context.Context, p Proposal) (ProposalRef, error) { |
| + return (&fileForge{}).Propose(ctx, p) |
| +} |
diff --git a/internal/runner/thin/forges.go b/internal/runner/thin/forges.go| new file mode 100644 |
| index 00000000..075fbb1b |
| --- /dev/null |
| +++ b/internal/runner/thin/forges.go |
| @@ -0,0 +1,172 @@ |
| +package thin |
| + |
| +import ( |
| + "context" |
| + "net/url" |
| + "slices" |
| + |
| + "amadan.net/oficina/equipo/internal/runner/forge" |
| + "amadan.net/oficina/equipo/internal/runner/workspace" |
| + "amadan.net/oficina/equipo/internal/wire" |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| +) |
| + |
| +// Use distinguishes credential authority for reads and writes. |
| +type Use uint8 |
| + |
| +const ( |
| + Read Use = iota + 1 |
| + Push |
| +) |
| + |
| +// Proposal identifies the pushed task branch. Forge-specific metadata belongs |
| +// in a later protocol addition, when proposals are carried over the wire. |
| +type Proposal struct{ Repo, Branch string } |
| +type ProposalRef struct{ URL string } |
| + |
| +// Forges routes by the parsed key's host. Missing forges never fall back to |
| +// the hub. Hostless identity and creation namespaces remain the hub's until |
| +// a later protocol can advertise connections separately. |
| +type Forges struct{ byHost map[string]Forge } |
| + |
| +func NewForges(forges ...Forge) (*Forges, error) { |
| + f := &Forges{byHost: make(map[string]Forge)} |
| + for _, fg := range forges { |
| + if fg == nil || !forgekey.KnownHost(fg.Host()) || f.byHost[fg.Host()] != nil { |
| + return nil, forgekey.ErrKey |
| + } |
| + f.byHost[fg.Host()] = fg |
| + } |
| + return f, nil |
| +} |
| + |
| +// Host is empty for a router: it cannot itself be registered as a forge. |
| +func (*Forges) Host() string { return "" } |
| +func (f *Forges) route(repo string) (Forge, string, error) { |
| + k, err := forgekey.Parse(repo) |
| + if err != nil { |
| + return nil, "", err |
| + } |
| + fg := f.byHost[k.Host] |
| + if fg == nil { |
| + return nil, "", forgekey.ErrKey |
| + } |
| + return fg, k.String(), nil |
| +} |
| +func (f *Forges) Remote(ctx context.Context, repo string, use Use) (workspace.Remote, error) { |
| + if use != Read && use != Push { |
| + return workspace.Remote{}, forgekey.ErrKey |
| + } |
| + fg, key, err := f.route(repo) |
| + if err != nil { |
| + return workspace.Remote{}, err |
| + } |
| + return fg.Remote(ctx, key, use) |
| +} |
| +func (f *Forges) Exists(ctx context.Context, repo string) (bool, error) { |
| + fg, key, err := f.route(repo) |
| + if err != nil { |
| + return false, err |
| + } |
| + return fg.Exists(ctx, key) |
| +} |
| +func (f *Forges) Create(ctx context.Context, repo string) error { |
| + fg, key, err := f.route(repo) |
| + if err != nil { |
| + return err |
| + } |
| + return fg.Create(ctx, key) |
| +} |
| +func (f *Forges) Propose(ctx context.Context, p Proposal) (ProposalRef, error) { |
| + fg, key, err := f.route(p.Repo) |
| + if err != nil { |
| + return ProposalRef{}, err |
| + } |
| + p.Repo = key |
| + return fg.Propose(ctx, p) |
| +} |
| +func (f *Forges) Merge(ctx context.Context, repo, branch string, req forge.MergeRequest) (forge.MergeResult, error) { |
| + fg, key, err := f.route(repo) |
| + if err != nil { |
| + return forge.MergeResult{}, err |
| + } |
| + return fg.Merge(ctx, key, branch, req) |
| +} |
| +func (f *Forges) catalog(list func(Forge) []string) []string { |
| + var out []string |
| + for host, fg := range f.byHost { |
| + for _, repo := range list(fg) { |
| + k, err := forgekey.Parse(repo) |
| + if err == nil && k.Host == host { |
| + out = append(out, k.String()) |
| + } |
| + } |
| + } |
| + slices.Sort(out) |
| + return slices.Compact(out) |
| +} |
| +func (f *Forges) Repos() []string { return f.catalog(func(fg Forge) []string { return fg.Repos() }) } |
| +func (f *Forges) Reachable(ctx context.Context) []string { |
| + return f.catalog(func(fg Forge) []string { return fg.Reachable(ctx) }) |
| +} |
| +func (f *Forges) Recheck() { |
| + for _, fg := range f.byHost { |
| + fg.Recheck() |
| + } |
| +} |
| +func (f *Forges) Agent() string { |
| + if fg := f.byHost[forgekey.Hub]; fg != nil { |
| + return fg.Agent() |
| + } |
| + return "" |
| +} |
| +func (f *Forges) CreateIn(ctx context.Context) []string { |
| + if fg := f.byHost[forgekey.Hub]; fg != nil { |
| + return fg.CreateIn(ctx) |
| + } |
| + return nil |
| +} |
| +func (f *Forges) CIHosted(ctx context.Context, repo string) (bool, error) { |
| + fg, key, err := f.route(repo) |
| + if err != nil { |
| + return false, err |
| + } |
| + if ci, ok := fg.(HostedCI); ok { |
| + return ci.CIHosted(ctx, key) |
| + } |
| + return false, nil |
| +} |
| +func (f *Forges) CIStatus(ctx context.Context, repo, branch, logs string) (forge.CIStatus, error) { |
| + fg, key, err := f.route(repo) |
| + if err != nil { |
| + return forge.CIStatus{}, err |
| + } |
| + if ci, ok := fg.(HostedCI); ok { |
| + return ci.CIStatus(ctx, key, branch, logs) |
| + } |
| + return forge.CIStatus{}, forge.ErrCIRead |
| +} |
| + |
| +// AccessCommand still carries hub namespace/repository targets. No other host |
| +// is admitted by this wire contract. |
| +func (f *Forges) RequestAccess(ctx context.Context, c wire.AccessCommand) (wire.AccessReport, error) { |
| + if af, ok := f.byHost[forgekey.Hub].(AccessForge); ok { |
| + return af.RequestAccess(ctx, c) |
| + } |
| + return wire.AccessReport{}, errAccess |
| +} |
| +func (f *Forges) PollAccess(ctx context.Context, id string, c wire.AccessCommand) (wire.AccessReport, error) { |
| + if af, ok := f.byHost[forgekey.Hub].(AccessForge); ok { |
| + return af.PollAccess(ctx, id, c) |
| + } |
| + return wire.AccessReport{}, errAccess |
| +} |
| + |
| +func (*fileForge) Host() string { return forgekey.Hub } |
| +func (*fileForge) Propose(_ context.Context, p Proposal) (ProposalRef, error) { |
| + k, err := forgekey.Parse(p.Repo) |
| + if err != nil || k.Host != forgekey.Hub || !wire.ValidTaskBranch(p.Branch) { |
| + return ProposalRef{}, forgekey.ErrKey |
| + } |
| + return ProposalRef{URL: "https://" + k.String() + "?branch=" + url.QueryEscape(p.Branch)}, nil |
| +} |
diff --git a/internal/runner/thin/forges_test.go b/internal/runner/thin/forges_test.go| new file mode 100644 |
| index 00000000..6ce26094 |
| --- /dev/null |
| +++ b/internal/runner/thin/forges_test.go |
| @@ -0,0 +1,243 @@ |
| +package thin |
| + |
| +import ( |
| + "context" |
| + "encoding/base64" |
| + "errors" |
| + "net/http" |
| + "reflect" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/runner/forge" |
| + "amadan.net/oficina/equipo/internal/runner/workspace" |
| + "amadan.net/oficina/equipo/internal/wire" |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| +) |
| + |
| +type routeForge struct { |
| + Forge |
| + host string |
| + calls []string |
| + uses []Use |
| + repos []string |
| + rechecks int |
| +} |
| + |
| +func (f *routeForge) Host() string { return f.host } |
| +func (f *routeForge) Repos() []string { return f.repos } |
| +func (f *routeForge) Reachable(context.Context) []string { return f.repos } |
| +func (f *routeForge) Recheck() { f.rechecks++ } |
| +func (f *routeForge) Agent() string { return "hub-agent" } |
| +func (f *routeForge) CreateIn(context.Context) []string { return []string{"oficina"} } |
| +func (f *routeForge) Remote(_ context.Context, repo string, use Use) (workspace.Remote, error) { |
| + f.calls = append(f.calls, repo) |
| + f.uses = append(f.uses, use) |
| + return workspace.Remote{URL: "https://" + repo}, nil |
| +} |
| +func (f *routeForge) Exists(_ context.Context, repo string) (bool, error) { |
| + f.calls = append(f.calls, repo) |
| + return true, nil |
| +} |
| +func (f *routeForge) Create(_ context.Context, repo string) error { |
| + f.calls = append(f.calls, repo) |
| + return nil |
| +} |
| +func (f *routeForge) Propose(_ context.Context, p Proposal) (ProposalRef, error) { |
| + f.calls = append(f.calls, p.Repo) |
| + return ProposalRef{URL: p.Branch}, nil |
| +} |
| +func (f *routeForge) Merge(_ context.Context, repo, branch string, req forge.MergeRequest) (forge.MergeResult, error) { |
| + f.calls = append(f.calls, repo) |
| + return forge.MergeResult{SHA: req.ExpectSHA, Into: branch}, nil |
| +} |
| + |
| +func TestForgesRouteWithoutFallback(t *testing.T) { |
| + ctx := context.Background() |
| + hub := &routeForge{host: forgekey.Hub} |
| + gh := &routeForge{host: forgekey.GitHub} |
| + f, err := NewForges(hub, gh) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, repo := range []string{"oficina/site", "github.com/Org/Repo"} { |
| + if _, err = f.Remote(ctx, repo, Read); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err = f.Remote(ctx, repo, Push); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err = f.Exists(ctx, repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err = f.Create(ctx, repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + if ref, e := f.Propose(ctx, Proposal{Repo: repo, Branch: "equipo/test"}); e != nil || ref.URL != "equipo/test" { |
| + t.Fatalf("proposal: %+v %v", ref, e) |
| + } |
| + if res, e := f.Merge(ctx, repo, "main", forge.MergeRequest{ExpectSHA: "judged"}); e != nil || res.SHA != "judged" || res.Into != "main" { |
| + t.Fatalf("merge: %+v %v", res, e) |
| + } |
| + } |
| + for _, want := range []struct { |
| + f *routeForge |
| + repo string |
| + }{{hub, "amadan.net/oficina/site"}, {gh, "github.com/Org/Repo"}} { |
| + if len(want.f.calls) != 6 || !reflect.DeepEqual(want.f.uses, []Use{Read, Push}) { |
| + t.Fatalf("calls: %+v", want.f) |
| + } |
| + for _, got := range want.f.calls { |
| + if got != want.repo { |
| + t.Fatalf("route: %q", got) |
| + } |
| + } |
| + } |
| + onlyHub, _ := NewForges(hub) |
| + for _, repo := range []string{"github.com/Org/Repo", "evil.com/a/b", "amadan.net/../b"} { |
| + n := len(hub.calls) |
| + if _, err = onlyHub.Remote(ctx, repo, Read); err == nil { |
| + t.Fatalf("remote accepted %q", repo) |
| + } |
| + if _, err = onlyHub.Exists(ctx, repo); err == nil { |
| + t.Fatal("exists fallback") |
| + } |
| + if err = onlyHub.Create(ctx, repo); err == nil { |
| + t.Fatal("create fallback") |
| + } |
| + if _, err = onlyHub.Propose(ctx, Proposal{Repo: repo}); err == nil { |
| + t.Fatal("proposal fallback") |
| + } |
| + if _, err = onlyHub.Merge(ctx, repo, "main", forge.MergeRequest{}); err == nil { |
| + t.Fatal("merge fallback") |
| + } |
| + if len(hub.calls) != n { |
| + t.Fatal("unregistered key reached hub") |
| + } |
| + } |
| + n := len(hub.calls) |
| + if _, err = f.Remote(ctx, "oficina/site", Use(99)); err == nil || len(hub.calls) != n { |
| + t.Fatal("unknown use reached forge") |
| + } |
| + for _, fs := range [][]Forge{{hub, hub}, {&routeForge{host: "evil.com"}}, {nil}} { |
| + if _, err := NewForges(fs...); err == nil { |
| + t.Fatal("invalid registration") |
| + } |
| + } |
| +} |
| + |
| +func TestForgesCatalogAndHubIdentity(t *testing.T) { |
| + hub := &routeForge{host: forgekey.Hub, repos: []string{"amadan.net/o/b", "amadan.net/o/a", "github.com/o/c", "amadan.net/o/a"}} |
| + gh := &routeForge{host: forgekey.GitHub, repos: []string{"github.com/o/c", "amadan.net/o/d"}} |
| + f, _ := NewForges(hub, gh) |
| + want := []string{"amadan.net/o/a", "amadan.net/o/b", "github.com/o/c"} |
| + if !reflect.DeepEqual(f.Repos(), want) || !reflect.DeepEqual(f.Reachable(context.Background()), want) { |
| + t.Fatal("catalog crosses host or loses order") |
| + } |
| + if f.Agent() != "hub-agent" || !reflect.DeepEqual(f.CreateIn(context.Background()), []string{"oficina"}) { |
| + t.Fatal("hub identity changed") |
| + } |
| + f.Recheck() |
| + if hub.rechecks != 1 || gh.rechecks != 1 { |
| + t.Fatal("recheck not forwarded") |
| + } |
| +} |
| + |
| +func TestHubProposalIsOnlyALink(t *testing.T) { |
| + f := accessForge(t, func(http.ResponseWriter, *http.Request) { t.Fatal("proposal contacted hub") }) |
| + ref, err := f.Propose(context.Background(), Proposal{Repo: "amadan.net/oficina/site", Branch: "equipo/t1-a"}) |
| + if err != nil || ref.URL != "https://amadan.net/oficina/site?branch=equipo%2Ft1-a" { |
| + t.Fatalf("proposal %+v %v", ref, err) |
| + } |
| + for _, p := range []Proposal{{Repo: "github.com/o/r", Branch: "equipo/t1-a"}, {Repo: "amadan.net/o/r", Branch: "main"}, {Repo: "amadan.net/../r", Branch: "equipo/t1-a"}} { |
| + if _, err := f.Propose(context.Background(), p); err == nil { |
| + t.Fatalf("proposal admitted %+v", p) |
| + } |
| + } |
| +} |
| + |
| +func TestRemoteUsername(t *testing.T) { |
| + for _, tc := range []struct{ user, want string }{{"", "x"}, {"x-access-token", "x-access-token"}} { |
| + env, _, err := remoteEnv(workspace.Remote{URL: "https://amadan.net/o/r", GitPassword: "secret", GitUsername: tc.user}) |
| + want := "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte(tc.want+":secret")) |
| + if err != nil || env["GIT_CONFIG_VALUE_9"] != want { |
| + t.Fatalf("username: %v %v", env, err) |
| + } |
| + } |
| +} |
| + |
| +type serviceForge struct { |
| + *routeForge |
| + serviceCalls []string |
| +} |
| + |
| +func (f *serviceForge) CIHosted(_ context.Context, repo string) (bool, error) { |
| + f.serviceCalls = append(f.serviceCalls, "hosted:"+repo) |
| + return true, nil |
| +} |
| +func (f *serviceForge) CIStatus(_ context.Context, repo, branch, logs string) (forge.CIStatus, error) { |
| + f.serviceCalls = append(f.serviceCalls, "status:"+repo+":"+branch+":"+logs) |
| + return forge.CIStatus{}, nil |
| +} |
| +func (f *serviceForge) RequestAccess(_ context.Context, c wire.AccessCommand) (wire.AccessReport, error) { |
| + f.serviceCalls = append(f.serviceCalls, "request:"+c.Target) |
| + return wire.AccessReport{}, nil |
| +} |
| +func (f *serviceForge) PollAccess(_ context.Context, id string, c wire.AccessCommand) (wire.AccessReport, error) { |
| + f.serviceCalls = append(f.serviceCalls, "poll:"+id+":"+c.Target) |
| + return wire.AccessReport{}, nil |
| +} |
| +func TestForgesForwardOptionalHubServices(t *testing.T) { |
| + ctx := context.Background() |
| + hub := &serviceForge{routeForge: &routeForge{host: forgekey.Hub}} |
| + gh := &serviceForge{routeForge: &routeForge{host: forgekey.GitHub}} |
| + f, _ := NewForges(hub, gh) |
| + for _, repo := range []string{"amadan.net/o/r", "github.com/O/R"} { |
| + if hosted, err := f.CIHosted(ctx, repo); err != nil || !hosted { |
| + t.Fatal("hosted not forwarded", err) |
| + } |
| + if _, err := f.CIStatus(ctx, repo, "equipo/fix", forge.CILogsFailed); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + c := wire.AccessCommand{Target: "o/r"} |
| + if _, err := f.RequestAccess(ctx, c); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := f.PollAccess(ctx, "a1", c); err != nil { |
| + t.Fatal(err) |
| + } |
| + want := []string{"hosted:amadan.net/o/r", "status:amadan.net/o/r:equipo/fix:" + forge.CILogsFailed, "request:o/r", "poll:a1:o/r"} |
| + if !reflect.DeepEqual(hub.serviceCalls, want) { |
| + t.Fatalf("hub services %v", hub.serviceCalls) |
| + } |
| + want = []string{"hosted:github.com/O/R", "status:github.com/O/R:equipo/fix:" + forge.CILogsFailed} |
| + if !reflect.DeepEqual(gh.serviceCalls, want) { |
| + t.Fatalf("other services %v", gh.serviceCalls) |
| + } |
| + empty, _ := NewForges() |
| + if _, err := empty.RequestAccess(ctx, c); err == nil { |
| + t.Fatal("missing access forge admitted") |
| + } |
| + if _, err := empty.PollAccess(ctx, "a1", c); err == nil { |
| + t.Fatal("missing poll forge admitted") |
| + } |
| + if _, err := empty.CIHosted(ctx, "amadan.net/o/r"); err == nil { |
| + t.Fatal("missing CI forge admitted") |
| + } |
| + if _, err := empty.CIStatus(ctx, "amadan.net/o/r", "b", forge.CILogsNone); err == nil { |
| + t.Fatal("missing status forge admitted") |
| + } |
| + plain, _ := NewForges(hub.routeForge) |
| + if hosted, err := plain.CIHosted(ctx, "amadan.net/o/r"); err != nil || hosted { |
| + t.Fatal("absent CI capability changed") |
| + } |
| + if _, err := plain.CIStatus(ctx, "amadan.net/o/r", "b", forge.CILogsNone); !errors.Is(err, forge.ErrCIRead) { |
| + t.Fatal("absent status capability changed") |
| + } |
| +} |
| +func TestFileForgeRejectsUnknownUseBeforeIO(t *testing.T) { |
| + f := accessForge(t, func(http.ResponseWriter, *http.Request) { t.Fatal("invalid use contacted hub") }) |
| + if _, err := f.Remote(context.Background(), "amadan.net/o/r", Use(99)); err == nil { |
| + t.Fatal("invalid use admitted") |
| + } |
| +} |
diff --git a/internal/runner/thin/index_empty_test.go b/internal/runner/thin/index_empty_test.go| index 774ca0ee..a83fb862 100644 |
| --- a/internal/runner/thin/index_empty_test.go |
| +++ b/internal/runner/thin/index_empty_test.go |
| @@ -26,7 +26,7 @@ func (f *pathForge) path(repo string) string { |
| return filepath.Join(f.root, strings.ReplaceAll(strings.TrimPrefix(repo, "amadan.net/"), "/", "__")+".git") |
| } |
| -func (f *pathForge) Remote(_ context.Context, repo string) (workspace.Remote, error) { |
| +func (f *pathForge) Remote(_ context.Context, repo string, _ Use) (workspace.Remote, error) { |
| if !slices.Contains(f.repos, repo) { |
| return workspace.Remote{}, workspace.ErrGitPassword |
| } |
diff --git a/internal/runner/thin/judge.go b/internal/runner/thin/judge.go| index ff0d58c3..ed50efbc 100644 |
| --- a/internal/runner/thin/judge.go |
| +++ b/internal/runner/thin/judge.go |
| @@ -1,6 +1,7 @@ |
| package thin |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "bytes" |
| "context" |
| "encoding/json" |
| @@ -40,7 +41,7 @@ import ( |
| // judgeTree checks the candidate out into a fresh task tree. The private |
| // repository goes with the tree: nothing is committed or published. |
| func (e *Engineer) judgeTree(ctx context.Context, r stepRow) (workspace.TaskTree, string, error) { |
| - if !slices.Contains(e.Owners, r.Person) || !repoKey.MatchString(r.Repo) || !wire.ValidTaskBranch(r.Branch) || !shaPattern.MatchString(r.CandidateSHA) || r.BaseSHA != "" && !shaPattern.MatchString(r.BaseSHA) { |
| + if !slices.Contains(e.Owners, r.Person) || !forgekey.ValidHub(r.Repo) || !wire.ValidTaskBranch(r.Branch) || !shaPattern.MatchString(r.CandidateSHA) || r.BaseSHA != "" && !shaPattern.MatchString(r.BaseSHA) { |
| return workspace.TaskTree{}, "policy_rejected", errors.New("judge refused") |
| } |
| if err := e.lease(ctx, r); err != nil { |
| @@ -980,7 +981,7 @@ func verdictUnset(mu *sync.Mutex, verdict *string) bool { |
| // reviewPrompt is the Review specialist's one user frame. |
| func (e *Engineer) reviewPrompt(r stepRow, diff string) string { |
| var b strings.Builder |
| - b.WriteString("[Equipo: review] You are Equipo's Review specialist, reviewing a change for " + r.Person + " in " + strings.TrimPrefix(r.Repo, "amadan.net/") + ".\n") |
| + b.WriteString("[Equipo: review] You are Equipo's Review specialist, reviewing a change for " + r.Person + " in " + forgekey.Display(r.Repo) + ".\n") |
| b.WriteString("Task title (quoted data): " + wire.QuotedData(r.Title) + "\n") |
| if len(r.PersonWords) > 0 { |
| b.WriteString("Person's words (composer messages, quoted data):\n") |
diff --git a/internal/runner/thin/judge_fetch_test.go b/internal/runner/thin/judge_fetch_test.go| index e66c2588..fce7c10c 100644 |
| --- a/internal/runner/thin/judge_fetch_test.go |
| +++ b/internal/runner/thin/judge_fetch_test.go |
| @@ -20,7 +20,7 @@ type refusingForge struct { |
| refuse, calls int |
| } |
| -func (f *refusingForge) Remote(context.Context, string) (workspace.Remote, error) { |
| +func (f *refusingForge) Remote(context.Context, string, Use) (workspace.Remote, error) { |
| f.calls++ |
| if f.calls <= f.refuse { |
| return workspace.Remote{}, errors.New("hub: too many requests") |
diff --git a/internal/runner/thin/judge_hosted.go b/internal/runner/thin/judge_hosted.go| index 3bd8e1a3..228533be 100644 |
| --- a/internal/runner/thin/judge_hosted.go |
| +++ b/internal/runner/thin/judge_hosted.go |
| @@ -1,6 +1,7 @@ |
| package thin |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "context" |
| "fmt" |
| "slices" |
| @@ -64,7 +65,7 @@ func (e *Engineer) hostedVerdict(ctx context.Context, r stepRow, rep wire.StepRe |
| rep.Hosted = &wire.HostedResult{Repo: r.Repo, Branch: r.Branch, SHA: st.SHA, State: st.State, ReportedAt: st.UpdatedAt, Failed: failedUnits(st.Steps)} |
| return rep, true |
| } |
| - where := "Hosted CI on " + strings.TrimPrefix(r.Repo, "amadan.net/") + " at " + shortSHA(st.SHA) |
| + where := "Hosted CI on " + forgekey.Display(r.Repo) + " at " + shortSHA(st.SHA) |
| switch st.State { |
| case wire.HostedSuccess: |
| code := 0 |
diff --git a/internal/runner/thin/mergedetail_test.go b/internal/runner/thin/mergedetail_test.go| index a883dae1..7b0a479e 100644 |
| --- a/internal/runner/thin/mergedetail_test.go |
| +++ b/internal/runner/thin/mergedetail_test.go |
| @@ -23,14 +23,14 @@ type httpHub struct { |
| client *http.Client |
| } |
| -func (h httpHub) Merge(ctx context.Context, repo, branch string, req forge.HubMergeRequest) (forge.HubMergeResult, error) { |
| +func (h httpHub) Merge(ctx context.Context, repo, branch string, req forge.MergeRequest) (forge.MergeResult, error) { |
| return forge.HubMerge(ctx, h.client, h.url, forge.Credential{Bearer: "agent-bearer"}, repo, branch, req) |
| } |
| // brokenRemote cannot be read: its error names credentials. |
| type brokenRemote struct{ *hubForge } |
| -func (brokenRemote) Remote(context.Context, string) (workspace.Remote, error) { |
| +func (brokenRemote) Remote(context.Context, string, Use) (workspace.Remote, error) { |
| return workspace.Remote{}, errors.New("dial https://agent:s3cr3t-pw@amadan.net/x: Authorization: Bearer s3cr3t-hub-token refused") |
| } |
diff --git a/internal/runner/thin/mergestep.go b/internal/runner/thin/mergestep.go| index a8678ec8..4b39a078 100644 |
| --- a/internal/runner/thin/mergestep.go |
| +++ b/internal/runner/thin/mergestep.go |
| @@ -1,6 +1,7 @@ |
| package thin |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "context" |
| "errors" |
| "os/exec" |
| @@ -46,7 +47,7 @@ func (e *Engineer) mergeStep(ctx context.Context, r stepRow, progress func(wire. |
| rep.State, rep.Reason = wire.StepFailed, reason |
| return rep |
| } |
| - if !slices.Contains(e.Owners, r.Person) || !repoKey.MatchString(r.Repo) || !wire.ValidTaskBranch(r.Branch) || !shaPattern.MatchString(r.CandidateSHA) { |
| + if !slices.Contains(e.Owners, r.Person) || !forgekey.ValidHub(r.Repo) || !wire.ValidTaskBranch(r.Branch) || !shaPattern.MatchString(r.CandidateSHA) { |
| return fail("policy_rejected") |
| } |
| if err := e.lease(ctx, r); err != nil { |
| @@ -88,7 +89,7 @@ func (e *Engineer) mergeStep(ctx context.Context, r stepRow, progress func(wire. |
| e.log("merge inspect", err) |
| return st, err |
| }, |
| - Request: func(ctx context.Context, req forge.HubMergeRequest) (forge.HubMergeResult, error) { |
| + Request: func(ctx context.Context, req forge.MergeRequest) (forge.MergeResult, error) { |
| return e.Forge.Merge(ctx, r.Repo, r.Branch, req) |
| }, |
| Confirm: confirmMerge} |
diff --git a/internal/runner/thin/mergestep_test.go b/internal/runner/thin/mergestep_test.go| index 4eef562e..84b56d53 100644 |
| --- a/internal/runner/thin/mergestep_test.go |
| +++ b/internal/runner/thin/mergestep_test.go |
| @@ -26,16 +26,16 @@ type hubForge struct { |
| requests int |
| // answer, if set, replaces the hub's answer for request n (merge may |
| // be called to land the merge first). |
| - answer func(n int, merge func() (forge.HubMergeResult, error)) (forge.HubMergeResult, error) |
| + answer func(n int, merge func() (forge.MergeResult, error)) (forge.MergeResult, error) |
| } |
| -func (f *hubForge) Remote(context.Context, string) (workspace.Remote, error) { |
| +func (f *hubForge) Remote(context.Context, string, Use) (workspace.Remote, error) { |
| return workspace.Remote{URL: f.dir}, nil |
| } |
| -func (f *hubForge) Merge(ctx context.Context, repo, branch string, req forge.HubMergeRequest) (forge.HubMergeResult, error) { |
| +func (f *hubForge) Merge(ctx context.Context, repo, branch string, req forge.MergeRequest) (forge.MergeResult, error) { |
| f.requests++ |
| - merge := func() (forge.HubMergeResult, error) { return forgetest.Merge(ctx, "/usr/bin/git", f.dir, branch, req) } |
| + merge := func() (forge.MergeResult, error) { return forgetest.Merge(ctx, "/usr/bin/git", f.dir, branch, req) } |
| if f.answer != nil { |
| return f.answer(f.requests, merge) |
| } |
| @@ -122,9 +122,9 @@ func TestMergeStep(t *testing.T) { |
| // brought the candidate in; one request only. |
| func TestMergeStepReconcilesALostAnswer(t *testing.T) { |
| e, f, r, cand := hubRig(t) |
| - f.answer = func(n int, merge func() (forge.HubMergeResult, error)) (forge.HubMergeResult, error) { |
| + f.answer = func(n int, merge func() (forge.MergeResult, error)) (forge.MergeResult, error) { |
| merge() |
| - return forge.HubMergeResult{}, forge.ErrMergeUncertain |
| + return forge.MergeResult{}, forge.ErrMergeUncertain |
| } |
| rep := e.Exec(context.Background(), r, func(wire.StepReport) {}) |
| tip := gitOut(t, f.dir, "rev-parse", "main") |
| @@ -160,24 +160,24 @@ func TestMergeStepRefusals(t *testing.T) { |
| t.Fatalf("moved %+v (%d requests)", rep, f.requests) |
| } |
| for _, c := range []struct { |
| - res forge.HubMergeResult |
| + res forge.MergeResult |
| reason string |
| }{ |
| - {forge.HubMergeResult{Status: 409, Reason: "conflicts"}, "merge_conflict"}, |
| - {forge.HubMergeResult{Status: 409, Reason: "ci_not_green", CIState: "failure"}, "amadan_ci_failed"}, |
| - {forge.HubMergeResult{Status: 403}, "merge_forbidden"}, |
| - {forge.HubMergeResult{Status: 409, Reason: "archived"}, "merge_failed"}, |
| + {forge.MergeResult{Status: 409, Reason: "conflicts"}, "merge_conflict"}, |
| + {forge.MergeResult{Status: 409, Reason: "ci_not_green", CIState: "failure"}, "amadan_ci_failed"}, |
| + {forge.MergeResult{Status: 403}, "merge_forbidden"}, |
| + {forge.MergeResult{Status: 409, Reason: "archived"}, "merge_failed"}, |
| } { |
| f.requests = 0 |
| - f.answer = func(int, func() (forge.HubMergeResult, error)) (forge.HubMergeResult, error) { return c.res, nil } |
| + f.answer = func(int, func() (forge.MergeResult, error)) (forge.MergeResult, error) { return c.res, nil } |
| if rep := e.Exec(context.Background(), r, func(wire.StepReport) {}); rep.State != wire.StepFailed || rep.Reason != c.reason || !rep.Termination { |
| t.Fatalf("%+v: %+v", c.res, rep) |
| } |
| } |
| // The hub's CI still running: deferred (the queue moves on), and past |
| // the wait it ends amadan_ci_pending. |
| - f.answer = func(int, func() (forge.HubMergeResult, error)) (forge.HubMergeResult, error) { |
| - return forge.HubMergeResult{Status: 409, Reason: "ci_not_green", CIState: "running"}, nil |
| + f.answer = func(int, func() (forge.MergeResult, error)) (forge.MergeResult, error) { |
| + return forge.MergeResult{Status: 409, Reason: "ci_not_green", CIState: "running"}, nil |
| } |
| if err := e.O.State.AcceptDispatch(context.Background(), "d1", r.DispatchCommand); err != nil { |
| t.Fatal(err) |
| @@ -247,9 +247,9 @@ func TestMergeCIWaitReleasesTheQueue(t *testing.T) { |
| s := e.O.State |
| var stepped atomic.Int32 |
| hubSawStep := false |
| - f.answer = func(n int, merge func() (forge.HubMergeResult, error)) (forge.HubMergeResult, error) { |
| + f.answer = func(n int, merge func() (forge.MergeResult, error)) (forge.MergeResult, error) { |
| if n < 3 { |
| - return forge.HubMergeResult{Status: 409, Reason: "ci_not_green", CIState: "running"}, nil |
| + return forge.MergeResult{Status: 409, Reason: "ci_not_green", CIState: "running"}, nil |
| } |
| hubSawStep = stepped.Load() == 1 |
| return merge() |
| @@ -310,10 +310,10 @@ func TestMergeCIWaitReleasesTheQueue(t *testing.T) { |
| func TestMergeStepSettlesDespiteCancel(t *testing.T) { |
| e, f, r, _ := hubRig(t) |
| ctx, cancel := context.WithCancel(context.Background()) |
| - f.answer = func(_ int, merge func() (forge.HubMergeResult, error)) (forge.HubMergeResult, error) { |
| + f.answer = func(_ int, merge func() (forge.MergeResult, error)) (forge.MergeResult, error) { |
| merge() |
| cancel() |
| - return forge.HubMergeResult{}, forge.ErrMergeUncertain |
| + return forge.MergeResult{}, forge.ErrMergeUncertain |
| } |
| rep := e.Exec(ctx, r, func(wire.StepReport) {}) |
| if rep.State != wire.StepDone || rep.MergeSHA == "" || f.requests != 1 { |
| @@ -377,9 +377,9 @@ func TestMergeSource(t *testing.T) { |
| t.Fatalf("cached %+v", again) |
| } |
| e2, f2, r2, _ := hubRig(t) |
| - f2.answer = func(n int, merge func() (forge.HubMergeResult, error)) (forge.HubMergeResult, error) { |
| + f2.answer = func(n int, merge func() (forge.MergeResult, error)) (forge.MergeResult, error) { |
| merge() |
| - return forge.HubMergeResult{}, forge.ErrMergeUncertain |
| + return forge.MergeResult{}, forge.ErrMergeUncertain |
| } |
| if rep := e2.Exec(context.Background(), r2, func(wire.StepReport) {}); rep.State != wire.StepDone || rep.MergeSource != wire.MergeSourceReconciled || rep.MergeParents != nil { |
| t.Fatalf("reconciled %+v", rep) |
diff --git a/internal/runner/thin/pistep.go b/internal/runner/thin/pistep.go| index 3f902d96..f6898588 100644 |
| --- a/internal/runner/thin/pistep.go |
| +++ b/internal/runner/thin/pistep.go |
| @@ -1,6 +1,7 @@ |
| package thin |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "context" |
| "database/sql" |
| "encoding/json" |
| @@ -554,7 +555,7 @@ func (e *Engineer) askPi(ctx context.Context, a askRow, l metered.Launch, progre |
| } |
| return rep, notStarted |
| } |
| - if !slices.Contains(e.Owners, a.Person) || !repoKey.MatchString(a.Repo) || !wire.ValidTaskBranch(a.Branch) || !shaPattern.MatchString(a.CandidateSHA) || a.BaseSHA != "" && !shaPattern.MatchString(a.BaseSHA) { |
| + if !slices.Contains(e.Owners, a.Person) || !forgekey.ValidHub(a.Repo) || !wire.ValidTaskBranch(a.Branch) || !shaPattern.MatchString(a.CandidateSHA) || a.BaseSHA != "" && !shaPattern.MatchString(a.BaseSHA) { |
| return fail("policy_rejected") |
| } |
| kept, found, err := e.O.State.keptSessionFor(ctx, a.StepID) |
diff --git a/internal/runner/thin/proposal_seam_test.go b/internal/runner/thin/proposal_seam_test.go| new file mode 100644 |
| index 00000000..fe77404b |
| --- /dev/null |
| +++ b/internal/runner/thin/proposal_seam_test.go |
| @@ -0,0 +1,83 @@ |
| +package thin |
| + |
| +import ( |
| + "amadan.net/oficina/equipo/internal/runner/workspace" |
| + "amadan.net/oficina/equipo/internal/wire" |
| + "context" |
| + "path/filepath" |
| + "testing" |
| +) |
| + |
| +type proposalSpy struct { |
| + Forge |
| + calls []Proposal |
| + at func(Proposal) |
| +} |
| + |
| +func (f *proposalSpy) Propose(ctx context.Context, p Proposal) (ProposalRef, error) { |
| + f.calls = append(f.calls, p) |
| + if f.at != nil { |
| + f.at(p) |
| + } |
| + return f.Forge.Propose(ctx, p) |
| +} |
| +func TestEngineeringProposesAfterPush(t *testing.T) { |
| + e, f, r, _ := hubRig(t) |
| + r.Specialist, r.StepID, r.Branch = wire.SpecialistEngineering, "s2", "equipo/tk1-another-fix" |
| + base := gitOut(t, f.dir, "rev-parse", "main") |
| + gitDir := e.tree(r, base).GitDir |
| + gitOut(t, filepath.Dir(f.dir), "clone", "-q", "--bare", f.dir, gitDir) |
| + tree := gitOut(t, filepath.Dir(f.dir), "--git-dir="+gitDir, "rev-parse", base+"^{tree}") |
| + r.Base, r.Candidate = base, gitOut(t, filepath.Dir(f.dir), "--git-dir="+gitDir, "commit-tree", tree, "-p", base, "-m", "another fix") |
| + spy := &proposalSpy{Forge: f, at: func(p Proposal) { |
| + if p.Repo != r.Repo || p.Branch != r.Branch || gitOut(t, f.dir, "rev-parse", p.Branch) != r.Candidate { |
| + t.Fatal("proposal before push or wrong branch") |
| + } |
| + }} |
| + e.Forge = spy |
| + rep := e.publish(context.Background(), r, wire.StepReport{}) |
| + if !rep.Pushed || len(spy.calls) != 1 { |
| + t.Fatalf("report %+v proposals %+v", rep, spy.calls) |
| + } |
| +} |
| +func TestRelayProposesAfterPush(t *testing.T) { |
| + r := newRelayRig(t) |
| + spy := &proposalSpy{Forge: r.f, at: func(p Proposal) { |
| + if p.Repo != r.header().Repo || p.Branch != relayBranch || r.head(t) != r.commit { |
| + t.Fatal("proposal before push or wrong branch") |
| + } |
| + }} |
| + r.e.Forge = spy |
| + r.receive(t, r.pack, r.header()) |
| + r.publish(t, "pb_1") |
| + r.relay.Once(context.Background()) |
| + if len(spy.calls) != 1 { |
| + t.Fatalf("proposals %+v", spy.calls) |
| + } |
| +} |
| + |
| +// Repository initialization is also a write, even before its first task. |
| +type useSpy struct { |
| + Forge |
| + uses []Use |
| +} |
| + |
| +func (f *useSpy) Remote(ctx context.Context, repo string, use Use) (workspace.Remote, error) { |
| + f.uses = append(f.uses, use) |
| + return f.Forge.Remote(ctx, repo, use) |
| +} |
| +func TestStartDefaultRequestsPushAuthority(t *testing.T) { |
| + f, c := startRig(t) |
| + const repo = "amadan.net/oficina/site" |
| + if err := f.Create(context.Background(), repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + spy := &useSpy{Forge: f} |
| + c.Forge = spy |
| + if err := c.StartDefault(context.Background(), repo); err != nil { |
| + t.Fatal(err) |
| + } |
| + if len(spy.uses) != 1 || spy.uses[0] != Push { |
| + t.Fatalf("initialization authority %v", spy.uses) |
| + } |
| +} |
diff --git a/internal/runner/thin/relay.go b/internal/runner/thin/relay.go| index 2ec73298..4bfa6e2a 100644 |
| --- a/internal/runner/thin/relay.go |
| +++ b/internal/runner/thin/relay.go |
| @@ -1,6 +1,7 @@ |
| package thin |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "bytes" |
| "context" |
| "crypto/sha256" |
| @@ -359,7 +360,7 @@ func (x *Relay) log(msg string, err error) { |
| // packCandidate is the pack of exactly one commit (the commit, its tree |
| // and blobs, no history) from the project clone. |
| func (e *Engineer) packCandidate(ctx context.Context, h wire.TransferHeader) ([]byte, error) { |
| - if !repoKey.MatchString(h.Repo) || !shaPattern.MatchString(h.CandidateSHA) { |
| + if !forgekey.ValidHub(h.Repo) || !shaPattern.MatchString(h.CandidateSHA) { |
| return nil, errPackRefused |
| } |
| ctx, cancel := context.WithTimeout(ctx, prepTimeout) |
| @@ -433,7 +434,7 @@ func (e *Engineer) publishWorker(ctx context.Context, p pubRow) (wire.PublishedR |
| rep.Pushed, rep.Reason = false, reason |
| return rep, true |
| } |
| - if !slices.Contains(e.Owners, p.Person) || !repoKey.MatchString(p.Repo) || !wire.ValidTaskBranch(p.Branch) || !shaPattern.MatchString(p.CandidateSHA) || !shaPattern.MatchString(p.BaseSHA) { |
| + if !slices.Contains(e.Owners, p.Person) || !forgekey.ValidHub(p.Repo) || !wire.ValidTaskBranch(p.Branch) || !shaPattern.MatchString(p.CandidateSHA) || !shaPattern.MatchString(p.BaseSHA) { |
| return fail("policy_rejected") |
| } |
| dir := filepath.Join(e.root(), "worker-"+p.TaskID+"-"+p.StepID+"-"+itoa(p.Attempt)) |
| @@ -482,8 +483,11 @@ func (e *Engineer) publishWorker(ctx context.Context, p pubRow) (wire.PublishedR |
| return refused |
| } |
| err = forge.PushBranch(ctx, forge.BranchPush{Root: filepath.Join(e.root(), "publish"), Git: e.O.Runner.GitPath, GitDir: dir, Repo: p.Repo, Branch: p.Branch, Default: def, Base: p.BaseSHA, Commit: p.CandidateSHA, Key: p.TaskID + "/" + p.StepID + "/" + itoa(p.Attempt) + "/worker", Person: p.Person, Owners: e.Owners, |
| - Remote: func(ctx context.Context) (workspace.Remote, error) { return e.Forge.Remote(ctx, p.Repo) }, |
| + Remote: func(ctx context.Context) (workspace.Remote, error) { return e.Forge.Remote(ctx, p.Repo, Push) }, |
| Confirm: confirm}) |
| + if err == nil { |
| + _, err = e.Forge.Propose(ctx, Proposal{Repo: p.Repo, Branch: p.Branch}) |
| + } |
| if relayFault != nil && relayFault("pushed") { |
| return rep, false |
| } |
diff --git a/internal/runner/thin/relay_test.go b/internal/runner/thin/relay_test.go| index c4ec0c03..a9a5d213 100644 |
| --- a/internal/runner/thin/relay_test.go |
| +++ b/internal/runner/thin/relay_test.go |
| @@ -24,7 +24,7 @@ type pushForge struct { |
| fail int |
| } |
| -func (f *pushForge) Remote(context.Context, string) (workspace.Remote, error) { |
| +func (f *pushForge) Remote(context.Context, string, Use) (workspace.Remote, error) { |
| if f.fail > 0 { |
| f.fail-- |
| return workspace.Remote{}, errors.New("hub unavailable") |
diff --git a/internal/runner/thin/research.go b/internal/runner/thin/research.go| index c8bea8e1..628501f3 100644 |
| --- a/internal/runner/thin/research.go |
| +++ b/internal/runner/thin/research.go |
| @@ -1,6 +1,7 @@ |
| package thin |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "context" |
| "crypto/sha256" |
| "database/sql" |
| @@ -59,7 +60,7 @@ const ( |
| researchWork = "research-work" |
| researchKeptDir = "research" |
| // researchForgeHost is the forge's host, never requested. |
| - researchForgeHost = "amadan.net" |
| + researchForgeHost = forgekey.Hub |
| // maxResearchWords bounds the person's words in the prompt. |
| maxResearchWords = 20 << 10 |
| // researchMinPass is the least phase time a retry pass starts with. |
diff --git a/internal/runner/thin/review_fixes_test.go b/internal/runner/thin/review_fixes_test.go| index 121d19cf..f7ad6d86 100644 |
| --- a/internal/runner/thin/review_fixes_test.go |
| +++ b/internal/runner/thin/review_fixes_test.go |
| @@ -117,7 +117,7 @@ type stalledForge struct { |
| url string |
| } |
| -func (f stalledForge) Remote(context.Context, string) (workspace.Remote, error) { |
| +func (f stalledForge) Remote(context.Context, string, Use) (workspace.Remote, error) { |
| return workspace.Remote{URL: f.url, GitPassword: "p"}, nil |
| } |
diff --git a/internal/runner/thin/run.go b/internal/runner/thin/run.go| index 50747d53..3315e656 100644 |
| --- a/internal/runner/thin/run.go |
| +++ b/internal/runner/thin/run.go |
| @@ -194,11 +194,16 @@ func Run(ctx context.Context, c runner.Config, o Options) error { |
| go link.Files.Run(ctx, 10*time.Minute) |
| fg := o.Forge |
| if fg == nil { |
| - fg = NewFileForge(c.AmadanCredentialPath, c.StateDir, !o.NoCreate) |
| - } |
| - if ff, ok := fg.(*fileForge); ok { |
| + ff := NewFileForge(c.AmadanCredentialPath, c.StateDir, !o.NoCreate).(*fileForge) |
| + ff.accessTargets = state.accessReadTargets |
| + fg, err = NewForges(ff) |
| + if err != nil { |
| + return err |
| + } |
| + } else if ff, ok := fg.(*fileForge); ok { |
| ff.accessTargets = state.accessReadTargets |
| } |
| + |
| clones := &Clones{Root: c.WorkspaceRoot, Git: c.GitPath, Forge: fg} |
| index := &Index{Forge: fg, Clones: clones, Path: filepath.Join(c.StateDir, "catalog.json"), Logger: o.Logger, Changed: link.HelloSoon, Pace: o.IndexPace} |
| tools := &bridge{State: state, Link: link, Forge: fg, Clones: clones, Index: index, Logger: o.Logger, SessionRoot: o.Claude.SessionRoot, Activity: link.Activity} |
diff --git a/internal/runner/thin/sandbox_masks_test.go b/internal/runner/thin/sandbox_masks_test.go| index c1941bd0..61017f81 100644 |
| --- a/internal/runner/thin/sandbox_masks_test.go |
| +++ b/internal/runner/thin/sandbox_masks_test.go |
| @@ -152,7 +152,7 @@ func TestMergeStepSandboxMasks(t *testing.T) { |
| func TestMergeStepSandboxMasksConfirmsLast(t *testing.T) { |
| e, f, r, _ := hubRig(t) |
| - f.answer = func(_ int, merge func() (forge.HubMergeResult, error)) (forge.HubMergeResult, error) { |
| + f.answer = func(_ int, merge func() (forge.MergeResult, error)) (forge.MergeResult, error) { |
| e.Clones.Forge = f |
| return merge() |
| } |
diff --git a/internal/runner/thin/worker.go b/internal/runner/thin/worker.go| index 2b64539a..5b1bb8be 100644 |
| --- a/internal/runner/thin/worker.go |
| +++ b/internal/runner/thin/worker.go |
| @@ -1,6 +1,7 @@ |
| package thin |
| import ( |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "context" |
| "errors" |
| "io" |
| @@ -116,7 +117,7 @@ func (w *Worker) Exec(ctx context.Context, r stepRow, progress func(wire.StepRep |
| rep.State, rep.Reason, rep.Termination = state, reason, true |
| return rep |
| } |
| - if r.Specialist != wire.SpecialistChecks || !repoKey.MatchString(r.Repo) || !shaPattern.MatchString(r.CandidateSHA) { |
| + if r.Specialist != wire.SpecialistChecks || !forgekey.ValidHub(r.Repo) || !shaPattern.MatchString(r.CandidateSHA) { |
| // Only checks are placed on workers until slice F. |
| return end(wire.StepFailed, "placement_refused") |
| } |
diff --git a/internal/runner/workspace/username_test.go b/internal/runner/workspace/username_test.go| new file mode 100644 |
| index 00000000..d2aad4f8 |
| --- /dev/null |
| +++ b/internal/runner/workspace/username_test.go |
| @@ -0,0 +1,42 @@ |
| +package workspace |
| + |
| +import ( |
| + "context" |
| + "encoding/base64" |
| + "os" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/equipo/team" |
| +) |
| + |
| +func TestWorkspaceFetchUsesRemoteUsername(t *testing.T) { |
| + dir := t.TempDir() |
| + script := filepath.Join(dir, "git") |
| + capture := filepath.Join(dir, "header") |
| + sha := strings.Repeat("a", 40) |
| + body := "#!/bin/sh\nif [ -n \"$GIT_CONFIG_VALUE_9\" ]; then\nprintf '%s' \"$GIT_CONFIG_VALUE_9\" > '" + capture + "'\nelse\nprintf '%s' '" + sha + "'\nfi\n" |
| + if err := os.WriteFile(script, []byte(body), 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + const repo = "amadan.net/o/r" |
| + if err := os.Mkdir(filepath.Join(dir, "project-"+digest(repo)), 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, user := range []string{"", "x-access-token"} { |
| + m := &Manager{cfg: Config{PrivateRoot: dir, GitPath: script, Forge: &forgeFake{remote: Remote{URL: "https://" + repo, GitPassword: "fixture-password", GitUsername: user}}}} |
| + if _, _, err := m.fetch(context.Background(), team.TargetBinding{Repository: repo, BaseRevision: sha}); err != nil { |
| + t.Fatal(err) |
| + } |
| + got, err := os.ReadFile(capture) |
| + wantUser := user |
| + if wantUser == "" { |
| + wantUser = "x" |
| + } |
| + want := "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte(wantUser+":fixture-password")) |
| + if err != nil || string(got) != want { |
| + t.Fatalf("fetch authentication user %q: %q %v", user, got, err) |
| + } |
| + } |
| +} |
diff --git a/internal/runner/workspace/workspace.go b/internal/runner/workspace/workspace.go| index d1423fc2..301f2628 100644 |
| --- a/internal/runner/workspace/workspace.go |
| +++ b/internal/runner/workspace/workspace.go |
| @@ -27,7 +27,15 @@ import ( |
| type PreparedBug = runnerproto.PreparedBug |
| type GitCandidate = team.GitCandidate |
| -type Remote struct{ URL, GitPassword string } |
| +type Remote struct{ URL, GitPassword, GitUsername string } |
| + |
| +// Username preserves the hub's historical Basic authentication user. |
| +func (r Remote) Username() string { |
| + if r.GitUsername == "" { |
| + return "x" |
| + } |
| + return r.GitUsername |
| +} |
| var ErrGitPassword = errors.New("configure a repository git password (PAT) in EQUIPO_AMADAN_CREDENTIAL_PATH") |
| @@ -276,7 +284,7 @@ func (m *Manager) fetch(ctx context.Context, t team.TargetBinding) (string, stri |
| if remote.GitPassword != "" { |
| env["GIT_CONFIG_COUNT"] = "10" |
| env["GIT_CONFIG_KEY_9"] = "http.extraHeader" |
| - env["GIT_CONFIG_VALUE_9"] = "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte("x:"+remote.GitPassword)) |
| + env["GIT_CONFIG_VALUE_9"] = "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte(remote.Username()+":"+remote.GitPassword)) |
| } |
| if _, err := m.git(ctx, repo, nil, env, "-c", "protocol."+protocol+".allow=always", "-c", "http.followRedirects=false", "fetch", "--no-auto-maintenance", "--no-tags", "--no-recurse-submodules", "--", remote.URL, ref); err != nil { |
| return "", "", err |
diff --git a/internal/wire/forgekey/key.go b/internal/wire/forgekey/key.go| new file mode 100644 |
| index 00000000..cd741ee2 |
| --- /dev/null |
| +++ b/internal/wire/forgekey/key.go |
| @@ -0,0 +1,85 @@ |
| +// Package forgekey owns repository keys. Recognising a host is not permission |
| +// to execute work there; callers retain their forge admission policy. |
| +package forgekey |
| + |
| +import ( |
| + "errors" |
| + "regexp" |
| + "strings" |
| +) |
| + |
| +const ( |
| + Hub = "amadan.net" |
| + GitHub = "github.com" |
| +) |
| + |
| +var ErrKey = errors.New("invalid repository key") |
| +var segment = regexp.MustCompile(`^[A-Za-z0-9_.-]+$`) |
| +var newName = regexp.MustCompile(`^[a-z0-9][a-z0-9.-]{1,38}$`) |
| + |
| +// Key preserves the forge's spelling. Use Equal for identity comparisons. |
| +type Key struct{ Host, Owner, Name string } |
| + |
| +func KnownHost(host string) bool { return host == Hub || host == GitHub } |
| +func (k Key) String() string { return k.Host + "/" + k.Owner + "/" + k.Name } |
| + |
| +// Parse accepts a key, or a bare owner/name for the hub. URLs are not keys. |
| +func Parse(raw string) (Key, error) { |
| + parts := strings.Split(raw, "/") |
| + if len(parts) == 2 { |
| + parts = append([]string{Hub}, parts...) |
| + } |
| + if len(parts) != 3 || !KnownHost(parts[0]) { |
| + return Key{}, ErrKey |
| + } |
| + for _, p := range parts[1:] { |
| + if !segment.MatchString(p) || p == "." || p == ".." { |
| + return Key{}, ErrKey |
| + } |
| + } |
| + return Key{Host: parts[0], Owner: parts[1], Name: parts[2]}, nil |
| +} |
| + |
| +func Equal(a, b string) bool { |
| + ka, ea := Parse(a) |
| + kb, eb := Parse(b) |
| + if ea != nil || eb != nil || ka.Host != kb.Host { |
| + return false |
| + } |
| + if ka.Host == GitHub { |
| + return strings.EqualFold(ka.String(), kb.String()) |
| + } |
| + return ka == kb |
| +} |
| + |
| +// Display keeps the host on non-hub keys so names cannot hide their forge. |
| +func Display(raw string) string { |
| + return strings.TrimPrefix(raw, Hub+"/") |
| +} |
| + |
| +// Normalize accepts the person-facing HTTPS and .git spellings. Validation |
| +// remains explicit at the caller's admission boundary. |
| +func Normalize(raw string) string { |
| + r := strings.TrimSpace(raw) |
| + r = strings.TrimPrefix(r, "https://") |
| + r = strings.TrimSuffix(strings.TrimSuffix(r, "/"), ".git") |
| + if !strings.HasPrefix(r, Hub+"/") && !strings.HasPrefix(r, GitHub+"/") { |
| + r = Hub + "/" + r |
| + } |
| + return r |
| +} |
| + |
| +// ValidHub preserves the hub's historical key regexp. Parse additionally |
| +// rejects dot path segments where a canonical path is required. |
| +func ValidHub(raw string) bool { |
| + parts := strings.Split(raw, "/") |
| + return len(parts) == 3 && parts[0] == Hub && segment.MatchString(parts[1]) && segment.MatchString(parts[2]) |
| +} |
| + |
| +func NewHubRepo(raw string) bool { |
| + parts := strings.Split(raw, "/") |
| + return ValidHub(raw) && newName.MatchString(parts[2]) |
| +} |
| + |
| +// HasHubPrefix preserves legacy prefix-only checks. Canonical admission uses Parse. |
| +func HasHubPrefix(raw string) bool { return strings.HasPrefix(raw, Hub+"/") } |
diff --git a/internal/wire/forgekey/key_test.go b/internal/wire/forgekey/key_test.go| new file mode 100644 |
| index 00000000..c83de8d1 |
| --- /dev/null |
| +++ b/internal/wire/forgekey/key_test.go |
| @@ -0,0 +1,61 @@ |
| +package forgekey |
| + |
| +import "testing" |
| + |
| +func TestParseAndDisplay(t *testing.T) { |
| + for _, tc := range []struct{ input, key, host, display string }{ |
| + {"oficina/Equipo", "amadan.net/oficina/Equipo", Hub, "oficina/Equipo"}, |
| + {"amadan.net/oficina/Equipo", "amadan.net/oficina/Equipo", Hub, "oficina/Equipo"}, |
| + {"github.com/Oficina/Equipo", "github.com/Oficina/Equipo", GitHub, "github.com/Oficina/Equipo"}, |
| + } { |
| + k, err := Parse(tc.input) |
| + if err != nil || k.String() != tc.key || k.Host != tc.host || Display(tc.input) != tc.display { |
| + t.Fatalf("%q: %#v, %v, display %q", tc.input, k, err, Display(tc.input)) |
| + } |
| + } |
| +} |
| + |
| +func TestRejectInvalidKeys(t *testing.T) { |
| + for _, raw := range []string{"", "name", "evil.com/org/repo", "https://amadan.net/org/repo", "AMADAN.NET/org/repo", "github.com/org/repo/extra", "amadan.net/../repo", "amadan.net/org/.", "amadan.net/org/repo?x", "amadan.net/org/repo#x", "amadan.net/org/re%2fpo", "amadan.net/org/re po", "amadan.net/org/repo\n", "amadan.net/org/\\repo", "user@amadan.net/org/repo", "amadan.net:443/org/repo"} { |
| + if _, err := Parse(raw); err == nil { |
| + t.Errorf("accepted %q", raw) |
| + } |
| + } |
| +} |
| + |
| +func TestEqualityKeepsForgeRules(t *testing.T) { |
| + if !Equal("github.com/Oficina/Equipo", "github.com/oficina/equipo") { |
| + t.Fatal("GitHub equality lost") |
| + } |
| + if Equal("amadan.net/Oficina/Equipo", "amadan.net/oficina/equipo") { |
| + t.Fatal("hub case folded") |
| + } |
| + if !Equal("oficina/equipo", "amadan.net/oficina/equipo") { |
| + t.Fatal("bare hub key differs") |
| + } |
| + if Equal("evil/a/b", "evil/a/b") || Equal("github.com/a/b", "amadan.net/a/b") { |
| + t.Fatal("invalid or cross-host equality") |
| + } |
| +} |
| + |
| +func TestHubAdmissionAndCreation(t *testing.T) { |
| + for _, raw := range []string{"github.com/org/repo", "org/repo", "https://amadan.net/org/repo", "amadan.net/org/repo/extra"} { |
| + if ValidHub(raw) || NewHubRepo(raw) { |
| + t.Fatalf("hub admitted %q", raw) |
| + } |
| + } |
| + if !ValidHub("amadan.net/Org/Repo_1") || !NewHubRepo("amadan.net/Org/site-1") { |
| + t.Fatal("hub key refused") |
| + } |
| + for _, raw := range []string{"amadan.net/org/Aa", "amadan.net/org/a", "amadan.net/org/a_b"} { |
| + if NewHubRepo(raw) { |
| + t.Fatalf("new repo admitted %q", raw) |
| + } |
| + } |
| + if Normalize(" https://amadan.net/org/repo.git/ ") != "amadan.net/org/repo" { |
| + t.Fatal("hub normalization changed") |
| + } |
| + if Normalize("https://github.com/Org/Repo.git") != "github.com/Org/Repo" { |
| + t.Fatal("GitHub spelling lost") |
| + } |
| +} |