The bug and the fix
The account menu offered "Connect your Oficina account" whenever the session method was not connect.HomeMethod. So somebody whose Slides account was already linked, but who signed in with the emailed link this time, still saw it (Paul hit this). offersHomeLink (internal/slides/chrome.go) now decides by the stored link: it offers the item only when Home is configured, the viewer is signed in, and a.home.Linked(ctx, v.user.ID) returns (false, nil). An error offers nothing. Once linked, the item is gone however the session signed in. The person ID is viewerState.user.ID, already resolved by currentUser/optionalViewer for every page that draws the menu, so nothing new is looked up to find it. The diff in chrome.go is only offersHomeLink and its one caller, to stay clear of feat/switcher-tiles.
Lookup cost
One query on the UNIQUE (issuer, personid) index of `homeidentity_links`, on each render that draws the account menu. Nothing on pages without the menu, and nothing when Home is not configured.
Upstream dependency: merge those first
This pins amadan.net/oficina/home/connect to home branch fix/connect-item-when-linked @ 08bbcf3, which pulls estilo fix/connect-item-when-linked @ 0b375d5. Both must merge first. Then this pin should move to their merge commits before this branch merges. The estilo jump (main 10-01 to 0b375d5) broke no Slides test.
What comes with it:
- The unknown-assertion flow. An ordinary Oficina sign-in with an unlinked subject shows "Oficina account not connected", whose button goes to
/signin/local. connect leaves a sealed 10-minute marker. A local sign-in in the same browser then goes from /auth/local/complete to /auth/start?return_to=%2Faccount%2Fhome%2Fconfirm, then a fresh Oficina assertion, then the confirm page, and the confirm POST stores the link. An expired marker is ignored and the landing is as before. - The success page. The confirm POST now redirects to
/account/home/confirm?connected=1&return_to=…, which renders "Accounts connected" only for a signed-in person whose link is stored. Slides renders the Home pages through connect.PageFor, so its "Back to Slides" goes to the page the link began from instead of always /. Slides sets no ReturnPath today, so in practice that is still /. The test checks the return_to path is honoured. - The button row. The connect page's primary and Back buttons sit in one
<div rst-form-foot> row, primary first (estilo's homeconnect template).
Copy
slides.home.confirm_title "Connect these two accounts?", confirm_body "Your Oficina account is confirmed. Connect it to the Slides account below, and you can sign in to Slides with Oficina from now on.", unknown_body "Sign in to your Slides account once to connect it to your Oficina account." The hub stays unnamed. en.toml is the only locale file.
The confirm step stays
We kept the explicit confirm click. Skipping it would let a remembered unknown assertion plus a local sign-in link two accounts with no deliberate gesture. And the Oficina assertion carries only an opaque subject, so the confirm page cannot name the Oficina address, only the local one. Instead the confirm page now has its own title and copy, so it no longer reads as the start page reloaded.
Was the link really stored?
Yes. In TestHomeMenuConnectThenAccountsConnectedAndItemGone (menu path) and in TestHomeUnknownAssertionResumesLinkAfterLocalSignIn (resume path), home_identity_links has 0 rows before the confirm POST and exactly 1 after it. Bridge.Resolve(subject) returns the local person (ID 72). The connected=1 page shows "Accounts connected", and the next page's menu no longer has the item.
Tests (internal/slides/homemenutest.go)
They run the real router under the locale middleware, with one cookie jar, a real signed assertion, and the real mail link and confirm door. Each was seen to fail without its fix:
- unlinked local session: the menu offers the item. Old code was already right here, so I checked it with a mutation:
return false fails it. - linked local session: no item. Fails on the old method check ("a linked person signed in locally is still offered…").
- Home session: no item. Mutation
return true fails it. - confirm POST, then Accounts connected, link row stored, item gone on the next render. Fails on the old method check (item still offered). Fails with
connect.Page instead of PageFor (way back ignores return_to). Fails with the old copy (confirm page lacks its own title). - unknown flow end to end. On main's pins it fails with "local sign-in did not resume the link: 303 /". With the old copy it fails on the unknown page wording.
- plain local sign-in with no marker lands on
/ and begins no link. This guards against a regression and passes on both. - button row. On main's estilo it fails: the buttons are not one rst-form-foot row.
I did not test the expired marker here. Slides has no clock hook into connect's Config.Now, and the marker is sealed, so an expired one cannot be made from the app side without adding a production test seam. Upstream covers it: home TestUnknownMarkerExpiresToTheMenuPath.
Gate
make ci and the JS half of .amadan/ci.d/10-gate pass locally with go1.26.5. Locally the wasm byte-compare cannot match, because this machine has Homebrew rustc 1.92 and not the pinned 1.98. No Rust is touched. The hub runner is the check for that step.