carlos / platform Public

console: linear sign_in_methods backfill (fixes the migration budget)

Materialize grant and Keymail session addresses once during backfill so reopening a populated store stays within the migration budget.
Co-Authored-By: GPT-6 Astra <noreply@openai.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev e5cb255f6aae831aaab47f20bfa544b59b14bd0e parent 095c613
1 file changed, +2 −2
  • internal/console/signinmethods_store.go +2 −2

CI passed — run details

Intent

Human

<task-notification> <task-id>by44r1ii4</task-id> <tool-use-id>toolu_01AYC2j83wiK1jmkZgapjaWn</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/1730ddc5-7bb6-4ebb-ab9b-85efe2e437e3/tasks/by44r1ii4.output</output-file> <status>completed</status> <summary>Background command "Ledger round 1 and run fix round 2" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>a900ef1d80d713304</task-id> <tool-use-id>toolu_015Z5tAAQX2Nq9ZcdMtwGx7P</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/1730ddc5-7bb6-4ebb-ab9b-85efe2e437e3/tasks/a900ef1d80d713304.output</output-file> <status>completed</status> <summary>Agent "Re-review Task 5 fix rounds" 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>1. Date cells overflowing at 390px because of `fmtTime`: ADDRESSED. 2. Table still scrolling at 390px, so hide the Added column on phones: ADDRESSED. New Critical/Important breakage: none. I did not run any tests. The fix2-390 screenshot shows Method, Signs in as and Last used fitting with no scroll. The re-review is written to `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/console-social-signin/.superpowers/sdd/2026-11-02-console-social-signin-1-methods/task-5-rereview.md`.</result> <usage><subagent_tokens>49139</subagent_tokens><tool_uses>7</tool_uses><duration_ms>32824</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>a07b5d2a0fdcc52bc</task-id> <tool-use-id>toolu_019iTQ7AickoLwHGvNtkXjQq</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/1730ddc5-7bb6-4ebb-ab9b-85efe2e437e3/tasks/a07b5d2a0fdcc52bc.output</output-file> <status>completed</status> <summary>Agent "Final whole-branch review, Plan 1" 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>**Verdict: ready to merge**, once CI passes on the whole console package, `-race` and the darwin/windows cross-builds, and Paul gives his go (this branch changes sign-in for everyone, so it isn't dormant). I ran one batch of the branch's own tests locally and they passed in 148 s. I did not run the whole package, `-race` or the cross-builds. **Critical:** none. **Important:** none. I found no path where an existing person is locked out, lands on the wrong person, or is charged the new-person budget: - **Migration:** it only inserts rows, a restart adds nothing twice, and every existing person maps to their own address. - **Invites:** the "holds this address" check runs again inside the accept transaction, and the membership is stored under the person, never under the invited address. - **Budget:** it is only read for people who already exist, and a refusal writes nothing. **Minor, mostly for later plans:** - **Plan 2:** `ResolveSignIn` and `PersonWouldBeNew` only work when the subject is an email address. A provider ID passed to them would create a person keyed by that ID. Plan 2 needs its own resolve path and must stop `finishSignin` treating the sign-in method as the row kind. - **Plan 4:** `PersonWouldBeNew` ignores removed rows but `ResolveSignIn` honours them. Nothing sets removed rows yet, so Plan 4 must settle both together. - **Plan 2:** people created by an operator or an invite who have never signed in get an `email` row even when their address is a Keymail one. Plan 2's "holds a Keymail method" check shouldn't rely only on method rows for them. - **Tidy-up:** `LookupSignIn` has no caller outside tests. - **Tidy-up:** two sign-ins racing for one new address can use two budget slots. That fails toward refusal. **Deferred minors that must be fixed before merge:** none. If you want one small cleanup commit first, it would: - add doc comments to the new exported store functions, saying they take email or Keymail addresses only (this is also what stops the Plan 2 misuse above); - add a comment on the new `method_id` column; - use the `MethodEmail`/`MethodKeymail` constants in `holdsAddressTx` instead of string literals. **Also recommended:** - **CI:** run the repository-root copy scanners too, because they parse the console package's source. - **After deploy on dev:** check the backfill with `SELECT COUNT(*) FROM users u WHERE NOT EXISTS (SELECT 1 FROM sign_in_methods m WHERE m.address = u.address)`, which should be 0. - **Before flagship:** the budget now limits Keymail sign-ups as well. Check that no test harness or demo flow creates more than 10 new people an hour from one IP. Full review: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/console-social-signin/.superpowers/sdd/2026-11-02-console-social-signin-1-methods/final-review.md</result> <usage><subagent_tokens>168981</subagent_tokens><tool_uses>46</tool_uses><duration_ms>582155</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>bzajifiwu</task-id> <tool-use-id>toolu_01UpaMQGfgec9UbSAhvQXfwo</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/1730ddc5-7bb6-4ebb-ab9b-85efe2e437e3/tasks/bzajifiwu.output</output-file> <status>completed</status> <summary>Background command "Wait for branch CI to finish" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 66.9 g CO₂e (5,378,033 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/signinmethods_store.go b/internal/console/signinmethods_store.go
index bc34edc0b..cf75813fc 100644
--- a/internal/console/signinmethods_store.go
+++ b/internal/console/signinmethods_store.go
@@ -29,8 +29,8 @@ func migrateSignInMethods(db sqlExecer) error {
);`,
`CREATE INDEX IF NOT EXISTS sign_in_methods_address ON sign_in_methods (address);`,
`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')
+SELECT CASE WHEN u.address IN (SELECT address FROM grants
+ UNION SELECT address FROM sessions WHERE method = 'keymail')
THEN 'keymail' ELSE 'email' END,
u.address, u.address, u.created_at
FROM users u