plan: console social sign-in plan 1, people and sign-in methods
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+248
−0
docs/superpowers/plans/2026-11-02-console-social-signin-1-methods.md+248 −0
Intent
Human
Go ahead
Attributed to this commit: 20.9 g CO₂e (2,233,430 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-console-social-signin, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/docs/superpowers/plans/2026-11-02-console-social-signin-1-methods.md b/docs/superpowers/plans/2026-11-02-console-social-signin-1-methods.md| new file mode 100644 |
| index 000000000..dd4087843 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-02-console-social-signin-1-methods.md |
| @@ -0,0 +1,248 @@ |
| +# Console social sign-in, Plan 1: people and sign-in methods |
| + |
| +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| + |
| +**Goal:** Every sign-in resolves through a `sign_in_methods` table to a person (the `users.address` contact address). Invites can be accepted by any address the person holds. Your settings lists the person's methods. A new-person budget gates every sign-up path. After this plan, the console behaves exactly as today for every existing person, but the model that Plans 2-4 (providers, Apple, link and merge) build on is in place. |
| + |
| +**Architecture:** The new table maps `(kind, subject)` to the `users.address` the method signs in to. `finishSignin` stops trusting the proved address as the person and resolves it through the table instead, creating the person and method on a first sign-in. Sessions record the method row they came through. Invite gates check that the person holds the invited address, not that it equals the session address. No downstream table changes key. |
| + |
| +**Tech Stack:** Go, SQLite through `database/sql` (`internal/console/store.go` pattern), `html/template`, the console test fixture (`newConsoleFixture`, `newBrowser`, `keymailWalk`, `newEmailFixture`). |
| + |
| +**Spec:** `docs/superpowers/specs/2026-11-02-console-social-signin-design.md` (rev 3, approved 2026-11-02). Plan 1 covers §6.1 (model, migration, resolution), §4.4 (invites), the listing part of §4.3, and §9's new-person budget. Not covered here: providers (§5, Plans 2-3), step-up changes (§8, Plan 2), add, remove, merge and contact change (§4.3 actions, §7, Plan 4), and §6.2 (Plan 2). |
| + |
| +## Global Constraints |
| + |
| +- Migrations are additive and idempotent: `CREATE TABLE IF NOT EXISTS`, plus `ALTER ... ADD COLUMN` in the ALTER list whose "duplicate column" error is swallowed (`store.go:146-148`, `store.go:590-610`). They run on every start. |
| +- The migration does no network I/O. Keymail discovery (`keymailAddress` with a lookup) is never called from it. |
| +- Addresses are stored trimmed and lower-cased, as everywhere else in the console. `subject` for `email` and `keymail` is that form. |
| +- `kind` values are the existing `MethodEmail` (`"email"`) and `MethodKeymail` (`"keymail"`) constants (`emailsignin_store.go:35`). Plans 2-3 add `google`, `apple` and `github`. |
| +- Every new on-screen string goes through copy review before it goes into a file (copy-review skill). The house voice has no em dashes. The draft strings are in Task 0. |
| +- Store only what the spec allows (§3): kind, subject, person address, label, timestamps. No names, avatars or tokens. |
| +- Locally, run only the touched package's tests, with `-run` (`go test ./internal/console -run 'TestX|TestY'`). CI runs the full suite and the darwin/windows cross-builds. Leave `GOCACHE` at its default. |
| +- Commit subjects stay under 80 characters. |
| + |
| +## Review Focus |
| + |
| +- **A `users` row with no method row.** `SetLastAccount` (`store.go:1561`) and `SetOperator` (`store.go:2590`) create users for addresses that have never signed in. Their first sign-in must attach a method to that existing person, land them as that address, and not be charged as a new person. Test in Task 2. |
| +- **Two first sign-ins racing for one new subject** (a double click, or two tabs). Both land on the same person with one method row and no error. Test in Task 1. |
| +- **A budget refusal writes nothing.** No users row, method row, session or grant, and the person sees the refusal page, not a 500. Test in Task 3. |
| +- **An invite to a held address is accepted under the person.** The membership row is keyed by the person's contact address, never by the invite's address, so it doesn't create a ghost member that nobody can sign in as. This covers both the plain accept path and the seat path (`billingseats.go:205-216`). Test in Task 4. |
| +- **Restart after the migration.** Re-running the migration adds no duplicate rows and doesn't overwrite `kind`, `added_at` or `last_used_at` on existing rows. Test in Task 1. |
| + |
| +--- |
| + |
| +### Task 0: Copy review for the new strings (gate, no code) |
| + |
| +Run the copy-review skill on these strings before Task 3 or Task 5 writes any of them into a file. Save the result as `docs/superpowers/specs/2026-11-02-console-social-signin-copy-approved.json` in the same shape as `2026-10-21-console-email-signin-copy-approved.json`, with an `action` and `strings[]` of `{id, text}`. Later tasks use the approved text byte for byte. |
| + |
| +| id | draft text | |
| +|----|------------| |
| +| `methods.heading` | Sign-in methods | |
| +| `methods.lede` | Every way you can sign in as {address}. | |
| +| `methods.col_method` | Method | |
| +| `methods.col_identity` | Signs in as | |
| +| `methods.col_added` | Added | |
| +| `methods.col_used` | Last used | |
| +| `methods.kind_email` | Email link or code | |
| +| `methods.kind_keymail` | Keymail | |
| +| `methods.never_used` | Not yet | |
| +| `signup.busy_title` | Try again later | |
| +| `signup.busy` | Too many new accounts have been made from here in the last hour. Try again later, or sign in to an account you already have. | |
| + |
| +- [ ] **Step 1:** Run copy-review on the table above and wait for Paul's edits. |
| +- [ ] **Step 2:** Write the approved JSON file and commit it: `git commit -m "copy: approved strings for console sign-in methods (plan 1)"`. |
| + |
| +--- |
| + |
| +### Task 1: The `sign_in_methods` table, backfill and store API |
| + |
| +**Files:** |
| +- Create: `internal/console/signinmethods_store.go` |
| +- Modify: `internal/console/store.go` (call the new migration from `migrate()`, after the `users` and `sessions` tables and the ALTER list) |
| +- Test: `internal/console/signinmethods_store_test.go` |
| + |
| +**Interfaces:** |
| +- Produces: |
| + - `type SignInMethod struct { ID int64; Kind, Subject, Address, Label string; AddedAt, LastUsedAt time.Time }`. A zero `LastUsedAt` means never used. |
| + - `func (s *Store) ResolveSignIn(kind, subject string, now time.Time) (m SignInMethod, created bool, err error)`. This finds the method, or creates it, and creates the person when none exists. It also stamps `last_used_at = now`. `created` is true only when a `users` row was inserted by this call. |
| + - `func (s *Store) LookupSignIn(kind, subject string) (SignInMethod, bool, error)`. A read-only lookup, used by Task 3 to decide before charging the budget. |
| + - `func (s *Store) PersonWouldBeNew(kind, subject string) (bool, error)`. True when there is no method row and no `users` row for `subject`. |
| + - `func (s *Store) SignInMethodsFor(address string) ([]SignInMethod, error)`, ordered by `added_at`, then `id`. |
| + - `func holdsAddressTx(q queryer, person, address string) (bool, error)`. True when `address == person`, or when an `email` or `keymail` method row with `subject = address` points to `person`. Here `queryer` is the subset of `*sql.DB` and `*sql.Tx` with `QueryRow`. Reuse an existing interface if the package has one. |
| + |
| +Schema (names are this plan's choice; the spec left them to the builder): |
| + |
| +```sql |
| +CREATE TABLE IF NOT EXISTS sign_in_methods ( |
| + id INTEGER PRIMARY KEY AUTOINCREMENT, |
| + kind TEXT NOT NULL, |
| + subject TEXT NOT NULL, |
| + address TEXT NOT NULL, -- users.address it signs in to |
| + label TEXT NOT NULL DEFAULT '', |
| + vouched_email TEXT NOT NULL DEFAULT '', -- providers only (Plan 2) |
| + vouched_trusted INTEGER NOT NULL DEFAULT 0, |
| + added_at INTEGER NOT NULL, |
| + last_used_at INTEGER NOT NULL DEFAULT 0, |
| + removed_at INTEGER NOT NULL DEFAULT 0, |
| + UNIQUE(kind, subject) |
| +); |
| +CREATE INDEX IF NOT EXISTS sign_in_methods_address ON sign_in_methods (address); |
| +``` |
| + |
| +Backfill, run on every start: |
| + |
| +```sql |
| +INSERT INTO sign_in_methods (kind, subject, address, added_at) |
| +SELECT CASE WHEN EXISTS (SELECT 1 FROM grants g WHERE g.address = u.address) |
| + OR EXISTS (SELECT 1 FROM sessions x WHERE x.address = u.address AND x.method = 'keymail') |
| + THEN 'keymail' ELSE 'email' END, |
| + u.address, u.address, u.created_at |
| +FROM users u |
| +WHERE NOT EXISTS (SELECT 1 FROM sign_in_methods m WHERE m.address = u.address) |
| +ON CONFLICT(kind, subject) DO NOTHING; |
| +``` |
| + |
| +A grant row exists only after a Keymail sign-in, and every session from before the `method` column was a Keymail one (`store.go:597`), so this needs no discovery lookup. A `users` row from `SetOperator`/`SetLastAccount` for someone who never signed in becomes an `email` method. That's harmless: if they later arrive through Keymail, `ResolveSignIn` adds a `keymail` row for the same person. |
| + |
| +Rows with `removed_at != 0` are ignored by `ResolveSignIn`'s match (Plan 4 uses them). In this plan nothing sets the column. |
| + |
| +- [ ] **Step 1: Write the failing tests** in `signinmethods_store_test.go`, each on a fresh store: |
| + - `TestSignInMethodsBackfill`: insert users `a@x.test` (with a grants row), `b@x.test` (a session with `method='email'`), and `c@x.test` (no sessions, no grant). Run the migration. Assert `SignInMethodsFor` gives `a`→`keymail`, `b`→`email` and `c`→`email`, each with `Address == Subject` and `AddedAt == users.created_at`. |
| + - `TestSignInMethodsBackfillIdempotent`: run the migration twice, then stamp `last_used_at` on one row and run it again. Assert the row count is unchanged and `last_used_at` is kept. |
| + - `TestResolveSignInCreatesPerson`: on an empty store, `ResolveSignIn("email","new@x.test",now)` gives `created == true` and `Address == "new@x.test"`, and leaves one users row and one method row. A second call gives `created == false` and the same `ID`, with `LastUsedAt` stamped to the second `now`. |
| + - `TestResolveSignInExistingUserNoMethod`: insert a users row via `SetLastAccount("op@x.test", 7)` with no method. `ResolveSignIn("keymail","op@x.test",now)` gives `created == false` and `Address == "op@x.test"`, and `LastAccount` is still 7. |
| + - `TestResolveSignInFollowsMapping`: insert a method row `(email, alias@x.test) → person@x.test` directly. `ResolveSignIn("email","alias@x.test",now)` gives `Address == "person@x.test"`, `created == false`, and creates no users row for `alias@x.test`. |
| + - `TestResolveSignInSecondKindSamePerson`: `ResolveSignIn("email","a@x.test")`, then `ResolveSignIn("keymail","a@x.test")`. This leaves two method rows, both with `Address == "a@x.test"`, and one users row. |
| + - `TestResolveSignInConcurrent`: 8 goroutines call `ResolveSignIn("email","race@x.test",now)` at once. All return the same `ID` and `Address`, exactly one returns `created == true`, and none returns an error. |
| + - `TestHoldsAddress`: with a person `p@x.test`, a method `(email, alias@x.test) → p@x.test`, and a method `(keymail, other@x.test) → q@x.test`: `holdsAddressTx(db, "p@x.test", "p@x.test")` is true, for `alias@x.test` it's true, for `other@x.test` it's false, and for `nobody@x.test` it's false. |
| +- [ ] **Step 2:** Run `go test ./internal/console -run 'TestSignInMethods|TestResolveSignIn|TestHoldsAddress'`. Expect FAIL (undefined). |
| +- [ ] **Step 3: Implement** the table, the backfill (`migrateSignInMethods(db)` called from `migrate()`) and the API in `signinmethods_store.go`. Do `ResolveSignIn` in one transaction: select the live row by `(kind, subject)`. If there is none, `INSERT INTO users ... ON CONFLICT DO NOTHING` (its `RowsAffected` decides `created`), then `INSERT INTO sign_in_methods ... ON CONFLICT(kind, subject) DO NOTHING`, then re-select. Finally update `last_used_at`. If SQLite reports busy under the concurrent test, use the store's existing retry or locking convention; check how `EnsureUser` callers cope. |
| +- [ ] **Step 4:** Run the same command. Expect PASS. |
| +- [ ] **Step 5: Commit:** `git commit -m "console: sign_in_methods table, backfill and resolution (social sign-in 1)"` |
| + |
| +--- |
| + |
| +### Task 2: Sign-in resolves through methods, and sessions record the method |
| + |
| +**Files:** |
| +- Modify: `internal/console/emailsignin.go:258` (`finishSignin`) |
| +- Modify: `internal/console/store.go` (ALTER list; `CreateSessionMethod` at `:2834`) |
| +- Modify: the callers of `finishSignin` (`server.go` `handleCallback`, `emailsignin.go` link and code handlers) only if the signature changes |
| +- Test: `internal/console/emailsignin_test.go` (or a new `signinmethods_test.go` for the server-level tests) |
| + |
| +**Interfaces:** |
| +- Consumes: `ResolveSignIn`, `SignInMethod` (Task 1). |
| +- Produces: |
| + - ALTER `sessions ADD COLUMN method_id INTEGER NOT NULL DEFAULT 0`. A 0 means the session predates this plan. |
| + - `func (s *Store) CreateSessionVia(address, keymailToken, method string, methodID int64, now time.Time) (string, error)`. `CreateSessionMethod` becomes a call to it with `methodID` 0, so existing callers and tests keep working. |
| + - `func (s *Store) SessionMethodID(rawToken string, now time.Time) (int64, bool)`, for Plan 4's removal. |
| + - `finishSignin(w, r, proved, keymailToken, method, next string)` keeps its signature. `proved` is the address the door proved, and `method` is also the method kind. |
| + |
| +The new `finishSignin` order: |
| +1. Resolve `(method, proved)` with `ResolveSignIn` to get `m` and `created`. `person := m.Address`. This replaces `EnsureUser`. The budget check is inserted before this step in Task 3. |
| +2. The Keymail grant stays keyed by `proved` (`SetGrantToken(proved, ...)`), because it is that Keymail mailbox's grant. In this plan `proved == person` always. |
| +3. Session, `noteSeen`, `auditSignInRow`, the welcome cookie, `RecordStepUp` and the landing all use `person`. The session is created with `CreateSessionVia(person, keymailToken, method, m.ID, now)`. |
| + |
| +- [ ] **Step 1: Write the failing tests:** |
| + - `TestKeymailSigninRecordsMethod`: `keymailWalk` for `newcomer@keymail.dev`. Afterwards `SignInMethodsFor("newcomer@keymail.dev")` has one `keymail` row with a stamped `LastUsedAt`, and `SessionMethodID(raw)` equals that row's `ID`. |
| + - `TestEmailSigninRecordsMethod`: an email-code sign-in for `pat@example.test` (use the existing email fixture helpers `postContinue` and `sentSignin`, then post the code). It leaves one `email` row, and the session's method ID matches. |
| + - `TestSigninLandsOnMappedPerson`: insert a method `(email, alias@example.test) → person@example.test` and a users row for `person@`. An email sign-in as `alias@example.test` creates a session whose `SessionInfo` address is `person@example.test`, with no users row for `alias@` and no welcome cookie. |
| + - `TestSigninExistingUserNoMethodNotWelcomed`: `SetLastAccount("inv@example.test", acctID)`, then email sign-in as `inv@example.test`. There's no welcome cookie (`created == false`), and the person lands on `acctID`'s account. |
| +- [ ] **Step 2:** Run `go test ./internal/console -run 'TestKeymailSigninRecordsMethod|TestEmailSigninRecordsMethod|TestSigninLandsOnMappedPerson|TestSigninExistingUserNoMethodNotWelcomed'`. Expect FAIL. |
| +- [ ] **Step 3: Implement** the ALTER, `CreateSessionVia`, `SessionMethodID` and the new `finishSignin` order above. |
| +- [ ] **Step 4:** Run the same command, plus the existing sign-in tests: `go test ./internal/console -run 'TestKeymail|TestFinishSignin|TestContinue|TestEmail|TestInvitePage|TestCLIPage'`. Expect PASS. |
| +- [ ] **Step 5: Commit:** `git commit -m "console: sign-in resolves through sign_in_methods; sessions record it"` |
| + |
| +--- |
| + |
| +### Task 3: New-person budget on every sign-up path (spec §9) |
| + |
| +**Files:** |
| +- Modify: `internal/console/emailsignin_limits.go` (constants plus one method) |
| +- Modify: `internal/console/emailsignin.go` (`finishSignin`, before `ResolveSignIn`) |
| +- Create: `internal/console/socialsignin_copy.go` (the map of Task 0's approved strings), and extend `copyText` to read it after `signinCopy` |
| +- Test: `internal/console/emailsignin_limits_test.go`, `internal/console/socialsignin_copy_test.go`, and a server-level test |
| + |
| +**Interfaces:** |
| +- Consumes: `PersonWouldBeNew` (Task 1); `s.clientIP(r)`; the server's existing `emailLimits` instance (find its field on `Server`). |
| +- Produces: |
| + - Constants `newPersonPerIPHour = 10` and `newPersonGlobalHour = 200`, mirroring `signinPerIPHour` and `signinGlobalHour`. |
| + - `func (l *emailLimits) newPerson(ip string) bool`. It records and allows when both the per-IP and global hourly windows are under their caps. When refused it records nothing. It joins `sweepWindows()`. |
| + - `var socialSigninCopy = map[string]string{...}`, holding exactly Task 0's approved ids. |
| + |
| +In `finishSignin`, before step 1: if `PersonWouldBeNew(method, proved)` is true and `!s.limits.newPerson(ip)`, render `renderMessage(w, r, http.StatusTooManyRequests, copyText("signup.busy_title"), copyText("signup.busy"))` and return. Nothing is written. Returning people never touch the budget. |
| + |
| +- [ ] **Step 1: Write the failing tests:** |
| + - `TestNewPersonBudget` (limits, injected clock): 10 calls from IP `a` are allowed and the 11th is refused. One call from IP `b` is still allowed. After the clock moves 61 minutes, IP `a` is allowed again. With 200 global hits spread over 20 IPs, a fresh IP is refused. |
| + - `TestNewPersonBudgetRefusalWritesNothing` (server): set the budget so it is exhausted (fill the window through the limits clock), then do an email-code sign-in for a new address. The response is 429 and the body contains `copyText("signup.busy")`. `userRows` for the address is 0, there's no method row, and the browser has no session cookie. |
| + - `TestNewPersonBudgetSparesReturning`: with the budget exhausted, an existing person signs in and gets a session. |
| + - `TestSocialSigninCopyMatchesApproved`: `socialSigninCopy` equals the approved JSON's id and text set exactly, and no id appears in both `signinCopy` and `socialSigninCopy`. Model it on `signincopy_test.go:10`. |
| +- [ ] **Step 2:** Run `go test ./internal/console -run 'TestNewPersonBudget|TestSocialSigninCopyMatchesApproved'`. Expect FAIL. |
| +- [ ] **Step 3: Implement** the constants, `newPerson`, the `finishSignin` gate, `socialsignin_copy.go` and the `copyText` fallback. |
| +- [ ] **Step 4:** Run the same command. Expect PASS. |
| +- [ ] **Step 5: Commit:** `git commit -m "console: new-person budget across sign-up paths (social sign-in 1)"` |
| + |
| +--- |
| + |
| +### Task 4: Invites accepted by any held address (spec §4.4) |
| + |
| +**Files:** |
| +- Modify: `internal/console/store.go:1598-1690` (`PendingInviteFor`, `AcceptInvite`, `acceptInviteTx`) |
| +- Modify: `internal/console/server.go:3598-3700` (invite page and accept: comments, and the address passed in) |
| +- Modify: `internal/console/billingseats.go:203-216` (`admitMember`) |
| +- Test: `internal/console/invite_held_address_test.go` |
| + |
| +**Interfaces:** |
| +- Consumes: `holdsAddressTx` (Task 1). |
| +- Produces (the signatures keep their shapes, and the second parameter is renamed `person`): |
| + - `PendingInviteFor(token, person string, now time.Time) (*Invite, error)`. The address gate becomes `holdsAddressTx(s.db, person, i.Address)`. The single opaque error stays the same. |
| + - `acceptInviteTx(tx, token, person string, now)`. The gate becomes `holdsAddressTx(tx, person, want)`, inside the same transaction. The membership row is inserted with `address = person`. |
| + - `AcceptInvite(token, person, now)` is unchanged apart from the rename. |
| + |
| +`admitMember` already passes the session address (`addr`) into all three and into `s.store.Role(acct.ID, addr)`. That stays correct, because `addr` is the person. Check that nothing between `PendingInviteFor` and `acceptInviteTx` uses `inv.Address` as a membership or seat key. If something does, switch it to `addr` and say so in the commit. |
| + |
| +The signed-out invite page's prefill (`PendingInviteAddress`) is unchanged: signing in as the invited address resolves to whichever person holds it. |
| + |
| +- [ ] **Step 1: Write the failing tests:** |
| + - `TestInviteAcceptedByHeldAddress`: account A, an invite to `alias@example.test`, and a person `person@example.test` with a method `(email, alias@example.test) → person@`. `AcceptInvite(token, "person@example.test", now)` succeeds. `Role(A, "person@example.test") == RoleMember`, and `Role(A, "alias@example.test") == ""`. |
| + - `TestInviteRefusedForUnheldAddress`: the same invite, with person `stranger@example.test` and no method. `PendingInviteFor` and `AcceptInvite` both fail, and there is no membership. |
| + - `TestInviteHeldAddressEndToEnd` (server): sign in by email as `alias@example.test` when that address maps to `person@`. Open `/invite/{token}`, then POST accept. This lands in A, and the membership is under `person@`. |
| + - `TestInviteSeatPathHeldAddress`: drive `admitMember` on a paid team with a seat authorisation, the same way the existing seat tests do (find them with `grep -n admitMember *_test.go`), as `person@` for an invite to `alias@`. The outcome is joined, and the membership and seat are consumed under `person@`. |
| +- [ ] **Step 2:** Run `go test ./internal/console -run 'TestInvite'`. Expect the new tests to FAIL and the existing ones to PASS. |
| +- [ ] **Step 3: Implement** the gate changes and renames. |
| +- [ ] **Step 4:** Run `go test ./internal/console -run 'TestInvite|TestAdmit|TestSeat'`. Expect PASS. |
| +- [ ] **Step 5: Commit:** `git commit -m "console: invites accept any address the person holds (social sign-in 1)"` |
| + |
| +--- |
| + |
| +### Task 5: Your settings lists sign-in methods (spec §4.3, listing only) |
| + |
| +**Files:** |
| +- Modify: `internal/console/authcli.go:1515` (`cliPage` gains `Methods []methodRow`), and `handleCLITokens` (`:1708`) |
| +- Modify: `internal/console/templates/settings.html` (a new section before `<h2>Command-line access</h2>`, line 9) |
| +- Test: `internal/console/settings_methods_test.go` |
| + |
| +**Interfaces:** |
| +- Consumes: `SignInMethodsFor` (Task 1); the `socialSigninCopy` ids (Task 3). |
| +- Produces: `type methodRow struct { Kind, Identity string; AddedAt, LastUsed time.Time }`. `Kind` is the display label from `methods.kind_email` or `methods.kind_keymail`, and `Identity` is the method's subject for `email`/`keymail` (Plan 2 adds provider labels). Rows with `removed_at != 0` are left out. |
| + |
| +The section has the heading (`methods.heading`), the lede (`methods.lede` with `{address}` set to the session address), and a table with the four column headings. Each row shows `Kind`, `Identity`, `fmtTime AddedAt`, and `fmtTime LastUsed`, or `methods.never_used` when it is zero. It has no buttons in this plan. Follow `settings.html`'s existing table markup (`tablewrap`, `table`). |
| + |
| +If `SignInMethodsFor` errors, log it and leave the section out. The rest of the page still renders, because the CLI token list matters more. |
| + |
| +- [ ] **Step 1: Write the failing tests:** |
| + - `TestSettingsListsMethods`: a person with backfilled `email` plus an added `keymail` method for `a@example.test`. GET `/settings` (the route `handleCLITokens` serves; confirm it in `server.go`) gives a body containing `copyText("methods.heading")`, both kind labels, `a@example.test`, and the "Command-line access" heading after the methods heading. |
| + - `TestSettingsMethodsNeverUsed`: a method with zero `last_used_at` shows `copyText("methods.never_used")`. |
| + - `TestSettingsMethodsOnlyOwn`: another person's method `(email, b@example.test) → b@example.test` doesn't appear on `a@`'s page. |
| +- [ ] **Step 2:** Run `go test ./internal/console -run 'TestSettings'`. Expect FAIL. |
| +- [ ] **Step 3: Implement** the row type, the handler addition and the template section. |
| +- [ ] **Step 4:** Run `go test ./internal/console -run 'TestSettings|TestCLITokens'`. Expect PASS. |
| +- [ ] **Step 5: Commit:** `git commit -m "console: Your settings lists sign-in methods (social sign-in 1)"` |
| + |
| +--- |
| + |
| +### Task 6: Branch gate |
| + |
| +- [ ] **Step 1:** `go vet ./internal/console/...`, then `go test ./internal/console` (the whole package, once). Expect PASS. |
| +- [ ] **Step 2:** Cross-build: `GOOS=darwin go build ./... && GOOS=windows go build ./...`. Expect no output. |
| +- [ ] **Step 3:** Push the branch, describe it with `amadan branch describe`, and wait for `amadan ci status -branch <branch>` to pass. This plan is not dormant (it changes sign-in and invite gates for everyone), so merging needs Paul's go after review. |