4 Commits

Author SHA1 Message Date
b58a36844d fix(ship): only a person who can push to the repository may link it (PY3.1 verifier)
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>
2026-09-30 04:33:15 +03:00
014f62b224 feat(ship): ship on push through the customer's own GitHub Actions and Cloudflare, with no token shown (PY3.1)
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>
2026-09-30 03:10:35 +03:00
0ce1528ac8 feat(relay): named claude-haiku and claude-sonnet-5 routes and LiteLLM price cross-check (RY-RL2)
claude-haiku (claude-haiku-4-5) and claude-sonnet-5 route Anthropic first
and the OpenRouter copy second; claude-sonnet stays on 4.5 unchanged. Both
are priced in config/catalog.json at list price, so the metered startup
check passes and a request served by the OpenRouter leg bills the same
catalog price. A contract test ties tensorzero.toml, catalog.json and the
built-in list prices together.

relay-catalog gains a read-only cross-check against LiteLLM's MIT price
JSON (relay-price-crosscheck CLI): it flags differences above 5% and never
changes a price. First run flags the two llama alias routes, whose retail
price differs from the gpt-oss model that now serves them. The provider
canary route list now covers the two new routes (34 calls a day).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 01:42:32 +03:00
57158358e1 feat(relay): engine ADR and daily provider-contract canary (RY-RL1)
Records OD-RY1's default: keep the TensorZero fork as the Relay engine,
maintain the four adapters in use, Bifrost as the Wave E provider layer,
LiteLLM price JSON read-only, and the three tripwires.

The canary calls every named chat route plain, streaming and with a
forced tool call, plus each fallback leg once, and passes a call only when
the route's first configured provider served it (raw usage provider_type).
A revoked Anthropic key is red even while OpenRouter keeps answering.
Output is canary format v1 under product railyard. routes.json is generated
from tensorzero.toml for boxes without tomllib; tests fail when stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 01:32:11 +03:00