# 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' guards sign a refused session out
   but ran nothing before `/signin`, so Sheets added an admission probe
   that runs its real signed-in guard on a throwaway request; Slides did
   the same with `requireSession` then `currentUser`. Without it, a removed
   member's session loops between `/signin` and the page that refuses it.
   Treat any 5xx from the guard as undecided (no refusal shown, nothing
   remembered, nothing forgotten), never as a refusal.
3. **auth's SigninPath.** Set rastrillo `auth.Config.SigninPath` to
   `connect.SigninPath`. Calendar (`newAuthPlugin`, auth.go) sets it to
   `/signin/local` while Home is on; Docs' and Sheets' auth already used
   `/signin` (only their own "send another link" hrefs pointed at
   `/signin/local`, and those must follow too). Left at `/signin/local`,
   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: `p, _ := connect.MintedPerson(r)`, then
   `RememberJar().Remember(w, lastsignin.Record{Method: MethodFederated,
   Provider: ProviderOficina, Address: p.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 already drew it through
   connect's `SignedOut`; Slides and Memoria draw the signed-out page from
   their own path today and must switch to `PageFor`, or pass their
   ForgetPath themselves.
7. **Team mode needs `Config.Admit`.** Since connect's member choice page
   landed, `connect.New` refuses to boot a team-mode instance that sets
   `HomeOnly`/`Unlinked` without `Admit`. An app jumping from an old
   connect (Slides was on d82341c) must add a `teamAdmit` (Sheets' and
   Docs' are the model) and mount the choose page (`/account/home/choose`).
8. **Copy Docs, Sheets and Slides, not this list alone.** They are the
   reviewed implementations (docs 2e21630 / #139, sheets 66e5391 / #71,
   slides d2e830f / #49). Their review records list the bugs found the
   first time; build their fixes in up front: Oficina ID remembered only
   for an admitted session; the refusal only on the plain door, so
   Other ways still works; a refused session's cookie cleared on the
   door's own response; the return memory not overwritten by a plain
   `/signin/local`, reset by a post without `return_to`, stripped even on
   a parse error, `/signed-out` read as `/`, cleared by Forget and
   sign-out; an end-to-end step-up test; the widest states at 320px.
9. **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`.
