railyard/apps/console/package.json
caelum0x c3b7edcf6d feat(console): GET /api/v1/rail/status, one aggregated health check for the rail
Consumer products (Rally, Menivor, Scribase, ...) and operators currently
have no single place to ask "is the rail actually up" -- they'd have to
probe Mint, Rago, Relay and Abacus separately before routing real traffic.

Adds lib/rail-status.ts (pure, injectable fetch per the repo's own transport
invariant) that checks every configured service in parallel with a bounded
per-service timeout, and GET /api/v1/rail/status that wires it to four new
optional env vars (MINT_HEALTH_URL, RAGO_HEALTH_URL, RELAY_HEALTH_URL,
ABACUS_HEALTH_URL -- unset services read "not_configured" and are excluded
from the verdict, so this degrades cleanly on any partial deployment).
Overall reads ok/degraded/down/unconfigured; HTTP status is 200 for
ok/degraded and 503 for down/unconfigured so a caller that only checks the
status code still gets the right answer without parsing the body.

TDD: 7 new tests in lib/rail-status.test.ts (all services healthy, one down
degrades the rest, a thrown network error reads down not an unhandled
rejection, a hung service times out instead of blocking forever, an unset
service skips the network call and is excluded from the verdict, zero
configured services reads unconfigured not a false ok, every service down
reads down). Full console suite: 166 pass (164 + the pre-existing env-only
failure in add-app-component.test.ts, unrelated -- missing root node_modules
in this sandbox, not a code regression).

Not deployed: the console Worker's deploy needs
~/.config/products-keys/railyard-console.env (not present on this machine)
and a working wrangler/pnpm toolchain (corepack's pnpm cache is broken here,
and the workspace root node_modules does not exist), so this could not be
shipped to railyard.ereboslab.com from this session -- noted in NOTES.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 18:39:35 +03:00

33 lines
1.1 KiB
JSON

{
"name": "@railyard/console",
"version": "0.1.0",
"private": true,
"description": "Railyard console: sign-in, the money ladder, apps, usage and billing (RYP-D1).",
"type": "module",
"scripts": {
"dev": "next dev --port 3020",
"build": "next build",
"cf:build": "opennextjs-cloudflare build",
"cf:deploy": "opennextjs-cloudflare deploy",
"typecheck": "tsc --noEmit",
"test": "node --test test/*.test.ts app/api/v1/deploys/*.test.ts app/api/v1/bridge/scribase/*.test.ts lib/ai/*.test.ts lib/flags/*.test.ts lib/watch/*.test.ts lib/ship/*.test.ts lib/insights-depth/*.test.ts lib/vitals-view.test.ts lib/rail-status.test.ts",
"test:bundle": "node --test test/bundle-secrets.test.ts"
},
"dependencies": {
"next": "14.2.35",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@opennextjs/cloudflare": "1.15.1",
"@types/node": "22.9.0",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"typescript": "5.6.3",
"wrangler": "4.139.0"
},
"engines": {
"node": ">=22.18"
}
}