2 Commits

Author SHA1 Message Date
71336987dd feat(bridge): Scribase bridge creates the bound Railyard org, one-time CLI claims and slot proofs; denylist 2026-09-29.3 (PY1.0)
PY1.0 acceptance (C8 delta check on main f919636; Wave E Y-0 to Y-5 merged):
1. Denylist .3 (gtm/policy, published by this package) adds portfolio-ott-drm
   and portfolio-ott-comparison (DRM, Netflix-style, your own Netflix beyond
   Menivor), addon-unlaunched (ADDON_LIVE), rally-capacity-purchase
   (RALLY_CAPACITY_PURCHASE_LIVE) and at-cost (allowed only next to a live
   price source). Re-vendored byte for byte; every new rule has failing
   fixtures (policy/test/fixtures/denylist-3-new-phrases.json); .2 fixtures kept.
2. apps/console/app/api/v1/bridge/scribase/{orgs,claims,proof}: signed
   (Standard Webhooks, RAILYARD_SCRIBASE_BRIDGE_SECRET), replay-proof calls from
   Scribase control-api. The first call creates the Railyard org bound to the
   Scribase org id (deterministic owner id, no second sign-up) and mirrors the
   add-on into the entitlement (plan "addon"); a lapsed add-on pauses the org
   and keeps its data. Keys go only to the Scribase CLI: a claim is a one-time,
   pre-approved device code (120 s) exchanged at /api/v1/device/token; a grep
   test keeps every bridge handler free of stdout, stderr and log writes.
3. proof answers {slot, state, live, proof:{kind,id,at}, next}; slots whose
   package has not landed answer "arriving".
Contract: tests/contract/fixtures/scribase-bridge/contract.json, run by
tests/contract/scribase-bridge.test.ts; the Scribase carve-out tests the same file.

Migration: apps/console/db/migrations/0002_scribase_bridge.sql (idempotent;
applied twice to a scratch local cluster only by test/migration.test.ts).
Env: RAILYARD_SCRIBASE_BRIDGE_SECRET (secret; unset keeps the bridge off).

Tests: console npm test 48/48, tests/contract 2/2, policy 11/11, cli 9/9, mcp 9/9,
tsc --noEmit clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 18:39:24 +03:00
247e860a16 feat(console): Railyard console with Scribase sign-in and the Dodo test-mode money ladder (RYP-D1, Y-2)
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>
2026-09-29 15:35:24 +03:00