railyard/PLAN-2026-10-23-DEEP.md
caelum0x 2e9ca56c36 fix(cli): stop railyard logs from buffering an unbounded tail in memory
`run()` always appended every stdout/stderr chunk from a child process onto
accumulator strings, even for `railyard logs` (wraps `wrangler tail`), which
only ever reads the exit code and can stream for hours -- so a long session
held every log line it had ever printed in memory for no reason. Added a
`capture` option (default true, unchanged for deploy/rollback which do need
the text back) and set `capture: false` for logs.

Load-tested the fix for real: a new fake-wrangler `tail` fixture that
behaves like the real thing (streams until killed, never exits on its own),
a 4,000-line end-to-end `railyard logs` test (every line still streamed
live, saved token redacted, --format/--status forwarded correctly), a
Ctrl+C-style signal-stop test, and a direct run() test proving capture:false
keeps result.stdout/stderr empty across 20,000 printed lines while
capture:true is unchanged. 28/28 CLI tests passing (23 pre-existing + 5 new).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-24 04:53:23 +03:00

525 lines
31 KiB
Markdown

# Railyard — prioritized feature backlog (2026-10-23)
Built from a fresh read of the live code (not the pitch) plus
`STRATEGY-2026-10-23.md` (competitive positioning, growth moves) and
`docs/CONSUMERS.md` (per-product wiring gaps). No `ARCHITECTURE-2026-10-23.md`
exists in this repo at time of writing — the canonical architecture doc is
`docs/RAILYARD_ENTERPRISE_ARCHITECTURE.md`, referenced inline below instead
of duplicated.
Ground truth restated from STRATEGY.md: one real self-serve product
(Insights), one unified console built-but-undeployed (`apps/console`,
blocked on an owner-only Scribase project provisioning step — confirmed live
2026-10-21/22, see `apps/console/NOTES.md`), and five-to-seven backend rails
(Relay, Rago, Switchyard/toolgate, Vend, Mint, Rithub) with no self-serve
signup path at all. The backlog below is ordered so the top items are the
ones that convert existing traffic/usage into signups or revenue fastest,
and the owner-blocked console deploy itself is called out once (item 1) with
every non-owner-blocked thing done in its shadow, rather than repeated as a
blocker under every other item.
## 1. Console cross-sell: prefilled signup bridge from Insights → Console
**Why #1:** STRATEGY.md names this the single highest-leverage growth move —
it is the only lever that converts the one proven self-serve funnel
(Insights, live at `insights.ereboslab.com`) into Console signups, and it
costs no new backend, only a bridge between two already-built flows.
- Add a dismissible banner to the Insights dashboard
(`apps/insights-edge` dashboard view) once a site has recorded ≥1 real
event: "See errors, flags and model spend for this site too — open your
Railyard account", linking to
`https://railyard.ereboslab.com/auth/start?email=<encoded>&src=insights`.
- In `apps/console/app/auth/start`, read `?email=` and `?src=` query params
and pre-fill the email-code form (`apps/console/lib/email-signin.ts`) so
the user only confirms, never retypes an address; store `src` on the
session row created in `apps/console/lib/session.ts` for attribution.
- Ship this on `main` now even though the Worker itself is not deployable
yet (owner-only Scribase step, see `apps/console/NOTES.md`) — it is ready
to go live the moment that one step clears, instead of being designed
after the fact.
## 2. "Relay vs. OpenRouter: $0 markup vs. 5.5-8%" comparison page
**Why #2:** STRATEGY.md calls this "the single clearest, most defensible
price-axis claim in the whole portfolio" — it is a page, not a pitch, and it
targets search queries ("OpenRouter alternative no markup") that already
have third-party demand.
- New public page, e.g. `apps/console/app/(marketing)/compare/relay-vs-openrouter/page.tsx`
(or a static page under the main railyard marketing site if one is
separate from `apps/console`): a real numbers table (spend tiers
$1k/$10k/$100k/mo → OpenRouter fee in dollars vs. Relay's $0 markup), the
success-only-billing mechanism explained in one paragraph, and a CTA into
the Console signup from item 1.
- Submit the finished URL to the exact channels STRATEGY.md's own research
surfaced organically ranking for this (awesome-llm-gateway GitHub lists,
r/LocalLLaMA, HN Show-HN) — a distribution task, not a build task, but
track it here so it isn't dropped once the page exists.
## 3. Faultline folded into Console's usage meter (not a separate bill)
**Why #3:** STRATEGY.md's gap analysis: Faultline today is "GlitchTip with a
new logo" and has no differentiation reason to exist; Rago already meters
`insights_events` the same way, so this is the cheapest real differentiation
available.
- Add a `error_events` metric alongside the existing `insights_events` metric
in `apps/rago` seeds/plan config, and a GlitchTip→Rago webhook bridge
(new small service, same shape as `apps/gitea/integrations/railyard/webhook-bridge/bridge.mjs`)
that POSTs an event to Rago per received GlitchTip error webhook.
- Add a "Faultline" tab to `apps/console/app/(app)` (next to the existing
`insights`, `flags`, `watch` tabs) that reads error counts for the org's
sites/projects and shows them against the same plan cap as Insights.
- Update the plan copy in `apps/console/lib/plans.ts`/`ladder.ts` so error
events count toward the existing bundle cap instead of being unmentioned.
## 4. Public landing + self-serve signup page for Rithub (git forge) — DONE 2026-10-24
**Why #4:** Rithub is live (`git.ereboslab.com`, HTTP 200) with zero
discovery/signup surface — pure wasted existing infrastructure, the cheapest
kind of growth to capture.
- Built: `apps/console/app/rithub/page.tsx` (public pitch page) +
`apps/console/app/api/v1/rithub/provision/route.ts` (session-authed) +
`apps/console/lib/gitea.ts` (admin API client, `sudo=` impersonation) +
`apps/console/db/migrations/0014_org_gitea.sql`. See
`BUILD-LOG-2026-10-23.md`'s "Round 2" for the full verification (a real
`gitea/gitea:1.23` container, end to end).
- Gated behind the same Console sign-in from item 1, via item 5's OIDC
prerequisite (closed in round 1) — Rithub access is reached by signing
into Console, not a separate native-Gitea-account flow.
- Owner-only step: set `GITEA_API_URL`/`GITEA_ADMIN_TOKEN` in production
(mint a site-admin token once on `git.ereboslab.com`); the route answers
503 with that exact instruction until then.
## 5. Rithub OIDC/SSO into Console (close `TODO(railyard-sso)`)
**Why #5:** STRATEGY.md: "ship that before claiming 'one bill, one sign-in'
anywhere in marketing copy, or the claim is false on day one" — this is a
prerequisite for item 4's CTA to actually be one sign-in rather than two.
- Add an OIDC discovery endpoint to `apps/console`
(`/.well-known/openid-configuration`, `/oauth/authorize`, `/oauth/token`,
`/oauth/userinfo`) backed by the existing session/JWT machinery in
`apps/console/lib/session.ts` and `apps/console/lib/tokens.ts`.
- Configure Gitea's `OAUTH2_PROVIDER` block in `apps/gitea/docker-compose.yml`
(the inline `TODO(railyard-sso)` marks exactly this spot) to point at the
new discovery endpoint, so a Console session logs a user straight into
Rithub with no second credential.
## 6. Switchyard (toolgate) self-serve signup — replace the admin-curl bootstrap
**Why #6:** STRATEGY.md and `apps/toolgate/README.md` both confirm onboarding
today is an admin-token `curl` call; this is the only rail in the repo with
real usage-ready infra (24 capabilities, 27 tools, MCP server, `sy` CLI) and
zero way for an outside developer to get a key without asking the owner.
- New `POST /v1/auth/signup` endpoint in `apps/toolgate` (mirror the pattern
already shipped in `apps/vend`'s `VEND_SIGNUP_ENABLED` flow: email +
workspace name in, `sk-t0-` key + session out, rate-limited per email).
Reuse Relay's own `sk-t0-` key format since Switchyard already shares
Relay's keys per the README.
- A minimal `/console` page in `apps/toolgate` (or a tab inside
`apps/console`) listing the 24-capability/27-tool catalog with live
pricing (`GET /v1/tools` already exists server-side per the README —
this just needs a web page, not a new API) and a "Create key" button
that calls the new signup endpoint.
## 7. Flip Vend's self-serve signup live + give it a landing page
**Why #7:** Unlike Switchyard, Vend already has a working signup endpoint
(`POST /v1/auth/signup`) and a full `/console` (Apps/Earnings/Team/Account)
gated only by the `VEND_SIGNUP_ENABLED` operator flag — this is the cheapest
item in the whole backlog, pure config + a landing page, not new code.
- Flip `VEND_SIGNUP_ENABLED=true` in Vend's deploy env (zero cost — no new
paid account, just an env var) and confirm the live `/v1/auth/signup`
default-terms response via `GET /v1/auth/signup`.
- Write the landing page the existing flow has never had: "resell LLM
access under your own brand" pitch (Vend's actual value prop per its
README: wallets, per-model prices, revenue splits), with a form that
POSTs straight to the already-built signup endpoint.
## 8. Rally (vcpeer.com) — close the two named Railyard-wiring gaps
**Why #8:** `docs/CONSUMERS.md` names these as open gaps for a product
already fully wired to Railyard everywhere else — finishing them converts
already-paying Rally usage into Railyard-metered usage without any new
product surface, i.e. pure revenue capture on existing traffic.
- **Abacus caps on `chat-fetch`:** extend `lib/railyard/abacus.ts`'s cap
enforcement to `lib/railyard/chat-fetch.ts` (today caps apply only to
`railyard-llm`/`gtm-llm`), and add a per-project `ABACUS_AGENT_ID` mapping
table so caps are per-customer, not per-deployment — the exact gap named
in `docs/CONSUMERS.md` item 6.
- **Rally subscription plans through Rago:** wire VC-viewer and Rally-seat
plan usage into Rago metering events (`lib/autogtm/rago-billing.ts`
pattern, new metric e.g. `rally_seat_active_month`) while Creem remains
the payment processor — `docs/CONSUMERS.md` item 4's explicit target
wiring.
## 9. Embeddings path through Relay for Rally
**Why #9:** `docs/CONSUMERS.md` gap 2 — Anthropic SDK and Voyage-rerank
embedding calls bypass Relay entirely today, meaning that spend is both
unmetered (no Rago event) and uncapped (no Abacus hold) even though every
other Rally LLM call site already goes through Relay.
- Add an OpenAI-compatible `/v1/embeddings` route to `apps/relay` that maps
to the TensorZero embedding backends already vendored in the fork, priced
in the same per-model catalog Relay uses for chat.
Switch `lib/embeddings/adapter.ts` in Rally to call this route the same
way `lib/railyard/chat-fetch.ts` wraps chat calls, env-gated so the direct
Voyage/Anthropic path remains the fallback.
## 10. Menivor per-render media-gateway metering
**Why #10:** `docs/CONSUMERS.md`: Menivor's `media_gateway.py::_settle_job`
jobs are "not metered per render" even though wallet holds/captures already
flow through Mint for the rest of Menivor — this is unbilled usage on a
product that already charges for renders everywhere else.
- Add a `railyard/metering.py`-style call (mirroring the existing
`app/integrations/railyard/metering.py` hook already used by
`wallet_bridge._meter_settlement`) into `media_gateway.py::_settle_job`
so every gateway-dispatched render emits the same `reel_ai_credits`/
per-render Rago event the rest of Menivor's render path already does.
## 11. Mint account self-provisioning (close the "no UI" gap)
**Why #11:** `docs/CONSUMERS.md` gap 5 — Rally's `mint-settlement.ts` needs
Mint accounts "provisioned per project out of band," with "no UI to create
them yet," which blocks every other item above that assumes a project
already has a Mint account.
- Add a `POST /v1/accounts` self-serve endpoint (if not already present —
`apps/mint` has the core ledger primitives per the README's 10-crate
shape) plus a small admin page under `apps/console/app/(app)/apps` to
create/view a project's Mint account id and balance inline with the rest
of the Apps tab, instead of a manual out-of-band step.
## 12. Watch (uptime) — finish the gated feature, flip it live
**Why #12:** Watch already has real code (`apps/console/app/(app)/watch`,
`apps/console/lib/watch/service.ts`) gated behind `RAILYARD_WATCH_LIVE` and a
32+ char `WATCH_AGENT_TOKEN` — this is a built feature sitting behind a flag,
cheaper to finish than anything net-new, and PostHog/UptimeRobot comparisons
in STRATEGY.md make clear uptime is a real wedge once live.
- Audit `apps/console/lib/watch/service.ts`'s `listWithState` for the actual
check-runner gap (the flag name implies a separate agent process is
expected to exist); build the missing scheduled-check runner (cron-style
HTTP/TCP probe worker, same shape as the other Rust `*-server` binaries in
this repo) if it doesn't already run anywhere, then set
`RAILYARD_WATCH_LIVE=1` and a real `WATCH_AGENT_TOKEN` in deploy env.
- Add a public status page per monitored app at
`apps/console/app/status/[app]` (route already scaffolded — confirm it
renders real check data once the runner is live, not a placeholder).
## 13. Switchyard catalog browser + `llms.txt` publish
**Why #13:** Switchyard's `/mcp` and `llms.txt` surfaces exist server-side
per the README, but there's no human-browsable catalog page — agent
developers evaluating Switchyard today have to read raw JSON from
`/v1/tools/*` instead of a page they can scan and link to.
- Build a simple `/catalog` page in `apps/toolgate` (or console tab) that
renders the 24-capability/27-tool manifest with live pricing from
`catalog/`, sortable by capability, with copy-paste `curl`/`sy` snippets
per tool — directly reusable by the signup flow in item 6.
## 14. Console setup-wizard to minimize the owner-only deploy step
**Why #14:** The console deploy is blocked on exactly one owner action
(provisioning a `railyard-console` Scribase project, per
`apps/console/NOTES.md`'s 2026-10-22 entry) — everything else (toolchain,
secrets, `wrangler deploy`) is already proven to work from this machine.
Rather than wait on that step, reduce it to the single smallest possible
click.
- Build a one-page `DEPLOY-CHECKLIST.md` + a `scripts/finish-console-deploy.sh`
that: checks `SCRIBASE_URL` against the control-plane host guard in
`lib/config.ts`, and once the owner pastes the new project's gateway host
into one env var, runs `cf:build` + `wrangler deploy` + the item 1-13
smoke checks automatically — so the owner's total manual work is "create
one Scribase project, paste one URL," not a multi-step runbook.
- Separately: check whether an existing, already-provisioned Scribase
project (any other product's) could serve as `railyard-console`'s
backend short-term, the same way Dodo's "one business, many Brands"
pattern let CalDesk reuse Bidstage's live key — if viable, this removes
the owner-only step entirely instead of just shrinking it.
## 15. Insights multi-site billing fix (per-site pricing penalty)
**Why #15 (lowest ranked, still concrete):** STRATEGY.md's competitor table
flags that Plausible-style per-site pricing "penalizes multi-property teams"
— Insights should differentiate on exactly this axis since it already has
the only live self-serve funnel in the repo.
- Add an org-level (not site-level) event pool to `apps/insights-edge`'s
plan logic so a team running 5 small sites shares one 10,000-event/month
free pool and one paid tier, instead of hitting 5 separate site caps —
a real pricing-model change, surfaced on the existing dashboard with a
"pooled across N sites" line item.
---
### Owner-only steps noted, not blocking (per standing rule)
- Item 1/14: Scribase project provisioning for `railyard-console` — one
owner click at scribase.com, no API key exists to do this headlessly.
- Item 2: submitting the comparison page to external listing sites —
posting to HN/Reddit under the owner's own accounts.
- Item 7: flipping `VEND_SIGNUP_ENABLED` and any other production env var
that requires redeploy access/secrets not present in this sandbox.
All 15 items above are coded against real files/paths/endpoints already
present in this repo (not hypothetical ones), ordered so the first several
convert already-live traffic (Insights, Rithub, Vend's built-but-off signup)
into signups/revenue before any net-new infrastructure is built.
---
## Addendum: per-app pages / APIs / features spec (2026-10-23)
Terse technical spec, one block per `apps/*` directory plus railyard core
(CLI + Rithub/Gitea + CI runner). Internal build doc — not restating code
that's self-evident from the route table, only the shape an implementer
needs. "Live" = curl-verified 200 on 2026-10-23; everything else is coded,
not confirmed serving real traffic.
### Core: CLI (`packages/cli`)
- No pages (terminal tool). Commands: `login`, `deploy`, `rollback`,
`deploys`, `logs`, `link`, `ci`, `domains` — each a thin HTTP client
against `apps/console`'s `/api/v1/*`.
- Auth: device-code flow (`POST /api/v1/device/code` → poll
`/api/v1/device/token`), token cached in `~/.railyard/credentials.json`.
- Remaining: none blocking; `railyard logs` (added 2026-10-22) was
load-tested against a long-running tail 2026-10-24 (see
`BUILD-LOG-2026-10-23.md` "Round 4") -- found and fixed a real unbounded-
memory bug in `run()`'s output capture, now covered by tests.
### Core: Rithub/Gitea + CI runner (`apps/gitea`, live `git.ereboslab.com`)
- Pages: stock Gitea 1.23 UI (repos/issues/PRs/Actions/Packages/Wiki) +
Railyard branding overlay (`apps/gitea/custom/`).
- APIs: Gitea REST `api/v1/*` + Actions API, consumed by the registered
`act_runner` (gitea/act_runner:0.6.1).
- Features: Postgres 17 via docker-compose, Rago/Mint billing bridge
(`integrations/railyard/webhook-bridge/bridge.mjs`), HTTPS+SSH push, LFS,
npm registry. CI proof: push → queued → running → success verified
2026-10-20.
- Remaining: none blocking — Console is now a real OIDC provider for Rithub
(backlog item 5) and `apps/console/app/rithub` self-serve-provisions an
org + first repo per Console session (backlog item 4), both closed
2026-10-24 (see `BUILD-LOG-2026-10-23.md` "Round 2").
- `apps/rithub` (own forge, 27.8k LOC) and `apps/rithub-forge` (Forgejo
submodule) are superseded, kept per no-delete rule, not deployed —
do not plan new work against either unless re-adopting one as primary.
### apps/mint (ledger/billing core)
- Page: `GET /admin` (`assets/admin.html`) — operator console only.
- API: ~60 routes under `/v1/*` (accounts, holds, transfers, allowances,
streams, checkouts, payouts, providers, keys, AITP-402, mint marketplace
under `/mint/v1/sellers/:seller/*`, webhooks for Dodo/Stripe Connect),
`/healthz`, `/readyz`. Auth: operator Bearer token on `/v1/admin/*`-style
calls (verify per-route in `mint-server/src/routes`), signed webhooks
verified by provider secret.
- Features: double-entry ledger, Ed25519 hash-linked receipts, success-only
billing, hold→capture/release, AITP-402, multi-provider on-ramp, KYC-tiered
redeem, payout reconciliation, Google Play RTDN (added 2026-10-22).
- Remaining: no founder-facing self-serve page (operator-only); wiring into
Rally/Menivor/Scribase is env-gated and off per `docs/CONSUMERS.md`.
### apps/relay (model gateway, TensorZero fork)
- Pages: forked TensorZero React Router SPA — api-keys, autopilot,
billing/{budgets,events,keys,settlements}, config, datapoints, datasets,
evaluations, observability/{episodes,functions,inferences}, models,
health, index.
- API: `/health`, `/status`, `/openai/v1/*`, `/inference` (vendored), plus
owned additions `/v1/relay/catalog`, `/v1/relay/quotes`,
`/v1/models/list`, `/api/v1/events`, `/relay/traces`, `/openai/files`.
Auth: per-API-key Bearer, budget-checked.
- Features: per-key spend budgets, operator-editable price catalog w/
OpenRouter list-price refresh, fallback routing/circuit-breaking/latency
hedging.
- Remaining: comparison page vs. OpenRouter (see backlog item 2) not built;
275 TODO/FIXME markers exist but the large majority are vendored
TensorZero engine code, not owned-overlay gaps (not individually
triaged — out of scope for a terse spec).
### apps/rago (billing/metering, Lago rewrite)
- Pages: `GET /admin` (`assets/admin.html`), `GET /portal/:token`
(customer self-serve portal).
- API: 234 distinct routes — customers, subscriptions, plans(+charges),
invoices(+pdf/xml/finalize/void/refund), credit_notes, wallets, coupons,
billable_metrics, events(+batch/estimate_fees), add_ons, taxes,
rate_cards, features, orders/quotes, payments, data_exports,
dunning_campaigns, activity/api/security logs, webhook_endpoints,
integrations(oauth/CRM/accounting sync), analytics/*, GraphQL dashboard
API, `auth/sso/{authorize,callback}`, `portal/:token/*`,
`webhooks/{stripe,creem,dodo,adyen,gocardless,iyzico}/:organization_id`,
`/health`, `/metrics`. Auth: API key (server), session (portal/GraphQL),
provider webhook signature.
- Features: exact decimal money math end-to-end, 6 payment-provider
webhooks, durable background worker.
- Remaining: 13 files with TODO/stub markers, not individually triaged.
### apps/vend ("white-label OpenRouter")
- Page: `assets/console.html` at `GET /console` (founder/tenant console:
sign-in, workspace creation, apps list, provisioning keys, end-user
wallets, payouts, team invites, model pricing, usage) + `assets/admin.html`
at `/admin` (operator).
- API: `/v1/auth/{login,setup,logout,github/*,google/*}`,
`/v1/chat/completions` (OpenAI-compatible), `/v1/models`,
`/v1/wallets(+/:external_ref)`, `/v1/control/*` (operator),
`/v1/customer/*` (founder self-serve), `/echo`, `/healthz`, `/readyz`.
Auth: session cookie (console), API key (chat completions).
- Features: one-call founder signup (workspace+key+session), per-model
founder-set pricing, revenue-split payouts on Mint.
- Remaining: `VEND_SIGNUP_ENABLED` (or equivalent) gate off in prod per
backlog item 7 — flip needs a redeploy/env step not available here.
### apps/abacus (spend-budget proxy, "kill switch")
- Page: `GET /admin` (HTML).
- API: `POST /v1/proxy`, `/v1/budget`, `/v1/receipts/:request_id`,
`/v1/admin/{overview,holds,receipts}`, `/healthz`, `/readyz`. Auth:
operator Bearer on `/v1/admin/*`.
- Features: inline budget-checked passthrough, Postgres-backed policy/hold
recovery, restart-safe JSONL fallback in single-replica mode.
- Remaining: none blocking; depends on `agent-runtime` for the agent side.
### apps/turnstile (AITP-402/x402 paywall middleware)
- Page: `GET /admin` (HTML).
- API: `POST /v1/echo` (demo, `TURNSTILE_DEMO_ECHO=1` only), `/v1/tools`,
`/v1/settlements/:request_id`, `/.well-known/aitp-tools`,
`/.well-known/x402`, `/mcp`,
`/v1/admin/{summary,settlements,recovery,tool-audit,tools/:name/enable,
tools/:name/disable,x402/{summary,payments,credit}}`, `/healthz`. Auth:
operator Bearer on `/v1/admin/*`, AITP-402 signed handshake on paid calls.
- Features: durable Postgres nonce store (horizontal scale), leased crash
recovery on journaled settlement, reuses `agent-runtime`'s real
`aitp-client` (never re-signs).
- Remaining: none blocking.
### apps/toolgate "Switchyard" (tool-calling gateway)
- Page: `GET /admin` (server-rendered, `routes/admin.rs`'s `console()`),
plus `/go`, `/device`, `/loop`, `/big` demo/OAuth helper pages,
`/llms.txt`, `/openapi.json`.
- API: `/v1/tools/search`, `/v1/tools/:id(+/call)`, `/v1/tools/batch`,
`/v1/passthrough/:tool_id/*rest`, `/v1/credentials(+/:id,
oauth/:provider/*)`, `/v1/keys(+/:id/revoke)`, `/v1/balance(+/topup)`,
`/v1/usage(+/calls,/calls/:id)`, `/v1/project`,
`/v1/bundles(+/:id/skill.md)`, full OAuth 2.1 server
(`/oauth/{authorize,consent,device/code,jwks,register,session,token}`),
`/.well-known/oauth-*`, `/mcp`, `/admin/api/{overview,orgs,projects,
members,keys,byo-tools}`, `/healthz`, `/readyz`. Auth: project API key,
OAuth 2.1 (PKCE, DCR, device flow) for `sy login`.
- Features: one key reaches a typed tool catalog (own products → public
APIs → BYO keys), Mint hold/capture per call, hash-chained audit log,
SSRF-safe egress.
- Remaining: none blocking.
### apps/context-passport "Identity Lock"
- Page: `GET /console` (Passports list/new, Identity assets, Generations,
Versions, Rights, Trained artifacts).
- API: `POST /v1/passports/:id/lock`, `/v1/passports/:id/attest`,
`/healthz`, `/readyz`. Auth: operator/owner token (narrower surface than
the other rails — identity/provenance only).
- Features: versioned lockable AI character/brand identity resolved
per-provider through Relay, c2pa-rs + ort (ONNX) provenance.
- Remaining: no Dockerfile — not containerized for deploy; add one before
treating this as shippable like mint/rago/vend.
### apps/game-economy (card packs/cosmetics/battle-pass on Mint)
- Pages: `GET /store` (player-facing), `GET /admin` (operator).
- API: `/v1/catalog`, `/v1/purchase`, `/v1/purchases/:player`,
`/v1/packs/open`, `/v1/inventory/:player`, `/v1/wallet/:player`,
`/v1/players`, `/v1/tokens`, `/v1/pass/advance`, `/v1/refunds`,
`/v1/iap/{credit,revenuecat,reverse}`,
`/v1/admin/{summary,catalog(+/pools/:rarity,/products/:sku),purchases,
refunds,revoke,players/:player,pass/advance}`, `/healthz`. Auth: player
session/token on `/v1/*` player routes, operator Bearer on `/v1/admin/*`.
- Features: idempotency-key purchase intent → deterministic hold →
capture-after-fulfillment → atomic inventory commit, Postgres-backed
multi-instance-safe state, idempotent retry of single-owner goods
(fix shipped `fix/game-economy-idempotent-replay-single-owner`).
- Remaining: none blocking; real `game-economy-server` binary exists
(corrects the stale Aug-2026 "library only" doc claim).
### apps/ledgerline (gross-margin side-car)
- Page: `/admin` per README's shipped-surface table.
- API: `GET /healthz`, `GET /readyz`, `POST /v1/events`,
`GET /v1/margins/:request_id`, `GET /v1/margins(+/summary)`. Auth:
operator Bearer.
- Features: durable outbox saga settling customer revenue + provider COGS
through Mint; compensation never releases a captured hold (reverses
revenue instead — `hardening/ledgerline-atomicity`).
- Remaining: no Dockerfile (same gap as context-passport); `tests/` now
populated (`concurrent_drivers.rs`, `pg_settlement.rs`), corrects the
stale Aug-2026 "empty tests/" doc claim.
### apps/rit (Smart-HTTP git server library)
- No pages. API: `/info/refs`, `/git-upload-pack`, `/git-receive-pack`
(Smart-HTTP protocol, not a REST API). No own auth layer — caller wraps
it (currently nothing in this repo wraps it into a live forge; `gitea`
is the live forge instead).
- Features: byte-for-byte real-Git-interop local object/index/ref model.
- Remaining: unused in production; either wire it under a thin wrapper as
a lighter-weight forge option or leave as a library dependency only —
no action needed unless a future app needs embedded git-serving.
### apps/product-analytics (PostHog-style event analytics, not deployed)
- Pages (nested in `apps/console`): `product-analytics/{page,setup,
insights,insights/new,insights/people,insights/segments,dashboards,
dashboards/[id],cohorts,experiments,experiments/new,experiments/[id],
actions,alerts,surveys,surveys/new,surveys/[id],exports,exports/new,
exports/[id],exports/csv,replay,replay/settings,replay/[session],
heatmaps,persons,persons/[distinct_id],privacy,sql,web}`.
- API (own service, `apps/product-analytics/src`): `insights/routes.ts`,
`capture/routes.ts`, `flags/routes.ts`,
`web/routes.ts` (`/v1/projects/:id/web`, `/v1/server/:id/batch`),
`remote-config/routes.ts` (`/array/:token/config(.js)`),
`alerts/routes.ts` (`/v1/projects/:id/alerts`, `/subscriptions`,
`/unsubscribe`), `surveys/routes.ts`, `replay/routes.ts`
(`/player/replay(+/events)`, `/player/embed/replay(+/events)`,
`/player/heatmap(+/data)`), `console/routes.ts` (`/v1/plans`,
`/v1/projects/:id/{events,groups,persons(+/:distinct_id(+/export)),
privacy/jobs,settings,status}`), `exports/`, `experiments/`,
`heatmaps/` route files. Auth: app's public site key (same key as
insights-edge).
- Features: events/people/identify/alias/groups, privacy delete/export,
console API for console's nested UI.
- Remaining: README states "not deployed"; limits in `src/plans.ts` are
targets, not owner-set real caps — do not advertise real pricing until
the owner sets these.
### apps/insights (vendored Umami — unmodified upstream)
- Stock Umami app/pages/API, no Railyard branding visible in README.
- Remaining (real ambiguity, flagged not assumed): relationship to
insights-edge + product-analytics (overlapping web-analytics purpose)
is undetermined from code — before building anything new here, confirm
with the owner whether this is still used or dead weight to archive
(do not delete without that confirmation, per no-delete rule).
### apps/insights-edge (cookieless analytics, LIVE `insights.ereboslab.com`)
- Pages: `/` landing, `/privacy`, `/live-demo`, `/d/:token`
(+`/delete`,`/upgrade`,`/api`), SEO pages in `src/pages.mjs`
(cookieless-analytics, GA-alternative, Plausible-alternative,
Fathom-alternative), `/sitemap.xml`, `/robots.txt`.
- API: `GET /s.js`, `/replay.js`, `/replay-viewer.js`,
`/replay-recorder.js`, `/replay-player.js`, `GET /api/replay/config`,
`POST /api/replay`, `POST /api/send`, `POST /api/batch`,
`GET /api/stats` (owner-only, Bearer `STATS_TOKEN`),
`POST /api/report` (owner-only), `POST /api/sites` (self-serve signup),
`POST /api/billing/webhook` (Dodo signature), `GET/POST /d/:token(+...)`.
- Features (as of this session): cookieless salted-daily-hash visitor id,
per-org Durable Object batching, plan-cap enforcement, bot/prefetch
filtering, session replay (paid, rrweb), Dodo billing, SEO pages,
**and the agent-failure pipe shipped in this session** — `$agent_failure`
custom event (`agent`, `model`, `error` only; prompts/keys dropped by
`src/agent-failure.mjs`'s `field()` regex+secret-pattern filter),
forwarded to Faultline (GlitchTip Sentry-store API) when `FAULTLINE_DSN`
is set, shown in its own "Agent failures" table on `/d/:token` and
`/live-demo`, separated from `events`/`converted` counts in
`store.mjs::siteStats`.
- Remaining: `FAULTLINE_DSN` is read from `env` but not yet declared in
`wrangler.jsonc` or documented as a required/optional secret — add it to
`apps/insights-edge/wrangler.jsonc`'s vars/secrets section and to
`apps/insights-edge/README.md` before relying on it in prod; the
Insights→Console cross-sell banner (backlog item 1) is still unbuilt.
### apps/console (unified dashboard, LIVE `railyard.ereboslab.com`)
- Pages: `/` landing, `/device`, `/connect/ai`, `/status/[app]`,
`(app)/{apps,billing,flags,insights(+/vitals),usage,watch}`, plus the
nested `product-analytics/*` tree above.
- API: `/api/apps`, `/api/billing/{checkout,cancel,pause,webhook}`,
`/api/connect/ai`, `/api/device/approve`, `/api/flags(+/segments)`,
`/api/watch`, `/api/v1/{ai/chat/completions, bridge/scribase/*, deploys,
domains(+/record), flags(+/client), github/*, insights/[...path], me,
rail/status, watch/agent/*}`, `/auth/{callback,email(+/verify),signout,
start}`. Auth: session cookie (dashboard), device-code (CLI), GitHub
App webhook signature, Dodo webhook signature.
- Features: device-code CLI auth, GitHub App ship-on-push, Cloudflare
Worker deploy orchestration, custom domains, Dodo billing, feature
flags, embedded product-analytics, Insights bridge, "Railyard Watch"
uptime, Scribase bridge, `GET /api/v1/rail/status` (aggregated health
check, shipped this wave).
- Remaining: ship-on-push gated behind `RAILYARD_SHIP_ON_PUSH_LIVE=1` +
7 secrets; replay-depth features gated behind `RAILYARD_REPLAY_LIVE`;
Watch gated behind `RAILYARD_WATCH_LIVE` — all coded, dark until the
owner sets those envs (owner-only secret-provisioning step, not a code
gap). Local `wrangler`/`pnpm` dev loop was broken per an earlier
session's note (`apps/console` NOTES) — re-verify before next deploy
attempt rather than assuming it still is.