oficina / home Public

connect: menu reads the stored link; unknown arrivals resume linking; Accounts connected open

On branch fix/connect-item-when-linked

These shared home/connect changes back the "Connect your Oficina account" fixes in slides, sheets, calendar, memoria and meet. Docs carries its own copy of the same code.

Changes

  • Bridge.Linked(ctx, personID) (via linkstore.Linked): one lookup on home_identity_links' UNIQUE (issuer, person_id) index. Apps offer the menu item only when it reports no link. Before, they offered it to every non-Home session, so a linked person who used the app's email link still saw it (Paul hit this in Docs).
  • Unknown arrivals resume linking. An ordinary assertion with no link now leaves the existing sealed, ten-minute navigation marker, with a new action link-resume and no identity in it. - On the next fresh local sign-in, localLinkNavigation.Complete calls Bridge.resumeLink, the same startLink that LinkStart uses. The person goes to the max_age=300 freshness check and then the confirm step. - Unchanged: fresh local auth, nonce binding, the fresh assertion and the explicit confirm POST. - If the marker has expired, or the link cannot begin, the person lands as before.
  • Accounts connected. ConfirmPost redirects to GET /account/home/confirm?connected=1&return_to=…. That page renders success only for a session whose person is linked. - PageFor(r, …) gives the page a way back to where the link began (SafePath again). - Page is unchanged, so its way back is still /.
  • Copy: - confirmtitle: "Connect these two accounts?" - confirmbody: "Your Oficina account is confirmed. Connect it to the account below…" - unknown_body: "Sign in to your existing account once to connect it to your Oficina account."
  • Estilo: the module now requires estilo fix/connect-item-when-linked @ 0b375d5, whose homeconnect template puts the buttons in one rst-form-foot row.

Confirm-step decision

The explicit confirm click stays.

  • Why keep it: skipping it would let a remembered unknown assertion plus a local sign-in link accounts with no deliberate gesture.
  • Why the page can't name both accounts: the assertion carries an opaque subject, so only the local address can be named. The page gets its own title and copy instead.

Tests (linked_test.go)

  • Coverage: Linked; the success page, including a crafted URL from an unlinked person; the full unknown-then-local-then-confirm flow; marker expiry; the menu marker; and the return-path test extended to the success page's way back.
  • Seen red: - Linked forced to false. - The confirm going straight back to the page. - rememberUnknown not wired. - No resume. - The expiry check deleted. A follow-up commit made the session fresh at the later time, so this failure is the marker's own.
  • Local gate: green for vet, fmt, build, go-test and connect's race. internal/provisioner's race step can't build on macOS, a pre-existing limit unrelated to this branch.

Merge order

Merge estilo first, then this branch. Each app's pin should then move to the merge commits.

Not merged, not deployed.

Caught up with main: merged 0ceb238 (Keymail step-up) with no conflicts in connect/, then moved connect's estilo requirement to 1817c1c, which is the estilo branch caught up with switcher tiles. Head is now 4d87d00. vet, fmt, build, go-test and connect's race are green with go1.26.5. The apps now pin 4d87d00. Merge order is unchanged: estilo, then home, then move each app's pin to the merge commits.

On "name both accounts" (item 4): the Oficina half cannot be named, by design. The assertion's subject is an opaque person ref, and Home's one rule is that it never stores a readable address, so no Oficina address exists anywhere to show. The confirm step names the local account and gets its own question for a title. The explicit click stays, because the resumed flow would otherwise link accounts with no deliberate gesture.

VERDICT: APPROVE-WITH-NITS Branch verdict: ready to merge

GPT-6-Astra (Codex), reviewing for session 21a32889. Reviewed the whole branch at 4d87d0031ed418a5f02dc4a8f0cfb5bae95fa701 against fetched origin/main, including the nested connect module and its consumers.

  1. No blocking P0/P1/P2 findings in this branch. Security review: I found no P0/P1 issue or demonstrated login-CSRF/account-link substitution in the changed flow. The sealed, ten-minute marker carries no identity; the resumed link still uses the actual fresh local session, a fresh nonce-bound Home assertion, and an explicit CSRF-protected confirmation POST. Success is checked against stored linkage. This is a code-review verdict, not a waiver of the required merge gate.

The marker parser checks purpose/origin binding, canonical encoding, a single cookie, and expiry. Link initiation, proof completion and confirmation preserve local-session/person binding, assertion freshness, replay prevention and uniqueness. Neither the marker nor a success query parameter is authority to create a link. The new stored-link lookup uses the existing issuer/person unique index; no schema migration is added.

Hardening note: Memoria now copies connect's private navigation-cookie name and bootstraps its local row on cookie presence before connect validates the marker. A public, validated resume/bootstrap hook would remove this coupling and avoid allocation for invalid/expired markers. This is not an authentication bypass.

Consumer integration note: I reproduced first-time-account 403 failures in Slides and Calendar and am posting P2 blockers on those branches. Their local completion/account routes do not bootstrap their local user rows. Docs and Calls reach working fallback Connect pages; Sheets and Memoria bootstrap before resume.

Validation: GOTOOLCHAIN=go1.26.5 make test passed vet, formatting, build and ordinary tests, including connect/linkstore. Its race target then failed because internal/provisioner has no buildable files on macOS; the other packages in that recipe passed. I separately ran the Makefile's connect race recipe: connect and linkstore passed. The exact-head hub CI is green. Merge estilo before home and update consumer pins if squash changes commit identities.