Public: anyone can read this; the crew can change it.

Connections: one place says an email is proven, with the sign-in proof reading it #18320

opened this

Merged 5h 51m ago, live in production

An account's email is now proven in one place: its email connection (core/identities.ts). The sign-in gate reads that connection and no longer keeps its own record.

Notes

opened this

An account's email is now proven in one place: its email connection (core/identities.ts). The sign-in gate reads that connection and no longer keeps its own record. So proving the address once, by the connection's code or the sign-in link, shows on both the gate and the connections list, and removing that connection unproves sign-in.

What moved where

  • core/verify.ts has a new SQL helper, provenEmailAt(u): "the account's proven email connection whose address is lower(user.email)". Everything that reads the proof uses it: emailVerified, consumeLink, the recovery links (issueRecovery, recoveryOwner, spendRecovery), and the people lists in core/roles.ts, core/accounts.ts and core/people_rows.ts.
  • markVerified (a followed link, an owner's word, a trusted account) now writes the proven connection. If another account had proven the same address as an extra connection, that older proof is unproven: the account whose email it is outranks it.
  • resetVerification (sign-up, changed address) unproves that connection and turns its uses off. Sign-in behaviour is the same as before.
  • email_check now holds only the links: hashes, expiry and send counts.
  • listConnections hides stand-in .invalid addresses. Those accounts stay proven, but they never see a row they could delete and lock themselves out with.
  • New migration 20261204221000-email-proof-in-connections.ts gives every proven person a proven connection, so nobody already proven loses it.

Choices to look at

  • email_check.verified_at is not dropped. The rule that migrations only add things (#875) refuses a drop while an older release is still serving. Nothing reads or writes the column now; #18321 tracks dropping it.
  • A trusted account now lists its own address as a proven connection. Deleting that row (page, API or terminal) now unproves sign-in, as the issue asks. The page has no warning for it yet; I left that out to keep this pull to storage.

Tests

  • New test/verify.test.ts covers: proven by code, then shown on the gate, the list and the people list; removing it leaves no sign-in proof and no recovery link; proven by the sign-in link, then listed; a changed address is unproven; the account holding an address outranks another's proof; stand-ins are hidden; the migration on old-shape data.
  • Tests that edited email_check.verified_at directly now call markVerified/resetVerification instead (a new unproveAll in test/helpers/verified.ts). Changed tests: verify-recovery, passkey-recovery, home-feed, ssh-tell, mcp-*, the tui-deploy suites, guest-contribute, first-ask-first-tell.
  • identities.test.ts and identities-doors.test.ts assumed a trusted account starts with an empty list. That assumption is now wrong, so they pick their rows by address. No assertion about sign-in changed.
  • Run here: tsc and the gate are clean. About 300 test files that touch verification, connections and people pass. One suite, quotas-storage, timed out under load and passes when run alone.

Try it: sign up, add your own address on Settings › Identities and prove it with the code. The "verify your email" notice goes away, and the row shows proven. Remove the row and the notice comes back.

🤖 Generated with Claude Code

Closes #18222

4 earlier comments · 1 event
commented

An account's email is now proven in one place: its email connection (core/identities.ts). The sign-in gate reads that connection and no longer keeps its own record. So proving the address once, by the connection's code or the sign-in link, shows on both the gate and the connections list, and removing that connection unproves sign-in.

What moved where

  • core/verify.ts has a new SQL helper, provenEmailAt(u): "the account's proven email connection whose address is lower(user.email)". Everything that reads the proof uses it: emailVerified, consumeLink, the recovery links (issueRecovery, recoveryOwner, spendRecovery), and the people lists in core/roles.ts, core/accounts.ts and core/people_rows.ts.
  • markVerified (a followed link, an owner's word, a trusted account) now writes the proven connection. If another account had proven the same address as an extra connection, that older proof is unproven: the account whose email it is outranks it.
  • resetVerification (sign-up, changed address) unproves that connection and turns its uses off. Sign-in behaviour is the same as before.
  • email_check now holds only the links: hashes, expiry and send counts.
  • listConnections hides stand-in .invalid addresses. Those accounts stay proven, but they never see a row they could delete and lock themselves out with.
  • New migration 20261204221000-email-proof-in-connections.ts gives every proven person a proven connection, so nobody already proven loses it.

Choices to look at

  • email_check.verified_at is not dropped. The rule that migrations only add things (#875) refuses a drop while an older release is still serving. Nothing reads or writes the column now; #18321 tracks dropping it.
  • A trusted account now lists its own address as a proven connection. Deleting that row (page, API or terminal) now unproves sign-in, as the issue asks. The page has no warning for it yet; I left that out to keep this pull to storage.

Tests

  • New test/verify.test.ts covers: proven by code, then shown on the gate, the list and the people list; removing it leaves no sign-in proof and no recovery link; proven by the sign-in link, then listed; a changed address is unproven; the account holding an address outranks another's proof; stand-ins are hidden; the migration on old-shape data.
  • Tests that edited email_check.verified_at directly now call markVerified/resetVerification instead (a new unproveAll in test/helpers/verified.ts). Changed tests: verify-recovery, passkey-recovery, home-feed, ssh-tell, mcp-*, the tui-deploy suites, guest-contribute, first-ask-first-tell.
  • identities.test.ts and identities-doors.test.ts assumed a trusted account starts with an empty list. That assumption is now wrong, so they pick their rows by address. No assertion about sign-in changed.
  • Run here: tsc and the gate are clean. About 300 test files that touch verification, connections and people pass. One suite, quotas-storage, timed out under load and passes when run alone.

Try it: sign up, add your own address on Settings › Identities and prove it with the code. The "verify your email" notice goes away, and the row shows proven. Remove the row and the notice comes back.

🤖 Generated with Claude Code

commented

Now the account's email connection is the only thing that says an email is proven (#18222). emailVerified, the recovery links and the people lists all ask provenEmailAt whether the account has a proven email connection for its current address. markVerified and resetVerification write that connection. A migration copies every existing proof into a connection and stops using email_check.verified_at; the column stays in place for the roll. So proving the address shows on the sign-in gate and in the list, and removing the connection takes the proof away from sign-in.

Merging main: #18168 added core/proven_identities.ts, a single list of proven identities that read email_check.verified_at. That conflicted with this branch in src/core/verify.ts. The merge keeps what both sides meant:

  • provenEmailAt now lives in core/proven_identities.ts, and verify.ts re-exports it so its existing callers don't change. This keeps the two modules from importing each other.
  • emailIdentity and listOf read the proof through provenEmailAt, so the identities list, the API and the terminal give the same answer as sign-in.
  • emailVerified is now main's provenAs(db, id, "email").
  • removeEmail swaps in the placeholder address and marks the old address's connection unproven, turning off its uses, instead of clearing verified_at. It also cancels any pending links.

Things to look at:

  • src/core/proven_identities.ts: whether removeEmail should unprove the old address's connection, as it does now, or delete it.
  • The migration 20261204221000-email-proof-in-connections.ts.

How to try it: bun x tsc --noEmit passes, and the gate passes after its one comment rewrap. scripts/fast.ts found too many tests to name, so I ran the 60 test files that use the email proof, the identities list or the verified-account helper: 408 pass, 0 fail. On the preview, prove an email from the profile, then remove it. The sign-in gate and the identities list should both show it unproven.

🤖 Generated with Claude Code

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

The account's email connection is now the only record that says the address is proven: the sign-in gate, recovery links, people lists and identities list all read it. This round answers juniper's review: the address you sign in with is marked, and removing it needs confirmation at every door. A bug in changing your address is also fixed.

The address you sign in with, at every door

  • Each connection now carries signIn, which is true when it is the account's own address (core/identities.ts).
  • dropConnection refuses to remove that row unless the caller confirms. It answers confirm_sign_in, which says "This is the address you sign in with. Removing it means you must prove it again before you can write." (SIGN_IN_ADDRESS).
  • Page: the row says "you sign in with it" and shows that sentence. Its Remove sits under a required "Remove it anyway" checkbox, which the server checks too.
  • Terminal: the row's meta says "you sign in with it", and d shows the same two sentences before its y/n.
  • API: GET /api/v1/connections includes signIn. DELETE /:id on that row answers 409 unless it carries ?confirm=true.
  • Docs: docs/features/account-identities.md says the address is listed and proven, what removing it does, and how each door asks first.

Clean-up

  • accounts.ts, roles.ts and people_rows.ts import provenEmailAt from proven_identities.ts. verify.ts no longer re-exports it.
  • The doc comment on markUnproven is back.
  • Address change bug: changing A → B → A opened the gate without a fresh proof. The profile saves B before the reset runs, so A's connection stayed proven. emailChanged now passes the old address to resetVerification, which unproves both. A new test in test/verify.test.ts walks A → B → A through updateProfile, and it fails without the fix.

To look at

  • An API client that removed its own address with a plain DELETE now gets a 409 until it adds ?confirm=true.

Tests: test/identities-doors.test.ts has one test per door (page, API, terminal): without confirmation the row and the proof stay; with it, both are gone. bun x tsc --noEmit, the design lint and the gate pass. I ran the 85 test files that touch connections, verification, the profile and the people lists: 803 pass, 0 fail. The rest of the suite is left to the forge's check.

Try it: on the preview, sign in and open /settings/identities. Your own address shows "you sign in with it" and the warning. Remove does nothing until the box is ticked. Once removed, the "verify your email" notice comes back.

🤖 Generated with Claude Code

[{"go":"/settings/identities","look":"the row for your own address","expect":"it says \"you sign in with it\", shows \"This is the address you sign in with. Removing it means you must prove it again before you can write.\", and a \"Remove it anyway\" checkbox beside Remove"},{"go":"/settings/identities","look":"press Remove on that row without ticking the box","expect":"the browser asks for the box; nothing is removed"},{"go":"/settings/identities","look":"tick the box and press Remove","expect":"the row is gone and the verify-your-email notice appears","ask":"Is the warning clear enough before someone locks themselves out of writing?"}]
commented

<!-- look-pages 8774fc9a4da2 --> Look pages for 8774fc9, from the gate:

  • look pages (none): "Looks: /settings/identities" is not a page of app.looks in forge.json; this pull changes src/web/pages/identities.ts but the forge could not trace the route of /, /admin/telemetry, /explore and 29 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

The account's email now counts as proven in one place only: its email connection. Sign-in, the connections list and the terminal all read that one answer, so they agree on whether an address is confirmed.

  • Where it lives: src/core/proven_identities.ts holds the proven list, and provenEmailAt is imported from one path. The sign-in proof reads it there and no longer keeps its own check.
  • Changing an address: the old address loses its proven mark too, so a changed address can't keep a confirmation it never earned.
  • Removing an address: the address you sign in with is marked. It is removed only after you confirm, on the web page, in the action/API and under src/tui/screens/identities.ts.
  • Migration: it stamps the email proof at the time the migration was written. email_check.verified_at is kept so a rollback still has it.
  • Tests: they read the proven list as it is now. The terminal test's screens are typed instead of cast.

The last commit is empty and only carries a No look: line. /settings/identities isn't one of the app.looks pages, and it only shows anything to a signed-in account that has connections, so no listed page pictures this change. The steps below walk it by hand instead. I chose not to add the page to forge.json looks, because that would change the screenshots taken for every pull.

bun scripts/gate.ts passes on this branch.

To try it: sign in on the preview, open /settings/identities, and try to remove the address you sign in with.

[
  {"go": "/settings/identities", "look": "the email connection row", "expect": "the address you sign in with is marked as the sign-in address and shows as proven"},
  {"go": "/settings/identities", "look": "remove on the sign-in address", "expect": "it asks for confirmation before removing; cancelling leaves the address in place", "ask": "Does the confirmation say clearly that this is the address you sign in with?"},
  {"go": "/settings/identities", "look": "after changing the account's email", "expect": "the old address no longer shows as proven"}
]

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs