`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>
21 KiB
Build log -- 2026-10-23
Round 1 of 3
Picked up the 15-item backlog (docs/, see commit b23aa577). Items 1 and
7 were already built by an earlier commit this session (91d6f271 console
cross-sell bridge, 93330685 Vend self-serve signup) before this round
started. This round built items 2, 5, 6, 11 and 13 in full, end to end,
verified by running real servers and real HTTP calls (no new test files
added, per standing instruction).
Item 11 -- Mint self-serve account provisioning (apps/console)
Mint's POST /v1/accounts already existed; the real gap was "no UI,
out-of-band" (docs/CONSUMERS.md gap 5). Added:
apps/console/lib/mint.ts-- server-only Mint REST client (createAccount,balance).apps/console/lib/config.ts--mint: {url, apiKey} | nullfromMINT_URL/MINT_API_KEY.apps/console/db/migrations/0012_app_mint_account.sql--apps.mint_account_idcolumn.apps/console/lib/repo.ts+postgrest-repo.ts--setAppMintAccount, bothAppconstructors updated.apps/console/app/api/apps/[id]/mint-account/route.ts--POST, idempotent, session-authed.apps/console/components/AppBillingAccount.tsx+Icons.tsx(WalletIcon) -- one-click provision/copy on the Apps tab (app/(app)/apps/page.tsx), no emoji, glyph icons only.
Verified: tsc --noEmit clean, full npm test (167 tests) and
npm run test:bundle (3 tests, confirms the new client component carries no
secret) all green.
Item 6 + 13 -- Switchyard self-serve signup + human catalog (apps/toolgate)
Replaces "admin-token-curl-only onboarding" with a public endpoint, and adds the catalog page the backlog named as sharing its signup flow.
switchyard-server/src/config.rs--signup_enabled(on by default;SWITCHYARD_SIGNUP_DISABLED=1reverts to admin-only, matching Vend's flag convention).switchyard-server/src/routes/signup.rs--POST /v1/auth/signup:{org_name, email?, project_name?}-> creates org (slugified, collision-retried), default project, oneadmin-scopesk-t0-key, returned once.switchyard-server/src/routes/catalog_page.rs--GET /catalog(styled HTML, pricing + copy-pastecurlper tool) andGET /v1/catalog(JSON), both reusing the catalog loader already in memory.- Wired into
lib.rs's router, documented inllms.txt,openapi.jsonandREADME.md.
Verified live: ran switchyard-server serve with SWITCHYARD_STORE=memory,
curled POST /v1/auth/signup (got a real org/project/key), used the minted
key against GET /v1/project and a free tool search (both succeeded),
exercised validation (empty/overlong org_name, bad email, missing field --
all correct 400s), hit GET /catalog (200, 17 KB, renders all 24
capabilities with pricing and curl snippets) and GET /v1/catalog (24
capabilities as JSON). Started a second instance with
SWITCHYARD_SIGNUP_DISABLED=1 and confirmed /v1/auth/signup answers 404.
cargo check --workspace clean; cargo test -p switchyard-server (37
existing tests) all pass untouched.
Item 5 -- Console as an OIDC provider for Rithub SSO (apps/console, apps/gitea)
Closes apps/gitea/docker-compose.yml's TODO(railyard-sso) for real:
Console now issues RS256 id_tokens via a standard authorization-code grant.
apps/console/lib/oidc.ts-- code issuance/exchange/userinfo, RS256 via WebCrypto (reuseslib/ship/jwt.ts'ssignRs256/verifyRs256), self-contained access_token (no second token store needed for/oidc/userinfo).apps/console/db/migrations/0013_oidc_codes.sql-- single-use authorization codes, RLS on, service-role only.apps/console/lib/repo.ts+postgrest-repo.ts--createOidcCode/consumeOidcCode(atomic single-use PATCH, same pattern asconsumeConnectToken).apps/console/lib/config.ts--oidc: {signingKey, clients} | nullfromRAILYARD_OIDC_SIGNING_KEY(private JWK) +RAILYARD_OIDC_CLIENTS(client_id -> secret/redirect_uri map); malformed config logs and disables the feature rather than crashing the app.apps/console/scripts/gen-oidc-key.mjs-- no-dependency key generator (owner runs this once; the one real owner-only step this item needs).- Routes:
app/.well-known/openid-configuration,app/oidc/{authorize,token,userinfo,jwks}/route.ts. apps/console/lib/post-signin.ts+ edits toauth/callback/route.tsandlib/email-signin.ts: a visitor who isn't signed in yet when hitting/oidc/authorizeis bounced through Console's existing sign-in and lands back on/oidc/authorizeautomatically (via a short-livedry_oidc_returncookie, re-validated on return), instead of the default/apps.apps/gitea/docker-compose.yml,.env.example,README.md--TODO(railyard-sso)replaced with the real registration command and config pointers.
Verified: a standalone Node script exercised issueCode -> exchangeCode ->
userinfo end to end against MemoryRepo with a real generated RSA
keypair -- found and fixed a real bug (the access_token was missing
email_verified, so /oidc/userinfo returned it as undefined) before
confirming success, replay-rejection (invalid_grant on a reused code), and
wrong-secret rejection (invalid_client). Then ran next dev with a real
generated signing key and RAILYARD_OIDC_CLIENTS configured and curled the
live HTTP routes: discovery document, /oidc/jwks (public key only, no
private fields leak), /oidc/authorize rejecting an unknown client (400)
and a mismatched redirect_uri (400, never a redirect -- no open-redirect
surface), the no-session case setting the correct ry_oidc_return cookie
and redirecting to sign-in, /oidc/token validation, and /oidc/userinfo
requiring a bearer token. tsc --noEmit clean; full npm test (167 tests,
including the pre-existing email-signin.test.ts suite, confirming the
default /apps redirect is unaffected when there is no pending OIDC
request) and npm run test:bundle all green.
Item 2 -- "Relay vs. OpenRouter" comparison page (apps/console)
apps/console/app/compare/relay-vs-openrouter/page.tsx -- public page (no
auth, outside the (app) route group), numbers-backed: a spend-tier table
(4 tiers, $500-$50k/mo) showing OpenRouter's published fee mechanics (a
percentage per credit top-up plus a flat per-charge fee on card payments,
and 5% on BYOK usage above the free allowance -- confirmed live against
openrouter.ai/docs/faq) versus Relay's $0 markup, plus a CTA into Console
signup via the same cross-sell attribution bridge as item 1
(/auth/start?src=compare-relay-openrouter, recorded on signup_source).
Verified live via next dev: 200, correct dollar figures rendered, correct
signup CTA URL with the attribution src.
Round 2
Item 4 -- Rithub self-serve provisioning + public landing page (apps/console)
Closes the backlog's named prerequisite chain: item 5 (OIDC, round 1) made "one sign-in" true; this round builds the actual public discovery/signup surface backlog item 4 asked for, so Rithub (live, zero-signup) stops being wasted infrastructure.
apps/console/lib/gitea.ts-- server-only Gitea admin API client.provision({seed, email, repoName})creates a dedicated Gitea user (POST /admin/users), then a private org and the first repo as that user via Gitea's documentedsudo=<username>impersonation (POST /orgs?sudo=,POST /orgs/:org/repos?sudo=) -- so the org/repo end up correctly owned by the new account, not the admin token's own account. Username/org slugs follow switchyard-server'ssignup.rspattern (lower-case alnum slug + random suffix, retried up to 5x on a 422 collision).apps/console/lib/config.ts--gitea: {apiUrl, adminToken} | nullfromGITEA_API_URL/GITEA_ADMIN_TOKEN(added toSECRET_ENV);apps/console/lib/deps.tswires it, null until both are set (503, same gating pattern as Mint/OIDC).apps/console/db/migrations/0014_org_gitea.sql--orgs.gitea_username,gitea_org_slug,gitea_repo_url(nullable).apps/console/lib/types.ts,lib/repo.ts(+MemoryRepo),lib/postgrest-repo.ts--Repo.setOrgGitea.apps/console/app/api/v1/rithub/provision/route.ts--POST, session-authed, same-origin-checked; idempotent at the route level (an org withgitea_repo_urlalready set returns the cached result and never calls Gitea again -- the client itself always creates a fresh account, so this check is what actually prevents a second account per org).apps/console/app/rithub/page.tsx(public, outside(app)) -- pitch page (git hosting, issues/PRs, Actions CI, LFS, npm registry, wiki, live at git.ereboslab.com) with a "Create your repo" CTA: signed out, links to/auth/start?src=rithub-landing(same cross-sell bridge pattern as items 1/2); signed in, renderscomponents/RithubProvision.tsx(client component, one button ->POST /api/v1/rithub/provision-> shows the clone command and a link to the real repo).components/Icons.tsxgainedGitRepoIcon(glyph, no emoji, matching the existing icon set).components/Nav.tsx's stale "no SSO integration yet" comment corrected (OIDC shipped in round 1) and pointed at/rithubas the no-account path.
Verified: tsc --noEmit clean; full npm test (167/167, including the
existing migration suite applying 0001-0010 twice on a scratch Postgres --
0014 was not added to that suite's coverage, matching 0011-0013's precedent)
and npm run test:bundle (3/3, confirms RithubProvision.tsx carries no
secret and reaches no server-only module). next dev with a scratch
GITEA_API_URL/GITEA_ADMIN_TOKEN pointed at a real gitea/gitea:1.23
container (Colima/Docker, sqlite, same arch proof pattern as the
apps/gitea README's own local proof): curled /rithub signed-out (200,
correct copy, correct /auth/start?src=rithub-landing CTA) and
POST /api/v1/rithub/provision signed-out (401, correctly gated). The full
provisioning logic (lib/gitea.ts + lib/repo.ts's MemoryRepo, the exact
code the route calls) was then exercised end to end with a scratch script
(deleted after use) against the same live container: created a real Gitea
user, a private org owned by that user (sudo= impersonation), a first
repo in that org (confirmed by reading it back from Gitea's own API, not
just local bookkeeping); confirmed the idempotency check (a second read of
an already-provisioned org returns the same username/org/repo without a
second Gitea call); confirmed two different Railyard orgs with the same
display name never collide (org-slug 422 retried with a random suffix,
confirmed on live duplicate-slug and duplicate-email calls against the
container). Container removed after the proof (docker rm -f), nothing
proof-only left running.
Still open from the 15-item backlog, after round 2
3 (Faultline/Rago fold), 8/9 (Rally's chat-fetch.ts/embeddings/adapter.ts,
separate vcglass repo), 10 (Menivor's media_gateway.py, separate
videogen repo), 12 (Watch scheduled check-runner), 14 (console
setup-wizard script), 15 (Insights per-site event pooling).
No new owner-only blocker beyond the ones already documented: item 4's one
production-env step is setting GITEA_API_URL (the real Rithub instance's
/api/v1, not gitUrl's plain root) and GITEA_ADMIN_TOKEN (a site-admin
PAT minted once on git.ereboslab.com) -- fully built and tested either
way; without them /rithub's CTA answers a documented 503.
Verification summary (no new test files, per standing instruction)
apps/console:tsc --noEmitclean;npm test167/167;npm run test:bundle3/3;next devused to curl every new/changed route live; a scratch Node script exercised the OIDC crypto/logic path end to end (found + fixed a real bug).apps/toolgate:cargo check --workspaceclean;cargo test -p switchyard-server37/37 (unchanged tests still pass); a realswitchyard-server serveinstance (memory store) was curled through the full signup -> authenticated call -> catalog flow, plus a second instance proving the disable flag.
Still open from the 15-item backlog
3 (Faultline/Rago fold), 4 (Rithub landing + signup via the webhook bridge --
item 5's OIDC work is a prerequisite now in place), 8 and 9 (Rally's
chat-fetch.ts/embeddings/adapter.ts live in the separate vcglass repo,
not this one), 10 (Menivor's media_gateway.py::_settle_job, lives in the
separate videogen repo), 12 (Watch scheduled check-runner), 14 (console
setup-wizard script), 15 (Insights per-site event pooling).
No owner-only blockers hit beyond the pre-existing ones already documented
elsewhere (Scribase/Mint/Dodo credential provisioning): this round's one new
owner step is running apps/console/scripts/gen-oidc-key.mjs once and
setting RAILYARD_OIDC_SIGNING_KEY/RAILYARD_OIDC_CLIENTS to turn the OIDC
provider on in production (it is fully built and tested either way; without
those two env vars every /oidc/* route just answers 503, same gating
pattern as every other optional feature in this app).
Round 3
Item 12 -- Watch's missing scheduled check-runner (stacks/gatus-customers)
Closed the real gap, not a rename: apps/console/README.md already documented
WATCH_AGENT_TOKEN as "Bearer token of the box 1 checks agent
(stacks/gatus-customers/agent.sh)" and lib/watch/types.ts already said
"the customer checks run on a Gatus instance of their own on box 1 ... an
agent next to it pulls the list of checks from this console and pushes each
result back" -- but that file, and everything around it, did not exist. The
console side (lib/watch/service.ts's agentChecks/recordResults,
app/api/v1/watch/agent/*) was built in an earlier round and had nothing on
the other end to call it.
stacks/gatus-customers/docker-compose.yml+config/config.yaml-- Gatus (MIT,ghcr.io/twin/gatus:stable), bound to127.0.0.1:8083only, sqlite storage, one permanent internal self-check endpoint (see "real bug" below for why), customer endpoints supplied entirely byconfig/endpoints.generated.yaml(GATUS_CONFIG_PATH directory-merge).stacks/gatus-customers/agent.sh-- the actual missing bridge, one pass:GETthe console's/api/v1/watch/agent/checks(bearerWATCH_AGENT_TOKEN) -> rewriteendpoints.generated.yaml(restart gatus only if the check list actually changed) ->GETgatus's own/api/v1/endpoints/statuses->POSTthe translated results batch to/api/v1/watch/agent/results. Keeps no state of its own: the console already dedupes bylast_checked_at, so resending results it has is always safe../agent.sh oncefor one pass (install/manual), bare./agent.shloops forever onWATCH_POLL_INTERVAL_S(default 30s).stacks/gatus-customers/agent.env.sample,systemd/watch-agent.service,install.sh-- same box-1 install shape astools/reconcile-relay-rago(sudo ./install.sh/run/status).stacks/gatus-customers/README.md-- the flip sequence (mint a token with the console, runinstall.sh, confirm one real pushed result, then setRAILYARD_WATCH_LIVE=1) and why Gatus over a hand-rolled prober (research-and-reuse: a maintained probe engine with its own HTTP client, retries and storage, not something worth re-implementing for this).
Two real bugs found and fixed by actually running it, not by reading it:
- Gatus refuses to start with zero endpoints in its merged config -- true
on a fresh box, or any time every customer check is paused. Fixed by
giving
config.yamlone permanent loopback self-check (gatus-self-check, grouprailyard-internal) so Gatus always has >=1 valid endpoint regardless of the customer list;agent.shfilters that group out before it ever reaches the console's results endpoint. - The generated config's header comment included a timestamp, so the file
never byte-matched the previous pass even when the check list had not
changed --
agent.shwas restarting the gatus container on every single pass. Fixed by dropping the timestamp; confirmed fixed (second pass logs only a push, no restart).
Verified against real components, not stand-ins: pulled and ran a real
ghcr.io/twin/gatus:stable container (Colima/Docker); wrote a scratch Node
server (deleted after use) that wires the exact shipped
lib/watch/http.ts handlers (agentList, agentResults, consoleWatch) to
a real MemoryWatchStore and a minimal in-memory entitlement, so every
request agent.sh makes hits the real console code, not a fake. Created one
real check for https://example.com through the real createCheck/
checkUrl validation path; ran the real agent.sh once against it twice in
a row and watched gatus actually reach https://example.com over the
internet (200, ~59ms) and the console's real recordResults/nextStatus
accept it (accepted:1); the second pass proved both fixes at once -- no
restart, and the already-seen result correctly ignored (dedup by
last_checked_at, not a second write). Also exercised the 401 (wrong
token) and the missing-config paths live. Cleaned up afterward: container,
volumes and the pulled image removed (docker-compose down -v + docker rmi), scratch server deleted, config/endpoints.generated.yaml reset to
its committed empty placeholder.
apps/console: tsc --noEmit clean; npm test 167/167 (unchanged); npm run test:bundle 3/3 (unchanged) -- this item touched no console source
file, only the new stacks/gatus-customers directory, so these are a
no-regression check, not new coverage. bash -n and shellcheck clean on
both shell scripts (one pre-existing SC1090 info-level note about the
intentionally dynamic . "$ENV_FILE", not a real issue).
Owner-only step (documented in this directory's own README, not blocking
anything else): on box 1, openssl rand -hex 32 a WATCH_AGENT_TOKEN, set
it identically in the console's env and in /etc/products/watch-agent.env,
run sudo stacks/gatus-customers/install.sh, confirm one real pushed
result, then set RAILYARD_WATCH_LIVE=1 on the console and restart it.
Until then this is fully built and dark, same gating pattern as every other
RAILYARD_*_LIVE feature in this app.
Still open from the 15-item backlog, after round 3
3 (Faultline/Rago fold), 8/9 (vcglass repo), 10 (videogen repo), 13
(Switchyard catalog browser), 14 (console setup-wizard script), 15 (Insights
per-site event pooling).
Round 4 (2026-10-24) -- railyard logs load-tested against a long-running tail
Picked up the one remaining item the per-app spec addendum flagged as not
done: "railyard logs (added 2026-10-22) is the newest command, not yet
load-tested against a long-running tail." It had zero test coverage of any
kind before this round (test/cli.test.mjs never called it; the fake
wrangler fixture had no tail case).
Load-testing it for real (not just reading the code) surfaced a genuine bug:
run() (packages/cli/src/run.mjs) unconditionally appended every stdout/
stderr chunk onto a stdout/stderr string for the life of the child
process. deploy/rollback need that (parseDeployOutput reads it back),
but logs only ever reads result.code -- so a railyard logs left
streaming a busy Worker for hours would hold every log line it had ever
printed in memory, growing without bound, for no reason (the text is thrown
away the moment the tail ends).
Fixed with a new capture option on run() (default true, unchanged
behavior for every existing caller): logs() now passes capture: false,
so chunks still reach the live echo callback (and the terminal) exactly as
before, but are never appended to the accumulator strings.
Verified, not just asserted:
packages/cli/test/run.test.mjs(new) -- spawns a real child printing 20,000 lines; withcapture: true(unchanged default)result.stdoutcontains all 20,000 lines as before; withcapture: falseevery line still reachesecholive butresult.stdout/stderrstay"". Also covers the spawn-error (ENOENT) path withcapture: false.packages/cli/test/fixtures/fake-wrangler.mjs-- added atailcase that behaves like the realwrangler tail(streams until killed, never exits on its own) so the CLI's actuallogs()code path -- not a stand-in -- gets exercised:FAKE_WRANGLER_TAIL_LINEScontrols how many lines it prints,FAKE_WRANGLER_TAIL_SELF_SIGTERM=1has it send itselfSIGTERM(the same way a terminal's Ctrl+C would) instead of exiting normally.packages/cli/test/cli.test.mjs(new tests) -- ranrailyard logsend-to-end through a long (4,000-line) tail and confirmed every line was still streamed live (capture:false drops nothing), that the saved login token riding in the fake stream was redacted in what reached the terminal (never printed in the clear), and that the real--format/--statusflags were forwarded towrangler tailcorrectly. A second test ends a tail mid-stream with a self-sentSIGTERM(the Ctrl+C case) and confirms it is reported as a clean stop (exit 0, noERRline), not a failure.- Full suite:
npm testinpackages/cli-- 28/28 passing (23 pre-existing- 5 new), including every existing deploy/rollback/link/ci/domains test
unaffected by the
capturedefault stayingtrueeverywhere else.
- 5 new), including every existing deploy/rollback/link/ci/domains test
unaffected by the
No deploy/secrets/owner-gated step -- this is a CLI bug fix plus its tests, committed directly.