Branch fix/connect-item-when-linked @ dc23a0d. Not merged, not deployed.
The bug and the fix
offersHomeLink refused only Home-method sessions. So a person whose Sheets account was already linked, but who signed in with the email link, was still offered "Connect your Oficina account" (the same thing Paul hit in Docs). Sheets had the bug.
The menu item now follows the stored link, not the session method: it is offered only when Home is configured, the viewer has a local (non-Home) session, and a.home.Linked(ctx, memberID) returns (false, nil). An error offers nothing. Once linked, the item never appears, however the session signed in. The person ID is the members.id for the session's address (read without creating, via a new localMemberID helper in home.go). Nothing in the request context already carried it. The chrome.go diff is confined to offersHomeLink and its one call (it now takes the address), so it should merge cleanly with feat/switcher-tiles.
Lookup cost
Each render that draws the account menu costs two indexed point reads: members by its unique address index, then home_identity_links on its UNIQUE (issuer, person_id) index.
Unknown-assertion flow (dependency)
This pins amadan.net/oficina/home/connect to home branch fix/connect-item-when-linked @ 08bbcf3, which brings estilo fix/connect-item-when-linked @ 0b375d5. Both must merge first, and this pin should then move to their merge commits. With it, an Oficina sign-in with no link shows the unknown page ("Sign in to your Sheets account once to connect it to your Oficina account.", button to /signin/local) and leaves a 10-minute sealed marker. The next fresh local sign-in in that browser begins the link itself: /auth/start?return_to=%2Faccount%2Fhome%2Fconfirm, then a fresh Home assertion, then the confirm page. Without the marker, the landing is /sheets as before.
Success page
The confirm POST now leads to /account/home/confirm?connected=1&return_to=..., which renders "Accounts connected". Sheets now calls connect.PageFor(r, ...), so its "Back to Sheets" goes to the page sign-in began from (e.g. /sheets), not /.
Button row
The connect page's buttons now sit in one <div rst-form-foot> row, primary first (estilo 0b375d5). A render-level test asserts this.
Confirm-step decision
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. Also, the Oficina assertion carries only an opaque subject, so the confirm page cannot name the Oficina address, only the local one. The confirm page now has its own title and copy: "Connect these two accounts?" / "Your Oficina account is confirmed. Connect it to the Sheets account below, and you can sign in to Sheets with Oficina from now on." The hub stays unnamed.
Was the link actually stored?
Yes. The tests count home_identity_links rows for the member: 0 on the confirm page before the click, and 1 after the confirm POST. This holds for both the menu flow and the resumed unknown flow. The very next /sheets render in the same session no longer offers the item.
Tests (internal/sheets/homeconnectitem_test.go), each seen red without its fix
TestConnectItemFollowsTheStoredLink: unlinked local session sees the item; after linking, the same session does not, and neither does a later email-link session; a Home session does not. Red with the old offersHomeLink ("a linked person signed in by email link is offered the connection").TestConfirmLeadsToAccountsConnected: Sheets' confirm copy; buttons in one form-foot row, primary then ghost; no link before the click; POST then "Accounts connected"; row stored; menu item gone. Red with the old offersHomeLink (menu), the old copy (confirm copy), and the old module pins (no rst-form-foot row).TestUnknownArrivalResumesTheLinkAfterLocalSignIn: the full flow above, through a real magic link, ending in "Accounts connected" with href="/sheets". Red with the old pins (local sign-in landed on /sheets), with connect.Page instead of PageFor (wrong back link), with the old copy, and with the old offersHomeLink.TestUnknownArrivalForgottenLandsAsBefore: the marker is set with Max-Age 600. With it gone (what the browser does after ten minutes), the local sign-in lands on /sheets and the item is offered. Red with the old pins (no marker). The sealed in-marker expiry can't be driven from Sheets, because connect's navigation clock isn't injectable from the app. It is covered upstream by TestUnknownMarkerExpiresToTheMenuPath.- The unlinked and Home-session cases are regression guards: they pass both before and after the fix.
- Fixture:
home_test.go's link helper now checks the new confirm title.
make test (GOTOOLCHAIN=go1.26.5) is green locally. The estilo bump broke nothing else.
Review: not yet reviewed by the highest-capability model (AGENTS.md §Review), so that pass is still owed before merge.