The Insights cross-sell banner, the Rithub landing page, and the
Relay-vs-OpenRouter comparison page all link straight to
`/auth/start?src=<slug>` with no `provider`/`email` for a logged-out
visitor (the normal case). That hit the fallback branch, which returned
a developer-facing `400 Pass ?provider=google|github or
?email=you@company.com` instead of taking the visitor anywhere — every
"Start free" / "Open Railyard Console" CTA on those pages 400'd for any
visitor without a known email, independent of the separate
Scribase-project outage already tracked in plans/railyard.md.
Per the GTM campaign-workflow playbook's "ad claims vs current product
page" / "follow a test submission end to end" checks
(plans/gtm/_archive/CAMPAIGN-WORKFLOW-90D-2026-10-10.md), redirect to
the real sign-in page instead, preserving the `src` attribution cookie
the same way the provider/email branches already do — `auth/callback`
and `lib/email-signin.ts` read that same cookie at completion time, so
attribution is unaffected.
Verified live: built with real required env vars (prerender-clean, all
4 OIDC routes included), ran `next start`, and curled the exact CTA
URLs used by the three pages — pre-fix returns 400, post-fix returns
302 to the sign-in page with `ry_src` set correctly.
- Apps tab: one-click Mint ledger account per app (POST /v1/accounts
already existed on Mint; the gap was the UI), db/migrations/0012.
- Console is now a real OIDC provider for Rithub (Gitea) SSO: RS256
id_token + self-contained access_token over the authorization-code
grant, single-use codes (db/migrations/0013), discovery/jwks/
authorize/token/userinfo routes. A visitor who isn't signed in yet
is bounced through existing sign-in and lands back on /oidc/authorize
automatically. Gated on RAILYARD_OIDC_SIGNING_KEY/RAILYARD_OIDC_CLIENTS
(scripts/gen-oidc-key.mjs generates the former); unset, every /oidc/*
route is a clean 503.
- Public, numbers-backed /compare/relay-vs-openrouter page with a
spend-tier pricing table and a Console-signup CTA using the existing
cross-sell attribution bridge.
Verified: tsc clean, full `npm test` (167) and `npm run test:bundle`
(3) green; a scratch script exercised the OIDC code/token/userinfo
flow end to end against real generated RSA keys (found and fixed a
missing email_verified claim); `next dev` used to curl every new
route live (discovery, jwks, authorize's 400s and sign-in detour,
token validation, userinfo auth, the comparison page, the mint-account
API).
Prefilled /auth/start?email=&src=insights deep link from the Insights
dashboard banner into Console signup, with first-touch attribution
recorded on the new org (migration 0011, signup_source column) so the
only proven self-serve funnel (Insights) now converts into Console
signups instead of dead-ending.
The console could only sign in with Google or GitHub, so it could not open
before both OAuth apps exist (owner item Y-2). Add email sign-in: Scribase
Auth mails a one-time code (POST /otp), the console redeems it (POST /verify),
reads the user from the auth server, checks it matches the address, and opens
the same session as the OAuth path. Same-origin checks on both posts; inputs
validated before any call. RAILYARD_OAUTH_PROVIDERS picks the OAuth buttons
(default google,github; empty = email only). 7 new tests, console 154/154,
tsc clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Next.js console for Cloudflare Workers (OpenNext config, wrangler.jsonc)
with data in the console's own Scribase project, schema railyard
(migration 0001: orgs, org_members, apps, deploys, entitlements,
billing_events, api_tokens, device_codes; idempotent, RLS on, no anon
grants).
- Sign-in with Google or GitHub through Scribase Auth (PKCE), user read
from the auth server, org and entitlements row created, signed
HttpOnly session.
- Money ladder (pure, immutable): $1 card check credited back to the
customer wallet, 14-day trial with the plan's limits, $19 a month or
$190 a year, pause switch and one-click cancel (ends at the next
billing date; a trial ends now).
- Webhook: Standard Webhooks signature and timestamp verified, replays
ignored by unique message id, signed checkout metadata, other brands
ignored, a refund of the card check reverses the credit and the
trial, a failed wallet call releases the id for the provider's retry.
- Apps, Usage and Billing screens, one primary action each; Add app
shows the deploy command and the Insights tag in two clicks.
- CLI device-flow login and org-scoped hashed tokens for Y-3.
- Test mode only: the live payment host is refused unless the owner
sets RAILYARD_DODO_LIVE=1.
Tests (node --test, 25): journey from sign-in to entitlements and the
snippet, refund, pause and cancel, webhook security, ladder, tokens and
org isolation, PostgREST repo, a component test of Add app with the copy
lint, a next build grep for sentinel secrets in the client bundle, and
the migration applied twice on a scratch Postgres.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>