- packages/cli/src/domains.mjs: a dependency-free client of Cloudflare's
public Workers Custom Domains API (zones lookup, PUT/GET/DELETE
/accounts/{id}/workers/domains, certificate pack state). Cloudflare
issues the TLS certificate; a domain reads active once it is. The token
goes in the Authorization header only and is scrubbed from every error.
Byte copy at apps/console/lib/ship/cf-domains.mjs (drift test).
- railyard domains [add|remove HOSTNAME] [--app]: the console attaches the
hostname to the app's production Worker with the org's Cloudflare grant
(the QY1.1 OAuth step; the access token is opened and used inside the
console only). Without a grant (409 no_cloudflare_grant) the CLI does the
same with the local login (CLOUDFLARE_API_TOKEN or the wrangler login
file after `wrangler whoami`) and the console records the outcome. Adding
an attached hostname keeps it; one on another Worker is refused; remove
is idempotent; a hostname outside the account's zones is refused plainly.
- Console: migration 0010 railyard.app_domains (one org per hostname,
lower case, cascade, RLS, no anon); GET/POST/DELETE /api/v1/domains and
POST /api/v1/domains/record (CLI bearer); states refreshed from
Cloudflare when the org has a grant. Cloudflare OAuth default scopes add
zone:read and ssl_certs:write (orgs linked before need to run
railyard link once more for console-side domains).
- Scribase bridge: new signed route domains {scribase_org_id, app?} ->
{available, domains:[{app, hostname, state, checked_at, created_at}],
next} for the Deploy tab; contract fixture v2 adds it (additive).
Tests: CLI 23/23 (new domains.test.mjs 5: grant path with the real console
handlers and a fake Cloudflare, local-login path, wrangler config file,
refusals, idempotent remove, no token printed or sent to the console);
console 147/147 (new lib/ship/domains.test.ts 4: drift, worker naming
equal to the CLI's, attach/detach and cross-org refusal, record and
refresh, bridge listing; 0010 migration on a scratch PG); contract 6/6;
console tsc clean.
Owner-only: one real-domain proof (railyard domains add on a domain in the
owner's Cloudflare account) is not run here; record it at the deploy gate.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Product analytics (A26, contract 5.3)
- Bridge: new signed route product_analytics {scribase_org_id, app, days?,
with_server_key?} -> host, public key (the site key), first product event,
web view; the server key only when asked, only to the Scribase control plane.
- sites answers analytics_host and analytics_key next to the page-tag values
(nothing of the Insights path removed); insights answers
first_product_event_at; the analytics proof falls back to
first_product_event when no page-tag event came.
- lib/product-analytics.ts: one-app, viewer-scoped org tokens for every call;
PRODUCT_ANALYTICS_PUBLIC_URL (default the SDK default host).
- PA: POST /v1/server/{app_id}/batch with Authorization: Bearer ry_pak_<hex>
(HMAC of the app id under PRODUCT_ANALYTICS_CONSOLE_SECRET, constant-time
check) for server-side forwarders (QU1.4); the public key is refused there.
- Contract tests/contract/fixtures/scribase-bridge/contract.json stays
version 2 with additive QY1.2 keys: product_analytics route and answer
keys, analytics_host section (env names, capture paths, server door).
Web view (A18)
- PA src/web/query.ts: visitors, page views, visits, bounce, daily series,
top pages, entry referrers ($direct), entry UTM, p75 page speed with
ratings, from pa.events under RLS. Shapes follow PostHog web analytics
stats_table (MIT, 7b13402a6350, nothing from ee/), NOTICE updated.
- Console: product-analytics/web screen (range picker, tables, page speed).
/s.js page speed (I7, P-Y12)
- The page tag sends LCP, INP, CLS, FCP and TTFB once per page view
(hidden, pagehide, or before a route change) as a performance event;
data-vitals="off" turns it off. Port of insights-web metrics.ts; metric
definitions per GoogleChrome/web-vitals (Apache-2.0), NOTICE added.
1,620 bytes gzip (budget 3,072).
- With PRODUCT_ANALYTICS_URL the edge collector also forwards every stored
event to product analytics ($pageview, $web_vitals, custom events,
$identify) with cookieless daily ids, no IP, retried on 5xx with the same
uuids, so the web view reads the same store.
Also: lib/ship/ship.test.ts type errors from QY1.1 fixed (doneText helper).
Tests
- insights-edge 34/34 (19 existing + 11 vitals within 10% of
chrome-page-loads.json and 3 KB gzip + 4 forwarding).
- console 135/135; contract 6/6; console tsc clean.
- product-analytics a1 52/52; test/qy 7/7 (web view hand counts, isolation,
edge-shape events, server door, and an end-to-end bridge -> SDK event ->
first_product_event proof: 31 ms against the 60 s target); tsc clean.
Note: performance events still count toward the collector's monthly cap,
as the insights-web ones already did.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Railyard GitHub App is shared by every Railyard org, so an installation on a
repository proved nothing about who was linking it: any org could start
railyard link for a repository the App was installed on (for example all of a
GitHub organization's repositories), get a link to its own org, open the
workflow pull request there, and, once the workflow was on the default branch,
receive that repository's code on every push in its own Cloudflare account.
The browser half now has the user sign in with the App (its user authorization,
no click after the first time) and checks with that user's own token that they
can push to the repository before anything is recorded or opened. The token is
used once and never stored. go and the setup URL no longer skip to Cloudflare or
the pull request. Needs GITHUB_APP_CLIENT_ID and GITHUB_APP_CLIENT_SECRET (the
manifest command stores them) and the App callback URL, which the manifest sets.
Tests first: an attacker org with read-only GitHub access is refused, claims no
installation and opens no pull request; forged codes and a refused sign-in fail.
Console 129/129, tsc clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RYP-E3 in Wave P. ADR RY-0004 records the evidence that path A exists
(Cloudflare self-managed OAuth clients, changelog 2026-06-03, authorization
code flow only) and builds it; path B stays the written fallback; path C
stays rejected.
- railyard link: one URL; at most two consents in the browser (install the
Railyard GitHub App on the repo, then Cloudflare's own consent screen with
PKCE), each skipped when done before; then one pull request from the App on
railyard/ship-on-push adding .github/workflows/railyard.yml. Nothing is
pushed to a default branch. The installation id GitHub sends back is not
trusted; the App's view of the repo decides.
- The workflow holds no key: it asks GitHub for an OIDC token (audience = the
console) and runs `railyard ci`. The console checks issuer, audience,
expiry and signature, the stable repository_id, the Railyard workflow ref
only, push/workflow_dispatch on branches only, and a paused org; it answers
with a short-lived Cloudflare access token (sealed refresh token rotated and
resealed; a cached access token reused while 10 min are left).
- railyard ci masks the token first, deploys exactly like railyard deploy,
never opens a login, and reports with a fresh OIDC token. The console
records the deploy (branch and commit from the token) and writes one
preview comment on the branch's pull request, edited on later pushes.
- Signed App webhooks drop links on uninstall or repo removal.
- GET /api/v1/github/manifest creates the App (owner item Y4); the done page
shows one command that pipes the App key into wrangler secrets.
- Migration 0007_ship.sql (idempotent; scratch Postgres only): installations,
links (one per repo), sealed Cloudflare grants, link sessions; RLS on, no
anon/authenticated grants.
- Off until RAILYARD_SHIP_ON_PUSH_LIVE=1 and every name is set (routes 503;
copy stays "arriving" under denylist rule railyard-slot-ship-on-push).
Env: RAILYARD_SHIP_ON_PUSH_LIVE, GITHUB_APP_ID, GITHUB_APP_SLUG,
GITHUB_APP_PRIVATE_KEY, GITHUB_APP_WEBHOOK_SECRET, CLOUDFLARE_OAUTH_CLIENT_ID,
CLOUDFLARE_OAUTH_CLIENT_SECRET, CLOUDFLARE_OAUTH_SCOPES (optional); reuses
RAILYARD_CREDENTIALS_KEY.
Tests: console 122/122 (ship 12, migration 0007 on a scratch cluster), tsc
clean; CLI 18/18 (link and ci 5, copy lint). The 5-minute push-to-live run on
a real repo and Cloudflare account is owner-run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>