Repository navigation
feat(cli): sign machines in with login and logout - #157
Conversation
Astra reviewReviewed StandardsNo merge-blocking method or YAGNI findings. SpecIntent — [P2] Make
|
Code review — PR 157 vs issue #142Reviewed Intent, in one paragraph. #142 asked for the agent-native CLI follow-through of device login: StandardsNo Effect service findings. (a) Documented standard
Command.withDescription(
"Sign in this machine; relay the URL and code, then use --complete [code]."
)
( (b) Baseline smell (judgement)Primitive Obsession — if ("code" in error) {
yield* state.forgetPendingLogin(apiUrl);
const message =
error.code === "denied"
? "The login was denied in the browser. Nothing was saved. Run: patchy login"
: error.code === "expired"
? "The login expired before it was confirmed (codes last ten minutes). Run: patchy login"
: `No login is pending for code ${login.userCode} on ${apiUrl}; it may already have been reported. Run: patchy login`;
Spec(a) Missing or partialAgent (b) Not asked forThat rerun polls. Polling is specified only for
(c) Looks implemented, wrongRerun success shape is Complete reports failure after the key is saved. Spec §10: “On complete it saves the token with MethodThis is the method I would ship. It is the prototype’s Stripe-shaped handoff with the throwaway knobs (
The YAGNIMostly the right size. JSON shapes, The one piece of machinery I would still question: // packages/cli/src/index.ts
ConfigProvider.layer(ConfigProvider.fromEnv({ preserveEmptyStrings: true }))The catalog of agent variables is specified. Presence is The gate truth table in
Summary
The method is the one to keep. The two changes worth making before merge are the success path after |
|
Resolved both reviews on this PR; dispositions below. Fixed
Kept as is, with reasons
Verification and merge readinessCommitted and pushed as
No unresolved blockers. Ready to merge into the specified stacked base; not merged. |
|
jgood to merge |
802a884 to
5ee3700
Compare
612021a to
7185d4f
Compare
Offline auth tests cannot prove that real Clerk sessions verify through JWKS or that Clerk accepts invitation delivery requests. This adds a separate live tier while keeping `pnpm test` offline. `pnpm test:clerk` loads the developer's keys, exercises `/company` through real `RequireSession`, and creates, lists, revokes and re-sends invitations. Fixtures are run-scoped and swept after testing, with an additional `always()` sweep in CI. The job runs on same-repository PRs except Dependabot and on `main`; missing secrets fail immediately. Credentials stay out of the shared Vitest context. Verification also exposed an embedded Postgres exit-hook bug that turned failed suites into exit 0. A pinned dependency patch and regression test preserve the failure status. **Stacked on #157 (`auth/142-cli-login-logout`).** This PR targets that branch and contains only the live-tier changes. ### Verification - Local live tier: 2 tests passed; repeated cleanup confirmed zero run users. - Offline suite: 322 tests passed, fetch guard silent. - Lint, typechecking, formatting and packed CLI e2e passed. - Missing-secret failures and the workflow gate's main/same-repo/fork/Dependabot cases checked locally. - Standards and Spec reviews completed; the secret-handling finding was fixed and rechecked. Marking `clerk-live` required is a maintainer step. Branch protection was not changed; the CI application's repository secrets already exist. Closes #143. Built with OpenAI GPT-6 Astra in the Oh My Pi harness.
Publishing required a machine token you already held. Agents had no way to hand sign-in to a person, and logging out needed to work even when the instance was unreachable.
Adds
patchy loginwith a URL/code handoff, resumable completion, and waiting for people at real terminals. Stored logins outrank the dev seed.patchy logoutforgets the local key first, then revokes it as a courtesy. The CLI docs and publishing skill teach the new flow.Stacked on
auth/141-device-login-server, which provides the server-side device-login routes. This PR targets that branch and contains only the CLI follow-through for #142.Verification:
pnpm test: 317 tests passed across 37 files.pnpm typecheck,pnpm lint, andpnpm test:packed-cli-e2epassed.Closes #142.
Model: GPT-6 Astra. Harness: Oh My Pi.