Merge branch 'github/seam' into main
70 files changed,
+2,036
−200
.gitleaksignore+4 −0.rastrillo/budgets.txt+6 −6docs/superpowers/plans/2026-11-23-github-seam-assumptions.md+24 −0docs/superpowers/plans/2026-11-23-github-seam.md+42 −0docs/superpowers/plans/CONTROLLER-REPORT-github-seam.md+359 −0docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md+1 −0docs/superpowers/specs/2026-11-22-equipo-github-connector-probe.md+214 −0internal/equipo/chat/placement.go+2 −1internal/equipo/chat/placement_card.go+2 −1internal/equipo/chat/projects.go+4 −11internal/equipo/chat/proposal_seam_test.go+66 −0internal/equipo/chat/tasks.go+8 −1internal/equipo/chat/tools.go+4 −6internal/equipo/chat/transfers.go+3 −0internal/equipo/copy.go+1 −0internal/equipo/proposal_seam_test.go+57 −0internal/equipo/setup/forgekey_test.go+20 −0internal/equipo/setup/projects.go+5 −4internal/equipo/work_views.go+7 −0internal/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/plan3test/plan3_release_test.go+2 −1internal/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/push_detail.go+1 −1internal/runner/forge/username_test.go+43 −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+9 −3internal/runner/thin/forge.go+27 −22internal/runner/thin/forge_seam_fixtures_test.go+16 −0internal/runner/thin/forges.go+180 −0internal/runner/thin/forges_review_test.go+141 −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/merge.go+1 −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+147 −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/budget_test.go+9 −0internal/wire/forgekey/key.go+92 −0internal/wire/forgekey/key_test.go+78 −0internal/wire/runners.go+1 −0internal/wire/tasks.go+1 −0
CI passed — 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/main: 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 1.4s
ci-box: codex: fetched and verified in 4.3s
ci-box: codex-code-mode-host: fetched and verified in 1.6s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.9s
ci-box: pi: installed and verified in 7.5s
ci-box: opencode: installed and verified in 2.3s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.8s
ci-box: clone deepened in 4.1s
ci-box: file times set from content: 2951 files, 192 directories
ci-box: ready in 18.6s
=== 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.144s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
5.0s
+ go list -export -test -tags testbuild -f ./...
5.3s
+ go list -export -test -tags browser,testbuild -f ./internal/equipo ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
3.2s
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 1m18.755s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m16.376s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m16.37s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 76.53, cpu waiting 42.25%, memory waiting 0.00%, io waiting 0.47%
--- 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 1m18.146s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m16.131s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m16.13s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 76.53, cpu waiting 42.25%, memory waiting 0.00%, io waiting 0.47%
--- 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 1m19.666s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m17.187s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m7.37s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.33s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.48s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 76.53, cpu waiting 42.31%, memory waiting 0.00%, io waiting 0.45%
--- 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 1m15.658s 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.116s amadan.net/oficina/equipo/internal/headless
receipt: slow test 36.53s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 19.03s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 8.96s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
receipt: slow test 8.6s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
machine: 32 CPUs, load 74.32, cpu waiting 41.52%, memory waiting 0.00%, io waiting 0.48%
--- 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 1m34.267s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m31.899s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m2.86s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 9.23s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 8.17s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 7.02s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 4.61s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 68.81, cpu waiting 41.58%, memory waiting 0.00%, io waiting 0.36%
--- 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 2m44.522s 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 2m41.95s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m36.8s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 18.17s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 8.68s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 6.6s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
receipt: slow test 6.4s amadan.net/oficina/equipo/internal/headless TestHeadlessBatchAfterRefusedReply
machine: 32 CPUs, load 30.94, cpu waiting 14.02%, memory waiting 0.00%, io waiting 0.10%
--- 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 2m8.377s 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 2m6.59s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 7.98s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.81s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 3.9s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 3.75s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
receipt: slow test 2.48s amadan.net/oficina/equipo/internal/thintest TestResearchDoneFallsBack
machine: 32 CPUs, load 46.63, cpu waiting 24.70%, memory waiting 0.00%, io waiting 0.19%
--- shard 7 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane thintest-contract: ./internal/thintest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -skip '^Test([^C]|C[^o]|Co[^n]|Con[^t])|^TestContract(Assistant|Outcome|Team|Handoff|HostAllowlist|HostIsPerPerson|Look|Use[A-Z]|RemoteCall|LanesRunAtOnce|NoMergeQuestionWhenGateMerges|PreviewHeldUntilPublishAnswer|PreviewNotHeldBelow19|PublishNeedsOwnerAnswer)' ./internal/thintest
receipt: test step 1m30.432s 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 1m28.312s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.26s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 5.08s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 4.48s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 2.37s amadan.net/oficina/equipo/internal/thintest TestContractPublishNameTaken
receipt: slow test 2.36s amadan.net/oficina/equipo/internal/thintest TestContractPreview
machine: 32 CPUs, load 69.49, cpu waiting 41.63%, memory waiting 0.00%, io waiting 0.37%
--- 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 4m47.826s, over the 45s its record on line 44 allows; reported only, timing fails on CI
receipt: test step 4m53.634s 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 4m47.826s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 37.01s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeAnsweredByAnotherModel
receipt: slow test 36.99s amadan.net/oficina/equipo/internal/runner/thin TestModelsEngineeringProbesThenRunsTheStrongest
receipt: slow test 36.84s amadan.net/oficina/equipo/internal/runner/thin TestModelsUnhealthyRetriedOnDemand
receipt: slow test 18.49s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 7.07s amadan.net/oficina/equipo/internal/runner/thin TestOpenCodeStepsRealOpenCode
machine: 32 CPUs, load 4.37, cpu waiting 1.60%, memory waiting 0.00%, io waiting 0.00%
--- shard 9 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
test lane runner-bug: ./internal/runner
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^TestDirectBugWorkflow$|^TestEnrolKeepsTheRole$' ./internal/runner
receipt: test step 51.666s 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.656s amadan.net/oficina/equipo/internal/runner
receipt: slow test 30.62s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.02s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 63.62, cpu waiting 34.71%, memory waiting 0.00%, io waiting 0.73%
--- 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 1m3.191s 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 1m1.747s amadan.net/oficina/equipo/internal/runner
receipt: slow test 51.62s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 46.21s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.4s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.71s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 71.49, cpu waiting 40.34%, memory waiting 0.00%, io waiting 0.59%
--- 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 35.838s 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 34.832s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.13s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.12s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 3.03s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 2.52s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.62s amadan.net/oficina/equipo/internal/runner TestCoordinatorTransientRefusalKeepsServing
machine: 32 CPUs, load 36.90, cpu waiting 21.91%, memory waiting 0.00%, io waiting 0.95%
--- 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 41.5%, load 33.76
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 1m9.172s 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.076s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 28.5s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 28.49s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 26.26s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 23.54s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 23.4s amadan.net/oficina/equipo/internal/equipotest TestAuthorityProjectKinds
machine: 32 CPUs, load 64.66, cpu waiting 39.29%, memory waiting 0.00%, io waiting 0.32%
--- 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 41.5%, load 33.76
test lane equipotest-e: ./internal/equipotest
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags testbuild -timeout 15m -run '^Test[E-P]' ./internal/equipotest
receipt: test step 1m17.659s 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 1m15.795s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 20.16s amadan.net/oficina/equipo/internal/equipotest TestProjectWritesRequireCurrentOwner
receipt: slow test 20.1s amadan.net/oficina/equipo/internal/equipotest TestProjectsSharedAndGrouped
receipt: slow test 20.04s amadan.net/oficina/equipo/internal/equipotest TestProjectRequestActorAndUpdate
receipt: slow test 20.03s amadan.net/oficina/equipo/internal/equipotest TestProjectRetryAndRevision
receipt: slow test 19.99s amadan.net/oficina/equipo/internal/equipotest TestProjectConcurrentRetry
machine: 32 CPUs, load 57.07, cpu waiting 34.85%, memory waiting 0.00%, io waiting 0.28%
--- 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 41.5%, load 33.76
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 1m15.049s 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 1m9.909s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 15.24s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 13.62s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 10.62s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 10.55s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 7.55s amadan.net/oficina/equipo/internal/equipotest TestRosterBootstrapOnce
machine: 32 CPUs, load 61.08, cpu waiting 36.00%, memory waiting 0.00%, io waiting 0.29%
--- 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 41.5%, load 33.76
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.058s 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.175s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 25.39s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 25.19s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 25.08s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 23.29s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsUpgrade
receipt: slow test 23.14s amadan.net/oficina/equipo/internal/equipotest TestSpecialistSettingsRollbackAndUnavailable
machine: 32 CPUs, load 64.66, cpu waiting 40.25%, memory waiting 0.00%, io waiting 0.33%
--- 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 41.5%, load 33.76
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.711s 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 52.746s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 3.67s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.55s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.76s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.74s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.3s amadan.net/oficina/equipo/internal/plan3test TestPlanMigrationUpgrade
machine: 32 CPUs, load 72.49, cpu waiting 41.67%, memory waiting 0.00%, io waiting 0.42%
--- 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 41.5%, load 33.76
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/chatmarkdown: 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/runner/containment: its inputs changed
budget note: internal/equipo took 57.118s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/chat took 18.565s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/equipo/setup took 12.686s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/idtest took 1m52.266s, 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 51.937s, over the 15s its record on line 40 allows; reported only, timing fails on CI
budget note: internal/runner/forge took 21.287s, over the 20s its record on line 35 allows; reported only, timing fails on CI
budget note: internal/runner/provider/claude/realcli took 14.372s, over the 10s the default allows; reported only, timing fails on CI
budget note: internal/runner/provider/pi took 1m20.178s, over the 1m0s its record on line 27 allows; reported only, timing fails on CI
budget note: internal/runner/workspace took 11.147s, over the 10s the default allows; reported only, timing fails on CI
receipt: test step 1m59.069s against a 60s target (the gate's other steps are not in this figure)
receipt: 39 packages ran, 25 cached, 18 without tests, 0 failed
receipt: slow package 1m52.266s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 1m20.178s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 1m6.793s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 57.457s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 57.118s amadan.net/oficina/equipo/internal/equipo
receipt: slow test 54.11s amadan.net/oficina/equipo/internal/idtest TestDoorRemembersOficinaID
receipt: slow test 46.21s amadan.net/oficina/equipo/internal/idtest TestDoorNeverJudgesANativeSession
receipt: slow test 46.15s amadan.net/oficina/equipo/internal/idtest TestDoorOficinaSettingsUnreadableIsNoLoop
receipt: slow test 45.79s amadan.net/oficina/equipo/internal/idtest TestDoorStepUpIsLocal
receipt: slow test 45.07s amadan.net/oficina/equipo/internal/idtest TestDoorForgetsOficinaIDForARefusedSession
machine: 32 CPUs, load 36.04, cpu waiting 17.70%, memory waiting 0.00%, io waiting 0.13%
--- shard 18 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-chat: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$' ./internal/headless
receipt: test step 1m25.16s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 1m23.242s amadan.net/oficina/equipo/internal/headless
receipt: slow test 39.12s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 14.87s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 10.13s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.08s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 6.41s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 72.49, cpu waiting 41.13%, memory waiting 0.00%, io waiting 0.41%
--- 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 1m31.53s 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.6s amadan.net/oficina/equipo/internal/headless
receipt: slow test 27.3s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 21.67s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 12.98s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 9.6s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
receipt: slow test 9.35s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
machine: 32 CPUs, load 68.81, cpu waiting 41.63%, memory waiting 0.00%, io waiting 0.37%
--- 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 1m42.55s 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 1m40.802s amadan.net/oficina/equipo/internal/headless
receipt: slow test 13.97s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 13.45s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 12.45s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 11.43s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 10.79s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsOpenCodeGoLimitRequired
machine: 32 CPUs, load 61.08, cpu waiting 37.12%, memory waiting 0.00%, io waiting 0.30%
--- 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
rastrillo: budget test: go test failed
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserCopyContinue
=== RUN TestBrowserCopyContinue
time=2026-11-23T18:43:53.659Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-23T18:43:53.659Z level=INFO msg="startup phase done" phase=state_lock took=245µs
time=2026-11-23T18:43:53.659Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-23T18:43:53.659Z level=INFO msg="startup phase done" phase=claim_roots took=103µs
time=2026-11-23T18:43:53.659Z level=INFO msg="startup phase" phase=sweep
time=2026-11-23T18:43:53.719Z level=INFO msg="startup phase done" phase=sweep took=59.715ms
time=2026-11-23T18:43:53.719Z level=INFO msg="startup phase" phase=credentials
time=2026-11-23T18:43:53.719Z level=INFO msg="startup phase done" phase=credentials took=206µs
time=2026-11-23T18:43:53.720Z level=INFO msg="startup phase" phase=open_state
time=2026-11-23T18:43:53.776Z level=INFO msg="startup phase done" phase=open_state took=56.262ms
time=2026-11-23T18:43:53.776Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-23T18:43:53.778Z level=INFO msg=connecting host=127.0.0.1:35271 protocol=28
time=2026-11-23T18:43:53.780Z level=INFO msg=connected host=127.0.0.1:35271 took=1.286ms
time=2026-11-23T18:43:53.781Z level=INFO msg="capabilities gathering"
time=2026-11-23T18:43:53.783Z level=INFO msg="capabilities gathered" took=1.813ms tags=linux,claude,go
time=2026-11-23T18:43:53.785Z level=INFO msg="hello sent" protocol=28
time=2026-11-23T18:43:53.793Z 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.40s)
--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m33.487s
FAIL amadan.net/oficina/equipo/internal/headless 93.698s
receipt: test step 1m35.246s 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 1m33.487s amadan.net/oficina/equipo/internal/headless
receipt: slow test 14.73s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 11.63s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 10.55s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 9.44s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 7.71s amadan.net/oficina/equipo/internal/headless TestBrowserNotebookLook
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 f623151cdca1441bd6afcb4141c58334f91e9bc0 6.40s 68.81
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 64.66, cpu waiting 39.29%, memory waiting 0.00%, io waiting 0.32%
--- 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.39s 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 533ms amadan.net/oficina/equipo/internal/equipo
receipt: slow test 530ms 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.011s, over the 10s the default allows; reported only, timing fails on CI
receipt: test step 11.464s 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.011s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 7.99s amadan.net/oficina/equipo/internal/idtest TestBrowserSmartDoor
receipt: slow test 2.02s 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.698s 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.141s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 2.14s 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 3m34.226s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 3m32.577s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 22.46s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.4s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 12s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
receipt: slow test 10.65s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 8.91s amadan.net/oficina/equipo/internal/thintest TestBrowserRhythm
machine: 32 CPUs, load 10.47, cpu waiting 4.37%, memory waiting 0.00%, io waiting 0.02%
--- shard 23 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
shard 23: make test-quarantine
python3 scripts/ci-test.py quarantine
quarantine: 12 tests from scripts/ci-quarantine.txt; a failure is retried once, and a pass on the retry is reported as a flake
+ go test -tags testbuild -timeout 15m -v -run '^TestHeadlessConnections$/^A5_cancel_and_sign_out$|^TestHeadlessConnections$/^C4_claude_sign_in$|^TestHeadlessConnections$/^C5_engineering_failover$|^TestHeadlessConnections$/^C5_engineering_to_codex$|^TestHeadlessConnections$/^C5_engineering_waits$' ./internal/headless (54s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 4.77s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.10s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 8.13s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.19s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 27.86s
+ 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 (56s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 12.35s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 11.28s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 9.71s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 19.98s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless (21s)
ok ./internal/headless TestMixedVersions 18.65s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks (3s)
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 68.14, cpu waiting 37.72%, memory waiting 0.00%, io waiting 0.68%
--- 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 14.124s 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.171s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 251ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 126ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 4ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow test 5.82s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.82s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 380ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 250ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 130ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxToolchain
CGO_ENABLED=0 RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py retried runner-host -run '^TestNamespace' -count=1 ./internal/runner/containment
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -run '^TestNamespace' -count=1 ./internal/runner/containment
receipt: test step 3.652s 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.233s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 290ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 240ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 140ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceOpenCodeBinaryAfterAttestation
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceExitStatus
machine: 32 CPUs, load 25.17, cpu waiting 11.36%, memory waiting 0.00%, io waiting 1.29%
--- 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 41.5%, load 33.76
shard 25: make runner-dead-references lanes-check build vet fmt-check spacing budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 2664 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.472s
machine: 32 CPUs, load 76.53, cpu waiting 42.25%, memory waiting 0.00%, io waiting 0.47%
--- 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 41.5%, load 33.76
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 63.62, cpu waiting 37.72%, memory waiting 0.00%, io waiting 0.68%
--- shard 27 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
stagger: govulncheck started 30s late; cpu waiting 41.5%, load 33.76
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 43.88, cpu waiting 23.71%, memory waiting 0.00%, io waiting 0.92%
--- 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 41.5%, load 33.76
shard 28: make gitleaks
[90m6:43PM[0m [32mINF[0m [1mUnknown SCM platform. Use --platform to include links in findings.[0m [36mhost=[0mamadan.net
[90m6:44PM[0m [32mINF[0m [1m1121 commits scanned.[0m
[90m6:44PM[0m [32mINF[0m [1mscanned ~64930771 bytes (64.93 MB) in 25.5s[0m
[90m6:44PM[0m [32mINF[0m [1mno leaks found[0m
machine: 32 CPUs, load 63.62, cpu waiting 37.72%, memory waiting 0.00%, io waiting 0.68%
=== perf ===
go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -no-time -require TestPerfScreens,TestPerfBoot -tags perf -count=1 -p 1 -parallel 1 -run '^TestPerf' ./...
perf: GET /: median 1.102ms, worst 1.203ms, budget 150ms
perf: GET /api/runner/protocol: median 80µs, worst 98µs, budget 150ms
perf: GET /api/v1/account-setups/{id}: median 959µs, worst 1.81ms, budget 150ms
perf: GET /api/v1/accounts: median 432µs, worst 473µs, budget 150ms
perf: GET /api/v1/auth/devices: median 447µs, worst 479µs, budget 150ms
perf: GET /api/v1/budgets: median 481µs, worst 505µs, budget 150ms
perf: GET /api/v1/capabilities: median 234µs, worst 256µs, budget 150ms
perf: GET /api/v1/cards/{id}: median 1.247ms, worst 1.338ms, budget 150ms
perf: GET /api/v1/connections: median 566µs, worst 629µs, budget 150ms
perf: GET /api/v1/connections/{id}: median 557µs, worst 588µs, budget 150ms
perf: GET /api/v1/conversation: median 892µs, worst 938µs, budget 150ms
perf: GET /api/v1/conversation/cards: median 1.409ms, worst 1.441ms, budget 150ms
perf: GET /api/v1/coordinator: median 1.937ms, worst 2.002ms, budget 150ms
perf: GET /api/v1/invites/{id}: median 449µs, worst 475µs, budget 150ms
perf: GET /api/v1/journey: median 7.306ms, worst 7.469ms, budget 150ms
perf: GET /api/v1/me: median 398µs, worst 450µs, budget 150ms
perf: GET /api/v1/me/settings: median 488µs, worst 524µs, budget 150ms
perf: GET /api/v1/needs-you: median 7.326ms, worst 7.582ms, budget 150ms
perf: GET /api/v1/notifications: median 1.675ms, worst 1.745ms, budget 150ms
perf: GET /api/v1/onboarding: median 393µs, worst 409µs, budget 150ms
perf: GET /api/v1/people: median 429µs, worst 479µs, budget 150ms
perf: GET /api/v1/playbooks: median 577µs, worst 617µs, budget 150ms
perf: GET /api/v1/playbooks/{id}: median 506µs, worst 534µs, budget 150ms
perf: GET /api/v1/playbooks/{id}/template-diff: median 818µs, worst 848µs, budget 150ms
perf: GET /api/v1/preferences: median 763µs, worst 818µs, budget 150ms
perf: GET /api/v1/projects/{id}: median 458µs, worst 489µs, budget 150ms
perf: GET /api/v1/projects/{id}/settings: median 597µs, worst 612µs, budget 150ms
perf: GET /api/v1/roster: median 483µs, worst 496µs, budget 150ms
perf: GET /api/v1/runners/{id}: median 410µs, worst 450µs, budget 150ms
perf: GET /api/v1/specialists: median 8.147ms, worst 8.279ms, budget 150ms
perf: GET /api/v1/specialists/{id}: median 7.888ms, worst 7.986ms, budget 150ms
perf: GET /api/v1/specialists/{id}/template-diff: median 833µs, worst 888µs, budget 150ms
perf: GET /api/v1/tasks/{id}/plan: median 1.151ms, worst 1.278ms, budget 150ms
perf: GET /api/v1/tasks/{id}/thread: median 715µs, worst 757µs, budget 150ms
perf: GET /api/v1/teams: median 425µs, worst 475µs, budget 150ms
perf: GET /api/v1/templates: median 598µs, worst 604µs, budget 150ms
perf: GET /api/v1/templates/{id}: median 433µs, worst 477µs, budget 150ms
perf: GET /auth/callback: median 79µs, worst 105µs, budget 150ms
perf: GET /auth/devices/{id}: median 3.873ms, worst 3.941ms, budget 150ms
perf: GET /auth/verify: median 80µs, worst 98µs, budget 150ms
perf: GET /connections: median 4.471ms, worst 4.792ms, budget 150ms
perf: GET /conversation: median 8.246ms, worst 11.473ms, budget 150ms
perf: GET /conversation/connections: median 250µs, worst 266µs, budget 150ms
perf: GET /conversation/notebook: median 237µs, worst 262µs, budget 150ms
perf: GET /conversation/settings: median 4.407ms, worst 4.569ms, budget 150ms
perf: GET /conversation/settings/autonomy: median 4.438ms, worst 4.702ms, budget 150ms
perf: GET /conversation/settings/connections: median 6.786ms, worst 7.096ms, budget 150ms
perf: GET /conversation/settings/connections/add: median 7.227ms, worst 7.4ms, budget 150ms
perf: GET /conversation/settings/copy: median 4.539ms, worst 4.66ms, budget 150ms
perf: GET /conversation/settings/housekeeping: median 4.535ms, worst 4.661ms, budget 150ms
perf: GET /conversation/settings/machines: median 5.125ms, worst 7.341ms, budget 150ms
perf: GET /conversation/settings/machines/add: median 5.181ms, worst 5.517ms, budget 150ms
perf: GET /conversation/settings/notebook: median 3.927ms, worst 4.034ms, budget 150ms
perf: GET /conversation/settings/thinking: median 4.564ms, worst 4.628ms, budget 150ms
perf: GET /housekeeping: median 4.301ms, worst 4.468ms, budget 150ms
perf: GET /invites/new: median 603µs, worst 641µs, budget 150ms
perf: GET /invites/{id}: median 649µs, worst 679µs, budget 150ms
perf: GET /jobs: median 3.951ms, worst 3.983ms, budget 150ms
perf: GET /jobs/{id}: median 5.134ms, worst 5.268ms, budget 150ms
perf: GET /journey: median 13.011ms, worst 13.392ms, budget 150ms
perf: GET /nav/rail: median 3.821ms, worst 3.954ms, budget 150ms
perf: GET /needs-you: median 13.231ms, worst 13.433ms, budget 150ms
perf: GET /onboarding: median 5.26ms, worst 5.302ms, budget 150ms
perf: GET /people: median 4.4ms, worst 4.53ms, budget 150ms
perf: GET /playbook-suggestions/{suggestion}: median 6.082ms, worst 6.157ms, budget 150ms
perf: GET /playbooks: median 5.554ms, worst 5.695ms, budget 150ms
perf: GET /playbooks/new: median 5.594ms, worst 5.812ms, budget 150ms
perf: GET /playbooks/{id}: median 5.159ms, worst 5.404ms, budget 150ms
perf: GET /playbooks/{id}/edit: median 5.204ms, worst 5.327ms, budget 150ms
perf: GET /playbooks/{id}/template-diff: median 4.371ms, worst 4.76ms, budget 150ms
perf: GET /preferences: median 5.033ms, worst 5.289ms, budget 150ms
perf: GET /preferences/sources/{source}: median 4.859ms, worst 4.956ms, budget 150ms
perf: GET /projects: median 6.542ms, worst 7.176ms, budget 150ms
perf: GET /projects/accounts: median 4.261ms, worst 4.384ms, budget 150ms
perf: GET /projects/new: median 4.112ms, worst 4.211ms, budget 150ms
perf: GET /projects/{id}: median 11.248ms, worst 11.281ms, budget 150ms
perf: GET /projects/{id}/edit: median 4.351ms, worst 4.45ms, budget 150ms
perf: GET /runners/enrol: median 5.029ms, worst 5.151ms, budget 150ms
perf: GET /settings: median 3.91ms, worst 4.08ms, budget 150ms
perf: GET /settings/coordinator: median 5.855ms, worst 6.148ms, budget 150ms
perf: GET /settings/devices: median 3.797ms, worst 5.299ms, budget 150ms
perf: GET /settings/recovery: median 3.861ms, worst 3.985ms, budget 150ms
perf: GET /settings/recovery/release: median 3.856ms, worst 3.967ms, budget 150ms
perf: GET /settings/thinking: median 243µs, worst 290µs, budget 150ms
perf: GET /signed-out: median 276µs, worst 306µs, budget 150ms
perf: GET /signin: median 278µs, worst 333µs, budget 150ms
perf: GET /specialists/new: median 3.835ms, worst 4.019ms, budget 150ms
perf: GET /specialists/{key}: median 11.211ms, worst 11.572ms, budget 150ms
perf: GET /specialists/{key}/edit: median 3.999ms, worst 4.109ms, budget 150ms
perf: GET /specialists/{key}/template-diff: median 4.179ms, worst 4.414ms, budget 150ms
perf: GET /tasks: median 6.237ms, worst 6.333ms, budget 150ms
perf: GET /tasks/new: median 3.679ms, worst 3.826ms, budget 150ms
perf: GET /tasks/{id}: median 6ms, worst 6.271ms, budget 150ms
perf: GET /tasks/{id}/merge: median 5.689ms, worst 7.505ms, budget 150ms
perf: GET /tasks/{id}/move: median 5.409ms, worst 5.476ms, budget 150ms
perf: GET /tasks/{id}/plan: median 6.53ms, worst 6.669ms, budget 150ms
perf: GET /tasks/{id}/preview: median 1.59ms, worst 1.659ms, budget 150ms
perf: GET /tasks/{id}/questions/{question}: median 5.753ms, worst 5.838ms, budget 150ms
perf: GET /tasks/{id}/rendered-change: median 5.4ms, worst 5.564ms, budget 150ms
perf: GET /tasks/{id}/rendered-change/{hash}.png: median 4.921ms, worst 5.155ms, budget 150ms
perf: GET /tasks/{id}/thread: median 8.761ms, worst 9.018ms, budget 150ms
perf: GET /team/{specialist}: median 5.001ms, worst 5.265ms, budget 150ms
perf: GET /teams: median 10.806ms, worst 12.916ms, budget 150ms
perf: GET /templates: median 3.99ms, worst 4.315ms, budget 150ms
perf: GET /usage: median 4.745ms, worst 4.881ms, budget 150ms
perf: GET /work: median 3.42ms, worst 3.64ms, budget 150ms
perf: GET /auth/devices/{id}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /connections: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/autonomy: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/connections: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/connections/add: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/copy: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/housekeeping: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/machines: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/machines/add: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/notebook: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /conversation/settings/thinking: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /housekeeping: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /invites/new: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /invites/{id}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /jobs: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /jobs/{id}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /journey: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /nav/rail: 0 bytes of framework CSS and JS, gzipped; 16000-byte budget
perf: GET /needs-you: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /onboarding: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /people: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /playbook-suggestions/{suggestion}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /playbooks: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /playbooks/new: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /playbooks/{id}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /playbooks/{id}/edit: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /playbooks/{id}/template-diff: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /preferences: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /preferences/sources/{source}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /projects: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /projects/accounts: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /projects/new: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /projects/{id}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /projects/{id}/edit: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /runners/enrol: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /settings: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /settings/coordinator: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /settings/devices: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /settings/recovery: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /settings/recovery/release: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /signed-out: 30270 bytes of framework CSS and JS, gzipped; 40000-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /specialists/new: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /specialists/{key}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /specialists/{key}/edit: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /specialists/{key}/template-diff: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/new: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/merge: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/move: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/plan: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/preview: 25954 bytes of framework CSS and JS, gzipped; 40000-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/questions/{question}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/rendered-change: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /tasks/{id}/thread: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /team/{specialist}: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /teams: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /templates: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /usage: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: GET /work: 57416 bytes of framework CSS and JS, gzipped; 60600-byte budget; it links the whole tokens.css: add Assets: assets to ui.PagesConfig (PagesConfig.Assets) in render.go, and in the layout use {{path $ pageStylesheet}} in place of static/tokens.css and replace the busy.js, live.js, light.js and anchor.js tags and the neededScripts line (or the select.js, calendar.js and datetime.js tags) with {{range pageScripts}}, keeping rastrillo.js and shell.js
perf: cold boot: median 159ms of [158.953147ms 159.406822ms 161.79312ms], budget 500ms
receipt: test step 50.949s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 87 without tests, 0 failed
receipt: slow package 10.553s amadan.net/oficina/equipo/internal/equipotest
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-runner
receipt: slow package 0s amadan.net/oficina/equipo/cmd/equipo-tool-proxy
receipt: slow package 0s amadan.net/oficina/equipo/internal/advice
receipt: slow package 0s amadan.net/oficina/equipo/internal/attach
receipt: slow test 10.02s amadan.net/oficina/equipo/internal/equipotest TestPerfScreens
receipt: slow test 530ms amadan.net/oficina/equipo/internal/equipotest TestPerfBoot
=== cache ===
ci-box: build cache /home/ci/work/repos/oficina__equipo/cache/go-build: 4.93 GiB in 28788 files
ci-box: module cache /home/ci/work/repos/oficina__equipo/cache/go-mod: 1.15 GiB in 40997 files
ci-box: build cache over 4.0 GiB: dropped 2.30 GiB this job did not read, kept 2.63 GiB
diff --git a/.gitleaksignore b/.gitleaksignore| index 4b575c5a..9f008b62 100644 |
| --- a/.gitleaksignore |
| +++ b/.gitleaksignore |
| @@ -17,3 +17,7 @@ ebb61a1eeabcb917445de229b035e76f41337a26:internal/websource/websource_test.go:ge |
| # A made-up password in TestRunCarlosClippedStderrNeverLogged: proves stderr cut |
| # at its limit is never logged, where a cut secret could slip past redaction. |
| 50721d92fa0faa48349dc7e45d34c60100148e64:internal/runner/thin/preview_carlos_test.go:generic-api-key:146 |
| + |
| +# False positive on prose Equal/Normalize in the seam regression report. |
| +# This is a pair of function names, not a credential; the sentence was rephrased. |
| +18594290c0568fd8375e83478e6a0e8db10b8272:docs/superpowers/plans/CONTROLLER-REPORT-github-seam.md:generic-api-key:237 |
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index 28b7d3e4..2376ac0f 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -14,8 +14,8 @@ perf GET /* skip Unknown private paths render 404; this fallback contains no scr |
| time internal/equipo/team 60s Plan 3 loaded CI measured 45.985s; niced serial reruns measured 18.079s and 22.031s. Keep migration, recovery, accounting and concurrency assertions; 60s leaves 30 percent headroom above loaded CI. |
| time internal/equipotest 300s Final fix package rerun measured 187.035s (review 172.4s); 300s gives 60 percent headroom for HTTP, sandbox, authority and final regression coverage. |
| -size internal/equipo 22101 - Reviewed native Projects and API copy plus Engineering stop reasons; measured 22101 source lines. |
| -size internal/wire 6828 - Project cursor, typed placement marker and Engineering stop reasons; measured 6828 source lines. |
| +size internal/equipo 22109 - Proposal failure details for Engineering and Copy with Luna-reviewed words; measured 22109 source lines. |
| +size internal/wire 6830 - Successful-push proposal diagnostic in existing Reason fields; measured 6830 source lines. |
| size internal/equipotest - 12017 Task 21 repairs historical migration and conversation fixtures after Plan 3, and the Rastrillo upgrade contract comparing served assets with what Assets serves; measured 0/12017 source/test lines. |
| time internal/runner/checks 90s CI worker measured 44.553s (44.6s rounded); |
| time internal/runner 330s Plan 3 CI repair measured 292.120s for the full package (controller CI 472.184s). |
| @@ -30,7 +30,7 @@ size internal/runner/provider 5715 - Fable follow-up: base and diagnostic gates, |
| time internal/plan3test 300s Initial cap for combined browser and runner acceptance; measure at both usable stops. |
| -size internal/plan3test - 11898 Reviewed API, native Projects and Engineering stop reason acceptance lists; measured 11898 test lines. |
| +size internal/plan3test - 11899 Add the controller-approved Luna proposal copy key to release inventory; measured 11899 test lines, source cap unchanged. |
| time internal/runner/forge 20s Plan 3 CI repair measured 10.527s for the full package (controller CI 10.407s). |
| time internal/runner/provider 15s Plan 3 CI repair measured 10.346s for the full package (controller CI 10.709s); |
| @@ -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 28446 22619 Forge review fixes, real fileForge router coverage, authority and proposal regressions; measured 28446 source and 22619 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). |
| @@ -56,7 +56,7 @@ perf GET /api/v1/tasks/{id} skip Thin v1 person API: bearer-only JSON for device |
| perf GET /api/v1/assistant/snapshot skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen. |
| perf GET /api/v1/assistant/messages skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen. |
| perf GET /api/v1/assistant/events skip Assistant event stream (Server-Sent Events), bearer-only and long-lived; not a screen. |
| -size internal/equipo/chat 33345 8333 Project cursor and typed-card marker with native review regression; measured 33345/8333 source/test lines. |
| +size internal/equipo/chat 33348 8399 Preserve proposal diagnostics on successful Engineering, Copy and worker publication; measured 33348 source and 8399 test lines. |
| perf GET /api/v1/questions/{id} skip Thin v1 person API: bearer-only JSON for devices; the browser reads questions on /tasks/{id}. |
| perf GET /api/v1/steps/{id}/log skip Thin v1 person API: bearer-only JSON for devices; the browser shows the log tail on /tasks/{id}. |
| perf GET /api/v1/connections/preference skip Connections slice 1 person API: bearer-only JSON for devices; the browser shows the preference on /conversation/connections. |
| @@ -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..b0e2638e |
| --- /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:497`; `internal/runner/thin/relay.go:485`; `internal/runner/thin/forges.go:174` | 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. Proposal failure preserves push success with a fixed diagnostic. | |
| +| 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:137` | HostedCI shape and hub transport unchanged; router forwards per host and keeps refusal sentinels. 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:1027`; `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:407`; `internal/equipo/work_pages.go:220`; `internal/equipo/task_merge.go:14` | Hub branch and repository URLs and approved merge-reference host unchanged; branch links share forgekey.HubBranchURL. ProposalRef is local only; no proposal wire field yet. | |
| +| Prompts | `internal/runner/thin/claude.go:874`; `internal/runner/thin/engineer.go:606`; `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..5fa10f94 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-23-github-seam.md |
| @@ -0,0 +1,42 @@ |
| +# 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. |
| + |
| +## Fable review follow-up, 2026-11-23 |
| + |
| +On the same branch after 176d61cb, add focused regressions before fixing: |
| +truncated host keys, real fileForge routing, git username redaction and Heads, |
| +per-call push authority, distinct hub identity, proposal failure after a good |
| +push, operation error identity, and the existing branch-link spelling. |
| +Break each guard and record the killing test. Preserve successful pushes and |
| +carry only proposal_failed in the existing Reason field, as the controller |
| +approved. Add Luna's approved fragment to copy.go and test sentence rendering. |
| +Record the organisation manifest flow and explicitly leave the uncaptured |
| +workflow refusal cause open. Repeat gates, full suites, postcommit reference |
| +scan and Linux CI, without rewriting existing commits. |
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..97cb9fe8 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-github-seam.md |
| @@ -0,0 +1,359 @@ |
| +# 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). |
| + |
| +## First CI and correction |
| + |
| +CI on `ab21a6e4` failed two of 29 shards; the other 27 passed, including |
| +Linux runner, merge, hosted CI and access tests. |
| + |
| +- Existing `TestProjectRejectsUnsafeBinding` caught `amadan.net/a` being |
| + interpreted as bare owner/name inside legacy CanonicalRepository. Added |
| + `TestCanonicalRepositoryRequiresFullHubKey`; it failed before the fix on |
| + both `amadan.net/a` and `https://amadan.net/a`. CanonicalRepository now |
| + requires the parsed spelling to equal its full host/path input, preserving |
| + the existing complete-hub-key requirement. Removing that condition again |
| + makes the new regression fail; restored and the new regression and existing |
| + unsafe-binding test both pass. This is the 29th killed runtime mutation. |
| +- The new forgekey test package lacked Rastrillo's timing receipt. Added its |
| + standard `TestMain` calling `budget.Main(m)`. `rastrillo budget test |
| + ./internal/wire/forgekey` now passes and reports package timing. |
| + |
| +No existing test assertions or names changed in this correction. The complete |
| +setup and equipotest suites and release gates are rerun before committing it. |
| + |
| +Correction verification: all release gates passed again. Full setup passed |
| +in 8.251s. Full equipotest completed in 436.480s with only the two existing |
| +macOS release-packaging failures (`TestRunnerReleaseContractPackaging` and |
| +`TestReleasePinsAndProvenance`): their isolated PATH selects a Python whose |
| +hashlib has no file_digest. The project binding tests passed. Those packaging |
| +lanes passed on Linux in the first CI run; no unrelated packaging code changed. |
| + |
| +## Fable review follow-up after 176d61cb |
| + |
| +The fixes are new commits on github/seam. Earlier commits and all tests that |
| +predate this branch retain their names and assertions. Changes to test code |
| +in this follow-up are to seam tests introduced on this branch, new regression |
| +files, and the explicitly approved copy-release inventory list. |
| + |
| +### Findings and behavior |
| + |
| +- P2-1: Parse rejects two-part keys beginning with either known host. Both |
| + amadan.net/a and github.com/a are rejected by key and no-fallback tests. |
| + Equal no longer equates them with a prefixed hub key; Normalize preserves |
| + the invalid input and parsing it still rejects it. |
| +- P2-2: a real NewFileForge, wrapped in NewForges, talks to the fake hub for |
| + read and push credentials, merge, hosted CI/status, and access request/poll. |
| + The test asserts its host and the exact authenticated HTTP paths. |
| +- P2-3: push redaction and Clones.Heads use Remote.Username(). The redaction |
| + regression uses x-access-token with a deliberately short fixture password |
| + so the generic long-token scrubber cannot hide a missing explicit scrub. |
| + It checks both raw and encoded values in PushDetail's resulting log tail. |
| +- Push authority: both Engineering and relay tests assert exactly one Push |
| + credential request. Changing either call to Read fails its regression. |
| +- Hub identity: fake forges now have different agents and create namespaces. |
| + Routing either hostless identity call to GitHub fails the test. |
| +- Proposal failure: a successful push remains successful and is not retried. |
| + The existing Reason field carries only proposal_failed. The instance keeps |
| + the diagnostic for local and worker publication and the successful step |
| + detail renders the approved fragment. No raw forge error reaches a person. |
| + ProposalRef remains local and absent on error; there is no new wire field. |
| +- Error identities: rejected Remote, Exists/Create, Merge, CIHosted and |
| + CIStatus keep their operation sentinel as well as ErrKey through errors.Is. |
| + Invalid Use and duplicate registration have separate ErrForgeUse and |
| + ErrForgeDuplicate identities. Neither is ErrKey. |
| +- Branch links: chat.BranchURL and hub Propose share forgekey.HubBranchURL, |
| + preserving the literal branch slash in the existing hub URL spelling. |
| +- Probe: recorded the controller-confirmed organisation manifest flow, |
| + with the external manifest_server.py's request/callback logic. The saved |
| + workflow report has only git's generic final stderr line, not the remote |
| + cause. Capturing the exact workflows-permission refusal remains open, |
| + alongside the complete merge table and CARLOS egress. |
| + |
| +### Tests first |
| + |
| +Focused tests ran with GOTOOLCHAIN=go1.26.11, CGO_ENABLED=0, testbuild and a |
| +physical TMPDIR. Before fixes, regressions failed on malformed host inputs, |
| +normalization and equality, router fallback, operation error identities, |
| +escaped proposal URL, Heads' x username, and the non-default encoded header |
| +remaining in PushDetail. Engineering requested Push three times after a |
| +proposal error; relay returned Pushed:false / push_failed after one good |
| +push. The rendering regression had no diagnostic text. After repairing the |
| +chat test's missing RunnerRole fixture, its local path also demonstrated |
| +that the instance discarded the diagnostic, before that path was fixed. |
| + |
| +### Copy review |
| + |
| +The controller supplied Luna's replacement on 2026-11-23, message |
| +`e27ea4c2-0708-4c63-9507-febfb7d1d032`: |
| + |
| +> "work.reason.proposal_failed": "the branch was pushed, but the review request could not be created", // COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23) |
| + |
| +The original proposed complete sentence did not fit the fragment grammar |
| +of work.reason.*. Luna also replaced "proposal" with "review request". |
| +The key was marked pending through copy-status.py, then recorded with the |
| +controller-authorized Luna marker and a bounded acceptedForgeSeam list. |
| +No accept command was run. Tests exercise reasonLine, "Stopped: %s", and |
| +successful-step detail; each rendered sentence has one final period. |
| +This is the only new app copy. ErrForgeUse and ErrForgeDuplicate are internal |
| +configuration diagnostics, not person-facing API text. |
| + |
| +### Review mutation checks |
| + |
| +All 26 review mutations failed a runtime assertion, then were restored. No |
| +compile failure counts as a kill. In particular, Fable's five surviving |
| +mutations (production Host, both Push call sites, Agent and CreateIn) now die. |
| +The swallowed-error mutation dies in both publication paths. These 26 checks |
| +are additional to the 29 recorded in the earlier implementation. |
| + |
| +Each command was `go test -tags testbuild ./<package> -run <test> -count=1`, |
| +with the pinned environment above. |
| + |
| +| # | Deliberate mutation | Package suffix | Killing test | |
| +| --- | --- | --- | --- | |
| +| 1 | reject truncated known host | `internal/wire/forgekey` | `TestRejectInvalidKeys|TestNormalizationAndEqualityAgree` | |
| +| 2 | production host identity | `internal/runner/thin` | `TestRouterWithProductionFileForge` | |
| +| 3 | push detail encoded username | `internal/runner/forge` | `TestPushDetailScrubsRemoteUsername` | |
| +| 4 | push detail raw password | `internal/runner/forge` | `TestPushDetailScrubsRemoteUsername` | |
| +| 5 | heads username | `internal/runner/thin` | `TestHeadsUsesRemoteUsername` | |
| +| 6 | engineering push authority | `internal/runner/thin` | `TestEngineeringProposesAfterPush` | |
| +| 7 | relay push authority | `internal/runner/thin` | `TestRelayProposesAfterPush` | |
| +| 8 | hub agent identity | `internal/runner/thin` | `TestForgesCatalogAndHubIdentity` | |
| +| 9 | hub create namespace identity | `internal/runner/thin` | `TestForgesCatalogAndHubIdentity` | |
| +| 10 | engineering proposal diagnostic | `internal/runner/thin` | `TestEngineeringProposalFailureKeepsPush` | |
| +| 11 | engineering successful push preserved | `internal/runner/thin` | `TestEngineeringProposalFailureKeepsPush` | |
| +| 12 | relay proposal diagnostic | `internal/runner/thin` | `TestRelayProposalFailureKeepsPush` | |
| +| 13 | relay successful push preserved | `internal/runner/thin` | `TestRelayProposalFailureKeepsPush` | |
| +| 14 | remote sentinel | `internal/runner/thin` | `TestRouterRefusalsKeepOperationIdentity` | |
| +| 15 | exists sentinel | `internal/runner/thin` | `TestRouterRefusalsKeepOperationIdentity` | |
| +| 16 | create sentinel | `internal/runner/thin` | `TestRouterRefusalsKeepOperationIdentity` | |
| +| 17 | merge sentinel | `internal/runner/thin` | `TestRouterRefusalsKeepOperationIdentity` | |
| +| 18 | hosted CI sentinel | `internal/runner/thin` | `TestRouterRefusalsKeepOperationIdentity` | |
| +| 19 | CI status sentinel | `internal/runner/thin` | `TestRouterRefusalsKeepOperationIdentity` | |
| +| 20 | invalid use identity sentinel | `internal/runner/thin` | `TestRouterRefusalsKeepOperationIdentity` | |
| +| 21 | duplicate identity sentinel | `internal/runner/thin` | `TestRouterRefusalsKeepOperationIdentity` | |
| +| 22 | branch link spelling | `internal/runner/thin` | `TestHubProposalIsOnlyALink` | |
| +| 23 | local step diagnostic | `internal/equipo/chat` | `TestProposalFailureKeepsSuccessfulPublication` | |
| +| 24 | worker step diagnostic | `internal/equipo/chat` | `TestProposalFailureKeepsSuccessfulPublication` | |
| +| 25 | step diagnostic displayed | `internal/equipo` | `TestProposalFailureDetailAndPunctuation` | |
| +| 26 | wire reason accepted | `internal/equipo/chat` | `TestProposalFailureKeepsSuccessfulPublication` | |
| + |
| +### Review verification |
| + |
| +Passed after restoration: fmt-check, gitleaks (1119 commits, no leaks), budget, |
| +migration-check, copy-release-check, lanes-check, spacing, TestPersonAPI, |
| +TestPlan3Release, TestBudgetRecordsAreShort and native fixtures (11 API, |
| +3586 markdown and 32000 seeded differential cases). |
| + |
| +Full suites passed: equipo 60.262s, chat 6.374s, thintest 208.968s, wire 0.367s, |
| +forgekey 0.249s and wireschema 0.739s. The focused thin forge, merge, hosted CI, |
| +access, proposal, router, username and initialization suite passed in 65.267s. |
| +The full runner tree was run with a four-minute per-package bound. Forge |
| +passed in 96.960s and workspace in 63.874s. As on the initial seam run, the |
| +Mac cannot pass the Linux containment/provider and host-policy fixtures; |
| +thin reached the four-minute timeout. These are not claimed as local passes. |
| +No platform guards or existing tests were weakened. Linux CI is the full |
| +runner gate. |
| + |
| +The six size exemptions changed only to measured counts: equipo 22105 source, |
| +wire 6830 source, plan3test 11899 test, thin 28446 source / 22619 test, and |
| +chat 8382 test with its existing source cap. Reasons name the diagnostic and |
| +regressions; no timing budget changed. Existing test files from main have no |
| +new substitutions in this review beyond the approved copy inventory list. |
| + |
| +### Shared Copy publication follow-up |
| + |
| +The shared Engineer.publish path also serves Copy. Before final handoff, a |
| +new regression demonstrated that the instance discarded proposal_failed on |
| +a successful Copy report. Copy now preserves the same diagnostic after its |
| +existing authorization and result validation, and its step detail shows the |
| +same approved fragment. No additional strings or wire fields were added. |
| +The successful Copy step remains done and pushed. |
| + |
| +Three more deliberate mutations were killed and restored, bringing this |
| +review's count to 29 runtime kills (58 including the earlier implementation): |
| + |
| +| Deliberate mutation | Killing regression | |
| +| --- | --- | |
| +| Drop Copy's successful-publication diagnostic | `chat.TestCopyProposalFailureKeepsSuccessfulPublication` | |
| +| Show Copy's diagnostic without a successful push | `equipo.TestCopyProposalFailureDetail` | |
| +| Add a Copy detail entry without a proposal diagnostic | `equipo.TestCopyProposalFailureDetail` | |
| + |
| +Both Copy regressions failed before the fix and passed after it. The full |
| +app, chat and thintest suites and release gates are repeated for this change. |
| +The runner code is unchanged from the preceding verified commit. |
| + |
| +The historical secret scan on 18594290 mistook the prose Equal/Normalize in |
| +this report for a credential. The sentence was rephrased and the exact |
| +commit/file/rule/line fingerprint was excluded in .gitleaksignore, with a |
| +reason. No credential was present, no broad rule was disabled and no history |
| +was rewritten. |
| + |
| +Follow-up verification passed: all release gates, PersonAPI/Plan3Release and |
| +budget-record checks. Repeated full suites: equipo 51.715s, chat 7.774s, |
| +thintest 219.940s. Final measured caps for the additional Copy path are equipo |
| +22109 source and chat 33348 source / 8399 test. All other caps above stand. |
| +The historical scan now passes over 1120 commits with no leaks. The first CI |
| +on 18594290 failed its secret-scan shard on the prose false positive; the |
| +narrow fingerprint correction is part of this follow-up commit. |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md| index 724dd0b8..0f12520d 100644 |
| --- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| @@ -6843,6 +6843,7 @@ records remain unchanged. |
| | `projects.remove_selection` | Remove project | Copy specialist | COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23) | |
| | `work.reason.no_further_changes` | it made no further changes to the candidate | Task page: fills "Engineering stopped: %s" when an Engineering step ended no_changes and an earlier round already pushed a candidate (stop reasons, 2026-11-23) | Runtime; COPY APPROVED (Paul, 2026-11-23, copy-review eavqvil43jg2zs3wxx3kxp3bpm, unchanged) | |
| | `work.reason.tools_refused` | Equipo refused the commands it needed to run | Task page: fills "Engineering stopped: %s" when an Engineering step committed nothing after Equipo refused tool requests it made (stop reasons, 2026-11-23) | Runtime; COPY APPROVED (Paul, 2026-11-23, copy-review eavqvil43jg2zs3wxx3kxp3bpm, unchanged) | |
| +| `work.reason.proposal_failed` | the branch was pushed, but the review request could not be created | Successful push diagnostic (GitHub seam, 2026-11-23; Luna, house rules) | COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23) | |
| ## Task 21 |
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..2d641dca |
| --- /dev/null |
| +++ b/docs/superpowers/specs/2026-11-22-equipo-github-connector-probe.md |
| @@ -0,0 +1,214 @@ |
| +# 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. |
| + |
| +## Organisation manifest flow: confirmed |
| + |
| +The controller confirms that private App `oficina-equipo-probe-acbafc`, |
| +ID `5891080`, was created through the manifest flow in organisation |
| +`oficina-equipo-test` and installed there on `probe` and `probe-other`. |
| +The saved full report confirms the installation lookup returned `200`, |
| +with exactly G4 permissions and no webhook events. It does not retain |
| +creation response bodies or the conversion code. |
| + |
| +The reviewed external `agent-tools/github-probe/manifest_server.py` binds |
| +only loopback. Its form posts the private App manifest with G4 permissions, |
| +an inactive webhook and empty default events to |
| +`https://github.com/organizations/oficina-equipo-test/settings/apps/new`. |
| +The callback checks its random state and the one-time code before |
| +`POST https://api.github.com/app-manifests/{code}/conversions`. |
| +It writes the returned credentials privately with mode 0600 and redirects |
| +to `https://github.com/apps/{slug}/installations/new`. Its creation response log contains only |
| +the App ID and slug. Neither credentials nor conversion values were read |
| +or copied for this record. |
| + |
| +## 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`. |
| +- Capture the workflow-push refusal cause line, as detailed below. |
| + |
| +The completed checks above do not claim these remaining gates passed. |
| + |
| +### Workflow refusal cause still to capture |
| + |
| +The saved report retains only: |
| + |
| +```text |
| +error: failed to push some refs to 'https://github.com/oficina-equipo-test/probe.git' |
| +``` |
| + |
| +It proves a nonzero push exit, but does not retain GitHub's cause line. |
| +Capturing that exact remote refusal, specifically the missing workflows |
| +permission, remains open. The complete merge table and CARLOS egress remain |
| +open as recorded above. The organisation manifest flow and Actions on an |
| +App push are confirmed. |
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/proposal_seam_test.go b/internal/equipo/chat/proposal_seam_test.go| new file mode 100644 |
| index 00000000..80557520 |
| --- /dev/null |
| +++ b/internal/equipo/chat/proposal_seam_test.go |
| @@ -0,0 +1,66 @@ |
| +package chat |
| + |
| +import ( |
| + "amadan.net/oficina/equipo/internal/copydesk" |
| + "amadan.net/oficina/equipo/internal/wire" |
| + "context" |
| + "gorm.io/gorm" |
| + "strings" |
| + "testing" |
| +) |
| + |
| +func TestProposalFailureKeepsSuccessfulPublication(t *testing.T) { |
| + for _, worker := range []bool{false, true} { |
| + t.Run(map[bool]string{false: "local", true: "worker"}[worker], func(t *testing.T) { |
| + r := placementRig(t) |
| + r.s.authority.RunnerRole = func(*gorm.DB, string) (string, error) { return wire.RolePrimary, nil } |
| + st := placementEdgeStep("s_proposal") |
| + st.CandidateSHA = strings.Repeat("a", 40) |
| + if worker { |
| + st.State = wire.StepDone |
| + st.Terminated = true |
| + st.Publication = wire.PublicationPending |
| + st.PublicationID = "pub_proposal" |
| + } |
| + if err := r.s.db.G.Create(&st).Error; err != nil { |
| + t.Fatal(err) |
| + } |
| + l := Lease{Runner: RunnerPrincipal{RunnerID: "RUNNER1", Person: hkOwner}, Protocol: wire.ProtocolCurrent} |
| + err := r.s.tx(context.Background(), func(tx *txn) error { |
| + if worker { |
| + return tx.published(l, &wire.PublishedReport{Publication: st.PublicationID, TaskID: st.TaskID, StepID: st.ID, Attempt: 1, CandidateSHA: st.CandidateSHA, Pushed: true, Reason: "proposal_failed"}) |
| + } |
| + return tx.stepReport(l, &wire.StepReport{TaskID: st.TaskID, StepID: st.ID, Attempt: 1, State: wire.StepDone, Termination: true, CandidateSHA: st.CandidateSHA, Pushed: true, Reason: "proposal_failed"}) |
| + }) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + var got stepRecord |
| + if err := r.s.db.G.First(&got, "id = ?", st.ID).Error; err != nil { |
| + t.Fatal(err) |
| + } |
| + if got.State != wire.StepDone || !got.Pushed || got.Reason != "proposal_failed" { |
| + t.Fatalf("successful push diagnostic: %+v", got) |
| + } |
| + if worker && got.Publication != wire.PublicationPublished { |
| + t.Fatal("publication failed", got.Publication) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +func TestCopyProposalFailureKeepsSuccessfulPublication(t *testing.T) { |
| + r := copyPendingRig(t, wire.StepQueued, "") |
| + r.s.authority.RunnerRole = func(*gorm.DB, string) (string, error) { return wire.RolePrimary, nil } |
| + r.exec("UPDATE chat_steps SET runner_id='RUNNER1' WHERE id='copy'") |
| + c := &wire.CopyResult{Owner: hkOwner, Delegation: 1, Input: strings.Repeat("a", 40), Compared: strings.Repeat("b", 40), Extraction: copydesk.Extraction{Version: 1}, Review: copydesk.Review{Version: 1}, Tokens: 100, UsageKnown: true} |
| + report := wire.StepReport{TaskID: "tkcopy", StepID: "copy", Attempt: 1, State: wire.StepDone, Termination: true, Pushed: true, CandidateSHA: c.Input, Copy: c, Reason: "proposal_failed"} |
| + r.must(r.tx(func(tx *txn) error { |
| + return tx.stepReport(Lease{Runner: RunnerPrincipal{RunnerID: "RUNNER1", Person: hkOwner}, Protocol: wire.ProtocolCopy}, &report) |
| + })) |
| + var got stepRecord |
| + r.must(r.s.db.G.First(&got, "id='copy'").Error) |
| + if got.State != wire.StepDone || !got.Pushed || got.Reason != "proposal_failed" { |
| + t.Fatalf("Copy push diagnostic: %+v", got) |
| + } |
| +} |
diff --git a/internal/equipo/chat/tasks.go b/internal/equipo/chat/tasks.go| index 6a80e7da..51c6b422 100644 |
| --- a/internal/equipo/chat/tasks.go |
| +++ b/internal/equipo/chat/tasks.go |
| @@ -17,6 +17,7 @@ import ( |
| "amadan.net/oficina/equipo/internal/equipo/housekeeping" |
| "amadan.net/oficina/equipo/internal/equipo/mergegate" |
| "amadan.net/oficina/equipo/internal/wire" |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| "gorm.io/gorm" |
| ) |
| @@ -404,7 +405,7 @@ func TaskLink(id string) string { return "/tasks/" + id } |
| // BranchURL opens a task branch on Amadan. |
| func BranchURL(repo, branch string) string { |
| - return "https://" + repo + "?branch=" + branch |
| + return forgekey.HubBranchURL(repo, branch) |
| } |
| func (t *txn) attachments(projectID string) ([]wire.Attachment, error) { |
| @@ -1499,6 +1500,9 @@ func (t *txn) stepReport(l Lease, v *wire.StepReport) error { |
| if err := t.copyDone(l, &k, &s, v); err != nil { |
| return err |
| } |
| + if v.Reason == "proposal_failed" { |
| + s.Reason = v.Reason |
| + } |
| case wire.SpecialistEngineering: |
| // Done is only for the attempt's own candidate: pushed by the |
| // primary, or committed by a worker (the primary publishes it). |
| @@ -1508,6 +1512,9 @@ func (t *txn) stepReport(l Lease, v *wire.StepReport) error { |
| // Pushed is the primary's word: for a worker's commit only the |
| // primary's published report sets it, and this report keeps it. |
| if role == wire.RolePrimary { |
| + if v.Reason == "proposal_failed" { |
| + s.Reason = v.Reason |
| + } |
| s.Pushed = true |
| } |
| s.Apple = v.Apple |
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/chat/transfers.go b/internal/equipo/chat/transfers.go| index 0efdfdbc..40570913 100644 |
| --- a/internal/equipo/chat/transfers.go |
| +++ b/internal/equipo/chat/transfers.go |
| @@ -257,6 +257,9 @@ func (t *txn) published(l Lease, v *wire.PublishedReport) error { |
| } |
| if v.Pushed { |
| s.Pushed, s.Publication = true, wire.PublicationPublished |
| + if v.Reason == "proposal_failed" { |
| + s.Reason = v.Reason |
| + } |
| } else { |
| s.Publication = wire.PublicationFailed |
| switch v.Reason { |
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go| index b5a1e9f9..40979234 100644 |
| --- a/internal/equipo/copy.go |
| +++ b/internal/equipo/copy.go |
| @@ -923,6 +923,7 @@ var pageCopy = map[string]string{ |
| "work.reason.no_changes": "nothing needed changing", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "work.reason.no_further_changes": "it made no further changes to the candidate", // COPY APPROVED (Paul, 2026-11-23, copy-review eavqvil43jg2zs3wxx3kxp3bpm, unchanged) |
| "work.reason.tools_refused": "Equipo refused the commands it needed to run", // COPY APPROVED (Paul, 2026-11-23, copy-review eavqvil43jg2zs3wxx3kxp3bpm, unchanged) |
| + "work.reason.proposal_failed": "the branch was pushed, but the review request could not be created", // COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23) |
| "work.reason.push_failed": "the push to Amadan failed", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "work.reason.push_conflict": "the branch changed on Amadan", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "work.reason.step_timeout": "it ran out of time", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
diff --git a/internal/equipo/proposal_seam_test.go b/internal/equipo/proposal_seam_test.go| new file mode 100644 |
| index 00000000..acfdcd5f |
| --- /dev/null |
| +++ b/internal/equipo/proposal_seam_test.go |
| @@ -0,0 +1,57 @@ |
| +package equipo |
| + |
| +import ( |
| + "amadan.net/oficina/equipo/internal/wire" |
| + "fmt" |
| + "strings" |
| + "testing" |
| +) |
| + |
| +func TestProposalFailureDetailAndPunctuation(t *testing.T) { |
| + const want = "The branch was pushed, but the review request could not be created." |
| + line := reasonLine("proposal_failed", "") |
| + stopped := fmt.Sprintf(copyText("work.stopped"), line) |
| + if line != want || stopped != "Stopped: "+want || strings.Count(line, ".") != 1 || strings.Count(stopped, ".") != 1 { |
| + t.Fatalf("reason %q, stopped %q", line, stopped) |
| + } |
| + task := wire.Task{ID: "tk1", Stage: wire.StageInProgress, Steps: []wire.Step{{Specialist: wire.SpecialistEngineering, State: wire.StepDone, Pushed: true, Reason: "proposal_failed", CandidateSHA: strings.Repeat("a", 40)}}} |
| + for _, it := range timelineOf(task, taskLineOf(task, "")) { |
| + if it.Kind == "stopped" { |
| + t.Fatal("successful push shown as stopped") |
| + } |
| + for _, text := range it.Text { |
| + if text == want { |
| + return |
| + } |
| + } |
| + } |
| + t.Fatal("successful step has no proposal diagnostic") |
| +} |
| + |
| +func TestCopyProposalFailureDetail(t *testing.T) { |
| + for _, tc := range []struct { |
| + pushed bool |
| + reason string |
| + }{{true, "proposal_failed"}, {false, "proposal_failed"}, {true, ""}} { |
| + task := wire.Task{ID: "tkcopy", Stage: wire.StageInReview, Steps: []wire.Step{{Specialist: wire.SpecialistCopy, State: wire.StepDone, Pushed: tc.pushed, Reason: tc.reason, CandidateSHA: strings.Repeat("a", 40)}}} |
| + items := timelineOf(task, taskLineOf(task, "")) |
| + if !tc.pushed || tc.reason == "" { |
| + if len(items) != 1 { |
| + t.Fatalf("irrelevant Copy diagnostic: %+v", items) |
| + } |
| + continue |
| + } |
| + found := false |
| + for _, it := range items { |
| + if it.Kind == "stopped" { |
| + t.Fatal("successful Copy push shown as stopped") |
| + } |
| + for _, text := range it.Text { |
| + found = found || text == reasonLine("proposal_failed", "") |
| + } |
| + } |
| + if !found { |
| + t.Fatal("Copy step has no proposal diagnostic") |
| + } |
| + } |
| +} |
diff --git a/internal/equipo/setup/forgekey_test.go b/internal/equipo/setup/forgekey_test.go| new file mode 100644 |
| index 00000000..2498ddc0 |
| --- /dev/null |
| +++ b/internal/equipo/setup/forgekey_test.go |
| @@ -0,0 +1,20 @@ |
| +package setup |
| + |
| +import ( |
| + "errors" |
| + "testing" |
| +) |
| + |
| +func TestCanonicalRepositoryRequiresFullHubKey(t *testing.T) { |
| + invalid := errors.New("invalid fixture") |
| + for _, raw := range []string{"amadan.net/a", "https://amadan.net/a", "amadan.net", "oficina/site", "github.com/oficina/site"} { |
| + if got, err := CanonicalRepository(raw, invalid); !errors.Is(err, invalid) || got != "" { |
| + t.Errorf("incomplete or non-hub key %q accepted: %q %v", raw, got, err) |
| + } |
| + } |
| + for _, raw := range []string{"amadan.net/oficina/site", "https://amadan.net/oficina/site", " https://amadan.net/oficina/site "} { |
| + if got, err := CanonicalRepository(raw, invalid); err != nil || got != "amadan.net/oficina/site" { |
| + t.Errorf("valid hub key %q: %q %v", raw, got, err) |
| + } |
| + } |
| +} |
diff --git a/internal/equipo/setup/projects.go b/internal/equipo/setup/projects.go| index d8d480c2..141055db 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 || key.String() != u.Host+u.Path { |
| 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/equipo/work_views.go b/internal/equipo/work_views.go| index 2b2f626f..e8dc1a1e 100644 |
| --- a/internal/equipo/work_views.go |
| +++ b/internal/equipo/work_views.go |
| @@ -1129,10 +1129,17 @@ func timelineOf(t wire.Task, v taskLine) []timelineItem { |
| continue |
| } |
| switch s.Specialist { |
| + case wire.SpecialistCopy: |
| + if s.Pushed && s.Reason == "proposal_failed" { |
| + out = append(out, timelineItem{Kind: "step", What: title, At: s.FinishedAt, Text: []string{reasonLine(s.Reason, "")}}) |
| + } |
| case wire.SpecialistEngineering: |
| it := timelineItem{Kind: "step", What: title, Took: took(s), Headline: headline(s.Headline, s.Summary), Markdown: s.Summary, At: s.FinishedAt} |
| if s.Pushed { |
| it.Text = append(it.Text, fmt.Sprintf(copyText("work.tl.pushed"), short(s.CandidateSHA))) |
| + if s.Reason == "proposal_failed" { |
| + it.Text = append(it.Text, reasonLine(s.Reason, "")) |
| + } |
| } |
| out = append(out, it) |
| case wire.SpecialistChecks: |
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/plan3test/plan3_release_test.go b/internal/plan3test/plan3_release_test.go| index c6788077..ea13c803 100644 |
| --- a/internal/plan3test/plan3_release_test.go |
| +++ b/internal/plan3test/plan3_release_test.go |
| @@ -198,11 +198,12 @@ func plan3CopyInventory(t *testing.T) { |
| // Paul, 2026-11-22: Luna verdicts and the controller clarification are this slice's review. |
| acceptedAPIErrors := slices.Contains([]string{"api.repo_not_allowed", "api.card_answered", "api.card_stale", "api.confirmation_required", "api.coordinator_busy", "api.hold_bar", "api.idempotency_conflict", "api.models_not_allowed", "api.not_active", "api.not_askable", "api.not_mergeable", "api.not_retryable", "api.question_ended", "api.runner_offline", "api.task_busy", "api.task_ended", "api.task_merging", "api.turn_ended"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)") |
| acceptedNativeProjects := slices.Contains([]string{"projects.new_request", "projects.remove_selection"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)") |
| + acceptedForgeSeam := key == "work.reason.proposal_failed" && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)") |
| acceptedCardNames := slices.Contains([]string{"projects.carried_selection", "projects.remember_name", "projects.name_to_remember", "projects.use_title", "docs/api/equipo-v1.md / Projects and starting a request"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-23)") |
| acceptedProjects := slices.Contains([]string{"projects.amadan", "projects.yours", "projects.can_add", "projects.add_reachable", "projects.names", "projects.names_hint", "projects.details", "projects.title", "projects.description", "projects.save", "projects.context", "projects.found", "projects.selected", "projects.owner_add", "projects.selection_lost", "projects.other", "projects.name_question", "projects.personal_names", "projects.forget_name", "docs/api/equipo-v1.md / Projects and starting a request"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-22)") |
| acceptedAgentAccess := slices.Contains([]string{"copyAgentConfig", "copyAgentForbidden", "copyAgentNotFound", "copyAgentUnavailable", "copyAgentTooLarge", "copyAgentInvalid", "copyAgentMedia", "copyAgentUnauthenticated", "agent.equipo_projects_list", "agent.equipo_tasks_list", "agent.equipo_task_get", "agent.equipo_needs_you", "docs/api/equipo-v1.md / Delegated read-only operations"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY ACCEPTED BY DELEGATION (Luna, 2026-11-20)") |
| acceptedCopy := strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED BY DELEGATION (Copy, record-bound) sha256:"+copydesk.Hash(rows[key]) |
| - if !acceptedAPIErrors && !acceptedNativeProjects && !acceptedInjection && !acceptedMail && !acceptedPush && !acceptedAgentAccess && !acceptedProjects && !acceptedCardNames && !acceptedAccess && !acceptedPlacementEdges && !acceptedPlacement && !acceptedReportActions && !acceptedRoster && !acceptedCopy && !strings.Contains(cells[3], "COPY REVIEW REQUIRED") && !acceptedAll && !acceptedGuide && !acceptedRound2 && !acceptedStarter && !acceptedDelegation && !approvedPublish && !approvedAssistant && !approvedJobs && !approvedOficina && !approvedFailedReplies && !approvedStopReasons { |
| + if !acceptedForgeSeam && !acceptedAPIErrors && !acceptedNativeProjects && !acceptedInjection && !acceptedMail && !acceptedPush && !acceptedAgentAccess && !acceptedProjects && !acceptedCardNames && !acceptedAccess && !acceptedPlacementEdges && !acceptedPlacement && !acceptedReportActions && !acceptedRoster && !acceptedCopy && !strings.Contains(cells[3], "COPY REVIEW REQUIRED") && !acceptedAll && !acceptedGuide && !acceptedRound2 && !acceptedStarter && !acceptedDelegation && !approvedPublish && !approvedAssistant && !approvedJobs && !approvedOficina && !approvedFailedReplies && !approvedStopReasons { |
| t.Fatal("entry has no copy review status or applicable acceptance", key) |
| } |
| } |
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/push_detail.go b/internal/runner/forge/push_detail.go| index 2c37c2d8..2795ce6e 100644 |
| --- a/internal/runner/forge/push_detail.go |
| +++ b/internal/runner/forge/push_detail.go |
| @@ -133,7 +133,7 @@ func pushAnswer(stdout, stderr string, remote *workspace.Remote) string { |
| } |
| text := strings.Join(lines, "\n") |
| if remote != nil && len(remote.GitPassword) >= 8 { |
| - text = strings.ReplaceAll(text, base64.StdEncoding.EncodeToString([]byte("x:"+remote.GitPassword)), "***") |
| + text = strings.ReplaceAll(text, base64.StdEncoding.EncodeToString([]byte(remote.Username()+":"+remote.GitPassword)), "***") |
| text = strings.ReplaceAll(text, remote.GitPassword, "***") |
| } |
| return runnerproto.RedactDetail(text, runnerproto.DetailLimit) |
diff --git a/internal/runner/forge/username_test.go b/internal/runner/forge/username_test.go| new file mode 100644 |
| index 00000000..e518a4fe |
| --- /dev/null |
| +++ b/internal/runner/forge/username_test.go |
| @@ -0,0 +1,43 @@ |
| +package forge |
| + |
| +import ( |
| + "context" |
| + "encoding/base64" |
| + "os" |
| + "path/filepath" |
| + "strings" |
| + "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) |
| + } |
| + } |
| +} |
| + |
| +func TestPushDetailScrubsRemoteUsername(t *testing.T) { |
| + remote := workspace.Remote{URL: "https://github.com/o/r", GitPassword: "abc12345", GitUsername: "x-access-token"} |
| + encoded := base64.StdEncoding.EncodeToString([]byte(remote.Username() + ":" + remote.GitPassword)) |
| + answer := pushAnswer("! rejected", "remote: diagnostic "+encoded+" "+remote.GitPassword, &remote) |
| + tail := PushDetail(&PushError{Op: "push", Answer: answer, Err: ErrPushUncertain}) |
| + if strings.Contains(tail, encoded) || strings.Contains(tail, remote.GitPassword) || !strings.Contains(tail, "diagnostic") { |
| + t.Fatalf("credentials leaked or detail lost: %q", tail) |
| + } |
| +} |
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..ee0d9f89 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,7 +432,7 @@ 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 || errors.Is(err, forge.ErrPushRefused) || errors.Is(err, forge.ErrPushConflict) || ctx.Err() != nil { |
| @@ -447,6 +448,11 @@ func (e *Engineer) publish(ctx context.Context, r stepRow, rep wire.StepReport) |
| // The private repository stays until the instance has acked this |
| // report (Sweep): a crash before then reconciles from it. |
| rep.State, rep.Reason, rep.Pushed = wire.StepDone, "", true |
| + // A proposal is subsequent metadata, not the outcome of the push. |
| + // Its raw error may contain credentials and never enters the report. |
| + if _, proposalErr := e.Forge.Propose(ctx, Proposal{Repo: r.Repo, Branch: r.Branch}); proposalErr != nil { |
| + rep.Reason = "proposal_failed" |
| + } |
| case errors.Is(err, forge.ErrPushConflict): |
| rep.State, rep.Reason = wire.StepFailed, "push_conflict" |
| default: |
| @@ -597,7 +603,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..c2828e79 |
| --- /dev/null |
| +++ b/internal/runner/thin/forges.go |
| @@ -0,0 +1,180 @@ |
| +package thin |
| + |
| +import ( |
| + "context" |
| + "errors" |
| + "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" |
| +) |
| + |
| +// ErrForgeUse and ErrForgeDuplicate identify configuration errors separately |
| +// from a repository key rejected by routing. |
| +var ErrForgeUse = errors.New("invalid forge credential use") |
| +var ErrForgeDuplicate = errors.New("duplicate forge registration") |
| + |
| +// 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()) { |
| + return nil, forgekey.ErrKey |
| + } |
| + if f.byHost[fg.Host()] != nil { |
| + return nil, ErrForgeDuplicate |
| + } |
| + 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{}, errors.Join(workspace.ErrGitPassword, ErrForgeUse) |
| + } |
| + fg, key, err := f.route(repo) |
| + if err != nil { |
| + return workspace.Remote{}, errors.Join(workspace.ErrGitPassword, 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, errors.Join(ErrNoCreate, 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 errors.Join(ErrNoCreate, 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{}, errors.Join(forge.ErrMergeRefused, 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, errors.Join(forge.ErrCIRead, 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{}, errors.Join(forge.ErrCIRead, 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: forgekey.HubBranchURL(k.String(), p.Branch)}, nil |
| +} |
diff --git a/internal/runner/thin/forges_review_test.go b/internal/runner/thin/forges_review_test.go| new file mode 100644 |
| index 00000000..57c1860d |
| --- /dev/null |
| +++ b/internal/runner/thin/forges_review_test.go |
| @@ -0,0 +1,141 @@ |
| +package thin |
| + |
| +import ( |
| + "context" |
| + "encoding/base64" |
| + "encoding/json" |
| + "errors" |
| + "fmt" |
| + "net/http" |
| + "os" |
| + "path/filepath" |
| + "reflect" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/runner/forge" |
| + "amadan.net/oficina/equipo/internal/runner/workspace" |
| + "amadan.net/oficina/equipo/internal/wire/forgekey" |
| +) |
| + |
| +func TestRouterRefusalsKeepOperationIdentity(t *testing.T) { |
| + ctx := context.Background() |
| + f, _ := NewForges(&routeForge{host: forgekey.Hub}) |
| + for _, repo := range []string{"github.com/a", "github.com/o/r", "bad"} { |
| + _, remote := f.Remote(ctx, repo, Read) |
| + _, exists := f.Exists(ctx, repo) |
| + create := f.Create(ctx, repo) |
| + _, merge := f.Merge(ctx, repo, "main", forge.MergeRequest{}) |
| + _, hosted := f.CIHosted(ctx, repo) |
| + _, status := f.CIStatus(ctx, repo, "main", forge.CILogsNone) |
| + for _, tc := range []struct{ got, want error }{{remote, workspace.ErrGitPassword}, {exists, ErrNoCreate}, {create, ErrNoCreate}, {merge, forge.ErrMergeRefused}, {hosted, forge.ErrCIRead}, {status, forge.ErrCIRead}} { |
| + if !errors.Is(tc.got, tc.want) || !errors.Is(tc.got, forgekey.ErrKey) { |
| + t.Errorf("%q: %v lost %v or key identity", repo, tc.got, tc.want) |
| + } |
| + } |
| + } |
| + _, use := f.Remote(ctx, "o/r", Use(99)) |
| + _, duplicate := NewForges(&routeForge{host: forgekey.Hub}, &routeForge{host: forgekey.Hub}) |
| + if !errors.Is(use, ErrForgeUse) || !errors.Is(duplicate, ErrForgeDuplicate) || errors.Is(use, forgekey.ErrKey) || errors.Is(duplicate, forgekey.ErrKey) || errors.Is(use, duplicate) || !errors.Is(use, workspace.ErrGitPassword) { |
| + t.Fatalf("use and registration need distinct identities: %v / %v", use, duplicate) |
| + } |
| +} |
| + |
| +func TestRouterWithProductionFileForge(t *testing.T) { |
| + ctx := context.Background() |
| + const repo = "amadan.net/carlos/platform" |
| + const branch = "equipo/t1-fix" |
| + const sha = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| + var calls []string |
| + ff := accessForge(t, func(w http.ResponseWriter, r *http.Request) { |
| + calls = append(calls, r.Method+" "+r.URL.Path) |
| + if r.Header.Get("Authorization") != "Bearer SECRET-ACCESS-TOKEN" { |
| + t.Error("missing hub credential") |
| + } |
| + switch r.URL.Path { |
| + case "/api/v1/repos": |
| + fmt.Fprint(w, `{"repos":[{"ns":"carlos","name":"platform"}]}`) |
| + case "/api/v1/repos/carlos/platform/branches/" + branch + "/merge": |
| + var req forge.MergeRequest |
| + if err := json.NewDecoder(r.Body).Decode(&req); err != nil || req.ExpectSHA != sha { |
| + t.Errorf("merge request: %+v %v", req, err) |
| + } |
| + fmt.Fprintf(w, `{"merged":true,"sha":%q,"into":"main"}`, sha) |
| + case "/api/v1/repos/carlos/platform/ci/hosted": |
| + fmt.Fprint(w, `{"on":true}`) |
| + case "/api/v1/repos/carlos/platform/ci/status": |
| + if r.URL.Query().Get("branch") != branch || r.URL.Query().Get("logs") != forge.CILogsFailed { |
| + t.Error("CI query lost") |
| + } |
| + fmt.Fprintf(w, `{"ns":"carlos","repo":"platform","branch":%q,"sha":%q,"state":"passed"}`, branch, sha) |
| + case "/api/v1/agents/access-requests": |
| + w.WriteHeader(201) |
| + writeAccess(w, "ar_one", "pending") |
| + case "/api/v1/agents/access-requests/ar_one": |
| + writeAccess(w, "ar_one", "approved") |
| + default: |
| + t.Error("unexpected route", r.URL) |
| + w.WriteHeader(404) |
| + } |
| + }) |
| + if ff.Host() != forgekey.Hub { |
| + t.Fatalf("production forge host: %q", ff.Host()) |
| + } |
| + f, err := NewForges(ff) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + for _, use := range []Use{Read, Push} { |
| + remote, err := f.Remote(ctx, repo, use) |
| + if err != nil || remote.URL != "https://"+repo || remote.GitPassword != "SECRET-GIT-TOKEN" { |
| + t.Fatalf("remote %d: %+v %v", use, remote, err) |
| + } |
| + } |
| + res, err := f.Merge(ctx, repo, branch, forge.MergeRequest{ExpectSHA: sha}) |
| + if err != nil || !res.Merged || res.SHA != sha { |
| + t.Fatalf("merge: %+v %v", res, err) |
| + } |
| + if hosted, err := f.CIHosted(ctx, repo); err != nil || !hosted { |
| + t.Fatal("hosted", hosted, err) |
| + } |
| + if status, err := f.CIStatus(ctx, repo, branch, forge.CILogsFailed); err != nil || status.SHA != sha || status.State != "passed" { |
| + t.Fatal("CI", status, err) |
| + } |
| + c := accessCommand() |
| + if rep, err := f.RequestAccess(ctx, c); err != nil || rep.State != "pending" { |
| + t.Fatal("request", rep, err) |
| + } |
| + if rep, err := f.PollAccess(ctx, "ar_one", c); err != nil || rep.State != "approved" { |
| + t.Fatal("poll", rep, err) |
| + } |
| + want := []string{"GET /api/v1/repos", "POST /api/v1/repos/carlos/platform/branches/" + branch + "/merge", "GET /api/v1/repos/carlos/platform/ci/hosted", "GET /api/v1/repos/carlos/platform/ci/status", "POST /api/v1/agents/access-requests", "GET /api/v1/agents/access-requests/ar_one"} |
| + if !reflect.DeepEqual(calls, want) { |
| + t.Fatalf("hub calls: %v", calls) |
| + } |
| +} |
| + |
| +type usernameForge struct { |
| + Forge |
| + remote workspace.Remote |
| +} |
| + |
| +func (f usernameForge) Remote(context.Context, string, Use) (workspace.Remote, error) { |
| + return f.remote, nil |
| +} |
| +func TestHeadsUsesRemoteUsername(t *testing.T) { |
| + root := t.TempDir() |
| + script := filepath.Join(root, "git") |
| + capture := filepath.Join(root, "header") |
| + if err := os.WriteFile(script, []byte("#!/bin/sh\nprintf '%s' \"$GIT_CONFIG_VALUE_9\" > '"+capture+"'\n"), 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + remote := workspace.Remote{URL: "https://github.com/o/r", GitPassword: "fixture-password", GitUsername: "x-access-token"} |
| + c := Clones{Root: root, Git: script, Forge: usernameForge{remote: remote}} |
| + if _, _, _, err := c.Heads(context.Background(), "github.com/o/r", nil); err != nil && !errors.Is(err, ErrEmptyRepo) { |
| + t.Fatal(err) |
| + } |
| + got, err := os.ReadFile(capture) |
| + want := "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte("x-access-token:fixture-password")) |
| + if err != nil || string(got) != want { |
| + t.Fatalf("heads header %q: %v", got, err) |
| + } |
| +} |
diff --git a/internal/runner/thin/forges_test.go b/internal/runner/thin/forges_test.go| new file mode 100644 |
| index 00000000..0c54b1ca |
| --- /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 f.host + "-agent" } |
| +func (f *routeForge) CreateIn(context.Context) []string { return []string{f.host + "-namespace"} } |
| +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{"amadan.net/a", "github.com/a", "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() != "amadan.net-agent" || !reflect.DeepEqual(f.CreateIn(context.Background()), []string{"amadan.net-namespace"}) { |
| + 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/t1-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/merge.go b/internal/runner/thin/merge.go| index ac839f2c..995ef764 100644 |
| --- a/internal/runner/thin/merge.go |
| +++ b/internal/runner/thin/merge.go |
| @@ -294,7 +294,7 @@ func (c *Clones) Heads(ctx context.Context, repo string, branches []string) (str |
| } 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)) |
| } |
| // main as well: when HEAD names no default (an empty repository, or a |
| // task branch a hub rebuild pointed it at), main decides, in this one |
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..10611ba2 |
| --- /dev/null |
| +++ b/internal/runner/thin/proposal_seam_test.go |
| @@ -0,0 +1,147 @@ |
| +package thin |
| + |
| +import ( |
| + "amadan.net/oficina/equipo/internal/runner/workspace" |
| + "amadan.net/oficina/equipo/internal/wire" |
| + "context" |
| + "errors" |
| + "path/filepath" |
| + "reflect" |
| + "strings" |
| + "testing" |
| +) |
| + |
| +type proposalSpy struct { |
| + Forge |
| + calls []Proposal |
| + failure error |
| + 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) |
| + } |
| + if f.failure != nil { |
| + return ProposalRef{}, f.failure |
| + } |
| + 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") |
| + } |
| + }} |
| + authority := &useSpy{Forge: spy} |
| + e.Forge = authority |
| + rep := e.publish(context.Background(), r, wire.StepReport{}) |
| + if !reflect.DeepEqual(authority.uses, []Use{Push}) { |
| + t.Fatalf("publish authority %v", authority.uses) |
| + } |
| + 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") |
| + } |
| + }} |
| + authority := &useSpy{Forge: spy} |
| + r.e.Forge = authority |
| + r.receive(t, r.pack, r.header()) |
| + r.publish(t, "pb_1") |
| + r.relay.Once(context.Background()) |
| + if !reflect.DeepEqual(authority.uses, []Use{Push}) { |
| + t.Fatalf("relay authority %v", authority.uses) |
| + } |
| + 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) |
| + } |
| +} |
| + |
| +func TestEngineeringProposalFailureKeepsPush(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, failure: errors.New("private raw forge diagnostic"), 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") |
| + } |
| + }} |
| + authority := &useSpy{Forge: spy} |
| + e.Forge = authority |
| + rep := e.publish(context.Background(), r, wire.StepReport{}) |
| + if !reflect.DeepEqual(authority.uses, []Use{Push}) { |
| + t.Fatalf("publish authority %v", authority.uses) |
| + } |
| + if !rep.Pushed || rep.State != wire.StepDone || rep.Reason != "proposal_failed" || len(spy.calls) != 1 || strings.Contains(rep.LogTail, "private raw") { |
| + t.Fatalf("report %+v proposals %+v", rep, spy.calls) |
| + } |
| +} |
| + |
| +func TestRelayProposalFailureKeepsPush(t *testing.T) { |
| + r := newRelayRig(t) |
| + spy := &proposalSpy{Forge: r.f, failure: errors.New("private raw forge diagnostic"), 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") |
| + } |
| + }} |
| + authority := &useSpy{Forge: spy} |
| + r.e.Forge = authority |
| + r.receive(t, r.pack, r.header()) |
| + r.publish(t, "pb_1") |
| + r.relay.Once(context.Background()) |
| + if !reflect.DeepEqual(authority.uses, []Use{Push}) { |
| + t.Fatalf("relay authority %v", authority.uses) |
| + } |
| + r.relay.Once(context.Background()) |
| + reps := r.reports(t) |
| + if len(reps) != 1 || !reps[0].Pushed || reps[0].Reason != "proposal_failed" || r.pushCount() != 1 { |
| + t.Fatalf("publication: %+v pushes %d", reps, r.pushCount()) |
| + } |
| + if len(spy.calls) != 1 { |
| + t.Fatalf("proposals %+v", spy.calls) |
| + } |
| +} |
diff --git a/internal/runner/thin/relay.go b/internal/runner/thin/relay.go| index 2ec73298..6ee8e5b1 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,7 +483,7 @@ 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 relayFault != nil && relayFault("pushed") { |
| return rep, false |
| @@ -490,6 +491,9 @@ func (e *Engineer) publishWorker(ctx context.Context, p pubRow) (wire.PublishedR |
| switch { |
| case err == nil: |
| rep.Pushed = true |
| + if _, proposalErr := e.Forge.Propose(ctx, Proposal{Repo: p.Repo, Branch: p.Branch}); proposalErr != nil { |
| + rep.Reason = "proposal_failed" |
| + } |
| return rep, true |
| case errors.Is(refused, ErrWithdrawn): |
| return fail("cancelled") |
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/budget_test.go b/internal/wire/forgekey/budget_test.go| new file mode 100644 |
| index 00000000..437945cd |
| --- /dev/null |
| +++ b/internal/wire/forgekey/budget_test.go |
| @@ -0,0 +1,9 @@ |
| +package forgekey |
| + |
| +import ( |
| + "amadan.net/rastrillo/rastrillo/budget" |
| + "os" |
| + "testing" |
| +) |
| + |
| +func TestMain(m *testing.M) { os.Exit(budget.Main(m)) } |
diff --git a/internal/wire/forgekey/key.go b/internal/wire/forgekey/key.go| new file mode 100644 |
| index 00000000..a25b6a58 |
| --- /dev/null |
| +++ b/internal/wire/forgekey/key.go |
| @@ -0,0 +1,92 @@ |
| +// 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 { |
| + if KnownHost(parts[0]) { |
| + return Key{}, ErrKey |
| + } |
| + 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+"/") } |
| + |
| +// HubBranchURL preserves the hub's existing branch-link spelling. |
| +// Callers validate the repository and branch at their admission boundary. |
| +func HubBranchURL(repo, branch string) string { return "https://" + repo + "?branch=" + branch } |
diff --git a/internal/wire/forgekey/key_test.go b/internal/wire/forgekey/key_test.go| new file mode 100644 |
| index 00000000..eff11c58 |
| --- /dev/null |
| +++ b/internal/wire/forgekey/key_test.go |
| @@ -0,0 +1,78 @@ |
| +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", "amadan.net/a", "github.com/a", "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") |
| + } |
| +} |
| + |
| +func TestNormalizationAndEqualityAgree(t *testing.T) { |
| + for _, raw := range []string{"amadan.net/a", "github.com/a"} { |
| + normalized := Normalize(raw) |
| + if normalized != raw || Equal(raw, "amadan.net/"+raw) || Equal(normalized, "amadan.net/"+raw) { |
| + t.Fatalf("truncated host changed identity: %q -> %q", raw, normalized) |
| + } |
| + if _, err := Parse(normalized); err == nil { |
| + t.Fatalf("normalized truncated host accepted: %q", normalized) |
| + } |
| + } |
| + for _, raw := range []string{"oficina/site", "amadan.net/oficina/site", "github.com/Oficina/Site"} { |
| + if !Equal(raw, Normalize(raw)) { |
| + t.Fatalf("normalization changed identity: %q", raw) |
| + } |
| + } |
| +} |
diff --git a/internal/wire/runners.go b/internal/wire/runners.go| index 501afdf2..4f73d801 100644 |
| --- a/internal/wire/runners.go |
| +++ b/internal/wire/runners.go |
| @@ -515,6 +515,7 @@ type PublishCommand struct { |
| // PublishedReport is the primary's answer to a publish: Pushed, or the |
| // reason it was not (push_failed, push_conflict, candidate_unavailable, |
| // cancelled). |
| +// A successful push may carry proposal_failed as a diagnostic only. |
| type PublishedReport struct { |
| Publication string `json:"publication"` |
| TaskID string `json:"task_id"` |
diff --git a/internal/wire/tasks.go b/internal/wire/tasks.go| index d4247d56..4d3859fe 100644 |
| --- a/internal/wire/tasks.go |
| +++ b/internal/wire/tasks.go |
| @@ -995,6 +995,7 @@ var StepReasons = map[string]bool{ |
| "workspace_refused": true, |
| "clone_failed": true, |
| "push_failed": true, |
| + "proposal_failed": true, |
| "push_conflict": true, |
| "superseded": true, |
| "interrupted": true, |