oficina / home Public

Run the native tests in parallel; give CI a 20-minute budget

Human

Prompt

Coordinator, 2026-11-14: hub CI on feat/oficina-id-native-a failed — the "race" step hit the runner's 15-minute job limit. Look for slow tests you added and make them fast. Report the race-step time locally before/after.

From this commit's own message. The prompt ledger has no entries for it — which is what a squashed, rebased or amended commit looks like, and what every commit looks like in a repo without a ledger.

Summary

35 of the 39 native tests are independent (each has its own app and database) and now call t.Parallel; the four that swap a package variable (mintPolicy, the two table caps) or the default logger stay serial. Local race run of internal/home: main 173 s, this branch before 212 s, after 200 s. On the hub, main e03a01a's own job takes about 14 min 5 s of its 15-minute budget (race step 777 s: internal/home 329 s, internal/provisioner 414 s), so any addition tips it over; .amadan/timeout goes from 15m to 20m (the runner allows 30m).
Agent notes
The budget is the durable problem, not this branch: internal/provisioner under -race (414 s) is the largest single cost and is untouched here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 6365328db12d44ce11c886d78a648b20ef3ff320 parent 0f45af8
7 files changed, +36 −1
  • .amadan/timeout +1 −1
  • internal/home/directory_native_test.go +3 −0
  • internal/home/native_code_test.go +13 −0
  • internal/home/native_grant_test.go +7 −0
  • internal/home/native_passkey_test.go +5 −0
  • internal/home/native_review_test.go +4 −0
  • internal/home/native_revoke_test.go +3 −0

CI passed — run details

diff --git a/.amadan/timeout b/.amadan/timeout
index 960e1d6..982b6c9 100644
--- a/.amadan/timeout
+++ b/.amadan/timeout
@@ -1 +1 @@
-15m
+20m
diff --git a/internal/home/directory_native_test.go b/internal/home/directory_native_test.go
index ab0ee93..f66600f 100644
--- a/internal/home/directory_native_test.go
+++ b/internal/home/directory_native_test.go
@@ -39,6 +39,7 @@ func exchangeBody(assertion, verifier string, extra ...string) string {
// §9: assert for the directory, exchange it with the verifier, read the
// teams. Zero teams is an empty list.
func TestNativeDirectoryTeams(t *testing.T) {
+ t.Parallel()
f := newMountedChooser(t)
cred := f.p.credential
d := newDevice(t)
@@ -126,6 +127,7 @@ func TestNativeDirectoryTeams(t *testing.T) {
// §12: the exchange accepts only native nonces. An assertion minted through
// /authorize, with a browser's nonce, does not redeem here.
func TestNativeDirectoryRefusesBrowserNonce(t *testing.T) {
+ t.Parallel()
f := newMountedChooser(t)
session := signInFully(t, f.p.credential, "web@example.invalid")
_, intent := f.p.start(t)
@@ -149,6 +151,7 @@ func TestNativeDirectoryRefusesBrowserNonce(t *testing.T) {
// The zero-teams help (§9, Paul's ruling H): help text only while Alta is
// blocked.
func TestNativeDirectoryNoTeamsHelp(t *testing.T) {
+ t.Parallel()
f := newMountedChooser(t)
w := directoryCall(t, f, "GET", noTeamsHelpPath, "", nil, nil)
if w.Code != 200 || !strings.Contains(w.Body.String(), "not on a team yet") || strings.Contains(w.Body.String(), "Create a team") {
diff --git a/internal/home/native_code_test.go b/internal/home/native_code_test.go
index 6b6ad76..8435943 100644
--- a/internal/home/native_code_test.go
+++ b/internal/home/native_code_test.go
@@ -18,6 +18,7 @@ import (
// §13 Codes: a full code sign-in, and the mail that carries the code.
func TestNativeCodeSignIn(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
start := d.start(t, app, sealtest.CanaryAddress)
@@ -52,6 +53,7 @@ func TestNativeCodeSignIn(t *testing.T) {
// §13 Codes: identical answers for known and unknown addresses.
func TestNativeCodeStartIdenticalForKnownAndUnknown(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
signInFully(t, app, "known@example.invalid")
shape := func(email string) (int, []string, []string) {
@@ -77,6 +79,7 @@ func TestNativeCodeStartIdenticalForKnownAndUnknown(t *testing.T) {
// §13 Codes: entropy, expiry and single use.
func TestNativeCodeEntropyExpiryAndSingleUse(t *testing.T) {
+ t.Parallel()
seen := map[string]bool{}
for range 200 {
c, err := newNativeCode()
@@ -126,6 +129,7 @@ func TestNativeCodeEntropyExpiryAndSingleUse(t *testing.T) {
// §13 Codes: a code dies after five wrong tries.
func TestNativeCodeDiesAfterFiveWrong(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
start := d.start(t, app, "a@example.invalid")
@@ -147,6 +151,7 @@ func TestNativeCodeDiesAfterFiveWrong(t *testing.T) {
// §13 Codes: persistent buckets survive a restart, and the per-(address,
// key) wrong-code cap holds.
func TestNativeCodeBucketsSurviveRestart(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
for range 5 {
newDevice(t).start(t, app, "a@example.invalid")
@@ -190,6 +195,7 @@ func TestNativeCodeBucketsSurviveRestart(t *testing.T) {
// §13 Codes: parallel starts cannot overspend a bucket.
func TestNativeCodeParallelStartsHoldTheCap(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
var wg sync.WaitGroup
var mu sync.Mutex
@@ -216,6 +222,7 @@ func TestNativeCodeParallelStartsHoldTheCap(t *testing.T) {
// §13 Codes: the daily cap, the returning-key exemption, and its exclusions.
func TestNativeCodeDailyCapAndReturningKeys(t *testing.T) {
+ t.Parallel()
for _, tc := range []struct {
reason string
returning bool
@@ -273,6 +280,7 @@ func TestNativeCodeDailyCapAndReturningKeys(t *testing.T) {
// The 429 markers: daily_limit is only the daily wrong-code cap for new
// devices, at start and at verify; every other limit is rate_limited.
func TestNativeCode429Markers(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
const email = "marker@example.invalid"
waiting := newDevice(t)
@@ -325,6 +333,7 @@ func TestNativeCode429Markers(t *testing.T) {
// §13 Codes: an exempt key keeps its own limit.
func TestNativeCodeExemptKeyKeepsItsOwnLimit(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
d.signInByCode(t, app, "e@example.invalid")
@@ -340,6 +349,7 @@ func TestNativeCodeExemptKeyKeepsItsOwnLimit(t *testing.T) {
// §13 Codes: one email allowance shared with the web, both ways.
func TestNativeCodeSharesTheWebEmailBudget(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
for range 5 {
signIn(t, app, "shared@example.invalid")
@@ -427,6 +437,7 @@ func httpRequestFrom(addr string) *http.Request {
// §13 Codes: no grant from a code alone on an enrolled account.
func TestNativeCodeOnEnrolledAccountNeedsPasskey(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
session := signInFully(t, app, sealtest.CanaryAddress)
enrol(t, app, session)
@@ -445,6 +456,7 @@ func TestNativeCodeOnEnrolledAccountNeedsPasskey(t *testing.T) {
// §13 Codes: no address and no code in any log line, the failure paths
// included.
func TestNativeCodeNothingInLogs(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
var buf bytes.Buffer
app.logger = slog.New(slog.NewTextHandler(&buf, &slog.HandlerOptions{Level: slog.LevelDebug}))
@@ -480,6 +492,7 @@ func (failingMailer) Send(context.Context, string, string, string) error {
// Resend replaces the code, three sends at most, thirty seconds apart.
func TestNativeCodeResend(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
start := d.start(t, app, "r@example.invalid")
diff --git a/internal/home/native_grant_test.go b/internal/home/native_grant_test.go
index c14a53a..0378732 100644
--- a/internal/home/native_grant_test.go
+++ b/internal/home/native_grant_test.go
@@ -18,6 +18,7 @@ const teamDocs = "https://blue.docs.oficina.works"
// §13 Proof: every way a proof can be wrong is refused, and no jti is
// recorded before the grant and the signature verify.
func TestNativeProofRefusals(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
grant, _ := d.signInByCode(t, app, "p@example.invalid")
@@ -60,6 +61,7 @@ func TestNativeProofRefusals(t *testing.T) {
// §13 Proof: a replayed jti is refused, also across a restart.
func TestNativeProofReplay(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
grant, _ := d.signInByCode(t, app, "r@example.invalid")
@@ -120,6 +122,7 @@ func TestNativeProofTableLimits(t *testing.T) {
// §13 Assert: the assertion is slice 1's v1 for the registered audience,
// with the grant's auth_time and a nonce Home derived from the challenge.
func TestNativeAssert(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
grant, _ := d.signInByCode(t, app, sealtest.CanaryAddress)
@@ -198,6 +201,7 @@ func TestNativeMintPolicyShared(t *testing.T) {
// §3: a 21st grant ends the least recently used; lapsed grants expire.
func TestNativeGrantLimitsAndExpiry(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
first, _ := d.signInByCode(t, app, "many@example.invalid")
@@ -255,6 +259,7 @@ func TestNativeGrantLimitsAndExpiry(t *testing.T) {
// §10: the device's own sign-out ends its grant; a late, pre-signed one is
// refused by the 30-second window.
func TestNativeSignout(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
grant, _ := d.signInByCode(t, app, "s@example.invalid")
@@ -278,6 +283,7 @@ func TestNativeSignout(t *testing.T) {
// challenge is SHA-256 of the verifier's base64url STRING, the convention the
// coordinator fixed for all three halves (Home, connect, the Swift client).
func TestNativeNonceVector(t *testing.T) {
+ t.Parallel()
raw := make([]byte, 32)
for i := range raw {
raw[i] = byte(i)
@@ -302,6 +308,7 @@ func TestNativeNonceVector(t *testing.T) {
// The two 401 markers: the client wipes the identity only on grant_ended.
func TestNativeUnauthorizedMarkers(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
grant, _ := d.signInByCode(t, app, "markers@example.invalid")
diff --git a/internal/home/native_passkey_test.go b/internal/home/native_passkey_test.go
index 787b515..f90db2d 100644
--- a/internal/home/native_passkey_test.go
+++ b/internal/home/native_passkey_test.go
@@ -42,6 +42,7 @@ func nativeChallenge(t *testing.T, w *httptest.ResponseRecorder) ([]byte, []stri
// §5: "Sign in with a passkey" needs no email; Home verifies the platform
// ceremony exactly as the web does and mints a passkey grant.
func TestNativePasskeySignIn(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
session := signInFully(t, app, sealtest.CanaryAddress)
key := enrol(t, app, session)
@@ -85,6 +86,7 @@ func TestNativePasskeySignIn(t *testing.T) {
// §5: the exact RP, origin and user-verification checks, and a failed
// ceremony still spends its challenge.
func TestNativePasskeyRejectsBadCeremonies(t *testing.T) {
+ t.Parallel()
for _, kind := range []string{"origin", "rp", "uv", "signature", "unknown"} {
t.Run(kind, func(t *testing.T) {
app := newNativeApp(t)
@@ -124,6 +126,7 @@ func TestNativePasskeyRejectsBadCeremonies(t *testing.T) {
// §4 + §5: a code on an enrolled account, finished with that person's
// passkey, mints an email+passkey grant; another person's passkey cannot.
func TestNativePendingFinishedByPasskey(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
session := signInFully(t, app, sealtest.CanaryAddress)
key := enrol(t, app, session)
@@ -161,6 +164,7 @@ func TestNativePendingFinishedByPasskey(t *testing.T) {
// §13 Domains: the association file's content, and nothing else in it.
func TestNativeAssociationFile(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
r := httptest.NewRequest("GET", Origin+aasaPath, nil)
w := httptest.NewRecorder()
@@ -191,6 +195,7 @@ func TestNativeAssociationFile(t *testing.T) {
// §4: every native endpoint refuses browser evidence and non-JSON, and
// renders nothing.
func TestNativeEndpointsRefuseBrowsers(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
for _, path := range []string{"/code/start", "/code/resend", "/code/verify", "/passkey/begin", "/passkey/finish", "/assert", "/signout"} {
for _, h := range []map[string]string{{"Origin": Origin}, {"Sec-Fetch-Site": "same-origin"}, {"Content-Type": "application/x-www-form-urlencoded"}} {
diff --git a/internal/home/native_review_test.go b/internal/home/native_review_test.go
index 7e70228..6fe115b 100644
--- a/internal/home/native_review_test.go
+++ b/internal/home/native_review_test.go
@@ -15,6 +15,7 @@ import (
// Its auth_time is a (possibly code-only) sign-in's, and the directory's
// browser routes trust auth_time for roster and operator freshness.
func TestNativeDirectorySessionIsConfined(t *testing.T) {
+ t.Parallel()
f := newMountedChooser(t)
cred := f.p.credential
d := newDevice(t)
@@ -69,6 +70,7 @@ func TestNativeDirectorySessionIsConfined(t *testing.T) {
// Review finding 2: any live grant makes a key returning; otherwise the most
// recently ENDED grant decides, not the most recently created one.
func TestNativeReturningKeyRule(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
insert := func(hash string, created int64, ended any, reason any) {
t.Helper()
@@ -121,6 +123,7 @@ func TestNativeReturningKeyRule(t *testing.T) {
// Review finding 3: expired sealed addresses are swept at boot and by
// verify and resend, not only by the next start.
func TestNativeExpiredStartsSwept(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
d.start(t, app, "swept@example.invalid")
@@ -149,6 +152,7 @@ func TestNativeExpiredStartsSwept(t *testing.T) {
// Review finding 4: rotating addresses inside one network buys nothing, and
// a device key holds one live native challenge.
func TestNativeNetworkBucketsAndBeginDedupe(t *testing.T) {
+ t.Parallel()
a := httpRequestFrom("[2001:db8:7:1::1]:1")
b := httpRequestFrom("[2001:db8:7:ffff::9]:1")
c := httpRequestFrom("[2001:db8:8::1]:1")
diff --git a/internal/home/native_revoke_test.go b/internal/home/native_revoke_test.go
index fa994b0..eb2a09f 100644
--- a/internal/home/native_revoke_test.go
+++ b/internal/home/native_revoke_test.go
@@ -17,6 +17,7 @@ import (
// §13 Revocation: a first passkey enrolment on the web ends every
// passkey-less grant; later enrolments end nothing.
func TestNativeFirstEnrolmentRevokesPasskeylessGrants(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
g1, _ := d.signInByCode(t, app, sealtest.CanaryAddress)
@@ -47,6 +48,7 @@ func TestNativeFirstEnrolmentRevokesPasskeylessGrants(t *testing.T) {
// the signed receipt this browser carries across. Behind a fresh session and
// request-forgery protection.
func TestNativeSignOutAllDevices(t *testing.T) {
+ t.Parallel()
f := newMountedChooser(t)
app := f.p.credential
g1, _ := newDevice(t).signInByCode(t, app, sealtest.CanaryAddress)
@@ -168,6 +170,7 @@ func namedCookieOrNil(r *httptest.ResponseRecorder, name string) *http.Cookie {
// §13 Revocation: recovery-based replacement ends every grant.
func TestNativeReplacementRevokesEveryGrant(t *testing.T) {
+ t.Parallel()
app := newNativeApp(t)
d := newDevice(t)
g, _ := d.signInByCode(t, app, sealtest.CanaryAddress)