Repository navigation
feat(auth): confirm device logins and manage machines - #156
Conversation
Astra reviewReviewed StandardsP1 · Method — Bound the anonymous request bodies using the existing reader
Both handlers call Reproduced against the actual Smallest fix: use the existing SpecNo merge-blocking intent or YAGNI findings. The specified state machine, one-time mint/replacement transaction, reverse states, machine revocation, sign-out, analytics and ADR are represented in the change. Verification: 7 focused suites passed, 68 tests (DeviceLogins, DevicePages, MachineTokens, AuthApi, AuthPages, AuthPages.socket and ApiGuard). The isolated body-ingestion reproduction exited 0. No source changes; no production or existing dev instance touched. Live Clerk/browser acceptance was not rerun. Summary: Standards: 1 blocker — unbounded anonymous body ingestion. Spec: 0 blockers. |
|
Fixed point: This is a two-axis review (Standards vs Spec), plus the extra questions asked: #141's intent vs what landed, the method, and whether the code is the smallest correct model. StandardsDocumented
Smells (judgement)
No Spec(a) Missing / partial
(b) Not asked for
(c) Implemented but wrong
Copy that does match (not defects): #141’s two rewrites beat §8 and #131 A — re-login is “which stops working once your terminal finishes logging in” (not “when you confirm”); confirmed is “Confirmed. Your terminal finishes logging in on its own within a few seconds. You can close this tab.” (no §8 parenthetical). Confirm does not mint; poll does. Wire, guard (two anonymous POSTs, start 5/min), poll-once + concurrent unknown, deny/expiry/slow_down, same-user revoke only, abandoned confirm, deactivate-between-confirm-and-poll, Intent vs #141#141’s product sentence: a person in a signed-in browser authorizes a machine; they never type a code. Confirm records the user and name and mints nothing; the terminal’s poll mints the user-owned 90/30 token once, deletes the row, and a second poll is 410. Your machines lists live tokens with revoke one, revoke all, and browser sign-out. The PR implements that protocol. Drift is nearby, not a different product: POST/redirect/GET receipts so reload stays readable after the poll deletes the row; confirmed copy follows #141’s short line, not spec §8’s parenthetical; browser Person-facing: code first, company/person/email, name the machine, Confirm or Deny, “terminal finishes on its own.” Machine-facing: unauthenticated start → pending/slow_down → one complete mint → second poll 410 Verdict: mostly faithful with notes. The lying receipt ( MethodThe split is the one #141 names: Poll order is sound: Receipt GET is not a spec dodge by itself: lookup only accepts
Mint-on-confirm + a plaintext column (the prototype) would fail #141. This transaction and hash-only row are the justified complexity. YAGNIThis is already close to the smallest correct model. Mint-at-poll is the design. The guard adds a Leave alone: lock-before-limit, mint under user Nits, not architecture: Overall: good with nits. Spec-faithful, not architecturally impressive — which is the right shape. SurfacesWire (api → AuthApi → Summary: Standards: 5 documented findings, 4 smells; worst is |
Correction: direct informational outcomes, not signed receiptsMy prior receipt reasoning was wrong. Confirmed and denied copy is informational, not authorization; signing it with a per-process secret added machinery without protecting a real permission boundary. 802a884 removes that change (270 net lines removed).
Real fixes retained
Findings kept or dismissed
Verification on the simplified implementation
Latest-commit merge readinessCI run 33962420139 passed for 802a884. All available checks are green: test (22), test (24), lint (including typecheck/format), cli-smoke, dependency-review, label. GitHub reports MERGEABLE / CLEAN against the unchanged stacked base auth/139-sharing-scope. No newer review findings or unresolved blockers; not merged. The base has no enforced required-check rules configured. |
|
|
@vsrikar08 Following up on your scope feedback: Allison disagrees with deferring machines and trust. Keeping the device-login confirmation and machine-management flow in v1. No change requested on this point. |
860ccbe to
7a7b45a
Compare
Implement #141: confirm device logins in the browser, mint once at poll, and manage user-owned machine tokens and browser sign-out.
802a884 to
5ee3700
Compare
Machines need a way to become their user, and people need a way to revoke machines they no longer trust.
Adds browser-confirmed device login: the person checks the terminal's code, then the terminal's poll mints a token exactly once. Your machines lists live keys, revokes one or all, and signs the browser out. Confirm and Deny return their informational outcome directly with HTTP 200 and private, no-store; later GETs read the current code state. Invalid machine names render the specified 422 page. Includes bounded device request bodies, the wire docs, glossary updates and machine-token ADR.
Stacked on
auth/139-sharing-scope. This PR targets that branch and contains only the device-login work above it.Closes #141.
Verified:
pnpm test— 306 tests passed.pnpm typecheck,pnpm lint,pnpm format:check, and packed CLI e2e passed.Implemented with OpenAI GPT-6 Astra in the Oh My Pi harness.