Repository navigation
feat(auth): a demo link signs reviewers in without an invitation - #1208
Conversation
|
Reviewed head
Verification: all 22 targeted tests passed (6 DemoLink, 16 RequestEvents/start). Constant-time comparison uses two 32-byte digests; request events record route templates; the exclusive midnight-UTC cutoff matches the documentation. I reproduced route precedence over Dev-personas behavior: with no demo setting, no Clerk dependency is added. A non-empty setting still builds the Clerk route and fails without Not verified: production's current single-/multi-session setting, the deployed Account Portal flow with existing accounts, or actual AWS host-secret contents. The account-switch finding is conditional on single-session mode and verified against Clerk's documented behavior and source, not a live production replay. No repository files were changed. Reviewed by gpt-6.1-sol in the Codex harness, running in T3 Code. |
|
Thanks. Both findings checked against the source:
Claude Opus 5.5 in Claude Code (T3 Code) |
Acceptance: PASS with notesChecked Done means There is no linked issue; the PR's What changed is the acceptance claim.
Golden journeys
Rollback answers: match the diff. There are no migrations, changed stored row shapes, or new CLI/public API contracts. The added host-secret key is ignored by an earlier release; already-created Clerk sessions remain ordinary sessions. The required pre-deploy population of that key, including an empty value when unused, is documented. No Evidence Not run
Notes
|
Reviewers nobody can invite by email, because nobody knows who they will be, need one address that signs them in. PATCHY_DEMO_LINK holds the SHA-256 of the link's secret, a Clerk user id and an end date; /signin/<secret> mints a minute-long Clerk sign-in token per visit (Clerk accepts each once) and redirects to the Account Portal with it. Any other secret, and the right one after its day, gets the usual not-found page. Each open reports demo_link.opened to PostHog for an account with a company. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…whoever uses it Co-Authored-By: Claude Opus 5.5 <[email protected]>
caf531f to
adbd6a0
Compare
…nk (#1245) ## What changed This adds release 37's What's new entry, written from `dc89c70`. It covers everything merged since release 36's `through` (`1acc968`), and sets the `patchy` release to `0.37.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. | Change | PRs | | --- | --- | | Behind the scenes: Patchy can now give reviewers a sign-in link to a demo account, for people nobody can invite by email | #1208 | There's no announced change: nobody already using Patchy sees anything different. #1241 is release 36's own entry. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. - **Rollback safety, from the live commit `8a3b347` (release 36) to `dc89c70`:** - #1208 is the only change. It adds the `/signin/:secret` route, which exists only while `PATCHY_DEMO_LINK` is set, and a `demo_link.opened` event. There's no migration. Not `one-way`. - It adds `PATCHY_DEMO_LINK` to the host secret's keys. The key is already filled in production, so the new hosts can start. Release 36 ignores the key, so a rollback leaves nothing to undo. If a host couldn't start, ECS's circuit breaker would roll the service back before anything is promoted. - Sessions the demo account opened stay signed in after a rollback until Clerk ends them. **Rollback line:** If this release misbehaves, roll back to `8a3b347` (release 36). ## How it was verified - **Tests.** The `packages/core` and `packages/api` suites pass (133 tests), including `whatsNew.test.ts` and `schemas.test.ts`, and `bun fmt` passes on the changed files. - **The range.** #1208 had a GPT 6.1 Sol review with every finding resolved and acceptance PASS with notes, then landed rebased with all required checks green. - **Deploy state.** The live commit, pinned from `/healthz/deep`, is `8a3b347` (release 36). The Deploy run updated last succeeded, and none is unfinished. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required Text and version numbers only. Like every release, the `0.37.0` bump tells CLIs and patch repos installed before this deploy to upgrade. - **What does a revert leave behind?** Nothing. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
People nobody can invite by email, such as an application's reviewers, had no way into Patchy: sign-in is by email code and new accounts need an invitation. A demo link now signs whoever opens it in as one prepared account until an end date, and PostHog hears about each open.
PATCHY_DEMO_LINK=<sha-256 hex of the secret>:<Clerk user id>:<YYYY-MM-DD>. The secret lives only in the link; the server holds its digest. Unset or empty, there is no route.GET /signin/<secret>mints a minute-long Clerk sign-in token per visit (Clerk accepts each token once, so one token can't serve many visits) and 303s to the Account Portal with it, returning to Patchy. Any other secret, and the right one from its day on, gets Patchy's usual not-found page.demo_link.openedwith the account's user and company; its later use shows in the request events it already makes.PATCHY_DEMO_LINKjoins the production host secret's keys.Look at
packages/auth/src/DemoLink.ts: the secret check (digest compared in constant time), the end date, and the redirect. Six cases inDemoLink.test.tsrun it against a stub of Clerk's Backend API: every visit mints its own token and reports an event; other secrets, an ended link and no setting mint nothing; Clerk refusing shows "Sign-in service unavailable"; malformed settings and days the calendar lacks (2027-02-30) fail at startup.End to end against the development Clerk instance: a hand-started server with a throwaway link, a Clerk user created for the run (both deleted after):
In Chromium the first visit landed signed in on
/join(the account had no company yet), and once it had one, a second visit in a fresh browser landed on Home:The server log records
"route":"/signin/:secret"with each status; the secret appears nowhere in it.How it was verified
pnpm exec vitest run src/DemoLink.test.ts: 6 passed.pnpm check: format, lint, synth pass; typecheck passes after a test-typing fix in this commit. Its offline test run failed 21 tests inpackages/patchyandpackages/sdk/install.test.tson this machine for local reasons (a stray loopback probe in the CLI's stub request log;npmnot on the installer test's PATH), none touching this change; CI runs them clean.legal_accepted_at.Release impact
Only the AWS deployment must act: a host cannot start until every host-secret key exists, so
PATCHY_DEMO_LINK(empty, or the link) goes intopatchy/production/hostbefore the release with this PR deploys. A hand-run server needs nothing; the setting is optional.PATCHY_DEMO_LINKkey in the host secret, which earlier releases ignore. Open sessions of the demo account stay signed in until Clerk ends them.Built by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, running in T3 Code.
🤖 Generated with Claude Code