carlos / platform Public

console: Your settings lists sign-in methods (social sign-in 1)

Co-Authored-By: GPT-6 Astra <noreply@openai.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev ac8703221d70f73cdf838d7cd8219bd30342a8f8 parent 74b232a
4 files changed, +189 −0
  • internal/console/authcli.go +27 −0
  • internal/console/settings_methods_test.go +144 −0
  • internal/console/templates/layout.html +1 −0
  • internal/console/templates/settings.html +17 −0

Intent

Human

<task-notification> <task-id>brs4z3hbi</task-id> <tool-use-id>toolu_019J26Z42PHyqjHnjwaTpSgd</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/1730ddc5-7bb6-4ebb-ab9b-85efe2e437e3/tasks/brs4z3hbi.output</output-file> <status>completed</status> <summary>Background command "Close Task 3; run Astra on Task 4" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>a68a3b6c810c4c014</task-id> <tool-use-id>toolu_017ZdqTz7cumZye34jzPA11o</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/1730ddc5-7bb6-4ebb-ab9b-85efe2e437e3/tasks/a68a3b6c810c4c014.output</output-file> <status>completed</status> <summary>Agent "Review Task 4 (spec + quality)" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**Spec verdict:** ✅ Spec compliant, with two cross-task ⚠️ items noted for the whole-branch review: - **Legacy sessions:** `holdsAddressTx` treats `address == person` as held without looking at methods. An old session that still carries an alias as its address could therefore accept an invite and create a membership under the alias. - **Invite creation:** the "already a member" check uses the invited address. Inviting an alias of an existing member still creates the invite and, on a billing team, records a seat authorisation. Accepting it is safe: no charge, no authorisation consumed. **Quality verdict:** Approved. **Critical/Important findings:** none. The full review is at `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/console-social-signin/.superpowers/sdd/2026-11-02-console-social-signin-1-methods/task-4-review.md`.</result> <usage><subagent_tokens>62936</subagent_tokens><tool_uses>8</tool_uses><duration_ms>97561</duration_ms></usage> </task-notification>

Attributed to this commit: 11.9 g CO₂e (1,443,173 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/internal/console/authcli.go b/internal/console/authcli.go
index 6c4607db8..a9cf39535 100644
--- a/internal/console/authcli.go
+++ b/internal/console/authcli.go
@@ -1510,6 +1510,11 @@ func (s *Server) notifyCLIIssued(address, rawToken string) {
}
}
+type methodRow struct {
+ Kind, Identity string
+ AddedAt, LastUsed time.Time
+}
+
// cliPage is the approval and tokens pages' data. It embeds page so the
// shared chrome ("top"/"bottom") keeps working unchanged.
type cliPage struct {
@@ -1522,6 +1527,7 @@ type cliPage struct {
Console string // this deployment's origin — the -console the CLI needs
Request *CLIAuthRequest
Tokens []CLIToken
+ Methods []methodRow
Days int
// ServiceAccounts maps a service credential's account id to that
// account's sqid, so the read-only mirror can say WHERE a row is managed
@@ -1533,6 +1539,10 @@ type cliPage struct {
ServiceAccounts map[int64]string
}
+func (p cliPage) MethodsText(id string) string {
+ return copyText("methods."+id, "address", p.Address)
+}
+
func (s *Server) renderCLI(w http.ResponseWriter, status int, name string, p cliPage) {
s.chrome(&p.page)
_ = s.writeTemplate(w, status, name, p)
@@ -1720,6 +1730,23 @@ func (s *Server) handleCLITokens(w http.ResponseWriter, r *http.Request) {
p := cliPage{page: page{Title: "Your settings", Address: addr, CSRF: raw, MobileParent: &navLink{Label: "Accounts", Href: "/accounts"}},
Tokens: toks, Console: s.cfg.Origin, Days: int(CLITokenTTL / (24 * time.Hour)),
ServiceAccounts: s.serviceAccountSqids(toks)}
+ methods, err := s.store.SignInMethodsFor(addr)
+ if err != nil {
+ log.Printf("console: settings sign-in methods: %v", err)
+ } else {
+ for _, m := range methods {
+ var kind string
+ switch m.Kind {
+ case MethodEmail:
+ kind = copyText("methods.kind_email")
+ case MethodKeymail:
+ kind = copyText("methods.kind_keymail")
+ default:
+ continue
+ }
+ p.Methods = append(p.Methods, methodRow{Kind: kind, Identity: m.Subject, AddedAt: m.AddedAt, LastUsed: m.LastUsedAt})
+ }
+ }
p.Flash, p.FlashErr = s.takeFlash(w, r)
s.renderCLI(w, http.StatusOK, "settings", p)
}
diff --git a/internal/console/settings_methods_test.go b/internal/console/settings_methods_test.go
new file mode 100644
index 000000000..e21a84d70
--- /dev/null
+++ b/internal/console/settings_methods_test.go
@@ -0,0 +1,144 @@
+package console
+
+import (
+ "net/http"
+ "net/url"
+ "strings"
+ "testing"
+ "time"
+)
+
+func settingsMethodsFixture(t *testing.T) (*consoleFixture, *http.Client) {
+ t.Helper()
+ fx := newConsoleFixture(t)
+ if _, err := fx.st.EnsureUser("a@example.test", time.Date(2026, 11, 1, 9, 0, 0, 0, time.UTC)); err != nil {
+ t.Fatal(err)
+ }
+ if err := migrateSignInMethods(fx.st.db); err != nil {
+ t.Fatal(err)
+ }
+ raw, err := fx.st.CreateSessionMethod("a@example.test", "", MethodEmail, time.Now())
+ if err != nil {
+ t.Fatal(err)
+ }
+ c := newBrowser(t)
+ u, err := url.Parse(fx.ts.URL)
+ if err != nil {
+ t.Fatal(err)
+ }
+ c.Jar.SetCookies(u, []*http.Cookie{{Name: sessionCookie, Value: raw, Path: "/"}})
+ return fx, c
+}
+
+func settingsMethodsBody(t *testing.T, fx *consoleFixture, c *http.Client) string {
+ t.Helper()
+ status, _, body := get(t, c, fx.ts.URL+"/settings")
+ if status != http.StatusOK {
+ t.Fatalf("GET /settings = %d", status)
+ }
+ return body
+}
+
+func settingsMethodsSection(t *testing.T, body string) string {
+ t.Helper()
+ start := strings.Index(body, "<h2>"+copyText("methods.heading")+"</h2>")
+ end := strings.Index(body, "<h2>Command-line access</h2>")
+ if start < 0 || end <= start {
+ t.Fatal("sign-in methods must appear before Command-line access")
+ }
+ return body[start:end]
+}
+
+func TestSettingsListsMethods(t *testing.T) {
+ fx, c := settingsMethodsFixture(t)
+ added := time.Date(2026, 11, 2, 10, 0, 0, 0, time.UTC)
+ if _, _, err := fx.st.ResolveSignIn(MethodKeymail, "a@example.test", added); err != nil {
+ t.Fatal(err)
+ }
+ used := added.Add(time.Hour)
+ if _, _, err := fx.st.ResolveSignIn(MethodKeymail, "a@example.test", used); err != nil {
+ t.Fatal(err)
+ }
+ section := settingsMethodsSection(t, settingsMethodsBody(t, fx, c))
+ for _, want := range []string{
+ copyText("methods.lede", "address", "a@example.test"),
+ copyText("methods.kind_email"), copyText("methods.kind_keymail"),
+ copyText("methods.col_method"), copyText("methods.col_identity"),
+ copyText("methods.col_added"), copyText("methods.col_used"),
+ "<td>a@example.test</td>", "2026-11-01 09:00 UTC",
+ "2026-11-02 10:00 UTC", "2026-11-02 11:00 UTC",
+ } {
+ if !strings.Contains(section, want) {
+ t.Errorf("methods section missing %q", want)
+ }
+ }
+ if strings.Contains(section, "<button") || strings.Contains(section, "<form") {
+ t.Error("methods section must be read-only")
+ }
+}
+
+func TestSettingsMethodsNeverUsed(t *testing.T) {
+ fx, c := settingsMethodsFixture(t)
+ section := settingsMethodsSection(t, settingsMethodsBody(t, fx, c))
+ if !strings.Contains(section, copyText("methods.never_used")) {
+ t.Error("unused method missing approved never-used text")
+ }
+}
+
+func TestSettingsMethodsOnlyOwn(t *testing.T) {
+ fx, c := settingsMethodsFixture(t)
+ if _, _, err := fx.st.ResolveSignIn(MethodEmail, "b@example.test", time.Now()); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := fx.st.db.Exec(`INSERT INTO sign_in_methods
+(kind, subject, address, label, added_at) VALUES ('keymail', 'alias@example.test', 'a@example.test', 'unused label', 1)`); err != nil {
+ t.Fatal(err)
+ }
+ body := settingsMethodsBody(t, fx, c)
+ section := settingsMethodsSection(t, body)
+ if strings.Contains(body, "b@example.test") {
+ t.Error("another person's method appeared on settings")
+ }
+ if !strings.Contains(section, "<td>alias@example.test</td>") || strings.Contains(section, "unused label") {
+ t.Error("method identity must use its subject")
+ }
+}
+
+func TestSettingsMethodsExcludeRemoved(t *testing.T) {
+ fx, c := settingsMethodsFixture(t)
+ if _, err := fx.st.db.Exec(`INSERT INTO sign_in_methods
+(kind, subject, address, added_at, removed_at) VALUES ('keymail', 'removed@example.test', 'a@example.test', 1, 2)`); err != nil {
+ t.Fatal(err)
+ }
+ body := settingsMethodsBody(t, fx, c)
+ settingsMethodsSection(t, body)
+ if strings.Contains(body, "removed@example.test") {
+ t.Error("removed method appeared on settings")
+ }
+}
+
+func TestSettingsMethodsDatesDoNotWrap(t *testing.T) {
+ fx, c := settingsMethodsFixture(t)
+ body := settingsMethodsBody(t, fx, c)
+ section := settingsMethodsSection(t, body)
+ if !strings.Contains(section, "<div class=\"tablewrap\">\n<table class=\"methods\">") {
+ t.Error("methods table needs its class inside a tablewrap")
+ }
+ if !strings.Contains(body, ".methods td:nth-child(3), .methods td:nth-child(4) { white-space: nowrap; }") {
+ t.Error("rendered layout must keep both method date cells on one line")
+ }
+}
+
+func TestSettingsMethodsReadErrorKeepsCLIAccess(t *testing.T) {
+ fx, c := settingsMethodsFixture(t)
+ if _, err := fx.st.db.Exec(`DROP TABLE sign_in_methods`); err != nil {
+ t.Fatal(err)
+ }
+ body := settingsMethodsBody(t, fx, c)
+ if strings.Contains(body, copyText("methods.heading")) {
+ t.Error("failed methods query must omit the section")
+ }
+ if !strings.Contains(body, "<h2>Command-line access</h2>") {
+ t.Error("failed methods query hid Command-line access")
+ }
+}
diff --git a/internal/console/templates/layout.html b/internal/console/templates/layout.html
index c884d723c..ea5d1788d 100644
--- a/internal/console/templates/layout.html
+++ b/internal/console/templates/layout.html
@@ -278,6 +278,7 @@
.tablewrap:has(> table.packs) { background: none; border: 0; border-radius: 0; box-shadow: none; margin: 0; }
.instances .instance-address { white-space: nowrap; }
.instances td:nth-child(2) { white-space: nowrap; }
+ .methods td:nth-child(3), .methods td:nth-child(4) { white-space: nowrap; }
.instance-open { display: inline-flex; padding: .25rem; }
.instance-group th { text-align: left; padding-top: 1rem; background: var(--accent-soft); }
.instance-group .small { font-weight: normal; }
diff --git a/internal/console/templates/settings.html b/internal/console/templates/settings.html
index 396ec8d20..d3fef7f96 100644
--- a/internal/console/templates/settings.html
+++ b/internal/console/templates/settings.html
@@ -6,6 +6,23 @@
<h1>Your settings</h1>
<p class="lede">Yours across every account — not any one account's.</p>
</div>
+{{if .Methods}}
+<h2>{{.MethodsText "heading"}}</h2>
+<p class="small">{{.MethodsText "lede"}}</p>
+<div class="tablewrap">
+<table class="methods">
+ <tr><th>{{.MethodsText "col_method"}}</th><th>{{.MethodsText "col_identity"}}</th><th>{{.MethodsText "col_added"}}</th><th>{{.MethodsText "col_used"}}</th></tr>
+ {{range .Methods}}
+ <tr>
+ <td>{{.Kind}}</td>
+ <td>{{.Identity}}</td>
+ <td>{{fmtTime .AddedAt}}</td>
+ <td>{{if .LastUsed.IsZero}}{{$.MethodsText "never_used"}}{{else}}{{fmtTime .LastUsed}}{{end}}</td>
+ </tr>
+ {{end}}
+</table>
+</div>
+{{end}}
<h2>Command-line access</h2>
<p class="small">Every terminal that can act as {{.Address}}.</p>
{{if .Tokens}}