oficina / home Public

Clone
git clone https://amadan.net/oficina/home

Plain git — no account needed to clone.

Download

Download this file

1# Bumping connect past the smart door (Home spec 2026-11-19-smart-door.md, step 4)
2
3## What changed
4
5- **Removed: `Routes.Signin`.** Bumping is a compile break for every app that
6 calls it (Docs, Sheets, Calendar, Slides, Memoria, Calls). That is on
7 purpose: the old method sent a bare `/signin` to Home, and the new `/signin`
8 never does. If it had quietly changed instead, an app still on its old door
9 would lose Oficina ID from `/signin` with nothing to say so.
10- **Added:** `Routes.SigninDoor`, `Routes.SigninLocal`, `Routes.SigninOficina`;
11 `SigninPath`, `SigninLocalPath`, `SigninOficinaPath`; `OficinaHref(r)`;
12 `MintedPerson(r)`; `RoutesConfig.ForgetPath`; `PageData.ForgetAction`.
13- **Changed:**
14 - `PageData` is connect's own struct, no longer an alias of estilo's
15 `homeconnect.PageData`. It has the same fields plus `ForgetAction`, so
16 templates and embedding structs are unaffected. A conversion to
17 `homeconnect.PageData` would break; no app has one.
18 - Linking's step-up (`Routes.Account` with a stale session) now redirects
19 to `/signin/local?reauth=1`, not bare `/signin/local`. App tests that
20 assert the old Location must change.
21- **Versions:** connect's go.mod requires rastrillo v0.38.0 and estilo
22 487cadb (since step 3). Bumping connect moves an app there by minimum
23 version selection, whatever the app pinned. connect imports no
24 `lastsignin` or `auth`; that is all "free of lastsignin" means.
25
26## The interim: bump without moving to the new door
27
28To bump connect before an app's step 6, replace `routes.Signin` with
29`routes.SigninOficina` inside the app's existing `/signin` wrapper. That
30keeps today's behaviour: the wrapper's admission check, then the hop to
31Home. `SigninOficina` no longer sends `sent`, `err` or `force` to the local
32form, so a wrapper that relied on that does it first:
33
34```go
35if q := r.URL.Query(); q.Has("sent") || q.Has("err") || q.Has("force") {
36 localSignin(w, r)
37 return
38}
39routes.SigninOficina(w, r)
40```
41
42Leave `/signin/local` on the app's own handler, and auth's `SigninPath` on
43`/signin/local`, until step 6.
44
45| App (connect pin) | Interim change |
46|---|---|
47| 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)`. |
48| 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`. |
49| Calendar (14c83d7) | In `homeSignin` and `teamSignin`, `a.home.routes.Signin` becomes `SigninOficina`, with the sent/err/force branch (to `a.h.signin`) before it. |
50| 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. |
51| Memoria (14c83d7) | In `signin`, the session middleware wraps `SigninOficina` instead, with the sent/err/force branch (to `a.localSignin`). |
52| 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. |
53
54Equipo uses only `DecodeCredentials` and is unaffected.
55
56## Step 6: the smart door
57
58Each app, with rastrillo's `SigninScreen` and `SigninOneWay` on and its door
59drawn by estilo's `estilo-signin-screen`:
60
611. **Routes.** Mount `GET /signin` at `Routes.SigninDoor`, `GET /signin/local`
62 at `Routes.SigninLocal` (never the app's handler directly, or its door
63 offers Oficina ID), and `GET /signin/oficina` at `Routes.SigninOficina`.
64 `RoutesConfig.LocalSignin` stays the app's door handler; connect calls it
65 for both door routes.
662. **Admission first.** `SigninDoor` and `SigninOficina` take any live session
67 cookie as signed in. Wrap both in the check the app already runs before
68 `/signin` (Docs' `admitted` plus `withoutCookie`; Calendar's
69 `homeSignin`/`teamSignin`; Slides' and Memoria's offboard; Calls'
70 `lookupPerson`/`teamSignin`). Sheets' guards sign a refused session out
71 but ran nothing before `/signin`, so Sheets added an admission probe
72 that runs its real signed-in guard on a throwaway request; Slides did
73 the same with `requireSession` then `currentUser`. Without it, a removed
74 member's session loops between `/signin` and the page that refuses it.
75 Treat any 5xx from the guard as undecided (no refusal shown, nothing
76 remembered, nothing forgotten), never as a refusal.
773. **auth's SigninPath.** Set rastrillo `auth.Config.SigninPath` to
78 `connect.SigninPath`. Calendar (`newAuthPlugin`, auth.go) sets it to
79 `/signin/local` while Home is on; Docs' and Sheets' auth already used
80 `/signin` (only their own "send another link" hrefs pointed at
81 `/signin/local`, and those must follow too). Left at `/signin/local`,
82 every outcome, chooser link and Forget goes to the email-only door, and
83 the chooser never has an Oficina ID row. Slides, Memoria and Calls
84 already use `/signin`.
854. **The federated door.** In the door handler, if `connect.OficinaHref(r)` is
86 not `""`, set `st.Federated = &auth.FederatedDoor{Provider:
87 lastsignin.ProviderOficina, Href: href, Label: "Oficina ID", Icon:
88 chrome.OficinaGlyph}`. Set none when it is `""`: on `/signin/local`, and on
89 any step-up.
905. **Remember Oficina ID** in `Config.MintHomeSession`, after the session is
91 stored: `p, _ := connect.MintedPerson(r)`, then
92 `RememberJar().Remember(w, lastsignin.Record{Method: MethodFederated,
93 Provider: ProviderOficina, Address: p.Label})`. Never carry over an address from the
94 jar. A failure to remember must not fail the sign-in.
956. **Signed out.** Set `RoutesConfig.ForgetPath` to where `auth.Forget` is
96 mounted, and draw `chrome.SignInNotice{…}.SignedOut(p.Action).Forgetting(p.ForgetAction, "")`
97 from `connect.PageFor(r, "signedout", …)`. Docs already drew it through
98 connect's `SignedOut`; Slides and Memoria draw the signed-out page from
99 their own path today and must switch to `PageFor`, or pass their
100 ForgetPath themselves.
1017. **Team mode needs `Config.Admit`.** Since connect's member choice page
102 landed, `connect.New` refuses to boot a team-mode instance that sets
103 `HomeOnly`/`Unlinked` without `Admit`. An app jumping from an old
104 connect (Slides was on d82341c) must add a `teamAdmit` (Sheets' and
105 Docs' are the model) and mount the choose page (`/account/home/choose`).
1068. **Copy Docs, Sheets and Slides, not this list alone.** They are the
107 reviewed implementations (docs 2e21630 / #139, sheets 66e5391 / #71,
108 slides d2e830f / #49). Their review records list the bugs found the
109 first time; build their fixes in up front: Oficina ID remembered only
110 for an admitted session; the refusal only on the plain door, so
111 Other ways still works; a refused session's cookie cleared on the
112 door's own response; the return memory not overwritten by a plain
113 `/signin/local`, reset by a post without `return_to`, stripped even on
114 a parse error, `/signed-out` read as `/`, cleared by Forget and
115 sign-out; an end-to-end step-up test; the widest states at 320px.
1169. **Tests** that expect `/signin` to answer `303 /auth/start` now expect the
117 door. Tests that expect the link step-up to land on `/signin/local` now
118 expect `/signin/local?reauth=1`.
119