Public: anyone can read this; the crew can change it.
Connections on an account: verified identities the person controls, each with its own uses, and a lookup that answers only on opt-in #18120
Merged 4h 15m ago, live in production
This pull adds the core of #18108: proven email connections on an account, each with opt-in uses, an opt-in-only lookup for integrations, and report attribution that goes through that opt-in. It is partial.
-
Reviews
Changes requested — before the latest pushChanges requested. The core and API are well made: codes are hashed, spent once, expire and allow 5 tries. The lookup answers
nullalike for unknown, unproven and not opted in. Lookup keys are stored as hashes and are revocable, and the rate limit keys on the key id. But this is not a finished feature, and the review list holds a miss as a change request. All of these in one round:- Both doors (blocking). There is no terminal screen under
src/tui/and no settings page. A person cannot add, prove, opt in or remove a connection except by hand-crafting API calls. The pull's own doc says "Not yet: the settings page, the terminal screen". A commit line sayingNo door:does not cover this, because the pull adds API routes with no way for a person to use them. Add a Connections section to the settings page. Make it server-rendered and escaped, with same-origin forms, and showNOT_RETROACTIVEbeside the uses. Add the matchingsrc/tui/screen, entered where AGENTS.md says. Both doors must gate on the signed-in account in the same way the API does. Then add areviewblock, and runbun scripts/design-lint.ts. - Address enumeration.
takenanswers 409 "cannot be added" when another account has proved the address. That tells any signed-in member whether an address is proven on this forge, which is the thing the lookup is careful never to reveal. Answer the same 201 and the same wording either way, and mail the owner nothing or a neutral note. Alternatively, accept the leak and say so in the doc. Thetakencode at prove time is a lesser leak and is fine. - Mail abuse. Any member can send a code to any third-party address. The limits are 60 s per address, 10 connections per account, and
sendCapped. Add-then-remove cycles evade the 10-connection limit, so check that the per-account send cap insendCappedreally keys on the account and not only on the address. - Unbounded audit table.
connection_lookup_auditgets a row for every call and is never pruned. Delete rows older than the retention you want when you count, or on the same path, so a key cannot grow the table without limit. - Redundant lookup in
reporterFor. It callsaskLookupand thenlookupa second time, and it also parses the email twice. HaveaskLookupreturn the user, or makereporterForthe single path. Also note that an unauthenticated report with a bogus key now touches the lookup tables on every request. Short-circuit when the header is empty. - Tidy.
export type { Use }insrc/actions/identities.tsis a re-export used only for convenience; drop it if nothing imports it.makeLookupKeyreturns the error codeinvalid_usefor a bad name; use a code that says what is wrong. - Tests. Add tests for the enumeration answer (item 2), for audit pruning, and for the screens and page once they exist. In
test/identities.test.ts, cover the reports route with a revoked key and with no header.
ApprovedBoth doors now exist (page at /settings/identities, terminal screen), with a how-to in docs/features. The earlier asks are met. An address held by another account now answers like a new one, and mail is capped per account. Audit rows are pruned,
reporterForis a single lookup, and tests cover each of these. Form writes go throughreadForm: same-origin check, bounded body, signed-in account only. The lookup key is stored as a hash, and every refusal on the lookup is the same 404 or{user:null}. Nothing blocking. - Both doors (blocking). There is no terminal screen under
-
Checks
shipped production is serving it deploy a338207
-
History
- Merge origin/main into scout/18108 (connections routes beside mail-aws; marks regenerated) 66e1b3a
- Mail from the owner's AWS account: the forge sets up SES, its DNS records and the mail key in one confirmed step (#18119) bd73c12
- Attention budget: settings at 155 words for the Proven emails nav entry (#18108) dfd979e
- Merge remote-tracking branch 'origin/main' into scout/18108-connections-on-an-account-verified-ident e6f4d33
- Games: a mod-set install refuses a Modrinth slug that now points at a different project than the lock holds (#18200) fa82fd9
- Access 3b: MCP, pages, the terminal, games and infrastructure ask may(), one door per pull (#18186) 5a3de44
- Games: the forge-velocity pin's sha256 is the jar's whole digest (#18198) 7ede9b5
- Access 4b-2: an admin sees who can reach what, by person and by resource (#18179) a8d3bc8
- Full suite red: test/standards-sitemap.test.ts (#18193) 8072255
- Games: the forge pins forge-velocity bee2a65cf3f2 (/forge answers from a SQLite snapshot at once, one clean style) (#18163) b4fe556
- Games survival step 3c: a vein-miner mod in the quality set (#18177) bd6dc66
- Bug and crash reports from an app become work: an issue on its repository, a triage, and a fix pull (#18097) 68dcbf7
- Games survival step 4: admin mods (luckperms fabric, ledger with fabric-language-kotlin) (#18148) 4fb3248
- Audit: the identities settings page has its entry (#18108) 49bbb35
- Games: /forge reads are answered in the same sync, and the agent sends a request within a fifth of a second (#18149) e529fa8
- Traces 5a: compare two traces of one issue side by side, with the cost and time difference (#18164) e7394aa
- Access 3a: the /api/v1 repository routes ask may(), shadowed first, then their inline checks go (#18165) 7ba81ba
- Identities: a screen file's header rewrapped, the screen test builds real key events (#18108) 78d7132
- Connections: the settings page and terminal screen, no address enumeration, per-account mail cap, pruned audit (#18108) ca9e959
- Spark's config is installed with the mod so a profile uploads to the forge and never elsewhere (#18173) 7de2fc0
7 earlier comments
I merged main into the branch and pushed it. The only conflict was src/generated/marks.ts.
- Resolution: that file is generated, so I took main's version and regenerated it with
bun scripts/own-source.tsinstead of hand-merging. The result has no conflict markers and covers both sides' marks. - Checks run:
bun x tsc --noEmitis clean, andtest/own-source.test.tspasses (3 tests). - Not run: I did not run any other tests locally.
scripts/fast.tscould only say the affected set was too broad to name (2987 files). I stopped a broadbun testrun that timed out. The forge's check runs the full suite on this push.
This push is a merge of current main into the branch, with no new code. I didn't reproduce the red check on #18120, which is a planner test about a "second park". Nothing in this change touches that test, so a later merge of main may have fixed it.
I ran the four checks you named, plus the connections tests, on the merged tree. All 18 tests pass:
- dead exports
- module-level state that requests write to
- the
duringjob timing list - duplicate imports
test/identities.test.ts
bun x tsc --noEmit and bun scripts/design-lint.ts are clean too. I did not run the full suite, and I did not run the planner test.
gate.ts --fix left nothing to commit. It only warns about similar-looking functions in src/core/identities.ts and one over-long comment in src/core/account_purge.ts.
What's on the branch (connections, #18108)
- Core and API: a connections list per account, with identities kept in
src/core/identities.ts. The routes are/api/v1/connections(add, remove, confirm), per-use opt-in, and a scoped lookup with its own keys. A migration adds the tables. - Lookup: it answers only for a verified identifier whose owner opted into that use. Unknown, unproven and not opted in all answer the same.
- Reports: reports filed through the bridge name the reporter only through that opt-in.
- How-to:
docs/features/account-identities.md.
Left out
- Moving the Minecraft link and the account's proven email (
core/verify.ts) into this list. - The OAuth and in-game proof flows.
- The terminal, settings page and Apple app doors.
I haven't checked these against the issue's checklist.
Try it: run bun test test/identities.test.ts.
The connections API now passes the two contract tests the check flagged. The other two failures passed when I re-ran them alone, so I made no change for them. The type check printed nothing, and I did not re-run the full suite, so the forge's check on this push is the full verdict.
What was wrong: the /api/v1/connections routes, added in #18108, were missing from the OpenAPI contract in two places.
- Tag:
connectionswas not inTAG_WORDS, sotest/contract-openapi-tags.test.tsfailed. I addedconnectionstosrc/contract/tags.tswith a one-line description. - Statuses: five routes answered 404 or 422 without declaring it, which
test/openapi-errors.test.tscaught. I added those statuses torefusesin the six route files undersrc/contract/openapi/routes/: 404 ondeleteApiV1ConnectionsIdanddeleteApiV1ConnectionsLookupKeysId, 422 on the other four.
The other two failures: the survival performance set > the terminal shows the set… (20 s) and the doors > a push to the branch a cell runs is synced…. Both passed when I re-ran test/game-mods.test.ts and test/dev-cell.test.ts, so I treated them as timeouts under shard load, not caused by this pull. If they fail again on the new check, they need a look of their own.
Gate: bun scripts/gate.ts --fix ran and still prints "one implementation?" similarity notes about src/core/identities.ts. I did not act on them.
Pushed as 5c729b1eb.
Connections now have both doors, and the review's seven items are addressed. tsc, the gate and 201 tests across 28 related files pass; the forge's check runs the full suite. I fixed two palette-roster tests that the new entry broke. The gate prints two "one implementation?" similarity notes for identityRemove and the screen test's draw, and I left them as they are.
What changed
- Both doors (1):
- Page: Settings › Proven emails at
/settings/identities, insrc/web/pages/identities.ts. It is server-rendered and escaped, and every act is a same-origin form (readForm) by the signed-in account only.NOT_RETROACTIVEsits beside the uses. It is listed in the settings nav, the palette rows,settings_routes.ts,lazy_lists.tsandmarks/settings.json. - Terminal: the "Proven emails" screen (
src/tui/screens/identities.ts) and a palette entry. Keys:aadd,ccode,f/ptoggle a use,dremove after a y/n. - Shared code: both doors call the same actions as the API. The refusal words now live in one table,
CONNECTION_WORDS, which the API also uses.
- Page: Settings › Proven emails at
- Enumeration (2): adding an address another account proved now answers 201 like any new address, mails nothing and stores an unprovable row. Its confirm answers 422
wrong_code, not 404, so it looks like a real pending connection. Only the 3-a-day mail cap on an address can still tell the two apart; the doc says so. - Mail abuse (3):
sendCappedwas keyed on the address and the whole forge only, so add-then-remove cycles were not capped per account. Sends now pass scopeconnection:<id>, which caps a member at 20 mails a day. - Audit (4): a key's rows older than 24 h are deleted on its next call, using the existing
(key_id, at)index. reporterFor(5): it is now a single lookup through a newfindNamed, which returns the user. It returns at once, touching no table, when the header is empty.- Tidy (6): I removed the
Usere-export (nothing imported it). A bad key name now answersinvalid_name, in the code, the contract and the docs. - Tests (7):
test/identities.test.tsnow covers the same-answer 201, the per-account mail cap,invalid_name, audit pruning, and the reports route with a revoked key and with no header. The existing test that expected 409 now expects 201. Newtest/identities-doors.test.tscovers the page (sign-in gate, cross-origin 403, add, prove, use, remove, another account's row untouched) and the screen.
Not done: the Apple app, and moving the Minecraft link or the account's proven email into this list. The 10-per-account connection limit is unchanged; the new mail cap is what stops add/remove cycles.
Try it:
- Open
/settings/identitiessigned in, add an email, give back the mailed code, then turn a use on. - Or open "Proven emails" from the terminal palette.
[
{"go": "/settings/identities", "look": "Proven emails page: an add-address form, the not-retroactive note, and 'None yet.' on a fresh account", "expect": "signed out it redirects to sign-in; signed in it shows the page inside the settings layout with 'Proven emails' in the Connections group"},
{"go": "/settings/identities", "look": "Add an address, then use the code field on its row", "expect": "the row reads 'not proven yet' with a code field; a wrong code flashes 'that code is wrong or has expired'; the right one shows 'proven' with feedback and profile both off"},
{"go": "/settings/identities", "look": "Turn feedback on, then Remove the row", "expect": "the use reads 'on' and the flash repeats that issues already filed are not rewritten; Remove deletes the row"}
]
🤖 Generated with Claude Code
The check failed because the new /settings/identities page had no entry in the design audit, so the audit test counted 142 entries against 143 pages. I added the missing line to docs/design/audit.md, after /settings/origins.
test/design-audit.test.ts now passes (4 of 4) and I pushed the fix. I did not run bun x tsc --noEmit or any other tests, since the change is a single documentation line.
bun scripts/gate.ts still prints two "one implementation?" notes about similar functions (identityRemove and identityConfirm, and draw in the identities-doors test). They are advisory and I left them alone.
The commit says No door: because the change touches no page, action, API route or MCP tool.
The first-view budget test was failing because Settings › Proven emails, the nav entry this pull adds, put two more words on the settings page. It had 155 words against a budget of 153. I raised the settings budget to 155 at both widths in docs/design/attention-budget.json, with a note on why, as the budget file's rule requires for a raise.
I merged main into the branch first, because its budget for settings had already moved to 153. test/attention.test.ts and test/attention-stamped.test.ts pass locally, 7 tests in all. I did not run the rest of the suite, so the full check on this push is the first run of everything else.
bun scripts/gate.ts --fix printed two "one implementation?" similarity notes and changed nothing:
identityRemoveis 0.76 likeidentityConfirminsrc/web/pages/identities.ts.drawintest/identities-doors.test.tsis 1.00 like atexthelper intest/feed-filters.test.ts.
I left both as they are. I didn't run bun x tsc --noEmit, since only the budget JSON changed.
What to look at: the budget change is the only edit in this fix. The rest of the pull is unchanged.
How to try it: bun test test/attention.test.ts test/attention-stamped.test.ts.
I merged main into the branch and pushed it. Three files conflicted, and none of the conflicts needed a judgement call.
src/http/api.tsandsrc/http/lazy_lists.ts: I kept both sides.identityRoutesand the connections routes now sit next tomain's newmailAwsRoutesand/api/v1/mail-awsentries.src/generated/marks.ts: I tookmain's version and regenerated it withbun scripts/own-source.ts, so it includes the connections marks and has no conflict markers left.
bun x tsc --noEmit is clean. I ran 802 tests across 56 files covering own-source, attention, identities, connections, lazy lists and the API contract, and all passed. I did not run the full suite, so the forge's check on this push is its first run. bun scripts/gate.ts --fix left one note that I did not act on: draw in test/identities-doors.test.ts is flagged as identical to a text helper in test/feed-filters.test.ts.
The pull itself is as before: connections on an account, verified identities, the settings page and terminal screen. The settings first-view budget is at 155 words for the "Proven emails" nav entry.
This pull adds the core of #18108: proven email connections on an account, each with opt-in uses, an opt-in-only lookup for integrations, and report attribution that goes through that opt-in. It is partial. The settings page, terminal screen and Apple app are not built, and the Minecraft link and the account's proven email have not moved into the new list. I ran
tsc,test/identities.test.ts, the lazy-list, migration, same-origin, feature-docs and reports tests, and the dead-code, module-state, duplicate-import and job-timing tests. All pass. I did not run the full suite or hit the preview.What changed
mailerOfandsendCapped, so it uses the forge's mail key and its caps.feedbackandprofile, both off by default. A use can only be chosen once the connection is proven.GET,POST,POST /:id/confirm,PUT /:id/uses/:useandDELETE /:idunder/api/v1/connectionsare same-origin and account-level.POST /api/v1/connections/lookuptakes{email, use}and a key inX-Forge-Lookup-Key. Unknown, unproven and not-opted-in all answer{user: null}. A missing or revoked key gets a 404.POST /api/v1/connections/lookup-keys, shown once and stored as a hash, and revokes them withDELETE …/lookup-keys/:id.fileReporttakes an optionalreporter.POST …/reportswith a lookup key and areporteraddress names the reporter only whenfeedbackis on. Removing the connection or switching the use off stops later reports naming them, and filed reports are untouched.core/identities.ts,actions/identities.tsandhttp/api/identities.ts, plus migration20261204060000-connections. The name avoids the existingcore/connections.tsandactions/connections.ts, which hold the model and cloud connections. A short how-to is indocs/features/account-identities.md.What I left out
No door:for this reason.core/verify.ts) are still stored where they were, so there is still more than one place that says who someone is.emailexists. Thekindcolumn is checked against that one value, so TestFlight, GitHub and Minecraft need a migration and their own proof flows.reporterinput yet except the reports route.tokenscope. The token layer 401s any unknown bearer, so a scoped token would have meant changes to every gate.scripts/gate.tsflags a few new functions as similar to others, for examplelistConnectionsandlistTeams. They are different tables and queries, so I reused nothing.To try it
POST /api/v1/connections {"email": …}.POST /api/v1/connections/:id/confirm {"code": …}with the mailed code.PUT /api/v1/connections/:id/uses/feedback {"on": true}.POST /api/v1/connections/lookup-keys {"name": …}.POST /api/v1/connections/lookupwith that key inX-Forge-Lookup-Key.test/identities.test.tsruns the whole sequence from the issue's "Done when".🤖 Generated with Claude Code
Closes #18108