oficina / equipo Public

Add Oficina ID sign-in to the native apps

Adopt the shared onboarding, renew Equipo device credentials, preserve pairing and push sign-out, and verify shared entitlements and Mac profile embedding.
Co-Authored-By: Codex GPT-6-Astra <noreply@openai.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 7f4e1006df5e8fa1b2ad3456b16b806428cd7a28 parent 257303d
26 files changed, +1,248 −23
  • native/OFICINA-ID-REPORT.md +148 −0
  • native/apple/Package.resolved +2 −2
  • native/apple/Package.swift +2 −2
  • native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings +55 −0
  • native/apple/Sources/EquipoKit/API/Transport.swift +10 −1
  • native/apple/Sources/EquipoKit/OficinaID/EquipoOficinaID.swift +233 −0
  • native/apple/Sources/EquipoKit/OficinaID/EquipoRenewingTransport.swift +49 −0
  • native/apple/Sources/EquipoKit/Pairing/DeviceAccount.swift +5 −0
  • native/apple/Sources/EquipoKit/Push/PhoneDelegate.swift +3 −0
  • native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings +55 −0
  • native/apple/Sources/EquipoKit/Session/EquipoSession.swift +9 −1
  • native/apple/Sources/EquipoKit/UI/Screens/AccountScreen.swift +7 −3
  • native/apple/Sources/EquipoKit/UI/Screens/AppModel.swift +77 −8
  • native/apple/Sources/EquipoKit/UI/Screens/OficinaAccountMenu.swift +39 −0
  • native/apple/Sources/EquipoKit/UI/Screens/OficinaNotice.swift +25 −0
  • native/apple/Sources/EquipoKit/UI/Screens/PhoneRoot.swift +7 −3
  • native/apple/Sources/EquipoKit/UI/Screens/SignInView.swift +47 −0
  • native/apple/Sources/EquipoMac/EquipoMacApp.swift +6 −2
  • native/apple/Tests/EquipoKitTests/OficinaIDTests.swift +383 −0
  • native/apple/Tests/EquipoKitTests/Support.swift +3 −0
  • native/ios/EquipoPhone.entitlements +10 −0
  • native/macos/DeveloperID.entitlements +10 −0
  • native/scripts/build-mac.sh +3 −0
  • native/scripts/check-native.sh +2 −0
  • native/scripts/check-oficina-id.py +52 −0
  • native/scripts/strings.json +6 −1

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/native__oficina-id: Type  Size Avail | ext4   96G   85G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type  Size Avail | ext4   96G   85G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 2.2s
ci-box: codex: fetched and verified in 3.4s
ci-box: codex-code-mode-host: fetched and verified in 1.3s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.8s
ci-box: pi: installed and verified in 7.4s
ci-box: opencode: installed and verified in 1.9s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.6s
ci-box: clone deepened in 3.5s
ci-box: file times set from content: 2811 files, 185 directories
ci-box: ready in 16.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.241s
=== compile ===
go build ./...
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py compile
+ go build -tags testbuild ./...
  1.1s
+ go list -export -test -tags testbuild -f  ./...
  0.6s
+ go list -export -test -tags browser,testbuild -f  ./internal/equipo ./internal/headless ./internal/idtest ./internal/plan3test ./internal/thintest
  0.3s
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
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m19.289s 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.749s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m17.75s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 34.40, cpu waiting 20.49%, memory waiting 0.00%, io waiting 1.09%
--- 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
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m20.572s 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 1m19.043s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m19.04s amadan.net/oficina/equipo/internal/headless TestHeadless
machine: 32 CPUs, load 34.40, cpu waiting 20.05%, memory waiting 0.00%, io waiting 1.06%
--- 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
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m21.823s 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 1m19.902s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m9.58s amadan.net/oficina/equipo/internal/headless TestHeadlessConnections
receipt: slow test 5.74s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenPasteEndToEnd
receipt: slow test 4.58s amadan.net/oficina/equipo/internal/headless TestHeadlessTokenConnection
machine: 32 CPUs, load 34.05, cpu waiting 20.05%, memory waiting 0.00%, io waiting 1.06%
--- 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
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m17.234s 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.687s amadan.net/oficina/equipo/internal/headless
receipt: slow test 36.27s amadan.net/oficina/equipo/internal/headless TestMacWorker
receipt: slow test 20s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 10.08s amadan.net/oficina/equipo/internal/headless TestHeadlessAttachments
receipt: slow test 9.33s amadan.net/oficina/equipo/internal/headless TestHeadlessPrewarm
machine: 32 CPUs, load 34.40, cpu waiting 20.61%, memory waiting 0.00%, io waiting 1.13%
--- 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_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m34.553s 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 1m32.967s amadan.net/oficina/equipo/internal/headless
receipt: slow test 58.37s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 10.66s amadan.net/oficina/equipo/internal/headless TestHeadlessRunnerKillLeavesNoCopies
receipt: slow test 9.63s amadan.net/oficina/equipo/internal/headless TestHeadlessCopyRotation
receipt: slow test 8.6s amadan.net/oficina/equipo/internal/headless TestHeadlessPolicyGuards
receipt: slow test 5.71s amadan.net/oficina/equipo/internal/headless TestHeadlessNewHouseRuleStartsFresh
machine: 32 CPUs, load 31.43, cpu waiting 16.37%, memory waiting 0.00%, io waiting 0.83%
--- 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_empty_repo$|^TestHeadless$/^3_empty_engineering$|^TestHeadless$/^3_empty_merge$|^TestHeadless$/^3_empty_merge_rebuilt$|^TestHeadless$/^3_empty_fix_round$' ./internal/headless
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 3m4.361s 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 3m2.458s amadan.net/oficina/equipo/internal/headless
receipt: slow test 1m41.84s amadan.net/oficina/equipo/internal/headless TestHeadlessAssistant
receipt: slow test 23.57s amadan.net/oficina/equipo/internal/headless TestHeadless
receipt: slow test 11.27s amadan.net/oficina/equipo/internal/headless TestHeadlessResearchHandoff
receipt: slow test 7.97s amadan.net/oficina/equipo/internal/headless TestHeadlessClaudeSignIn
receipt: slow test 7.25s amadan.net/oficina/equipo/internal/headless TestHeadlessTurnBatching
machine: 32 CPUs, load 11.11, cpu waiting 3.67%, memory waiting 0.00%, io waiting 0.18%
--- 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 345ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 2m2.804s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 8.14s amadan.net/oficina/equipo/internal/thintest TestContractTeamJobSettledStates
receipt: slow test 6.79s amadan.net/oficina/equipo/internal/thintest TestExplorePreviewsOff
receipt: slow test 3.81s amadan.net/oficina/equipo/internal/thintest TestContractPreviewHeldUntilPublishAnswer
receipt: slow test 3.61s amadan.net/oficina/equipo/internal/thintest TestContractTeamNudgePersonNeeds
receipt: slow test 2.56s amadan.net/oficina/equipo/internal/thintest TestResearchDoneFallsBack
machine: 32 CPUs, load 5.63, cpu waiting 0.25%, memory waiting 0.00%, io waiting 4.03%
--- 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 377ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m25.558s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 9.2s amadan.net/oficina/equipo/internal/thintest TestContractPreviewNotScheduled
receipt: slow test 5.1s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotOffered
receipt: slow test 4.49s amadan.net/oficina/equipo/internal/thintest TestContractMacRecheckMergeAuthority
receipt: slow test 2.44s amadan.net/oficina/equipo/internal/thintest TestContractPublishNotNow
receipt: slow test 2.37s amadan.net/oficina/equipo/internal/thintest TestContractPreview
machine: 32 CPUs, load 5.63, cpu waiting 0.25%, memory waiting 0.00%, io waiting 4.03%
--- 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
cache miss: amadan.net/oficina/equipo/internal/runner/thin: its inputs changed
budget note: internal/runner/thin took 4m27.767s, over the 45s its record on line 44 allows; reported only, timing fails on CI

receipt: test step 4m40.571s 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 4m27.767s amadan.net/oficina/equipo/internal/runner/thin
receipt: slow test 36.95s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeAnsweredByAnotherModel
receipt: slow test 36.9s amadan.net/oficina/equipo/internal/runner/thin TestModelsEngineeringProbesThenRunsTheStrongest
receipt: slow test 36.78s amadan.net/oficina/equipo/internal/runner/thin TestModelsUnhealthyRetriedOnDemand
receipt: slow test 18.45s amadan.net/oficina/equipo/internal/runner/thin TestModelsProbeRunsInsideTheAdmission
receipt: slow test 6.75s amadan.net/oficina/equipo/internal/runner/thin TestOpenCodeStepsRealOpenCode
machine: 32 CPUs, load 2.93, cpu waiting 0.73%, memory waiting 0.00%, io waiting 0.03%
--- 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
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

receipt: test step 47.174s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 46.125s amadan.net/oficina/equipo/internal/runner
receipt: slow test 26.09s amadan.net/oficina/equipo/internal/runner TestDirectBugWorkflow
receipt: slow test 20.02s amadan.net/oficina/equipo/internal/runner TestEnrolKeepsTheRole
machine: 32 CPUs, load 31.53, cpu waiting 19.29%, memory waiting 0.00%, io waiting 1.87%
--- 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
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

receipt: test step 45.892s 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 43.974s amadan.net/oficina/equipo/internal/runner
receipt: slow test 33.92s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowCandidateOrder
receipt: slow test 29.84s amadan.net/oficina/equipo/internal/runner TestPlanWorkflowFeature
receipt: slow test 8.38s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryCallRefusalKeepsServing
receipt: slow test 1.66s amadan.net/oficina/equipo/internal/runner TestCoordinatorRefusalMatrix
machine: 32 CPUs, load 31.53, cpu waiting 19.29%, memory waiting 0.00%, io waiting 1.87%
--- 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
cache miss: amadan.net/oficina/equipo/internal/runner: its inputs changed

receipt: test step 34.564s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 33.703s amadan.net/oficina/equipo/internal/runner
receipt: slow test 5.13s amadan.net/oficina/equipo/internal/runner TestDirectFaultIsolation
receipt: slow test 3.3s amadan.net/oficina/equipo/internal/runner TestClaimRefusalsBackOff
receipt: slow test 3.11s amadan.net/oficina/equipo/internal/runner TestCoordinatorRecoveryRefusedKeepsServing
receipt: slow test 1.99s amadan.net/oficina/equipo/internal/runner TestToolVerbUnderFakeHarness
receipt: slow test 1.61s amadan.net/oficina/equipo/internal/runner TestReportPostsRetryExactRequest
machine: 32 CPUs, load 25.51, cpu waiting 13.77%, memory waiting 0.00%, io waiting 2.29%
--- 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 25.6%, load 19.98
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
cache miss: amadan.net/oficina/equipo/internal/equipotest: its inputs changed

receipt: test step 1m4.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 1m2.339s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 26.76s amadan.net/oficina/equipo/internal/equipotest TestAuthorityCoreIntegration
receipt: slow test 26.68s amadan.net/oficina/equipo/internal/equipotest TestBootstrapNamesOwnersSetting
receipt: slow test 24.68s amadan.net/oficina/equipo/internal/equipotest TestAccountLabelMigration
receipt: slow test 22.32s amadan.net/oficina/equipo/internal/equipotest TestBudgetConfigurationFailuresAreAtomic
receipt: slow test 22.11s amadan.net/oficina/equipo/internal/equipotest TestAccountConcurrentDuplicate
machine: 32 CPUs, load 31.43, cpu waiting 16.37%, memory waiting 0.00%, io waiting 0.83%
--- 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 25.6%, load 19.98
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 329ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m15.284s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 20.04s amadan.net/oficina/equipo/internal/equipotest TestProjectConcurrentRetry
receipt: slow test 20.04s amadan.net/oficina/equipo/internal/equipotest TestProjectsReopen
receipt: slow test 20s amadan.net/oficina/equipo/internal/equipotest TestProjectsFailuresRollBack
receipt: slow test 20s amadan.net/oficina/equipo/internal/equipotest TestProjectRequestActorAndUpdate
receipt: slow test 19.89s amadan.net/oficina/equipo/internal/equipotest TestProjectsAccountRevisionAndValidation
machine: 32 CPUs, load 19.98, cpu waiting 11.11%, memory waiting 0.00%, io waiting 2.44%
--- 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 25.6%, load 19.98
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
cache miss: amadan.net/oficina/equipo/internal/equipotest: its inputs changed

receipt: test step 1m14.736s 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 1m3.325s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 14.91s amadan.net/oficina/equipo/internal/equipotest TestReleaseStampContract
receipt: slow test 12.79s amadan.net/oficina/equipo/internal/equipotest TestRosterChangesAffectExistingSession
receipt: slow test 9.8s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalWhileAssigned
receipt: slow test 9.75s amadan.net/oficina/equipo/internal/equipotest TestRosterRemovalRollsBack
receipt: slow test 6.69s amadan.net/oficina/equipo/internal/equipotest TestRosterProtectsLastOwner
machine: 32 CPUs, load 29.46, cpu waiting 13.86%, memory waiting 0.00%, io waiting 0.70%
--- 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 25.6%, load 19.98
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 401ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1m6.827s amadan.net/oficina/equipo/internal/equipotest
receipt: slow test 25.88s amadan.net/oficina/equipo/internal/equipotest TestSigninNoProof
receipt: slow test 24.88s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedExistingTeam
receipt: slow test 24.85s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsSeedRollback
receipt: slow test 23.08s amadan.net/oficina/equipo/internal/equipotest TestSpecialistSettingsCurrentOwner
receipt: slow test 23.04s amadan.net/oficina/equipo/internal/equipotest TestSpecialistsUpgrade
machine: 32 CPUs, load 19.98, cpu waiting 11.11%, memory waiting 0.00%, io waiting 2.44%
--- 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 25.6%, load 19.98
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 591ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 53.424s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 3.82s amadan.net/oficina/equipo/internal/plan3test TestPlan3Upgrade
receipt: slow test 3.59s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3B
receipt: slow test 1.72s amadan.net/oficina/equipo/internal/plan3test TestConversationQuestionRace
receipt: slow test 1.57s amadan.net/oficina/equipo/internal/plan3test TestCoordinatorAcceptance3A
receipt: slow test 1.27s amadan.net/oficina/equipo/internal/plan3test TestInviteMigration
machine: 32 CPUs, load 25.51, cpu waiting 11.11%, memory waiting 0.00%, io waiting 2.44%
--- 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 27.6%, load 19.98
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/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/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/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/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/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/wireschema ./internal/wire/wiretest ./tools/drive
cache miss: amadan.net/oficina/equipo/internal/copydesk: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/webread: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/opencode: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/forge: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/workspace: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/claude: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/equipo/team: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/codex: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/checks: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/containment: its inputs changed
cache miss: amadan.net/oficina/equipo/internal/runner/provider/pi: its inputs changed
budget note: internal/equipo took 28.353s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/equipo/chat took 15.717s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/equipo/setup took 12.903s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/idtest took 44.976s, over the 10s the default allows (measured on the run this cached result came from); reported only, timing fails on CI
budget note: internal/release took 19.39s, 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 39.119s, over the 15s its record on line 40 allows; reported only, timing fails on CI

receipt: test step 2m13.417s against a 60s target (the gate's other steps are not in this figure)
receipt: 11 packages ran, 50 cached, 18 without tests, 0 failed
receipt: slow package 52.272s amadan.net/oficina/equipo/internal/runner/provider/opencode
receipt: slow package 51.374s amadan.net/oficina/equipo/internal/runner/provider/pi
receipt: slow package 44.976s amadan.net/oficina/equipo/internal/idtest
receipt: slow package 39.119s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow package 36.024s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow test 21.32s amadan.net/oficina/equipo/internal/runner/provider/opencode TestOpenCodeAcceptanceHostileRepository
receipt: slow test 21.19s amadan.net/oficina/equipo/cmd/equipo-runner TestReleaseRunnerHasNoFakeWorker
receipt: slow test 15.24s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringOfflineGo
receipt: slow test 12.6s amadan.net/oficina/equipo/internal/idtest TestIDCallbackGuardAndPendingNonce
receipt: slow test 9.24s amadan.net/oficina/equipo/internal/runner/containment TestEngineeringMissingModuleCache
machine: 32 CPUs, load 14.79, cpu waiting 5.12%, memory waiting 0.00%, io waiting 0.25%
--- 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 1m21.498s 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 1m20.136s amadan.net/oficina/equipo/internal/headless
receipt: slow test 37.26s amadan.net/oficina/equipo/internal/headless TestBrowserDraftIsTheMessage
receipt: slow test 14.97s amadan.net/oficina/equipo/internal/headless TestBrowserDraftStreamsFormatted
receipt: slow test 10.19s amadan.net/oficina/equipo/internal/headless TestBrowserChat
receipt: slow test 7.62s amadan.net/oficina/equipo/internal/headless TestBrowserComposer
receipt: slow test 5.72s amadan.net/oficina/equipo/internal/headless TestBrowserChatSendStaysOnPage
machine: 32 CPUs, load 34.05, cpu waiting 19.59%, memory waiting 0.00%, io waiting 1.02%
--- 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 1m30.187s 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.754s amadan.net/oficina/equipo/internal/headless
receipt: slow test 25.42s amadan.net/oficina/equipo/internal/headless TestBrowserRailFollowsWork
receipt: slow test 22.03s amadan.net/oficina/equipo/internal/headless TestBrowserTaskThread
receipt: slow test 13.82s amadan.net/oficina/equipo/internal/headless TestBrowserReceiptFollowsReview
receipt: slow test 9.99s amadan.net/oficina/equipo/internal/headless TestBrowserAskAfterMerge
receipt: slow test 7.88s amadan.net/oficina/equipo/internal/headless TestBrowserTaskCard
machine: 32 CPUs, load 31.43, cpu waiting 17.40%, memory waiting 0.00%, io waiting 0.89%
--- 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
cache miss: amadan.net/oficina/equipo/internal/headless: its inputs changed

receipt: test step 1m39.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 1m37.637s amadan.net/oficina/equipo/internal/headless
receipt: slow test 13.27s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsConversation
receipt: slow test 13.06s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAdd
receipt: slow test 12.97s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsAddPage
receipt: slow test 10.22s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsMeteredLimitRequired
receipt: slow test 10.1s amadan.net/oficina/equipo/internal/headless TestBrowserConnectionsOpenCodeGoLimitRequired
machine: 32 CPUs, load 29.24, cpu waiting 14.81%, memory waiting 0.00%, io waiting 0.75%
--- shard 21 of 29 ---
RASTRILLO='go run amadan.net/rastrillo/rastrillo/cmd/rastrillo' python3 scripts/ci-test.py shard
timing budgets: reported, not enforced: a shared runner's load is not this change's time (set EQUIPO_CI_DEDICATED=1 on a dedicated runner)
browser: /opt/chromium-156.0.8078.79-1_deb13u1/chrome: Chromium 156.0.8078.79
browser lane browser-headless-rest: ./internal/headless
+ go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -tags browser,testbuild -timeout 15m -run '^(TestBrowserAskAfterMerge|TestBrowserChat|TestBrowserChatSendStaysOnPage|TestBrowserComposer|TestBrowserComposerDock|TestBrowserComposerFocus|TestBrowserComposerReconcile|TestBrowserConnectionsAdd|TestBrowserConnectionsAddPage|TestBrowserConnectionsConversation|TestBrowserConnectionsCopyLink|TestBrowserConnectionsEndedNote|TestBrowserConnectionsMeteredLimitRequired|TestBrowserConnectionsOpenCodeGoLimitRequired|TestBrowserConnectionsSignIn|TestBrowserConnectionsSignInSwitch|TestBrowserConnectionsToken|TestBrowserCopyContinue|TestBrowserCopySettingAndFlag|TestBrowserDraftIsTheMessage|TestBrowserDraftStreamsFormatted|TestBrowserEmptyExplore|TestBrowserMoveIn|TestBrowserNotebook|TestBrowserNotebookLook|TestBrowserPasteBox|TestBrowserPasteBoxLook|TestBrowserPasteCopiesItsBox|TestBrowserRailFollowsWork|TestBrowserReceiptFollowsReview|TestBrowserReceiptsDesktop|TestBrowserReceiptsTouch|TestBrowserRefreshRace|TestBrowserStalePageReloads|TestBrowserTaskCard|TestBrowserTaskThread|TestBrowserThinkingAndCards|TestBrowserUsageAndAdvice|TestBrowserWaitingTurns|TestNotebookScreenshots)$' -skip '^TestBrowserChat$|^TestBrowserChatSendStaysOnPage$|^TestBrowserComposer$|^TestBrowserComposerReconcile$|^TestBrowserComposerFocus$|^TestBrowserComposerDock$|^TestBrowserDraftStreamsFormatted$|^TestBrowserDraftIsTheMessage$|^TestBrowserTaskCard$|^TestBrowserReceiptFollowsReview$|^TestBrowserRailFollowsWork$|^TestBrowserTaskThread$|^TestBrowserAskAfterMerge$|^TestBrowserReceiptsDesktop$|^TestBrowserReceiptsTouch$|^TestBrowserConnections|^TestBrowserPasteBox$|^TestBrowserPasteCopiesItsBox$' ./internal/headless
--- FAIL amadan.net/oficina/equipo/internal/headless TestBrowserEmptyExplore
=== RUN   TestBrowserEmptyExplore
time=2026-11-20T20:14:39.120Z level=INFO msg="startup phase" phase=state_lock
time=2026-11-20T20:14:39.120Z level=INFO msg="startup phase done" phase=state_lock took=64µs
time=2026-11-20T20:14:39.120Z level=INFO msg="startup phase" phase=claim_roots
time=2026-11-20T20:14:39.120Z level=INFO msg="startup phase done" phase=claim_roots took=80µs
time=2026-11-20T20:14:39.120Z level=INFO msg="startup phase" phase=sweep
time=2026-11-20T20:14:39.153Z level=INFO msg="startup phase done" phase=sweep took=33.062ms
time=2026-11-20T20:14:39.153Z level=INFO msg="startup phase" phase=credentials
time=2026-11-20T20:14:39.153Z level=INFO msg="startup phase done" phase=credentials took=101µs
time=2026-11-20T20:14:39.153Z level=INFO msg="startup phase" phase=open_state
time=2026-11-20T20:14:39.195Z level=INFO msg="startup phase done" phase=open_state took=41.873ms
time=2026-11-20T20:14:39.195Z level=WARN msg="no seal key: token connections cannot be added" err=*fs.PathError
time=2026-11-20T20:14:39.197Z level=INFO msg=connecting host=127.0.0.1:34587 protocol=28
time=2026-11-20T20:14:39.198Z level=INFO msg=connected host=127.0.0.1:34587 took=869µs
time=2026-11-20T20:14:39.198Z level=INFO msg="capabilities gathering"
time=2026-11-20T20:14:39.198Z level=INFO msg="capabilities gathered" took=406µs tags=linux,claude,go
time=2026-11-20T20:14:39.199Z level=INFO msg="hello sent" protocol=28
time=2026-11-20T20:14:39.203Z level=INFO msg=welcome protocol=28 role=primary generation=1
time=2026-11-20T20:14:40.177Z level=INFO msg="connection checked" connection=claude-1 state=healthy
    browser_receipts_test.go:169: waiting for [...document.querySelectorAll('[equipo-markdown]:not([data-stream-text])')].some(e=>e.textContent.includes("I'm your coordinator")): context deadline exceeded (last evaluation: context deadline exceeded)
--- FAIL: TestBrowserEmptyExplore (5.82s)

--- FAIL amadan.net/oficina/equipo/internal/headless (package output)
FAIL
rastrillo-budget/v1 ran 1m25.271s
FAIL	amadan.net/oficina/equipo/internal/headless	85.550s


receipt: test step 1m26.58s 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 1m25.271s amadan.net/oficina/equipo/internal/headless
receipt: slow test 15.18s amadan.net/oficina/equipo/internal/headless TestBrowserThinkingAndCards
receipt: slow test 10.58s amadan.net/oficina/equipo/internal/headless TestBrowserWaitingTurns
receipt: slow test 10.33s amadan.net/oficina/equipo/internal/headless TestBrowserMoveIn
receipt: slow test 10.26s amadan.net/oficina/equipo/internal/headless TestBrowserStalePageReloads
receipt: slow test 7.81s amadan.net/oficina/equipo/internal/headless TestBrowserRefreshRace
rastrillo: budget test: go test failed
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 '^TestBrowserEmptyExplore$' -count=1 ./internal/headless   (retry, once)
##############################################################################
FLAKE ./internal/headless:TestBrowserEmptyExplore browser-headless-rest 7f4e1006df5e8fa1b2ad3456b16b806428cd7a28 5.82s 32.60
##############################################################################
failed, then passed on its one retry: the step stays green and the flake is on record
machine: 32 CPUs, load 29.24, cpu waiting 15.83%, memory waiting 0.00%, io waiting 0.81%
--- 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 313ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 573ms amadan.net/oficina/equipo/internal/equipo
receipt: slow test 570ms 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)$' ./internal/idtest

receipt: test step 236ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1.697s amadan.net/oficina/equipo/internal/idtest
receipt: slow test 1.7s 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 217ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 1.893s amadan.net/oficina/equipo/internal/plan3test
receipt: slow test 1.89s 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|TestBrowserHousekeeping|TestBrowserInnerGallery|TestBrowserInnerScreens|TestBrowserInstantThinking|TestBrowserInstantThinkingQueued|TestBrowserMachines|TestBrowserPhoneIndex|TestBrowserPlacementQuestionAndPending|TestBrowserProjectPlacement|TestBrowserProjectsList|TestBrowserReportActionFeedback|TestBrowserReportNextSteps|TestBrowserReportThread|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)$' ./internal/thintest

receipt: test step 265ms against a 60s target (the gate's other steps are not in this figure)
receipt: 0 packages ran, 1 cached, 0 without tests, 0 failed
receipt: slow package 3m25.942s amadan.net/oficina/equipo/internal/thintest
receipt: slow test 17.9s amadan.net/oficina/equipo/internal/thintest TestBrowserAccessRequest
receipt: slow test 14.35s amadan.net/oficina/equipo/internal/thintest TestBrowserSettingsTeams
receipt: slow test 12.07s amadan.net/oficina/equipo/internal/thintest TestBrowserThinkingCycles
receipt: slow test 10.74s amadan.net/oficina/equipo/internal/thintest TestBrowserPlacementQuestionAndPending
receipt: slow test 8.26s amadan.net/oficina/equipo/internal/thintest TestBrowserInnerScreens
machine: 32 CPUs, load 5.63, cpu waiting 1.42%, memory waiting 0.00%, io waiting 3.90%
--- 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   (51s)
ok ./internal/headless TestHeadlessConnections/A5_cancel_and_sign_out 5.16s
ok ./internal/headless TestHeadlessConnections/C4_claude_sign_in 1.32s
ok ./internal/headless TestHeadlessConnections/C5_engineering_failover 9.02s
ok ./internal/headless TestHeadlessConnections/C5_engineering_to_codex 9.47s
ok ./internal/headless TestHeadlessConnections/C5_engineering_waits 24.77s
+ 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   (61s)
ok ./internal/headless TestHeadlessConnections/C5_review_auth 12.34s
ok ./internal/headless TestHeadlessConnections/C5_review_failover 13.43s
ok ./internal/headless TestHeadlessConnections/C5_review_on_codex 20.29s
ok ./internal/headless TestHeadlessConnections/C5_review_other_family_first 12.96s
+ go test -tags testbuild -timeout 15m -v -run '^TestMixedVersions$' ./internal/headless   (21s)
ok ./internal/headless TestMixedVersions 19.62s
+ go test -tags testbuild -timeout 15m -v -run '^TestCheckSandboxDeniedPathsTampering$' ./internal/runner/checks   (1s)
ok ./internal/runner/checks TestCheckSandboxDeniedPathsTampering 0.78s
+ go test -tags testbuild -timeout 15m -v -run '^TestRunnerCancelAndSupersede$' ./internal/runner/thin   (1s)
ok ./internal/runner/thin TestRunnerCancelAndSupersede 0.06s
quarantine: 0 flaked (passed on the retry), 0 failed
machine: 32 CPUs, load 33.80, cpu waiting 20.93%, memory waiting 0.00%, io waiting 1.43%
--- 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 8.078s against a 60s target (the gate's other steps are not in this figure)
receipt: 4 packages ran, 0 cached, 3 without tests, 0 failed
receipt: slow package 7.062s amadan.net/oficina/equipo/internal/runner/checks
receipt: slow package 165ms amadan.net/oficina/equipo/internal/runner/provider/claude
receipt: slow package 63ms amadan.net/oficina/equipo/internal/runner/provider/codex
receipt: slow package 1ms amadan.net/oficina/equipo/internal/runner/provider
receipt: slow package 0s amadan.net/oficina/equipo/internal/runner/provider/gotoolchain
receipt: slow test 4.92s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsGoFixture
receipt: slow test 1.7s amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPaths
receipt: slow test 330ms amadan.net/oficina/equipo/internal/runner/checks TestCheckSandboxDeniedPathsCache
receipt: slow test 160ms amadan.net/oficina/equipo/internal/runner/provider/claude TestDirectJournalAdapterBarrier
receipt: slow test 90ms 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 2.983s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 0 without tests, 0 failed
receipt: slow package 2.692s amadan.net/oficina/equipo/internal/runner/containment
receipt: slow test 270ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReadOnlyScratch
receipt: slow test 180ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryUnavailableProof
receipt: slow test 120ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceDirectPolicyAdmission
receipt: slow test 110ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceRecoveryCleansScratch
receipt: slow test 100ms amadan.net/oficina/equipo/internal/runner/containment TestNamespaceReapsOrphans
machine: 32 CPUs, load 12.86, cpu waiting 4.14%, memory waiting 0.00%, io waiting 3.41%
--- 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 27.6%, load 19.98
shard 25: make runner-dead-references lanes-check build vet fmt-check budget migration-check
python3 scripts/runner-dead-references.py
reference scan: 2524 text files, 2846 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 run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
budget size: 88 directories within budget
CGO_ENABLED=0 go test ./internal/equipo -run '^TestMigrationModels$' -count=1
ok  	amadan.net/oficina/equipo/internal/equipo	2.465s
machine: 32 CPUs, load 30.27, cpu waiting 18.32%, memory waiting 0.00%, io waiting 2.00%
--- 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 27.6%, load 19.98
shard 26: make staticcheck
go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 -tags browser,perf,testbuild ./...
machine: 32 CPUs, load 25.51, cpu waiting 11.11%, memory waiting 0.00%, io waiting 2.44%
--- 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 25.6%, load 19.98
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 5
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 27.07, cpu waiting 14.96%, memory waiting 0.00%, io waiting 2.21%
--- 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 25.6%, load 19.98
shard 28: make gitleaks
8:13PM INF Unknown SCM platform. Use --platform to include links in findings. host=amadan.net
8:14PM INF 1065 commits scanned.
8:14PM INF scanned ~60663579 bytes (60.66 MB) in 12.3s
8:14PM INF no leaks found
machine: 32 CPUs, load 30.27, cpu waiting 18.32%, memory waiting 0.00%, io waiting 2.00%
=== 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.063ms, worst 1.111ms, budget 150ms
perf: GET /api/runner/protocol: median 69µs, worst 105µs, budget 150ms
perf: GET /api/v1/account-setups/{id}: median 617µs, worst 688µs, budget 150ms
perf: GET /api/v1/accounts: median 425µs, worst 449µs, budget 150ms
perf: GET /api/v1/auth/devices: median 445µs, worst 476µs, budget 150ms
perf: GET /api/v1/budgets: median 495µs, worst 521µs, budget 150ms
perf: GET /api/v1/capabilities: median 238µs, worst 288µs, budget 150ms
perf: GET /api/v1/cards/{id}: median 1.181ms, worst 1.223ms, budget 150ms
perf: GET /api/v1/connections: median 546µs, worst 578µs, budget 150ms
perf: GET /api/v1/connections/{id}: median 508µs, worst 547µs, budget 150ms
perf: GET /api/v1/conversation: median 884µs, worst 906µs, budget 150ms
perf: GET /api/v1/conversation/cards: median 1.353ms, worst 1.49ms, budget 150ms
perf: GET /api/v1/coordinator: median 1.63ms, worst 1.67ms, budget 150ms
perf: GET /api/v1/invites/{id}: median 436µs, worst 457µs, budget 150ms
perf: GET /api/v1/journey: median 7.123ms, worst 7.224ms, budget 150ms
perf: GET /api/v1/me: median 407µs, worst 447µs, budget 150ms
perf: GET /api/v1/me/settings: median 499µs, worst 521µs, budget 150ms
perf: GET /api/v1/needs-you: median 7.056ms, worst 7.146ms, budget 150ms
perf: GET /api/v1/notifications: median 1.592ms, worst 1.656ms, budget 150ms
perf: GET /api/v1/onboarding: median 385µs, worst 433µs, budget 150ms
perf: GET /api/v1/people: median 431µs, worst 457µs, budget 150ms
perf: GET /api/v1/playbooks: median 583µs, worst 611µs, budget 150ms
perf: GET /api/v1/playbooks/{id}: median 520µs, worst 546µs, budget 150ms
perf: GET /api/v1/playbooks/{id}/template-diff: median 826µs, worst 855µs, budget 150ms
perf: GET /api/v1/preferences: median 759µs, worst 772µs, budget 150ms
perf: GET /api/v1/projects/{id}: median 442µs, worst 465µs, budget 150ms
perf: GET /api/v1/projects/{id}/settings: median 557µs, worst 611µs, budget 150ms
perf: GET /api/v1/roster: median 461µs, worst 474µs, budget 150ms
perf: GET /api/v1/runners/{id}: median 427µs, worst 468µs, budget 150ms
perf: GET /api/v1/specialists: median 7.923ms, worst 8.115ms, budget 150ms
perf: GET /api/v1/specialists/{id}: median 7.837ms, worst 7.885ms, budget 150ms
perf: GET /api/v1/specialists/{id}/template-diff: median 833µs, worst 875µs, budget 150ms
perf: GET /api/v1/tasks/{id}/plan: median 1.109ms, worst 1.181ms, budget 150ms
perf: GET /api/v1/tasks/{id}/thread: median 722µs, worst 769µs, budget 150ms
perf: GET /api/v1/teams: median 423µs, worst 469µs, budget 150ms
perf: GET /api/v1/templates: median 592µs, worst 629µs, budget 150ms
perf: GET /api/v1/templates/{id}: median 450µs, worst 506µs, budget 150ms
perf: GET /auth/callback: median 83µs, worst 109µs, budget 150ms
perf: GET /auth/devices/{id}: median 3.282ms, worst 3.331ms, budget 150ms
perf: GET /auth/verify: median 83µs, worst 127µs, budget 150ms
perf: GET /connections: median 3.602ms, worst 5.892ms, budget 150ms
perf: GET /conversation: median 7.047ms, worst 7.383ms, budget 150ms
perf: GET /conversation/connections: median 248µs, worst 298µs, budget 150ms
perf: GET /conversation/notebook: median 230µs, worst 249µs, budget 150ms
perf: GET /conversation/settings: median 3.757ms, worst 3.944ms, budget 150ms
perf: GET /conversation/settings/autonomy: median 3.429ms, worst 3.666ms, budget 150ms
perf: GET /conversation/settings/connections: median 5.905ms, worst 6.104ms, budget 150ms
perf: GET /conversation/settings/connections/add: median 6.152ms, worst 6.242ms, budget 150ms
perf: GET /conversation/settings/copy: median 3.49ms, worst 3.702ms, budget 150ms
perf: GET /conversation/settings/housekeeping: median 4.033ms, worst 6.854ms, budget 150ms
perf: GET /conversation/settings/machines: median 4.32ms, worst 4.627ms, budget 150ms
perf: GET /conversation/settings/machines/add: median 4.234ms, worst 4.288ms, budget 150ms
perf: GET /conversation/settings/notebook: median 3.257ms, worst 3.291ms, budget 150ms
perf: GET /conversation/settings/thinking: median 3.783ms, worst 3.828ms, budget 150ms
perf: GET /housekeeping: median 3.59ms, worst 3.639ms, budget 150ms
perf: GET /invites/new: median 557µs, worst 599µs, budget 150ms
perf: GET /invites/{id}: median 615µs, worst 623µs, budget 150ms
perf: GET /jobs: median 3.125ms, worst 3.204ms, budget 150ms
perf: GET /jobs/{id}: median 4.242ms, worst 4.349ms, budget 150ms
perf: GET /journey: median 9.837ms, worst 9.998ms, budget 150ms
perf: GET /nav/rail: median 2.903ms, worst 6.266ms, budget 150ms
perf: GET /needs-you: median 9.67ms, worst 10.515ms, budget 150ms
perf: GET /onboarding: median 3.817ms, worst 3.898ms, budget 150ms
perf: GET /people: median 3.15ms, worst 3.315ms, budget 150ms
perf: GET /playbook-suggestions/{suggestion}: median 4.902ms, worst 5.086ms, budget 150ms
perf: GET /playbooks: median 4.423ms, worst 4.522ms, budget 150ms
perf: GET /playbooks/new: median 4.561ms, worst 4.667ms, budget 150ms
perf: GET /playbooks/{id}: median 4.339ms, worst 4.378ms, budget 150ms
perf: GET /playbooks/{id}/edit: median 4.314ms, worst 4.454ms, budget 150ms
perf: GET /playbooks/{id}/template-diff: median 3.549ms, worst 3.611ms, budget 150ms
perf: GET /preferences: median 4.177ms, worst 7.05ms, budget 150ms
perf: GET /preferences/sources/{source}: median 3.967ms, worst 4.111ms, budget 150ms
perf: GET /projects: median 4.993ms, worst 5.264ms, budget 150ms
perf: GET /projects/accounts: median 3.507ms, worst 3.58ms, budget 150ms
perf: GET /projects/new: median 3.407ms, worst 3.503ms, budget 150ms
perf: GET /projects/{id}: median 9.922ms, worst 10.139ms, budget 150ms
perf: GET /projects/{id}/edit: median 3.516ms, worst 3.626ms, budget 150ms
perf: GET /runners/enrol: median 4.153ms, worst 4.214ms, budget 150ms
perf: GET /settings: median 3.255ms, worst 3.303ms, budget 150ms
perf: GET /settings/coordinator: median 5.27ms, worst 8.367ms, budget 150ms
perf: GET /settings/devices: median 3.191ms, worst 3.366ms, budget 150ms
perf: GET /settings/recovery: median 3.391ms, worst 3.46ms, budget 150ms
perf: GET /settings/recovery/release: median 3.297ms, worst 3.439ms, budget 150ms
perf: GET /settings/thinking: median 240µs, worst 287µs, budget 150ms
perf: GET /signin: median 310µs, worst 344µs, budget 150ms
perf: GET /specialists/new: median 3.176ms, worst 3.282ms, budget 150ms
perf: GET /specialists/{key}: median 10.442ms, worst 10.544ms, budget 150ms
perf: GET /specialists/{key}/edit: median 3.413ms, worst 3.54ms, budget 150ms
perf: GET /specialists/{key}/template-diff: median 3.567ms, worst 3.608ms, budget 150ms
perf: GET /tasks: median 5.017ms, worst 5.075ms, budget 150ms
perf: GET /tasks/new: median 3.054ms, worst 3.178ms, budget 150ms
perf: GET /tasks/{id}: median 5.368ms, worst 8.112ms, budget 150ms
perf: GET /tasks/{id}/merge: median 4.742ms, worst 4.915ms, budget 150ms
perf: GET /tasks/{id}/move: median 4.437ms, worst 4.638ms, budget 150ms
perf: GET /tasks/{id}/plan: median 5.488ms, worst 5.643ms, budget 150ms
perf: GET /tasks/{id}/preview: median 1.429ms, worst 1.542ms, budget 150ms
perf: GET /tasks/{id}/questions/{question}: median 4.999ms, worst 5.051ms, budget 150ms
perf: GET /tasks/{id}/rendered-change: median 4.537ms, worst 4.663ms, budget 150ms
perf: GET /tasks/{id}/rendered-change/{hash}.png: median 4.052ms, worst 4.255ms, budget 150ms
perf: GET /tasks/{id}/thread: median 7.543ms, worst 7.77ms, budget 150ms
perf: GET /team/{specialist}: median 4.098ms, worst 4.282ms, budget 150ms
perf: GET /teams: median 9.955ms, worst 10.203ms, budget 150ms
perf: GET /templates: median 3.307ms, worst 3.33ms, budget 150ms
perf: GET /usage: median 3.919ms, worst 4.146ms, budget 150ms
perf: GET /work: median 2.904ms, worst 3.04ms, budget 150ms
perf: cold boot: median 258ms of [257.324189ms 257.593781ms 257.943166ms], budget 500ms

receipt: test step 28.851s against a 60s target (the gate's other steps are not in this figure)
receipt: 1 packages ran, 0 cached, 84 without tests, 0 failed
receipt: slow package 8.69s 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 7.87s amadan.net/oficina/equipo/internal/equipotest TestPerfScreens
receipt: slow test 820ms amadan.net/oficina/equipo/internal/equipotest TestPerfBoot
=== cache ===
ci-box: build cache /home/ci/work/repos/oficina__equipo/cache/go-build: 3.90 GiB in 24016 files
ci-box: module cache /home/ci/work/repos/oficina__equipo/cache/go-mod: 0.84 GiB in 27348 files
diff --git a/native/OFICINA-ID-REPORT.md b/native/OFICINA-ID-REPORT.md
new file mode 100644
index 00000000..4b32c231
--- /dev/null
+++ b/native/OFICINA-ID-REPORT.md
@@ -0,0 +1,148 @@
+# Oficina ID native adoption
+
+Branch: `native/oficina-id`. Implements step 5 of the approved
+[spec](../docs/superpowers/specs/2026-11-20-equipo-native-oficina-id.md).
+
+## What a person sees
+
+- First Oficina app: the kit's Welcome, passkey or email/code, then the team.
+- One readable Oficina ID and one Equipo team: straight in, with no sign-in
+ form or team address. Several identities use the kit's identity chooser.
+- Several Equipo teams: the kit's Team step. The account menu can change teams.
+- No Equipo teams: the kit's zero-teams help. Other apps' teams are filtered out.
+- Other ways to sign in: the existing address, code and browser approval.
+ Saved pairings still open. This route suspends automatic Oficina ID sign-in;
+ Sign in with Oficina ID returns to it.
+- Sign out: the kit forgets the shared identity and its app sessions; Equipo
+ forgets and best-effort revokes that identity's device credentials, detaches
+ push registration, unregisters remote notifications, clears the badge and
+ ends Live Activities. Use another goes through the kit's confirmation and
+ the same cleanup. Signing out elsewhere also clears Equipo's native account.
+- An outage during renewal keeps the conversation and pending writes, with
+ a retry notice when the kit reports the failure. Foreground and stream
+ retries recover when Home returns.
+
+The existing server contract still requires an Oficina ID linked to an active
+Equipo member. A directory entry alone grants no access; the kit shows the
+server's refusal.
+
+## Implementation
+
+`RastrilloApple` is pinned to Docs' `1e36aac95ed252848722926efc8ba8f9dc803216`.
+The kit selects an identity/team and mints its session. Equipo posts the session
+cookie, same-origin header, a fresh Curve25519 signing public key and device
+label to the native device endpoint. It persists the returned bearer and key
+in `DeviceAccounts`, as pairing does. Engine requests remain device bearers.
+
+Optional account metadata binds a saved device to its identity, team and the
+hash of its source session. Existing account JSON still decodes. Renewal updates
+the current `EquipoSession` without discarding its conversation or pending
+writes. The kit renews on foreground and a 24-hour clock; an updated session
+registers a replacement device and retires the previous device best effort.
+HTTP 401/403 and rejected event streams re-mint and retry once, retaining the
+original request body, revision and idempotency key. A definite permission
+refusal remains a 403 after the retry. Re-mints are coalesced and
+limited to once a minute. Late answers after leaving cannot restore an account.
+
+Both entitlement files retain the old default Keychain group first,
+`9U4A84C4WK.works.oficina.equipo`, followed by the shared identity group.
+They add the platform's App Group and webcredentials association and retain
+push entitlements. The new signing check verifies the old default group.
+
+Mac packaging already delegates to the kit's bundler, which at the pinned
+revision supports both `--provisioning-profile` and `--entitlements`, embeds the
+profile before signing and strips restricted grants from ad hoc development
+builds. The wrapper now documents these options; the gate exercises profile
+embedding and ad hoc behavior with dummy bytes and mocked signing. The existing
+configuration retains the private profile path. No profile is copied into this
+repository and verification does not read it or invoke a signing identity.
+
+## Verification
+
+Tests use `FakeOficinaIDService`, in-memory identity/device stores and
+`ScriptedTransport`. No test uses a real identity or Keychain. The initial suite
+failed on the absent adoption; additional failing tests exposed native-device
+rejection, cold-launch orphan cleanup, recovery after a Home outage and starting the
+conversation when sign-in completes in an already active scene. A final
+regression test distinguishes definite permission refusals from renewal outages.
+
+The native gate is `native/scripts/check-native.sh`: signing contract, API
+fixtures, strings, web parity, reference scan, Swift tests, Mac build and an
+unsigned iOS Simulator build. The final gate passes 114 Swift tests, including 20 Oficina ID adoption tests.
+All 28 deliberate mutations below failed their selected check; each change was
+restored before the final gate. Two initially surviving mutations led to stronger
+assertions for local credential removal and absence of fallback Home requests.
+
+Live loopback check:
+
+```sh
+CGO_ENABLED=0 go test ./internal/plan3test -run '^TestPersonAPINativeLiveExchange$' -count=1
+```
+
+Passed. The existing test runs fake Home and the production Equipo router on
+loopback listeners, exchanges an assertion, registers a device, checks the
+session/device expiry match and reads the engine snapshot with the bearer.
+The Swift integration suite tests the app side separately with the kit fake;
+this was not a signed app or passkey UI smoke test.
+
+## Copy for Luna
+
+Five new English strings; existing Equipo strings are unchanged:
+
+| Key | Text |
+| --- | --- |
+| `oficina.sign_in` | Sign in with Oficina ID |
+| `oficina.connecting` | Signing in to your team |
+| `oficina.device_failed` | Could not sign in to this team. Try again. |
+| `oficina.retry` | Try again |
+| `oficina.current_team` | Current team |
+
+The onboarding, Other ways to sign in, Use another Oficina ID, identity/team
+rows, replacement confirmation and identity-labelled Sign out reuse the kit's
+copy. Both existing string catalogs are generated from the English source;
+string and web-parity checks pass. New copy remains for Luna's review.
+
+## Controller follow-up
+
+Review the branch and the five new strings. Signed-device/shared-Keychain and
+Developer ID launch checks remain with the controller: this task does not
+change profiles, identities, App Store Connect or Keychains. Nothing is merged,
+deployed or uploaded.
+
+## Deliberate mutations
+
+Each Swift mutation ran `swift test --package-path native/apple --filter` with
+its protecting test, observing an assertion failure (not a compiler failure).
+The signing mutations ran `python3 native/scripts/check-oficina-id.py`. Kit
+mutations used a temporary module copy because SwiftPM's checkout is read-only.
+
+| Guard broken | Protecting check |
+| --- | --- |
+| Same-origin header | `firstAppShowsWelcomeThenKeepsDeviceAndFreshKey` |
+| Cookie restricted to device registration | `onlyDeviceRegistrationMaySendTheSessionCookie` |
+| Submitted public key matches fresh stored key | `firstAppShowsWelcomeThenKeepsDeviceAndFreshKey` |
+| Device persisted before adoption | `firstAppShowsWelcomeThenKeepsDeviceAndFreshKey` |
+| Directory filtered for Equipo | `oneIdentityGoesStraightInAndSeveralTeamsOrNoneUseKit` |
+| Credential bound to its source session | `renewsAfter24HoursWithoutReplacingConversationSession` |
+| Late device response refused after sign-out | `lateRegistrationCannotRestoreSignedOutDevice` |
+| Orphaned credential removed on cold launch | `nativeCredentialWhoseIdentityWasRemovedCannotSurviveRelaunch` |
+| Old paired account restored | `oldSavedPairingStillLoadsWithoutOficinaID` |
+| Re-mint rate limited | `repeatedRejectionsAreRateLimitedAndKeepConversation` |
+| Device endpoint refusal re-mints | `deviceEndpointRejectionRemintsTheKitSession` |
+| Engine 403 re-mints | `rejectionsRemintOnceAndRetryWithTheNewBearer` |
+| Retry uses replacement bearer | `rejectionsRemintOnceAndRetryWithTheNewBearer` |
+| Clock waits 24 hours | `dailyTimerRenewsWhileAppStaysOpen` |
+| Equipo device revoked | `signOutStopsPushesAndRevokesThisDevice` |
+| Notifications unregistered and badge cleared | `signOutStopsPushesAndRevokesThisDevice` |
+| Kit identity signs out | `signOutStopsPushesAndRevokesThisDevice` |
+| Unavailable team retried on foreground | `foregroundRecoversAfterARejectedSessionMetAnOutage` |
+| Shared sign-out leaves fallback pairing alone | `sharedIdentityRemovalLeavesAnActiveFallbackPairingAlone` |
+| Local device removed on sign-out | `signOutStopsPushesAndRevokesThisDevice` |
+| Fallback suppresses automatic Home requests | `pairingFallbackSuspendsStraightInAndReturnResumesIt` |
+| Old default Keychain group retained | Signing check |
+| Mac profile embedded | Signing check with dummy profile and mocked signing |
+| Ad hoc build strips restricted grants | Signing check with dummy profile and mocked signing |
+| Foreground sign-in starts conversation | `signingInWhileAlreadyForegroundStartsTheConversation` |
+| Push registrar detached on sign-out | `signOutStopsPushesAndRevokesThisDevice` |
+| Definite permission refusal remains a 403 | `aDefinite403StaysARefusalAfterRemint` |
+| Event-stream authentication re-mints | `rejectedEventStreamRemintsAndPreservesCursor` |
diff --git a/native/apple/Package.resolved b/native/apple/Package.resolved
index 1e58fce5..ccc11518 100644
--- a/native/apple/Package.resolved
+++ b/native/apple/Package.resolved
@@ -1,12 +1,12 @@
{
- "originHash" : "2a6af65c7a784d5b21d8800f9821f79e73fca703bcece0ae1f22243bdbe1c584",
+ "originHash" : "f8647e79c0ca0df01bafdd02c9beb5a09a910e056cadf98437c25797abe06489",
"pins" : [
{
"identity" : "native",
"kind" : "remoteSourceControl",
"location" : "https://amadan.net/rastrillo/native",
"state" : {
- "revision" : "f1c7a14db2ddb8960afabc8268cd92c490543397"
+ "revision" : "1e36aac95ed252848722926efc8ba8f9dc803216"
}
},
{
diff --git a/native/apple/Package.swift b/native/apple/Package.swift
index 493bbdb4..69bc0692 100644
--- a/native/apple/Package.swift
+++ b/native/apple/Package.swift
@@ -5,7 +5,7 @@ import Foundation
// rastrillo/native at the revision Docs uses. OFICINA_NATIVE_PACKAGE_PATH
// points at a local checkout instead, for work on the kit itself.
let sharedNative: Package.Dependency = ProcessInfo.processInfo.environment["OFICINA_NATIVE_PACKAGE_PATH"].map { .package(name: "native", path: $0) }
- ?? .package(url: "https://amadan.net/rastrillo/native", revision: "f1c7a14db2ddb8960afabc8268cd92c490543397")
+ ?? .package(url: "https://amadan.net/rastrillo/native", revision: "1e36aac95ed252848722926efc8ba8f9dc803216")
let package = Package(
name: "EquipoNative",
@@ -32,7 +32,7 @@ let package = Package(
.product(name: "RastrilloMacUpdates", package: "native", condition: .when(platforms: [.macOS]))],
path: "Sources/EquipoMac"),
.testTarget(name: "EquipoKitTests",
- dependencies: ["EquipoKit", "EquipoActivity", .product(name: "RastrilloNative", package: "native")],
+ dependencies: ["EquipoKit", "EquipoActivity", .product(name: "RastrilloTestSupport", package: "native"), .product(name: "RastrilloNative", package: "native")],
resources: [.copy("Fixtures")]),
]
)
diff --git a/native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings b/native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings
index 3387547a..e3138a02 100644
--- a/native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings
+++ b/native/apple/Sources/EquipoActivity/Resources/Localizable.xcstrings
@@ -706,6 +706,61 @@
}
}
},
+ "oficina.connecting": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Signing in to your team"
+ }
+ }
+ }
+ },
+ "oficina.current_team": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Current team"
+ }
+ }
+ }
+ },
+ "oficina.device_failed": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Could not sign in to this team. Try again."
+ }
+ }
+ }
+ },
+ "oficina.retry": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Try again"
+ }
+ }
+ }
+ },
+ "oficina.sign_in": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Sign in with Oficina ID"
+ }
+ }
+ }
+ },
"pairing.approve_lede": {
"extractionState": "manual",
"localizations": {
diff --git a/native/apple/Sources/EquipoKit/API/Transport.swift b/native/apple/Sources/EquipoKit/API/Transport.swift
index e383ef61..e7501610 100644
--- a/native/apple/Sources/EquipoKit/API/Transport.swift
+++ b/native/apple/Sources/EquipoKit/API/Transport.swift
@@ -10,10 +10,12 @@ public struct APIRequest: Sendable, Equatable {
public var bearer: String?
public var idempotencyKey: String?
public var ifMatch: Int64?
+ public var nativeSession: NativeSession?
public init(_ method: String, _ path: String, query: [URLQueryItem] = [], body: Data? = nil,
- bearer: String? = nil, idempotencyKey: String? = nil, ifMatch: Int64? = nil) {
+ bearer: String? = nil, idempotencyKey: String? = nil, ifMatch: Int64? = nil, nativeSession: NativeSession? = nil) {
self.method = method; self.path = path; self.query = query; self.body = body
+ self.nativeSession = nativeSession
self.bearer = bearer; self.idempotencyKey = idempotencyKey; self.ifMatch = ifMatch
}
@@ -34,6 +36,13 @@ public struct APIRequest: Sendable, Equatable {
r.httpBody = body
r.setValue("application/json", forHTTPHeaderField: "Content-Type")
}
+ if let nativeSession {
+ // Only the bridge may send a cookie. Engine and pairing requests
+ // stay bearer-only, including after renewal.
+ guard path == "/auth/devices/native", method == "POST", bearer == nil else { throw EquipoAPIError.badOrigin }
+ r.setValue(origin.absoluteString, forHTTPHeaderField: "Origin")
+ r.setValue("\(nativeSession.name)=\(nativeSession.value)", forHTTPHeaderField: "Cookie")
+ }
if let bearer { r.setValue("Bearer \(bearer)", forHTTPHeaderField: "Authorization") }
if let idempotencyKey { r.setValue(idempotencyKey, forHTTPHeaderField: "Idempotency-Key") }
if let ifMatch { r.setValue("\"\(ifMatch)\"", forHTTPHeaderField: "If-Match") }
diff --git a/native/apple/Sources/EquipoKit/OficinaID/EquipoOficinaID.swift b/native/apple/Sources/EquipoKit/OficinaID/EquipoOficinaID.swift
new file mode 100644
index 00000000..b968ea84
--- /dev/null
+++ b/native/apple/Sources/EquipoKit/OficinaID/EquipoOficinaID.swift
@@ -0,0 +1,233 @@
+import Combine
+import CryptoKit
+import Foundation
+import Observation
+import RastrilloApple
+
+/// The kit owns identity, team choice and session renewal. Equipo turns
+/// that session into its existing device bearer and keeps it in DeviceAccounts.
+@MainActor @Observable
+public final class EquipoOficinaID {
+ public let model: OficinaIDModel
+ public private(set) var error: String?
+ public private(set) var busy = false
+ public private(set) var account: DeviceAccount?
+ public var suspended = false
+ @ObservationIgnored var onAccount: ((DeviceAccount, EquipoTransport) -> Void)?
+ @ObservationIgnored var onLeave: (() -> Void)?
+ @ObservationIgnored private var watch: AnyCancellable?
+ @ObservationIgnored private var registration: (OficinaSignedIn, Task<Void, Never>)?
+ @ObservationIgnored public private(set) var cleanup: Task<Void, Never>?
+ @ObservationIgnored private var renewal: Task<Void, Never>?
+ private let accounts: DeviceAccounts
+ private let makeTransport: @Sendable (URL) -> EquipoTransport
+ private let label: () -> String
+ private let now: @Sendable () -> Date
+ private var started = false
+ private var epoch = 0
+ private var lastRejection: Date?
+ private var identityID: String?
+
+ nonisolated public static let configuration = OficinaIDConfiguration(app: "equipo", appName: "Equipo")
+ nonisolated public static var appGroup: String {
+ #if os(macOS)
+ "9U4A84C4WK.works.oficina"
+ #else
+ "group.works.oficina"
+ #endif
+ }
+
+ public init(model: OficinaIDModel, accounts: DeviceAccounts,
+ makeTransport: @escaping @Sendable (URL) -> EquipoTransport,
+ now: @escaping @Sendable () -> Date = Date.init, label: @escaping () -> String) {
+ self.model = model; self.accounts = accounts; self.makeTransport = makeTransport
+ self.now = now; self.label = label
+ watch = model.$step.sink { [weak self] step in
+ self?.stepChanged(step)
+ }
+ }
+
+ public func start() async {
+ guard !started else { return }
+ started = true
+ if suspended { model.suspendStraightIn() }
+ await model.start()
+ // Another app may have signed this identity out while Equipo was
+ // closed. A successful negative lookup removes its background bearer;
+ // an unreadable Keychain leaves it alone.
+ for saved in accounts.all() {
+ if let identity = saved.oficinaIdentity, (try? model.store.hasIdentity(identity)) == false {
+ accounts.remove(saved.origin)
+ Task { await self.revoke(saved) }
+ }
+ }
+ await model.refreshTeams()
+ await synchronize()
+ }
+
+ private func stepChanged(_ step: OficinaIDModel.Step) {
+ // @Published delivers before step is set. Invalidate synchronously,
+ // then read the new step in a task. A late device answer cannot revive it.
+ if model.identity == nil, let identityID {
+ self.identityID = nil
+ forget(identityID)
+ }
+ switch step {
+ case .signedIn:
+ Task { [weak self] in await self?.synchronize() }
+ case .loading, .unavailable: break // Keep the conversation over an outage.
+ default:
+ if account != nil { epoch += 1; account = nil; onLeave?() }
+ }
+ }
+
+ /// Also called after model actions, so their callers can await the bridge.
+ public func synchronize() async {
+ guard !suspended, case .signedIn(let state) = model.step else { return }
+ identityID = state.identity.id
+ if let registration, registration.0 == state { await registration.1.value; return }
+ let epoch = self.epoch
+ let waiting = Task { [weak self] in
+ guard let self else { return }
+ await self.register(state, epoch: epoch)
+ }
+ registration = (state, waiting)
+ await waiting.value
+ if registration?.0 == state { registration = nil }
+ }
+
+ private func register(_ state: OficinaSignedIn, epoch: Int) async {
+ let hash = Self.hash(state.session.value)
+ if let saved = accounts.all().first(where: {
+ $0.origin == state.origin && $0.oficinaIdentity == state.identity.id && $0.oficinaTeam == state.team.sqid
+ && $0.oficinaSessionHash == hash && $0.isUsable(now: now())
+ }) {
+ guard current(state, epoch: epoch) else { return }
+ install(saved)
+ return
+ }
+ busy = true; error = nil
+ defer { busy = false }
+ // Fresh Curve25519 signing key, exactly as pairing creates one.
+ var next = DeviceAccount.new(origin: state.origin, label: label())
+ next.oficinaIdentity = state.identity.id
+ next.oficinaTeam = state.team.sqid
+ next.oficinaSessionHash = hash
+ next.teamName = state.team.name
+ let previous = accounts.all().first { $0.origin == state.origin }
+ do {
+ let body = try EquipoJSON.encoder.encode(["public_key": try next.publicKey(), "label": next.label])
+ let transport = makeTransport(state.origin)
+ next.credential = try await EquipoClient(transport: transport, token: nil).send(
+ APIRequest("POST", "/auth/devices/native", body: body, nativeSession: state.session))
+ guard current(state, epoch: epoch) else { await revoke(next); return }
+ do { try accounts.save(next) }
+ catch { await revoke(next); throw error }
+ install(next)
+ if let previous, previous.credential?.id != next.credential?.id {
+ Task { await self.revoke(previous) }
+ }
+ } catch {
+ guard current(state, epoch: epoch) else { return }
+ self.error = String(localized: "oficina.device_failed", bundle: .module)
+ if let api = error as? EquipoAPIError, api.status == 401 || api.status == 403,
+ lastRejection.map({ now().timeIntervalSince($0) >= 60 }) ?? true {
+ lastRejection = now()
+ await model.refreshTeams(maxAge: 0)
+ guard current(state, epoch: epoch) else { return }
+ await model.sessionRejected()
+ // A new kit session gets a new registration. Never await our
+ // own in-flight registration when Home left the step unchanged.
+ if model.step != .signedIn(state) { await synchronize() }
+ }
+ }
+ }
+
+ private func current(_ state: OficinaSignedIn, epoch: Int) -> Bool {
+ !suspended && self.epoch == epoch && model.step == .signedIn(state)
+ }
+
+ private func install(_ next: DeviceAccount) {
+ error = nil
+ guard account != next else { return }
+ account = next
+ let origin = next.origin, identity = next.oficinaIdentity, team = next.oficinaTeam
+ let transport = EquipoRenewingTransport(inner: makeTransport(origin), credential: { [weak self] in
+ guard let self, !self.suspended, self.model.identity?.id == identity,
+ let current = self.account, current.origin == origin, current.oficinaTeam == team else { return nil }
+ return current.credential?.token
+ }, rejected: { [weak self] in await self?.rejected() })
+ onAccount?(next, transport)
+ }
+
+ public func renewIfNeeded() async {
+ guard !suspended else { return }
+ if let renewal { await renewal.value; return }
+ let task = Task {
+ if case .unavailable = model.step { await model.retry() }
+ else { await model.renewIfNeeded() }
+ await synchronize()
+ }
+ renewal = task
+ await task.value
+ renewal = nil
+ }
+
+ /// Coalesced and limited to once a minute, including a refused re-mint.
+ /// A sustained 403 must not create a loop of Home assertions.
+ func rejected() async {
+ guard !suspended else { return }
+ if let renewal { await renewal.value; return }
+ if let lastRejection, now().timeIntervalSince(lastRejection) < 60 { return }
+ lastRejection = now()
+ let task = Task {
+ await model.refreshTeams(maxAge: 0)
+ if case .unavailable = model.step { await model.retry() }
+ else { await model.sessionRejected() }
+ await synchronize()
+ }
+ renewal = task
+ await task.value
+ renewal = nil
+ }
+
+ /// Leave Equipo's native account locally before any network cleanup.
+ /// The kit may also reach this through Use another or another app's sign-out.
+ private func forget(_ identity: String) {
+ epoch += 1
+ registration?.1.cancel(); registration = nil
+ renewal?.cancel(); renewal = nil
+ let old = accounts.all().filter { $0.oficinaIdentity == identity }
+ for account in old { accounts.remove(account.origin) }
+ account = nil; error = nil; lastRejection = nil
+ onLeave?()
+ cleanup = Task { for account in old { await self.revoke(account) } }
+ }
+
+ public func signOut() {
+ if let identityID { self.identityID = nil; forget(identityID) }
+ model.signOut()
+ }
+
+ public func pause() {
+ suspended = true; epoch += 1
+ model.suspendStraightIn()
+ account = nil
+ }
+
+ public func resume() async {
+ suspended = false
+ await model.resumeStraightIn()
+ await synchronize()
+ }
+
+ private func revoke(_ account: DeviceAccount) async {
+ let client = EquipoClient(transport: makeTransport(account.origin), token: account.credential?.token)
+ if let id = account.credential?.id, let page = try? await client.devices(),
+ let device = page.items.first(where: { $0.id == id }) {
+ _ = try? await client.revokeDevice(id, EquipoClient.empty(ifMatch: device.revision))
+ }
+ }
+
+ private static func hash(_ value: String) -> String { Base64URL.encode(Data(SHA256.hash(data: Data(value.utf8)))) }
+}
diff --git a/native/apple/Sources/EquipoKit/OficinaID/EquipoRenewingTransport.swift b/native/apple/Sources/EquipoKit/OficinaID/EquipoRenewingTransport.swift
new file mode 100644
index 00000000..979574fa
--- /dev/null
+++ b/native/apple/Sources/EquipoKit/OficinaID/EquipoRenewingTransport.swift
@@ -0,0 +1,49 @@
+import Foundation
+
+/// Supplies the current device bearer on every request, including requests
+/// retained by a conversation across renewal. Cookies never reach the engine.
+struct EquipoRenewingTransport: EquipoTransport {
+ let inner: EquipoTransport
+ let credential: @MainActor @Sendable () -> String?
+ let rejected: @MainActor @Sendable () async -> Void
+ var origin: URL { inner.origin }
+
+ private func authorized(_ request: APIRequest) async throws -> APIRequest {
+ guard let token = await credential() else { throw EquipoAPIError.signedOut }
+ var request = request
+ request.bearer = token
+ return request
+ }
+
+ func send(_ request: APIRequest) async throws -> APIResponse {
+ let first = try await authorized(request)
+ let response = try await inner.send(first)
+ guard response.status == 401 || response.status == 403 else { return response }
+ await rejected()
+ let retry = try await authorized(request)
+ guard retry.bearer != first.bearer else {
+ // A permission refusal is definite. An ended credential during
+ // a Home outage keeps pending writes until a later renewal.
+ if response.status == 403 { return response }
+ throw EquipoAPIError.offline
+ }
+ let retried = try await inner.send(retry)
+ guard retried.status != 401 else { throw EquipoAPIError.offline }
+ return retried
+ }
+
+ func lines(_ request: APIRequest) async throws -> AsyncThrowingStream<String, Error> {
+ let first = try await authorized(request)
+ do { return try await inner.lines(first) }
+ catch let error as EquipoAPIError where error.status == 401 || error.status == 403 {
+ await rejected()
+ let retry = try await authorized(request)
+ guard retry.bearer != first.bearer else {
+ if error.status == 403 { throw error }
+ throw EquipoAPIError.offline
+ }
+ do { return try await inner.lines(retry) }
+ catch let error as EquipoAPIError where error.status == 401 { throw EquipoAPIError.offline }
+ }
+ }
+}
diff --git a/native/apple/Sources/EquipoKit/Pairing/DeviceAccount.swift b/native/apple/Sources/EquipoKit/Pairing/DeviceAccount.swift
index 7ebb9afd..750737e3 100644
--- a/native/apple/Sources/EquipoKit/Pairing/DeviceAccount.swift
+++ b/native/apple/Sources/EquipoKit/Pairing/DeviceAccount.swift
@@ -11,6 +11,11 @@ public struct DeviceAccount: Codable, Sendable, Equatable {
public var credential: DeviceCredential?
public var teamName: String?
public var address: String?
+ /// Absent on saved pairings from before Oficina ID. The session hash
+ /// binds this bearer to the kit session that minted it, without a second cookie.
+ public var oficinaIdentity: String?
+ public var oficinaTeam: String?
+ public var oficinaSessionHash: String?
/// Throws if the stored key is damaged; pairing then starts again with a new one.
public func signingKey() throws -> Curve25519.Signing.PrivateKey { try .init(rawRepresentation: keySeed) }
diff --git a/native/apple/Sources/EquipoKit/Push/PhoneDelegate.swift b/native/apple/Sources/EquipoKit/Push/PhoneDelegate.swift
index 7a52911a..ad500d50 100644
--- a/native/apple/Sources/EquipoKit/Push/PhoneDelegate.swift
+++ b/native/apple/Sources/EquipoKit/Push/PhoneDelegate.swift
@@ -13,6 +13,9 @@ public final class EquipoPhoneDelegate: NSObject, UIApplicationDelegate {
public func application(_ application: UIApplication, didFinishLaunchingWithOptions options: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
notifications.onRoute = { [weak self] route in self?.model.open(route) }
model.liveActivities.start()
+ // A push can launch the app without creating a view. Validate the
+ // shared identity and attach its device before sending activity tokens.
+ Task { await model.start() }
return true
}
diff --git a/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings b/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings
index 3387547a..e3138a02 100644
--- a/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings
+++ b/native/apple/Sources/EquipoKit/Resources/Localizable.xcstrings
@@ -706,6 +706,61 @@
}
}
},
+ "oficina.connecting": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Signing in to your team"
+ }
+ }
+ }
+ },
+ "oficina.current_team": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Current team"
+ }
+ }
+ }
+ },
+ "oficina.device_failed": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Could not sign in to this team. Try again."
+ }
+ }
+ }
+ },
+ "oficina.retry": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Try again"
+ }
+ }
+ }
+ },
+ "oficina.sign_in": {
+ "extractionState": "manual",
+ "localizations": {
+ "en": {
+ "stringUnit": {
+ "state": "translated",
+ "value": "Sign in with Oficina ID"
+ }
+ }
+ }
+ },
"pairing.approve_lede": {
"extractionState": "manual",
"localizations": {
diff --git a/native/apple/Sources/EquipoKit/Session/EquipoSession.swift b/native/apple/Sources/EquipoKit/Session/EquipoSession.swift
index 25ed5cf6..0a60dce4 100644
--- a/native/apple/Sources/EquipoKit/Session/EquipoSession.swift
+++ b/native/apple/Sources/EquipoKit/Session/EquipoSession.swift
@@ -40,7 +40,7 @@ public final class EquipoSession {
public private(set) var refreshFailed = false
public private(set) var cursor: Int64 = 0
- public let client: EquipoClient
+ public private(set) var client: EquipoClient
private let accounts: DeviceAccounts
private let runner = CoalescedRunner()
private var live: Task<Void, Never>?
@@ -344,6 +344,14 @@ public final class EquipoSession {
return true
}
+ /// A renewed Oficina ID credential keeps the conversation and pending
+ /// writes mounted. Every new request uses the replacement bearer.
+ func renew(_ account: DeviceAccount, transport: EquipoTransport) {
+ self.account = account
+ client = EquipoClient(transport: transport, token: account.credential?.token)
+ if status == .signedOut { status = .loading }
+ }
+
// MARK: Signing out
private func endSession() {
diff --git a/native/apple/Sources/EquipoKit/UI/Screens/AccountScreen.swift b/native/apple/Sources/EquipoKit/UI/Screens/AccountScreen.swift
index 58c87859..08ac53cd 100644
--- a/native/apple/Sources/EquipoKit/UI/Screens/AccountScreen.swift
+++ b/native/apple/Sources/EquipoKit/UI/Screens/AccountScreen.swift
@@ -20,9 +20,13 @@ public struct AccountScreen: View {
LabeledContent(String(localized: "account.until", bundle: .module), value: expires.formatted(date: .long, time: .omitted))
}
}
- Section {
- Button(String(localized: "account.sign_out", bundle: .module), role: .destructive) { confirming = true }
- } footer: { Text(String(localized: "account.sign_out_footer", bundle: .module)) }
+ if session.account.oficinaIdentity != nil {
+ EquipoOficinaAccountMenu(app: model, model: model.oficina.model)
+ } else {
+ Section {
+ Button(String(localized: "account.sign_out", bundle: .module), role: .destructive) { confirming = true }
+ } footer: { Text(String(localized: "account.sign_out_footer", bundle: .module)) }
+ }
}
.formStyle(.grouped)
.confirmationDialog(String(localized: "account.sign_out_confirm", bundle: .module), isPresented: $confirming) {
diff --git a/native/apple/Sources/EquipoKit/UI/Screens/AppModel.swift b/native/apple/Sources/EquipoKit/UI/Screens/AppModel.swift
index dca5a66d..cd1b2ec6 100644
--- a/native/apple/Sources/EquipoKit/UI/Screens/AppModel.swift
+++ b/native/apple/Sources/EquipoKit/UI/Screens/AppModel.swift
@@ -11,6 +11,11 @@ public final class EquipoAppModel {
public let accounts: DeviceAccounts
public private(set) var session: EquipoSession?
public let pairing: PairingModel
+ public let oficina: EquipoOficinaID
+ public private(set) var showingPairing: Bool
+ private var started = false
+ private var isForeground = false
+ private static let routeKey = "signin.route"
/// Set when the server ended the session, so pairing can say why.
public private(set) var endedTeam: String?
/// Where a tapped notification or Live Activity asked to go, until the
@@ -24,25 +29,72 @@ public final class EquipoAppModel {
#endif
public init(store: SecretStore = KeychainSecretStore(), notifications: NotificationSystem? = nil,
- push: PushRegistrar = PushRegistrar()) {
+ push: PushRegistrar = PushRegistrar(), oficinaModel: OficinaIDModel? = nil,
+ makeTransport: @escaping @Sendable (URL) -> EquipoTransport = { URLSessionTransport(origin: $0) },
+ now: @escaping @Sendable () -> Date = Date.init, deviceLabel: (() -> String)? = nil) {
accounts = DeviceAccounts(store: store)
- pairing = PairingModel(accounts: accounts)
+ pairing = PairingModel(accounts: accounts, makeTransport: makeTransport)
+ let old = accounts.all().first { $0.oficinaIdentity == nil && $0.isUsable() }
+ let route = store.read(Self.routeKey).flatMap { String(data: $0, encoding: .utf8) }
+ showingPairing = route.map { $0 == "pairing" } ?? (old != nil)
+ oficina = EquipoOficinaID(model: oficinaModel ?? .live(configuration: EquipoOficinaID.configuration,
+ appGroup: EquipoOficinaID.appGroup),
+ accounts: accounts, makeTransport: makeTransport, now: now,
+ label: deviceLabel ?? { PairingView.deviceLabel })
self.notifications = notifications
self.push = push
#if os(iOS)
liveActivities = LiveActivities(registrar: push)
#endif
- if let account = accounts.all().first(where: { $0.isUsable() }) {
+ oficina.suspended = showingPairing
+ oficina.onAccount = { [weak self] account, transport in self?.adopt(account, transport: transport) }
+ oficina.onLeave = { [weak self] in
+ guard let self, !self.showingPairing else { return }
+ self.sessionEnded()
+ }
+ if showingPairing, let account = old {
// Written again so a slice 1 credential becomes readable after
// first unlock, for Live Activity tokens sent in the background.
try? accounts.save(account)
- session = EquipoSession(account: account, accounts: accounts)
+ session = EquipoSession(account: account, accounts: accounts, transport: makeTransport(account.origin))
sessionStarted()
}
}
public var needsPairing: Bool { session == nil || session?.status == .signedOut }
+ public func start() async {
+ guard !started else { return }
+ started = true
+ await oficina.start()
+ }
+
+ /// The view's task cancels this clock when its scene goes away. A scene
+ /// that stays open still renews daily, without waiting for a foreground.
+ public func runRenewals(sleep: @Sendable (Duration) async throws -> Void = { try await Task.sleep(for: $0) }) async {
+ await start()
+ while !Task.isCancelled {
+ do { try await sleep(.seconds(24 * 60 * 60)) } catch { return }
+ await oficina.renewIfNeeded()
+ }
+ }
+
+ public func otherWays() {
+ showingPairing = true
+ try? accounts.store.write(Data("pairing".utf8), account: Self.routeKey)
+ oficina.pause()
+ session?.stopLive(); session = nil
+ pairing.cancel()
+ forgetPushes()
+ }
+
+ public func useOficinaID() async {
+ showingPairing = false
+ try? accounts.store.write(Data("oficina".utf8), account: Self.routeKey)
+ pairing.cancel()
+ await oficina.resume()
+ }
+
/// After pairing approves this device.
public func paired() {
guard let account = pairing.account else { return }
@@ -52,13 +104,21 @@ public final class EquipoAppModel {
func adopt(_ account: DeviceAccount, transport: EquipoTransport? = nil) {
endedTeam = nil
- session = EquipoSession(account: account, accounts: accounts, transport: transport)
+ if let session, account.oficinaIdentity != nil,
+ session.account.oficinaIdentity == account.oficinaIdentity,
+ session.account.oficinaTeam == account.oficinaTeam, session.origin == account.origin, let transport {
+ session.renew(account, transport: transport)
+ } else {
+ session?.stopLive()
+ session = EquipoSession(account: account, accounts: accounts, transport: transport)
+ }
sessionStarted()
}
/// There is a team: ask to notify (the system asks once), register with
/// APNs, and register this device with the team's server.
private func sessionStarted() {
+ if isForeground { session?.startLive() }
notifications?.askAndRegister()
let client = session?.client
let push = self.push
@@ -68,12 +128,17 @@ public final class EquipoAppModel {
/// The server ended the session (revoked, removed or expired): pair again.
public func sessionEnded() {
endedTeam = session?.teamName
+ session?.stopLive()
session = nil
pairing.cancel()
forgetPushes()
}
public func signOut() async {
+ if session?.account.oficinaIdentity != nil || (!showingPairing && oficina.model.identity != nil) {
+ oficina.signOut()
+ return
+ }
await session?.signOut()
session = nil
endedTeam = nil
@@ -105,11 +170,15 @@ public final class EquipoAppModel {
}
public func foreground() {
+ isForeground = true
NativeConnectivity.shared.foregrounded()
let push = self.push
Task { await push.sync() }
- guard let session else { return }
- session.startLive()
+ Task {
+ await start()
+ await oficina.renewIfNeeded()
+ if isForeground { session?.startLive() }
+ }
}
- public func background() { session?.stopLive() }
+ public func background() { isForeground = false; session?.stopLive() }
}
diff --git a/native/apple/Sources/EquipoKit/UI/Screens/OficinaAccountMenu.swift b/native/apple/Sources/EquipoKit/UI/Screens/OficinaAccountMenu.swift
new file mode 100644
index 00000000..0c0b0706
--- /dev/null
+++ b/native/apple/Sources/EquipoKit/UI/Screens/OficinaAccountMenu.swift
@@ -0,0 +1,39 @@
+import RastrilloApple
+import SwiftUI
+
+/// The same account menu composition as Docs, using the kit's rows,
+/// identity replacement confirmation and sign-out words.
+struct EquipoOficinaAccountMenu: View {
+ let app: EquipoAppModel
+ @ObservedObject var model: OficinaIDModel
+ private var teams: [OficinaTeam] {
+ guard let identity = model.identity else { return [] }
+ return (model.store.teams(identity.id)?.teams ?? []).filter { $0.origin(for: "equipo") != nil }
+ }
+ var body: some View {
+ Section {
+ if let identity = model.identity { OficinaIdentityRow(identity: identity) }
+ ForEach(teams) { team in
+ Button {
+ Task { await model.choose(team); await app.oficina.synchronize() }
+ } label: {
+ HStack {
+ OficinaTeamRow(team: team)
+ if app.session?.account.oficinaTeam == team.sqid {
+ Image(systemName: "checkmark").accessibilityLabel(String(localized: "oficina.current_team", bundle: .module))
+ }
+ }
+ }.buttonStyle(.plain).disabled(model.busy)
+ }
+ if let error = app.oficina.error { Text(error).foregroundStyle(.secondary) }
+ if let error = model.error { OficinaErrorLine(error) }
+ Button(OficinaIDText.text("continue.another")) { model.useAnother() }
+ Button(OficinaIDText.text("otherWays")) { app.otherWays() }
+ Button(OficinaIDText.text("signOut", model.identity?.label ?? ""), role: .destructive) {
+ Task { await app.signOut() }
+ }
+ }
+ .task { await model.refreshTeams() }
+ .oficinaReplaceConfirmation(model)
+ }
+}
diff --git a/native/apple/Sources/EquipoKit/UI/Screens/OficinaNotice.swift b/native/apple/Sources/EquipoKit/UI/Screens/OficinaNotice.swift
new file mode 100644
index 00000000..cf10077d
--- /dev/null
+++ b/native/apple/Sources/EquipoKit/UI/Screens/OficinaNotice.swift
@@ -0,0 +1,25 @@
+import RastrilloApple
+import SwiftUI
+
+/// A failed re-mint leaves the conversation mounted, with a way to retry.
+public struct EquipoOficinaNotice: View {
+ private let app: EquipoAppModel
+ @ObservedObject private var model: OficinaIDModel
+ public init(model: EquipoAppModel) { app = model; self.model = model.oficina.model }
+ public var body: some View {
+ if let error = app.oficina.error ?? model.error {
+ VStack(alignment: .leading, spacing: 8) {
+ OficinaErrorLine(error)
+ Button(String(localized: "oficina.retry", bundle: .module)) {
+ Task {
+ await app.oficina.renewIfNeeded()
+ await app.session?.refresh()
+ }
+ }.disabled(model.busy || app.oficina.busy)
+ }
+ .padding(12)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .background(.background)
+ }
+ }
+}
diff --git a/native/apple/Sources/EquipoKit/UI/Screens/PhoneRoot.swift b/native/apple/Sources/EquipoKit/UI/Screens/PhoneRoot.swift
index 74165076..06a9919d 100644
--- a/native/apple/Sources/EquipoKit/UI/Screens/PhoneRoot.swift
+++ b/native/apple/Sources/EquipoKit/UI/Screens/PhoneRoot.swift
@@ -4,7 +4,7 @@ import SwiftUI
/// The iPhone app: pairing until there is a team, then Conversation, Needs
/// you and Tasks as tabs, with the task view pushed from any of them.
public struct PhoneRoot: View {
- @State var model: EquipoAppModel
+ @State private var model: EquipoAppModel
@Environment(\.scenePhase) private var phase
public init(model: EquipoAppModel = EquipoAppModel()) { _model = State(initialValue: model) }
@@ -12,8 +12,12 @@ public struct PhoneRoot: View {
Group {
if let session = model.session, session.status != .signedOut {
PhoneTabs(model: model, session: session)
+ .id(ObjectIdentifier(session))
+ .safeAreaInset(edge: .top, spacing: 0) {
+ if session.account.oficinaIdentity != nil { EquipoOficinaNotice(model: model) }
+ }
} else {
- PairingView(model: model)
+ EquipoSignInView(model: model)
}
}
.tint(Palette.accent)
@@ -28,7 +32,7 @@ public struct PhoneRoot: View {
}
// A Live Activity's tap: its task.
.onOpenURL { url in if let route = PushRoute(url: url) { model.open(route) } }
- .task { model.foreground() }
+ .task { model.foreground(); await model.runRenewals() }
}
}
diff --git a/native/apple/Sources/EquipoKit/UI/Screens/SignInView.swift b/native/apple/Sources/EquipoKit/UI/Screens/SignInView.swift
new file mode 100644
index 00000000..b11dd02d
--- /dev/null
+++ b/native/apple/Sources/EquipoKit/UI/Screens/SignInView.swift
@@ -0,0 +1,47 @@
+import RastrilloApple
+import SwiftUI
+
+/// Both platforms use the kit's full onboarding, with pairing as an explicit route.
+public struct EquipoSignInView: View {
+ let app: EquipoAppModel
+ public init(model: EquipoAppModel) { app = model }
+ public var body: some View {
+ if app.showingPairing {
+ PairingView(model: app)
+ .safeAreaInset(edge: .bottom) {
+ Button(String(localized: "oficina.sign_in", bundle: .module)) {
+ Task { await app.useOficinaID() }
+ }.padding()
+ }
+ } else {
+ EquipoOnboarding(app: app, model: app.oficina.model)
+ }
+ }
+}
+
+private struct EquipoOnboarding: View {
+ let app: EquipoAppModel
+ @ObservedObject var model: OficinaIDModel
+ var body: some View {
+ Group {
+ if case .signedIn = model.step {
+ VStack(spacing: 16) {
+ if let error = app.oficina.error {
+ Text(error)
+ Button(String(localized: "oficina.retry", bundle: .module)) {
+ Task { await app.oficina.synchronize() }
+ }
+ } else {
+ ProgressView(String(localized: "oficina.connecting", bundle: .module))
+ }
+ Button(OficinaIDText.text("otherWays")) { app.otherWays() }
+ Button(OficinaIDText.text("signOut", model.identity?.label ?? ""), role: .destructive) {
+ app.oficina.signOut()
+ }
+ }.padding(24)
+ } else {
+ OficinaOnboardingView(model: model, otherWays: { app.otherWays() })
+ }
+ }
+ }
+}
diff --git a/native/apple/Sources/EquipoMac/EquipoMacApp.swift b/native/apple/Sources/EquipoMac/EquipoMacApp.swift
index 2277974b..ce7ea393 100644
--- a/native/apple/Sources/EquipoMac/EquipoMacApp.swift
+++ b/native/apple/Sources/EquipoMac/EquipoMacApp.swift
@@ -68,13 +68,17 @@ struct MacRoot: View {
Group {
if let session = model.session, !model.needsPairing {
MacMainView(model: model, session: session)
+ .id(ObjectIdentifier(session))
+ .safeAreaInset(edge: .top, spacing: 0) {
+ if session.account.oficinaIdentity != nil { EquipoOficinaNotice(model: model) }
+ }
} else {
- PairingView(model: model).frame(minWidth: 560, minHeight: 520)
+ EquipoSignInView(model: model).frame(minWidth: 560, minHeight: 520)
}
}
.tint(Color(nsColor: .webAccent))
.frame(minWidth: 860, minHeight: 560)
- .onAppear { model.foreground() }
+ .task { model.foreground(); await model.runRenewals() }
.onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in model.foreground() }
// Live while a window can be seen, even beside another app.
.onReceive(NotificationCenter.default.publisher(for: NSApplication.didChangeOcclusionStateNotification)) { _ in
diff --git a/native/apple/Tests/EquipoKitTests/OficinaIDTests.swift b/native/apple/Tests/EquipoKitTests/OficinaIDTests.swift
new file mode 100644
index 00000000..e5589baa
--- /dev/null
+++ b/native/apple/Tests/EquipoKitTests/OficinaIDTests.swift
@@ -0,0 +1,383 @@
+import Foundation
+import RastrilloApple
+import RastrilloTestSupport
+import Testing
+@testable import EquipoKit
+
+private final class IDClock: @unchecked Sendable {
+ private let lock = NSLock()
+ private var date = Date()
+ var now: Date { lock.withLock { date } }
+ func advance(_ seconds: TimeInterval) { lock.withLock { date += seconds } }
+}
+
+@MainActor private final class IDFixture {
+ let service = FakeOficinaIDService()
+ let shared = OficinaMemoryStore()
+ let privateStore = OficinaMemoryStore()
+ let secrets = MemorySecretStore()
+ let transport = ScriptedTransport()
+ let clock = IDClock()
+ let notifications = FakeNotifications()
+ let suite = "EquipoIDTests.\(UUID().uuidString)"
+ let defaults: UserDefaults
+ let model: OficinaIDModel
+ let app: EquipoAppModel
+
+ init(held: HeldIDTransport? = nil) {
+ defaults = UserDefaults(suiteName: suite)!
+ let store = OficinaIDStore(shared: shared, appPrivate: privateStore, group: defaults)
+ let clock = clock
+ model = OficinaIDModel(configuration: EquipoOficinaID.configuration, store: store, service: service,
+ passkeys: FakePasskeys(), makeKey: { OficinaSoftwareKey() }, now: { clock.now }, appDefaults: defaults)
+ let transport = transport
+ app = EquipoAppModel(store: secrets, notifications: notifications, push: PushRegistrar(environment: nil), oficinaModel: model,
+ makeTransport: { _ in if let held { held } else { transport } }, now: { clock.now }, deviceLabel: { "Test phone" })
+ service.addPerson(email: "person@example.test", identityID: "id-1")
+ service.setTeams([team()], for: "id-1")
+ service.admit("id-1", at: transport.origin, as: .linked)
+ transport.on("POST /auth/devices/native", fixture: "device-credential")
+ transport.on("GET /auth/devices", fixture: "devices")
+ transport.on("DELETE /auth/devices/dev_01JD5Z4Q2X", fixture: "ack")
+ }
+ deinit { UserDefaults(suiteName: suite)?.removePersistentDomain(forName: suite) }
+ func team(_ id: String = "t1", app: String = "equipo") -> OficinaTeam {
+ OficinaTeam(sqid: id, label: id, name: "Team \(id)", role: "member", apps: [
+ OficinaTeamApp(app: app, origin: transport.origin.absoluteString, consumerID: id)
+ ])
+ }
+ func signIn() async {
+ await app.start()
+ model.continueWithEmail(); model.email = "person@example.test"
+ await model.submitEmail(); model.code = FakeOficinaIDService.goodCode
+ await model.submitCode()
+ await app.oficina.synchronize()
+ }
+ func seedIdentity() async throws {
+ let key = OficinaSoftwareKey()
+ let start = try await service.startCode(email: "person@example.test", key: key, platform: "macos")
+ guard case .granted(let grant) = try await service.verifyCode(start: start.start, code: FakeOficinaIDService.goodCode, key: key) else { throw EquipoAPIError.signedOut }
+ _ = try model.store.add(grant: grant, key: key, label: "Person", labelSource: .email, method: "code", now: clock.now)
+ }
+}
+
+@MainActor @Suite struct OficinaIDTests {
+ @Test func firstAppShowsWelcomeThenKeepsDeviceAndFreshKey() async throws {
+ let f = IDFixture()
+ await f.app.start()
+ #expect(f.model.step == .welcome)
+ #expect(f.app.session == nil)
+ #expect(!f.app.showingPairing)
+ await f.signIn()
+ let account = try #require(f.app.session?.account)
+ #expect(account.oficinaIdentity == "id-1")
+ #expect(account.oficinaTeam == "t1")
+ #expect(f.app.accounts.all() == [account])
+ let request = try #require(f.transport.sent("POST /auth/devices/native").first)
+ let body = try JSONDecoder().decode([String: String].self, from: #require(request.body))
+ #expect(body == ["public_key": try account.publicKey(), "label": "Test phone"])
+ let wire = try request.urlRequest(origin: f.transport.origin)
+ #expect(wire.url?.path == "/api/v1/auth/devices/native")
+ #expect(wire.value(forHTTPHeaderField: "Origin") == f.transport.origin.absoluteString)
+ #expect(wire.value(forHTTPHeaderField: "Cookie")?.hasPrefix("__Host-rastrillo_session=") == true)
+ #expect(wire.value(forHTTPHeaderField: "Authorization") == nil)
+ #expect(wire.value(forHTTPHeaderField: "Content-Type") == "application/json")
+ #expect(!wire.httpShouldHandleCookies)
+ await f.app.oficina.synchronize()
+ #expect(f.transport.sent("POST /auth/devices/native").count == 1)
+ let bearer = try APIRequest("GET", "/snapshot", bearer: account.credential?.token).urlRequest(origin: account.origin)
+ #expect(bearer.value(forHTTPHeaderField: "Cookie") == nil)
+ }
+
+ @Test func oneIdentityGoesStraightInAndSeveralTeamsOrNoneUseKit() async throws {
+ for count in [0, 1, 2] {
+ let f = IDFixture()
+ f.service.setTeams((0..<count).map { f.team("t\($0)") } + [f.team("docs", app: "docs")], for: "id-1")
+ try await f.seedIdentity()
+ await f.app.start()
+ if count == 1 {
+ #expect(f.app.session?.account.oficinaTeam == "t0")
+ } else if count == 0 {
+ #expect(f.model.step == .noTeams)
+ #expect(f.app.session == nil)
+ } else {
+ guard case .teams(let teams) = f.model.step else { Issue.record("expected kit's team step"); return }
+ #expect(teams.count == 2)
+ #expect(f.app.session == nil)
+ await f.model.choose(teams[1]); await f.app.oficina.synchronize()
+ #expect(f.app.session?.account.oficinaTeam == "t1")
+ }
+ }
+ }
+
+ @Test func renewsAfter24HoursWithoutReplacingConversationSession() async throws {
+ let f = IDFixture(); await f.signIn()
+ let original = try #require(f.app.session)
+ let key = original.account.keySeed
+ await f.app.oficina.renewIfNeeded()
+ #expect(f.transport.sent("POST /auth/devices/native").count == 1)
+ f.clock.advance(24 * 60 * 60 + 1)
+ await f.app.oficina.renewIfNeeded()
+ #expect(f.transport.sent("POST /auth/devices/native").count == 2)
+ #expect(f.app.session === original)
+ #expect(f.app.session?.account.keySeed != key)
+ }
+
+ @Test func rejectionsRemintOnceAndRetryWithTheNewBearer() async throws {
+ for status in [401, 403] {
+ let f = IDFixture(); await f.signIn()
+ let original = try #require(f.app.session)
+ let next = String(decoding: Fixture.data("device-credential"), as: UTF8.self).replacingOccurrences(of: "TOKENFIXTURE", with: "RENEWED")
+ f.transport.replace("POST /auth/devices/native", with: .success(APIResponse(status: 200, data: Data(next.utf8))))
+ f.transport.on("GET /me", .success(APIResponse(status: status, data: Data())), .success(APIResponse(status: 200, data: Fixture.data("me"))))
+ _ = try await original.client.me()
+ #expect(f.transport.sent("POST /auth/devices/native").count == 2)
+ #expect(f.transport.sent("GET /me").count == 2)
+ #expect(f.transport.sent("GET /me").last?.bearer == "equipo.person.v1.RENEWED")
+ // Both ordinary requests remain device bearers, never cookies.
+ #expect(f.transport.sent("GET /me").allSatisfy { $0.bearer != nil && $0.nativeSession == nil })
+ }
+ }
+
+ @Test func offlineRenewalKeepsAccountAndSignOutForgetsItImmediately() async throws {
+ let f = IDFixture(); await f.signIn()
+ let original = try #require(f.app.session)
+ f.clock.advance(24 * 60 * 60 + 1)
+ f.service.failNext("assert", with: .offline)
+ await f.app.oficina.renewIfNeeded()
+ #expect(f.app.session === original)
+ await f.app.signOut()
+ #expect(f.app.session == nil)
+ #expect(f.app.accounts.all().isEmpty)
+ #expect(f.model.identity == nil)
+ await f.app.oficina.cleanup?.value
+ await f.model.cleanup?.value
+ #expect(f.service.liveGrants == 0)
+ #expect(!f.transport.sent("GET /auth/devices").isEmpty)
+ }
+
+ @Test func pairingFallbackSuspendsStraightInAndReturnResumesIt() async throws {
+ let f = IDFixture(); try await f.seedIdentity()
+ f.app.otherWays()
+ await f.app.start()
+ #expect(f.app.showingPairing)
+ #expect(f.model.step == .welcome)
+ #expect(!f.service.calls.contains { $0.hasPrefix("assert ") })
+ #expect(f.app.session == nil)
+ #expect(f.transport.sent("POST /auth/devices/native").isEmpty)
+ await f.app.useOficinaID()
+ #expect(!f.app.showingPairing)
+ #expect(f.app.session != nil)
+ }
+
+ @Test func foregroundRecoversAfterARejectedSessionMetAnOutage() async throws {
+ let f = IDFixture(); await f.signIn()
+ let original = try #require(f.app.session)
+ f.service.failNext("assert", at: f.transport.origin.absoluteString, with: .offline)
+ f.transport.on("GET /me", .success(APIResponse(status: 401, data: Data())))
+ _ = try? await original.client.me()
+ #expect(f.app.session === original)
+ guard case .unavailable = f.model.step else { Issue.record("expected an unavailable team"); return }
+ f.clock.advance(61)
+ await f.app.oficina.renewIfNeeded()
+ guard case .signedIn = f.model.step else { Issue.record("foreground did not recover"); return }
+ #expect(f.app.session === original)
+ #expect(f.transport.sent("POST /auth/devices/native").count == 2)
+ }
+
+ @Test func signingInWhileAlreadyForegroundStartsTheConversation() async throws {
+ let f = IDFixture()
+ await f.app.start()
+ f.app.foreground()
+ await f.signIn()
+ for _ in 0..<100 {
+ if !f.transport.sent("GET /snapshot").isEmpty { break }
+ try await Task.sleep(for: .milliseconds(10))
+ }
+ f.app.background()
+ #expect(!f.transport.sent("GET /snapshot").isEmpty)
+ }
+
+ @Test func dailyTimerRenewsWhileAppStaysOpen() async throws {
+ let f = IDFixture(); await f.signIn()
+ let sleep = IDDailySleep(clock: f.clock)
+ await f.app.runRenewals(sleep: { try await sleep.wait($0) })
+ #expect(f.transport.sent("POST /auth/devices/native").count == 2)
+ #expect(await sleep.waits == [.seconds(86400), .seconds(86400)])
+ }
+
+ @Test func aDefinite403StaysARefusalAfterRemint() async throws {
+ let f = IDFixture(); await f.signIn()
+ let next = String(decoding: Fixture.data("device-credential"), as: UTF8.self).replacingOccurrences(of: "TOKENFIXTURE", with: "RENEWED")
+ f.transport.replace("POST /auth/devices/native", with: .success(APIResponse(status: 200, data: Data(next.utf8))))
+ f.transport.on("GET /me", .success(APIResponse(status: 403, data: Data())))
+ do {
+ _ = try await f.app.session?.client.me()
+ Issue.record("the permission refusal disappeared")
+ } catch let error as EquipoAPIError {
+ #expect(error.status == 403)
+ }
+ #expect(f.transport.sent("GET /me").count == 2)
+ #expect(f.transport.sent("POST /auth/devices/native").count == 2)
+ }
+
+ @Test func rejectedEventStreamRemintsAndPreservesCursor() async throws {
+ for status in [401, 403] {
+ let f = IDFixture(); await f.signIn()
+ let next = String(decoding: Fixture.data("device-credential"), as: UTF8.self).replacingOccurrences(of: "TOKENFIXTURE", with: "RENEWED")
+ f.transport.replace("POST /auth/devices/native", with: .success(APIResponse(status: 200, data: Data(next.utf8))))
+ f.transport.onStream(.failure(.status(status)), .success([]))
+ let session = try #require(f.app.session)
+ let stream = try await session.client.events(after: 42)
+ for try await _ in stream {}
+ let requests = f.transport.sent("GET /events")
+ #expect(requests.count == 2)
+ #expect(requests.allSatisfy { $0.query == [URLQueryItem(name: "after", value: "42")] })
+ #expect(requests.last?.bearer == "equipo.person.v1.RENEWED")
+ #expect(f.transport.sent("POST /auth/devices/native").count == 2)
+ }
+ }
+
+ @Test func repeatedRejectionsAreRateLimitedAndKeepConversation() async throws {
+ let f = IDFixture(); await f.signIn()
+ let original = try #require(f.app.session)
+ f.transport.on("GET /me", .success(APIResponse(status: 401, data: Data())))
+ for _ in 0..<3 { _ = try? await original.client.me() }
+ #expect(f.transport.sent("POST /auth/devices/native").count == 2)
+ #expect(f.app.session === original)
+ }
+
+ @Test func signOutStopsPushesAndRevokesThisDevice() async throws {
+ let f = IDFixture(); await f.signIn()
+ #expect(f.notifications.asked > 0)
+ await f.app.push.attach(f.app.session?.client)
+ let generation = f.app.push.generation
+ f.app.needsYouChanged(3)
+ await f.app.signOut()
+ #expect(f.notifications.unregistered == 1)
+ #expect(f.app.accounts.all().isEmpty)
+ #expect(f.notifications.badges.last == 0)
+ #expect(f.app.session == nil)
+ await f.app.oficina.cleanup?.value
+ #expect(f.app.push.generation == generation + 1)
+ #expect(f.transport.sent("DELETE /auth/devices/dev_01JD5Z4Q2X").count == 1)
+ let count = f.transport.sent("POST /auth/devices/native").count
+ await f.app.oficina.renewIfNeeded()
+ #expect(f.transport.sent("POST /auth/devices/native").count == count)
+ #expect(f.model.step == .welcome)
+ }
+
+ @Test func replacementThroughKitAlsoForgetsDeviceAndPushes() async throws {
+ let f = IDFixture(); await f.signIn()
+ f.model.useAnother()
+ #expect(f.app.session != nil)
+ f.model.cancelReplace()
+ #expect(f.app.session != nil)
+ f.model.useAnother(); f.model.confirmReplace()
+ #expect(f.app.session == nil)
+ #expect(f.app.accounts.all().isEmpty)
+ #expect(f.notifications.unregistered == 1)
+ #expect(f.model.step == .email)
+ }
+
+ @Test func sharedIdentityRemovalLeavesAnActiveFallbackPairingAlone() async throws {
+ let f = IDFixture(); await f.signIn()
+ f.app.otherWays()
+ var paired = DeviceAccount.new(origin: f.transport.origin, label: "Paired")
+ paired.credential = try Fixture.decode("device-credential")
+ try f.app.accounts.save(paired)
+ f.app.adopt(paired, transport: f.transport)
+ f.model.signOut()
+ #expect(f.app.session?.account == paired)
+ #expect(f.app.accounts.all() == [paired])
+ }
+
+ @Test func onlyDeviceRegistrationMaySendTheSessionCookie() throws {
+ for path in ["/snapshot", "/auth/devices", "/auth/devices/exchange"] {
+ #expect(throws: EquipoAPIError.badOrigin) {
+ try APIRequest("POST", path, nativeSession: NativeSession(name: "session", value: "fixture"))
+ .urlRequest(origin: URL(string: "https://example.test")!)
+ }
+ }
+ }
+
+ @Test func deviceEndpointRejectionRemintsTheKitSession() async throws {
+ let f = IDFixture()
+ f.transport.replace("POST /auth/devices/native", with: .success(APIResponse(status: 403, data: Data())))
+ f.transport.on("POST /auth/devices/native", fixture: "device-credential")
+ await f.signIn()
+ #expect(f.app.session != nil)
+ #expect(f.transport.sent("POST /auth/devices/native").count == 2)
+ let cookies = f.transport.sent("POST /auth/devices/native").compactMap { $0.nativeSession?.value }
+ #expect(Set(cookies).count == 2)
+ }
+
+ @Test func nativeCredentialWhoseIdentityWasRemovedCannotSurviveRelaunch() async throws {
+ let f = IDFixture(); await f.signIn()
+ try f.model.store.remove("id-1")
+ let transport = f.transport
+ let freshModel = OficinaIDModel(configuration: EquipoOficinaID.configuration,
+ store: OficinaIDStore(shared: f.shared, appPrivate: f.privateStore, group: f.defaults),
+ service: f.service, passkeys: FakePasskeys(), makeKey: { OficinaSoftwareKey() }, appDefaults: f.defaults)
+ let relaunched = EquipoAppModel(store: f.secrets, push: PushRegistrar(environment: nil), oficinaModel: freshModel,
+ makeTransport: { _ in transport })
+ await relaunched.start()
+ #expect(relaunched.session == nil)
+ #expect(relaunched.accounts.all().isEmpty)
+ }
+
+ @Test func lateRegistrationCannotRestoreSignedOutDevice() async throws {
+ let held = HeldIDTransport()
+ let f = IDFixture(held: held)
+ try await f.seedIdentity()
+ let start = Task { await f.app.start() }
+ await held.waitUntilEntered()
+ await f.app.signOut()
+ await held.release()
+ await start.value
+ #expect(f.app.session == nil)
+ #expect(f.app.accounts.all().isEmpty)
+ #expect(f.model.identity == nil)
+ }
+
+ @Test func oldSavedPairingStillLoadsWithoutOficinaID() throws {
+ let f = IDFixture()
+ var account = DeviceAccount.new(origin: f.transport.origin, label: "Old phone")
+ account.credential = try Fixture.decode("device-credential")
+ try f.app.accounts.save(account)
+ let relaunched = EquipoAppModel(store: f.secrets, push: PushRegistrar(environment: nil), oficinaModel: f.model)
+ #expect(relaunched.session?.account == account)
+ #expect(relaunched.showingPairing)
+ }
+}
+
+/// Holds the first device answer until sign-out has invalidated its request.
+private actor HeldIDTransport: EquipoTransport {
+ nonisolated let origin = URL(string: "https://oficina.example.test")!
+ private var entered = false
+ private var continuation: CheckedContinuation<Void, Never>?
+ func send(_ request: APIRequest) async throws -> APIResponse {
+ if request.path == "/auth/devices/native" {
+ entered = true
+ await withCheckedContinuation { continuation = $0 }
+ return APIResponse(status: 200, data: Fixture.data("device-credential"))
+ }
+ return APIResponse(status: 404, data: Data())
+ }
+ func lines(_ request: APIRequest) async throws -> AsyncThrowingStream<String, Error> { throw EquipoAPIError.offline }
+ func waitUntilEntered() async {
+ while !entered { await Task.yield() }
+ }
+ func release() { continuation?.resume(); continuation = nil }
+}
+
+private actor IDDailySleep {
+ let clock: IDClock
+ var waits: [Duration] = []
+ init(clock: IDClock) { self.clock = clock }
+ func wait(_ duration: Duration) throws {
+ waits.append(duration)
+ if waits.count > 1 { throw CancellationError() }
+ clock.advance(86401)
+ }
+}
diff --git a/native/apple/Tests/EquipoKitTests/Support.swift b/native/apple/Tests/EquipoKitTests/Support.swift
index 2b16896d..379289ce 100644
--- a/native/apple/Tests/EquipoKitTests/Support.swift
+++ b/native/apple/Tests/EquipoKitTests/Support.swift
@@ -13,6 +13,9 @@ final class ScriptedTransport: EquipoTransport, @unchecked Sendable {
func on(_ route: String, _ answers: Result<APIResponse, EquipoAPIError>...) {
lock.withLock { script[route, default: []] += answers }
}
+ func replace(_ route: String, with answer: Result<APIResponse, EquipoAPIError>) {
+ lock.withLock { script[route] = [answer] }
+ }
func on(_ route: String, fixture: String, status: Int = 200) { on(route, .success(APIResponse(status: status, data: Fixture.data(fixture)))) }
func on(_ route: String, status: Int, fixture: String) { on(route, .success(APIResponse(status: status, data: Fixture.data(fixture)))) }
diff --git a/native/ios/EquipoPhone.entitlements b/native/ios/EquipoPhone.entitlements
index 527170f6..8e48c363 100644
--- a/native/ios/EquipoPhone.entitlements
+++ b/native/ios/EquipoPhone.entitlements
@@ -9,5 +9,15 @@
profiles must carry aps-environment. -->
<key>aps-environment</key>
<string>$(EQUIPO_APS_ENVIRONMENT)</string>
+ <!-- Keep the old default group first so saved pairings remain readable. -->
+ <key>keychain-access-groups</key>
+ <array>
+ <string>9U4A84C4WK.works.oficina.equipo</string>
+ <string>9U4A84C4WK.works.oficina.id</string>
+ </array>
+ <key>com.apple.security.application-groups</key>
+ <array><string>group.works.oficina</string></array>
+ <key>com.apple.developer.associated-domains</key>
+ <array><string>webcredentials:id.oficina.works</string></array>
</dict>
</plist>
diff --git a/native/macos/DeveloperID.entitlements b/native/macos/DeveloperID.entitlements
index 72cdda88..df6e8b58 100644
--- a/native/macos/DeveloperID.entitlements
+++ b/native/macos/DeveloperID.entitlements
@@ -9,5 +9,15 @@
it (bundle-mac.py), gets no APNs token and does not register. -->
<key>com.apple.developer.aps-environment</key>
<string>production</string>
+ <!-- Keep the old default group first so saved pairings remain readable. -->
+ <key>keychain-access-groups</key>
+ <array>
+ <string>9U4A84C4WK.works.oficina.equipo</string>
+ <string>9U4A84C4WK.works.oficina.id</string>
+ </array>
+ <key>com.apple.security.application-groups</key>
+ <array><string>9U4A84C4WK.works.oficina</string></array>
+ <key>com.apple.developer.associated-domains</key>
+ <array><string>webcredentials:id.oficina.works</string></array>
</dict>
</plist>
diff --git a/native/scripts/build-mac.sh b/native/scripts/build-mac.sh
index 4ef6fb92..9b9f433d 100755
--- a/native/scripts/build-mac.sh
+++ b/native/scripts/build-mac.sh
@@ -3,6 +3,9 @@
# "Oficina Equipo" in Finder and the Dock, "Equipo" in its menus, Sparkle
# configured from mac-updates.json. Signs ad hoc unless --sign-identity says
# otherwise; never notarises or publishes.
+# --provisioning-profile PATH and --entitlements PATH override mac-updates.json.
+# The pinned kit embeds the profile at Contents/embedded.provisionprofile
+# before signing. Ad hoc builds omit restricted grants and never open a profile.
set -eu
cd "$(dirname "$0")/.."
swift package --package-path apple resolve
diff --git a/native/scripts/check-native.sh b/native/scripts/check-native.sh
index 13cb067a..e3b191ca 100755
--- a/native/scripts/check-native.sh
+++ b/native/scripts/check-native.sh
@@ -5,6 +5,8 @@
set -eu
cd "$(dirname "$0")/.."
logs=build/logs; mkdir -p "$logs"
+swift package --package-path apple resolve
+python3 scripts/check-oficina-id.py
python3 scripts/check-fixtures.py
python3 scripts/check-strings.py
python3 scripts/check-parity.py
diff --git a/native/scripts/check-oficina-id.py b/native/scripts/check-oficina-id.py
new file mode 100644
index 00000000..be8101fb
--- /dev/null
+++ b/native/scripts/check-oficina-id.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+"""Oficina ID's signing contract, without reading a profile or Keychain."""
+import importlib.util
+import json
+import os
+from pathlib import Path
+import plistlib
+import tempfile
+from unittest.mock import patch
+
+root = Path(__file__).resolve().parents[1]
+config = json.loads((root / 'mac-updates.json').read_text())
+old_default = '9U4A84C4WK.works.oficina.equipo'
+for relative, group, push in [
+ ('ios/EquipoPhone.entitlements', 'group.works.oficina', 'aps-environment'),
+ ('macos/DeveloperID.entitlements', '9U4A84C4WK.works.oficina', 'com.apple.developer.aps-environment'),
+]:
+ values = plistlib.loads((root / relative).read_bytes())
+ # An unspecified access group still selects the old app-private group.
+ assert values['keychain-access-groups'] == [old_default, '9U4A84C4WK.works.oficina.id'], relative
+ assert values['com.apple.security.application-groups'] == [group], relative
+ assert values['com.apple.developer.associated-domains'] == ['webcredentials:id.oficina.works'], relative
+ assert push in values, relative
+assert config['bundle_id'] == 'works.oficina.equipo'
+
+kit = Path(os.environ.get('OFICINA_NATIVE_PACKAGE_PATH', root / 'apple/.build/checkouts/native'))
+spec = importlib.util.spec_from_file_location('mac_updates', kit / 'tools/mac_updates.py')
+module = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(module)
+# Exercise the bundler used by build-mac.sh, with dummy bytes and mocked
+# signing. Never read the private profile or invoke codesign in this check.
+with tempfile.TemporaryDirectory() as temp:
+ temp = Path(temp)
+ app = temp / 'Equipo.app'
+ (app / 'Contents').mkdir(parents=True)
+ (app / 'Contents/Info.plist').write_bytes(plistlib.dumps({'CFBundleIdentifier': config['bundle_id']}))
+ profile = temp / 'fixture.provisionprofile'
+ profile.write_bytes(b'profile fixture')
+ entitlements = root / config['entitlements']
+ assert module.signing_declaration(None, entitlements, profile, {}) == (entitlements, profile)
+ with patch.object(module, 'decode_profile', return_value={}), \
+ patch.object(module, 'signing_entitlements', return_value=({}, [])), \
+ patch.object(module, 'verify_signature'), patch.object(module.subprocess, 'run'):
+ module.sign_bundle(app, 'fixture identity', entitlements, profile)
+ assert (app / 'Contents/embedded.provisionprofile').read_bytes() == profile.read_bytes()
+ # Ad hoc builds neither open the real profile nor retain restricted grants.
+ with patch.object(module, 'decode_profile', side_effect=AssertionError('opened profile')), \
+ patch.object(module.subprocess, 'run'):
+ granted = module.sign_bundle(app, '-', entitlements, temp / 'absent-profile')
+ assert 'keychain-access-groups' not in granted
+ assert not (app / 'Contents/embedded.provisionprofile').exists()
+print('Oficina ID: old default Keychain group, shared grants and Mac profile embedding checked')
diff --git a/native/scripts/strings.json b/native/scripts/strings.json
index a9d7d919..1cac3afb 100644
--- a/native/scripts/strings.json
+++ b/native/scripts/strings.json
@@ -162,5 +162,10 @@
"thread.sent": "Sent",
"track.position %@ %@": "%1$@ of %2$@",
"track.spoken %@": "Stage: %@",
- "work.tl.merge_dropped": "An earlier attempt to add this change was dropped when the task became an exploration."
+ "work.tl.merge_dropped": "An earlier attempt to add this change was dropped when the task became an exploration.",
+ "oficina.device_failed": "Could not sign in to this team. Try again.",
+ "oficina.sign_in": "Sign in with Oficina ID",
+ "oficina.retry": "Try again",
+ "oficina.connecting": "Signing in to your team",
+ "oficina.current_team": "Current team"
}