connect: fixes from Fable's review of f763fbc (smart-door step 4)
1. The link step-up kept "local only" for one page. Begin now sends a stale session to /signin/local?reauth=1, so rastrillo carries reauth on every outcome, chooser link, Forget and Begin it sends to auth.Config.SigninPath (/signin on the smart door): the door is still drawn (no signed-in shortcut to "/") and still offers no Oficina ID. rastrillo's copy is "Sign in again to continue", which is what linking asks. TestLinkStepUpStaysLocalPastTheFirstPage. 2. README: step 6 sets auth.Config.SigninPath to connect.SigninPath (Docs, Sheets and Calendar use /signin/local today) and mounts /signin/local at Routes.SigninLocal, never the app's handler. 3. MIGRATING.md: the API changes, the per-app interim (routes.Signin -> routes.SigninOficina inside each app's wrapper, keeping today's hop; Sheets needs a small sent/err/force wrapper) and the step-6 checklist. 4. "forces no rastrillo version" reworded: connect imports no lastsignin or auth, but its go.mod requires rastrillo v0.38.0 and estilo 487cadb. 5. README: wrap SigninDoor and SigninOficina in the app's admission check, or a removed member loops. No new hook. 6. Tests: PageFor on any state but "signedout" carries no ForgetAction (the view.go guard is now caught), and TestConnectImportsNoLastsignin fails rather than skips when go list fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 files changed,
+179
−10
connect/MIGRATING.md+95 −0connect/README.md+20 −5connect/api.go+2 −1connect/door_test.go+49 −2connect/navigation.go+12 −1connect/navigation_test.go+1 −1
CI passed — run details
CI log
amadan: .amadan/timeout: this job's budget is 20m0s (this runner allows up to 30m0s) === vet === CGO_ENABLED=0 go vet ./... CGO_ENABLED=0 go vet -tags browser ./internal/home/ cd handoff && CGO_ENABLED=0 go vet ./... cd roster && CGO_ENABLED=0 go vet ./... cd dashboard && CGO_ENABLED=0 go vet ./... cd connect && CGO_ENABLED=0 go vet ./... cd teammode && CGO_ENABLED=0 go vet ./... === fmt === === build === CGO_ENABLED=0 go build ./... CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build ./cmd/home ./cmd/oficina ./internal/operatorlaunch cd handoff && CGO_ENABLED=0 go build ./... cd roster && CGO_ENABLED=0 go build ./... cd dashboard && CGO_ENABLED=0 go build ./... cd connect && CGO_ENABLED=0 go build ./... cd teammode && CGO_ENABLED=0 go build ./... === go-test === CGO_ENABLED=0 go test -count=1 ./... ? amadan.net/oficina/home/cmd/home [no test files] ok amadan.net/oficina/home/cmd/home-placeholder 0.772s ? amadan.net/oficina/home/cmd/oficina [no test files] ok amadan.net/oficina/home/internal/guardstest 0.097s ok amadan.net/oficina/home/internal/home 51.930s ok amadan.net/oficina/home/internal/home/directorydata 1.439s ok amadan.net/oficina/home/internal/home/logtest 0.004s ok amadan.net/oficina/home/internal/home/seal 0.002s ok amadan.net/oficina/home/internal/home/sealtest 0.006s ok amadan.net/oficina/home/internal/home/wisp 0.051s ok amadan.net/oficina/home/internal/operator 6.449s ok amadan.net/oficina/home/internal/operatorlaunch 4.122s ok amadan.net/oficina/home/internal/provisioner 49.028s cd handoff && CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/home/handoff 0.668s ok amadan.net/oficina/home/handoff/seal 0.002s cd roster && CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/home/roster 5.122s cd dashboard && CGO_ENABLED=0 go test ./... ok amadan.net/oficina/home/dashboard (cached) cd connect && CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/home/connect 1.407s ok amadan.net/oficina/home/connect/linkstore 0.508s cd teammode && CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/home/teammode 0.101s ? amadan.net/oficina/home/teammode/teammodetest [no test files] === race === go test -race -count=1 ./internal/home/ ./internal/operator/ ./internal/operatorlaunch/ ./internal/home/directorydata/ ok amadan.net/oficina/home/internal/home 320.779s ok amadan.net/oficina/home/internal/operator 82.747s ok amadan.net/oficina/home/internal/operatorlaunch 22.393s ok amadan.net/oficina/home/internal/home/directorydata 23.652s ok amadan.net/oficina/home/internal/provisioner 399.470s cd handoff && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/handoff 12.868s ok amadan.net/oficina/home/handoff/seal 1.014s cd roster && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/roster 6.963s cd dashboard && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/dashboard 1.065s cd connect && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/connect 6.231s ok amadan.net/oficina/home/connect/linkstore 6.263s cd teammode && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/teammode 1.947s ? amadan.net/oficina/home/teammode/teammodetest [no test files]
diff --git a/connect/MIGRATING.md b/connect/MIGRATING.md| new file mode 100644 |
| index 0000000..ce00f15 |
| --- /dev/null |
| +++ b/connect/MIGRATING.md |
| @@ -0,0 +1,95 @@ |
| +# Bumping connect past the smart door (Home spec 2026-11-19-smart-door.md, step 4) |
| + |
| +## What changed |
| + |
| +- **Removed: `Routes.Signin`.** Bumping is a compile break for every app that |
| + calls it (Docs, Sheets, Calendar, Slides, Memoria, Calls). That is on |
| + purpose: the old method sent a bare `/signin` to Home, and the new `/signin` |
| + never does. If it had quietly changed instead, an app still on its old door |
| + would lose Oficina ID from `/signin` with nothing to say so. |
| +- **Added:** `Routes.SigninDoor`, `Routes.SigninLocal`, `Routes.SigninOficina`; |
| + `SigninPath`, `SigninLocalPath`, `SigninOficinaPath`; `OficinaHref(r)`; |
| + `MintedPerson(r)`; `RoutesConfig.ForgetPath`; `PageData.ForgetAction`. |
| +- **Changed:** |
| + - `PageData` is connect's own struct, no longer an alias of estilo's |
| + `homeconnect.PageData`. It has the same fields plus `ForgetAction`, so |
| + templates and embedding structs are unaffected. A conversion to |
| + `homeconnect.PageData` would break; no app has one. |
| + - Linking's step-up (`Routes.Account` with a stale session) now redirects |
| + to `/signin/local?reauth=1`, not bare `/signin/local`. App tests that |
| + assert the old Location must change. |
| +- **Versions:** connect's go.mod requires rastrillo v0.38.0 and estilo |
| + 487cadb (since step 3). Bumping connect moves an app there by minimum |
| + version selection, whatever the app pinned. connect imports no |
| + `lastsignin` or `auth`; that is all "free of lastsignin" means. |
| + |
| +## The interim: bump without moving to the new door |
| + |
| +To bump connect before an app's step 6, replace `routes.Signin` with |
| +`routes.SigninOficina` inside the app's existing `/signin` wrapper. That |
| +keeps today's behaviour: the wrapper's admission check, then the hop to |
| +Home. `SigninOficina` no longer sends `sent`, `err` or `force` to the local |
| +form, so a wrapper that relied on that does it first: |
| + |
| +```go |
| +if q := r.URL.Query(); q.Has("sent") || q.Has("err") || q.Has("force") { |
| + localSignin(w, r) |
| + return |
| +} |
| +routes.SigninOficina(w, r) |
| +``` |
| + |
| +Leave `/signin/local` on the app's own handler, and auth's `SigninPath` on |
| +`/signin/local`, until step 6. |
| + |
| +| App (connect pin) | Interim change | |
| +|---|---| |
| +| Docs (e03a01a) | Drop-in: `homeRoutes.signin` already sends sent/err/force to `handlers.signin` first. `h.routes.Signin(w, r)` becomes `h.routes.SigninOficina(w, r)`. | |
| +| Sheets (e03a01a) | `/signin` is mounted raw at `a.homeRoutes.Signin`: mount a small wrapper with the sent/err/force branch above (to `a.handleSignin`), then `SigninOficina`. | |
| +| Calendar (14c83d7) | In `homeSignin` and `teamSignin`, `a.home.routes.Signin` becomes `SigninOficina`, with the sent/err/force branch (to `a.h.signin`) before it. | |
| +| Slides (d82341c) | In `homeSignin`, `a.homeRoutes.Signin` becomes `SigninOficina`, with the sent/err/force branch (to `a.signin`). Slides has the oldest pin; its bump also brings every connect change since 11-01. | |
| +| Memoria (14c83d7) | In `signin`, the session middleware wraps `SigninOficina` instead, with the sent/err/force branch (to `a.localSignin`). | |
| +| Calls (14c83d7) | In `signin`, the session middleware wraps `SigninOficina` instead, with the sent/err/force branch (to `a.localSignin`); the join-cookie branch is unchanged. | |
| + |
| +Equipo uses only `DecodeCredentials` and is unaffected. |
| + |
| +## Step 6: the smart door |
| + |
| +Each app, with rastrillo's `SigninScreen` and `SigninOneWay` on and its door |
| +drawn by estilo's `estilo-signin-screen`: |
| + |
| +1. **Routes.** Mount `GET /signin` at `Routes.SigninDoor`, `GET /signin/local` |
| + at `Routes.SigninLocal` (never the app's handler directly, or its door |
| + offers Oficina ID), and `GET /signin/oficina` at `Routes.SigninOficina`. |
| + `RoutesConfig.LocalSignin` stays the app's door handler; connect calls it |
| + for both door routes. |
| +2. **Admission first.** `SigninDoor` and `SigninOficina` take any live session |
| + cookie as signed in. Wrap both in the check the app already runs before |
| + `/signin` (Docs' `admitted` plus `withoutCookie`; Calendar's |
| + `homeSignin`/`teamSignin`; Slides' and Memoria's offboard; Calls' |
| + `lookupPerson`/`teamSignin`; Sheets has none yet). Without it, a removed |
| + member's session loops between `/signin` and the page that refuses it. |
| +3. **auth's SigninPath.** Set rastrillo `auth.Config.SigninPath` to |
| + `connect.SigninPath`. Docs (`signinAgainPath`, auth.go), Sheets |
| + (`signinFormPath`, signin.go) and Calendar (`newAuthPlugin`, auth.go) set |
| + it to `/signin/local` while Home is on. Left there, every outcome, chooser |
| + link and Forget goes to the email-only door, and the chooser never has an |
| + Oficina ID row. Slides, Memoria and Calls already use `/signin`. |
| +4. **The federated door.** In the door handler, if `connect.OficinaHref(r)` is |
| + not `""`, set `st.Federated = &auth.FederatedDoor{Provider: |
| + lastsignin.ProviderOficina, Href: href, Label: "Oficina ID", Icon: |
| + chrome.OficinaGlyph}`. Set none when it is `""`: on `/signin/local`, and on |
| + any step-up. |
| +5. **Remember Oficina ID** in `Config.MintHomeSession`, after the session is |
| + stored: `RememberJar().Remember(w, lastsignin.Record{Method: |
| + MethodFederated, Provider: ProviderOficina, Address: |
| + connect.MintedPerson(r).Label})`. Never carry over an address from the |
| + jar. A failure to remember must not fail the sign-in. |
| +6. **Signed out.** Set `RoutesConfig.ForgetPath` to where `auth.Forget` is |
| + mounted, and draw `chrome.SignInNotice{…}.SignedOut(p.Action).Forgetting(p.ForgetAction, "")` |
| + from `connect.PageFor(r, "signedout", …)`. Docs, Slides and Memoria draw |
| + the signed-out page from their own path today and must switch to |
| + `PageFor`, or pass their ForgetPath themselves. |
| +7. **Tests** that expect `/signin` to answer `303 /auth/start` now expect the |
| + door. Tests that expect the link step-up to land on `/signin/local` now |
| + expect `/signin/local?reauth=1`. |
diff --git a/connect/README.md b/connect/README.md| index 24d106e..5ebeeee 100644 |
| --- a/connect/README.md |
| +++ b/connect/README.md |
| @@ -92,7 +92,9 @@ state the door must answer"): |
| - `SigninLocalPath` (`/signin/local`) at `Routes.SigninLocal`: the same door |
| with **email as the one way in**. connect sends people here when Oficina ID |
| cannot help them: unknown, failed, a link to resume, "Connect my existing |
| - account", and a session too old to link. It has no signed-in shortcut. |
| + account", and a session too old to link (as `/signin/local?reauth=1`). It |
| + has no signed-in shortcut. Mount it at `SigninLocal`, never at the app's |
| + door handler directly, or that door offers Oficina ID. |
| - `SigninOficinaPath` (`/signin/oficina?return_to=…`) at `Routes.SigninOficina`: |
| "Continue with Oficina ID". It remembers the validated `return_to` in the |
| sealed return cookie and redirects to `handoff.StartPath`. A live session |
| @@ -112,12 +114,25 @@ if href := connect.OficinaHref(r); href != "" { |
| } |
| ``` |
| -`SigninDoor` and `SigninOficina` read the session cookie and nothing else. An |
| -app whose signed-in routes refuse some live sessions must end or hide such a |
| -session first, or `/signin` and the refusing page redirect to each other. |
| +Set rastrillo's `auth.Config.SigninPath` to `connect.SigninPath`. rastrillo |
| +sends every outcome, chooser link and Forget there. Apps with Home set it to |
| +`/signin/local` today, and left there the chooser never has an Oficina ID row. |
| +A step-up stays local on `/signin` too, because `reauth=1` rides every one of |
| +those links. |
| + |
| +**Wrap `SigninDoor` and `SigninOficina` in the app's admission check.** They |
| +read the session cookie and nothing else, so a session the app's signed-in |
| +routes refuse (a removed member, a revoked share) counts as signed in. Unless |
| +the app ends or hides it first, `/signin` and the refusing page redirect to |
| +each other forever. |
| + |
| +Bumping connect is a compile break (`Routes.Signin` is gone). `MIGRATING.md` |
| +has the per-app changes, including an interim that keeps today's behaviour |
| +until an app moves to the new door. |
| **Remembering Oficina ID** is the app's job, in `Config.MintHomeSession`. |
| -connect imports no `lastsignin`, so it forces no rastrillo version on you. |
| +connect imports no `lastsignin` or `auth` (its go.mod still requires |
| +rastrillo v0.38.0, so a bump moves you there). |
| After storing the session, call `RememberJar().Remember` with |
| `lastsignin.MethodFederated`, `ProviderOficina` and the address of |
| `connect.MintedPerson(r)` (empty for a Home-only person). Never carry an |
diff --git a/connect/api.go b/connect/api.go| index fec56f1..5531a05 100644 |
| --- a/connect/api.go |
| +++ b/connect/api.go |
| @@ -84,7 +84,8 @@ type Config struct { |
| // That makes it the one place an app remembers "Continue with Oficina |
| // ID" for its smart door (Home spec 2026-11-19-smart-door.md, "The |
| // cookie"), and connect leaves it to the app: connect imports no |
| - // lastsignin, so it forces no rastrillo version on its consumers. |
| + // lastsignin or auth. (Its go.mod requires rastrillo v0.38.0, so a |
| + // bump still moves an app there.) |
| // Once the session is stored, the app records the federated way in |
| // with the address of the person who just signed in, or with none: |
| // |
diff --git a/connect/door_test.go b/connect/door_test.go| index 907699c..a643513 100644 |
| --- a/connect/door_test.go |
| +++ b/connect/door_test.go |
| @@ -273,7 +273,7 @@ func TestStepUpNeverReachesHome(t *testing.T) { |
| f.h.navigation = n |
| w := httptest.NewRecorder() |
| n.Begin(w, httptest.NewRequest(http.MethodGet, navigationOrigin+"/account/home", nil)) |
| - if w.Code != 303 || w.Header().Get("Location") != SigninLocalPath { |
| + if w.Code != 303 || w.Header().Get("Location") != linkStepUpPath { |
| t.Fatalf("link step-up: %d %q", w.Code, w.Header().Get("Location")) |
| } |
| f.get(f.h.SigninLocal, w.Header().Get("Location"), liveSession) |
| @@ -285,6 +285,45 @@ func TestStepUpNeverReachesHome(t *testing.T) { |
| } |
| } |
| +// TestLinkStepUpStaysLocalPastTheFirstPage is Fable's finding 1 on |
| +// f763fbc. Linking sends a signed-in person to sign in again, and the |
| +// first page is /signin/local. Every page after it is rastrillo's: an |
| +// outcome, a chooser link, Forget and Begin all go to auth.Config.SigninPath, |
| +// which is /signin on the smart door. Marked reauth=1, they carry the |
| +// step-up, so /signin still draws the door (no shortcut to "/" before the |
| +// person has signed in again) and still offers no Oficina ID. |
| +func TestLinkStepUpStaysLocalPastTheFirstPage(t *testing.T) { |
| + f := newDoorFixture(t) |
| + _, n := navigationFixture(t) |
| + w := httptest.NewRecorder() |
| + n.Begin(w, httptest.NewRequest(http.MethodGet, navigationOrigin+"/account/home", nil)) |
| + first, err := url.Parse(w.Header().Get("Location")) |
| + if err != nil || first.Path != SigninLocalPath || first.Query().Get("reauth") != "1" { |
| + t.Fatalf("link step-up is not marked: %q", w.Header().Get("Location")) |
| + } |
| + // What rastrillo v0.38.0's one-way screen sends next, with SigninPath |
| + // /signin (auth/oneway.go: signinHref sets reauth=1 on every chooser |
| + // link and Back; afterForget and keepReauth keep it on Forget's and |
| + // Begin's redirects). connect cannot import auth here without pulling |
| + // rastrillo's whole module graph into its go.sum, so the shapes are |
| + // written out. |
| + for _, next := range []string{ |
| + SigninPath + "?reauth=1&way=email", // EmailHref, Use a different email |
| + SigninPath + "?reauth=1", // Back |
| + SigninPath + "?err=rate&reauth=1", // Begin's rate limit, kept by keepReauth |
| + SigninPath + "?reauth=1&return_to=%2Fd%2F42&ways=1", // the chooser |
| + } { |
| + calls := f.calls |
| + w := f.get(f.h.SigninDoor, next, liveSession) |
| + if w.Code != 299 || f.calls != calls+1 { |
| + t.Fatalf("%s bounced a person stepping up: %d %q", next, w.Code, w.Header().Get("Location")) |
| + } |
| + if f.href != "" { |
| + t.Fatalf("%s offered Oficina ID to a step-up", next) |
| + } |
| + } |
| +} |
| + |
| // TestSignedOutOffersForget: with ForgetPath, the signed-out page carries a |
| // second form, "Forget me on this device", posting to the app's Forget. |
| // Without it there is none, as before. It is a plain same-origin form, so |
| @@ -300,6 +339,11 @@ func TestSignedOutOffersForget(t *testing.T) { |
| Protect: csrf.Protect(bridgeOrigin), |
| Render: func(w http.ResponseWriter, r *http.Request, state, label string, status int) { |
| got = PageFor(r, state, label) |
| + for _, other := range []string{"failed", "unknown", "success", "start"} { |
| + if PageFor(r, other, label).ForgetAction != "" { |
| + t.Fatalf("%s offered Forget", other) |
| + } |
| + } |
| w.WriteHeader(status) |
| }} |
| h, err := NewRoutes(f.b, cfg) |
| @@ -445,7 +489,10 @@ func TestMintedPersonIsWhoJustSignedIn(t *testing.T) { |
| func TestConnectImportsNoLastsignin(t *testing.T) { |
| out, err := exec.Command("go", "list", "-deps", "./...").Output() |
| if err != nil { |
| - t.Skip("go list unavailable:", err) |
| + t.Fatal("go list -deps failed, so nothing was checked:", err) |
| + } |
| + if !strings.Contains(string(out), "amadan.net/oficina/home/connect\n") { |
| + t.Fatal("go list -deps did not list connect itself") |
| } |
| for _, dep := range strings.Fields(string(out)) { |
| switch dep { |
diff --git a/connect/navigation.go b/connect/navigation.go| index 94a9b85..35a218f 100644 |
| --- a/connect/navigation.go |
| +++ b/connect/navigation.go |
| @@ -107,9 +107,20 @@ func (n *localLinkNavigation) Begin(w http.ResponseWriter, r *http.Request) { |
| return |
| } |
| localNavigationCookie(w, localLinkNavigationCookie, encoded, int(localLinkNavigationLifetime)) |
| - http.Redirect(w, r, SigninLocalPath, http.StatusSeeOther) |
| + http.Redirect(w, r, linkStepUpPath, http.StatusSeeOther) |
| } |
| +// linkStepUpPath is where linking sends a person to sign in again: the |
| +// email-only door, marked as a step-up. The mark is what keeps it local |
| +// past the first page. rastrillo sends every outcome, chooser link and |
| +// Forget to auth.Config.SigninPath, which is SigninPath once an app is on |
| +// the smart door; reauth=1 rides all of them (and Begin's form), so the |
| +// door it lands on still offers no Oficina ID (OficinaHref, auth's |
| +// offers) and SigninDoor's signed-in shortcut does not bounce the person |
| +// to "/" before they have signed in again. The copy is rastrillo's |
| +// "Sign in again to continue", which is what linking asks. |
| +const linkStepUpPath = SigninLocalPath + "?reauth=1" |
| + |
| var ( |
| errNavigationClock = errors.New("home connect: navigation clock unusable") |
| errNavigationSeal = errors.New("home connect: navigation marker unavailable") |
diff --git a/connect/navigation_test.go b/connect/navigation_test.go| index f87707d..11ba296 100644 |
| --- a/connect/navigation_test.go |
| +++ b/connect/navigation_test.go |
| @@ -48,7 +48,7 @@ func TestNavigationRequiresActualFreshLocalSession(t *testing.T) { |
| } |
| w := httptest.NewRecorder() |
| n.Begin(w, httptest.NewRequest("GET", navigationOrigin+"/account/home", nil)) |
| - if w.Code != 303 || w.Header().Get("Location") != "/signin/local" { |
| + if w.Code != 303 || w.Header().Get("Location") != "/signin/local?reauth=1" { |
| t.Fatal(w.Code, w.Header()) |
| } |
| r := httptest.NewRequest("GET", navigationOrigin+localLinkCompletePath, nil) |