The bug
The account menu offered "Connect your Oficina account" to any member whose session method was magiclink or keymail. A person whose account is already linked to Oficina, but who signed in this time with Calls' own emailed link, still saw it (Paul hit this).
The fix
offersHomeLink(r, v) keeps its conditions (Home configured, signed in, member, local method) and adds a.home.bridge.Linked(r.Context(), v.person.ID) returning (false, nil). The offer follows the stored link, not how this session signed in. An error offers nothing. The person ID comes from the viewer that account() already has (viewerOf: the context person behind the guards, otherwise the optional lookup), so there is no second person lookup. The chrome.go diff is local to offersHomeLink and its one call, so it should merge cleanly with feat/switcher-tiles.
Lookup cost: one SELECT 1 FROM home_identity_links WHERE issuer = ? AND person_id = ? on the UNIQUE (issuer, person_id) index, run only on renders that draw the account menu for a local member session. A Home session short-circuits before the query.
Upstream this depends on (merge these first)
- home
fix/connect-item-when-linked @ 08bbcf3 (Bridge.Linked, connect.PageFor, the unknown-assertion resume, the success page, the new copy) - estilo
fix/connect-item-when-linked @ 0b375d5 (the homeconnect button row)
This branch pins those branch commits. Once they merge, move the pin to the merge commits.
What changes for the person
- Unknown assertion: an Oficina sign-in with no link here shows "Oficina account not connected". Its one button, "Sign in to your existing account", goes to
/signin/local. The next fresh local sign-in in the same browser (/auth/local/complete) begins the link itself: /auth/start?return_to=%2Faccount%2Fhome%2Fconfirm, then a fresh Home assertion, then the confirm page. A marker older than 10 minutes is ignored, and the person lands on /continue as before. - Success page: Connect accounts now redirects to
/account/home/confirm?connected=1&return_to=…, which shows "Accounts connected", only to a signed-in person whose link is stored. Calls renders with connect.PageFor, so "Back to the app" returns to the page the link began from, not /. - Button row: the connect pages' buttons share one
<div rst-form-foot> row, primary first. - Copy: Calls has no copy overrides (it uses
connect.English directly), so it gets the new confirm and unknown copy for free.
Confirm step: kept
We kept the explicit confirm click. Skipping it would let a remembered unknown assertion plus a local sign-in link the two accounts with no deliberate gesture. 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 ("Connect these two accounts?") and its own copy.
Was the link actually stored?
Yes. The tests count rows in home_identity_links joined to alice's persons row:
- 0 before the confirm click;
- 1 after Connect accounts, both from the menu and from the unknown-assertion resume.
After the resume, a later Oficina sign-in with that subject succeeds.
Edge case: the resume needs the person's persons row to exist already. Calls' LookupLocalSession uses existingHomePerson, and the row is created on /continue. A member who has never signed in to Calls before therefore does not resume. connect falls back to /account/home (the Connect page), which still works. The tests give alice one earlier sign-in, which is the "existing account" the page asks for.
Tests (internal/calls/home_connect_item_test.go), each seen red
| Test | What it checks | Red run | |---|---|---| | TestTheConnectItemFollowsTheStoredLinkNotTheSessionMethod | Unlinked local session: item shown. Home session: no item. Linked account signed in by emailed link: no item. | Without the offersHomeLink change: "a linked account signed in by emailed link is still offered to connect" | | TestConfirmingTheLinkSaysSoAndRetiresTheMenuItem | Confirm POST leads to Accounts connected, the row exists, and the next render in the same magic-link session has no item. | Without the fix: "the menu still offers to connect right after connecting". On the old pins: fails at the confirm page's title. | | TestAnUnknownOficinaSigninResumesAsALinkAfterLocalSignin | The full resume flow (unknown page, local sign-in, freshness start, assertion, confirm, link stored), started from /signin?return_to=/settings. | Without PageFor: the success button is not href="/settings". On the old pins: lands on /continue. | | TestAnExpiredUnknownMarkerLandsAsBefore | A marker sealed with the fixture's DEK, 11 minutes old, lands on /continue. The same marker 1 minute old resumes, which shows the forged marker is the one connect writes. | On the old pins: the current-marker half fails. | | TestTheConnectPagesButtonsShareOneRowPrimaryFirst | Exact rst-form-foot markup, primary Connect first, then Back. | On the old estilo pin. |
Gate: GOTOOLCHAIN=go1.26.5 make ci and make race are green locally. The estilo bump broke no existing test.