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

An edge sign-in for someone with no forge account creates nothing and goes to the forge's own signup #2599

Parked opened this
Closed without merging

An edge sign-in no longer creates an account. A login with no account here is treated as signed out and offered /signup. The full bun test run didn't finish in the sandbox, so I ran only the suites that touch edge sign-in and accounts.

Notes

stopped parked by the crew deploy 6e597ae

opened this

An edge sign-in no longer creates an account. A login with no account here is treated as signed out and offered /signup. The full bun test run didn't finish in the sandbox, so I ran only the suites that touch edge sign-in and accounts. Those pass, and tsc --noEmit is clean.

What changed

  • ensureEdgeUser in src/core/users.ts now only finds an existing active user by name and returns undefined otherwise. I dropped its unused host argument.
  • resolveAuth in src/http/server.ts no longer creates accounts or records the user.created event with via: "edge". A stranger's request is signed out and marked edgeStranger (new field on Auth).
  • For such a request, the header button reads "Sign up" and goes to /signup, instead of looping back to the edge login. /signup applies the signup setting and its checks as for anyone, and shows "Signup is closed on this forge." when closed.
  • The sign-up page's edge text said the edge "makes your account on first sight"; it now says the edge doesn't make an account here.
  • Accounts the edge already made still sign in by name, as before.

Tests

  • In test/edge-auth.test.ts, an unknown edge login makes no user row, gets 401, and sees "Sign up" with no "Sign out". An account made earlier with origin edge still signs in and is not an admin.
  • In test/signup-closed.test.ts and test/signup.test.ts, an unknown edge login is still refused while signup is closed. It is also refused after signup reopens, and an existing account still signs in in both states.
  • I rewrote tests that assumed the edge makes accounts: no-signup-admin, reserved-names, and accounts. In accounts they now create the account directly and add the user.created event by hand.
  • I deleted two tests that only checked behaviour that no longer exists: "an account the edge makes is audited too" in accounts, and "an account the edge makes must prove an address too" in verify-email.

Left out

  • The origin: "edge" variant in createUser stays, because existing accounts and these tests still use it. Removing it is a separate cleanup.
  • The full suite wasn't run to completion, so the forge's check on this push is the first full run.

Try it Start the forge with an edge token. Request / with x-plat-user: nobody and the matching x-plat-edge-token header. The page shows "Sign up" and GET /api/v1/user returns 401. Neither request adds a user row.

🤖 Generated with Claude Code

Closes #2593

2 earlier comments
commented

An edge sign-in no longer creates an account. A login with no account here is treated as signed out and offered /signup. The full bun test run didn't finish in the sandbox, so I ran only the suites that touch edge sign-in and accounts. Those pass, and tsc --noEmit is clean.

What changed

  • ensureEdgeUser in src/core/users.ts now only finds an existing active user by name and returns undefined otherwise. I dropped its unused host argument.
  • resolveAuth in src/http/server.ts no longer creates accounts or records the user.created event with via: "edge". A stranger's request is signed out and marked edgeStranger (new field on Auth).
  • For such a request, the header button reads "Sign up" and goes to /signup, instead of looping back to the edge login. /signup applies the signup setting and its checks as for anyone, and shows "Signup is closed on this forge." when closed.
  • The sign-up page's edge text said the edge "makes your account on first sight"; it now says the edge doesn't make an account here.
  • Accounts the edge already made still sign in by name, as before.

Tests

  • In test/edge-auth.test.ts, an unknown edge login makes no user row, gets 401, and sees "Sign up" with no "Sign out". An account made earlier with origin edge still signs in and is not an admin.
  • In test/signup-closed.test.ts and test/signup.test.ts, an unknown edge login is still refused while signup is closed. It is also refused after signup reopens, and an existing account still signs in in both states.
  • I rewrote tests that assumed the edge makes accounts: no-signup-admin, reserved-names, and accounts. In accounts they now create the account directly and add the user.created event by hand.
  • I deleted two tests that only checked behaviour that no longer exists: "an account the edge makes is audited too" in accounts, and "an account the edge makes must prove an address too" in verify-email.

Left out

  • The origin: "edge" variant in createUser stays, because existing accounts and these tests still use it. Removing it is a separate cleanup.
  • The full suite wasn't run to completion, so the forge's check on this push is the first full run.

Try it Start the forge with an edge token. Request / with x-plat-user: nobody and the matching x-plat-edge-token header. The page shows "Sign up" and GET /api/v1/user returns 401. Neither request adds a user row.

🤖 Generated with Claude Code

commented

I merged main into the branch and pushed it. The only conflict was the header's sign-in area in src/web/layout.ts.

  • Conflict fix: main added a guest menu in front of the Sign in button. This branch swaps that button for "Sign up" when an edge sign-in finds no account. The merged header keeps both. A guest sees the menu, then "Sign up" if they are an edge stranger and "Sign in" otherwise.
  • Tests: test/accounts.test.ts passes (21 tests). The type check printed nothing, which I read as clean. I never saw a result from the full bun test run. The first two attempts printed nothing and a third timed out. I did not run the guest, edge-auth or sign-in suites by name. The forge's check on this push will run the whole suite.

🤖 Generated with Claude Code

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs