Repository navigation
console: a routed TypeScript SPA, built rather than hand-written - #1
Merged
Merged
Conversation
The console was one hand-written page with one address. That shape was the
limit: everything had to be visible at once, the upstream table crammed
endpoints, labels, owner and error text into cells you could only read by
scrolling sideways, and there was nothing to send a colleague but a screenshot.
It is now TypeScript, Preact via preact/compat, TanStack Router and TanStack
Query, built with Vite, across five routes — overview, upstreams, upstream
detail, catalog, test console. Filters, sort and selection live in the URL, so
"the broken upstream" is a link. Rationale, and what was deliberately left out,
in docs/design.md.
Preact rather than React because the whole bundle ships inside every fold
binary; react-dom alone is most of a font subset's worth of bytes.
Routing is on the fragment, and that is a deployment constraint rather than a
preference. fold serves these assets from an http.FileServer over an embedded
FS, so there is no SPA fallback and GET /console/upstreams is a 404 in every
shipped binary — which this repo cannot fix, because that server lives behind a
reviewed vendoring step in another repo. Hash routing makes every deep link a
request for /console/, which the file server already answers, and keeps the
OAuth redirect_uri to one registerable value.
The security invariants are unchanged and now have teeth. The token still lives
in page memory only. Upstream-controlled strings are still never markup — JSX
escapes text children, and both eslint and CI reject the escape hatches. Two
CSP consequences that were previously only conventions are now enforced: no
inline <script> (Vite's module-preload polyfill is off for this reason) and no
style attributes, since default-src 'self' grants no 'unsafe-inline'.
BUILD OUTPUT IS COMMITTED, in dist/. fold builds from the Go module proxy
alone, which runs no generators, so the built bytes have to be in git or they
never reach an operator. CI rebuilds and fails on any drift, which is what
makes the vendored copy trustworthy.
REQUIRES A COMPANION CHANGE IN fold. The vendored directory was called
console/; it is dist/ now. docs/fold-sync-console.patch carries the one-line
path change to scripts/sync-console.sh plus the reviewer notes, and must land
there together with a pin bump to this commit. Until it does, fold's weekly
console-sync workflow will fail rather than open its PR — loudly, by design.
The embedded file set itself is unchanged, so fold's MANIFEST and
introspection_test.go need no edit.
Also here:
- The Go dev harness is gone. It existed solely to give the page a single
origin with the gateway; a Go module for one reverse proxy stopped paying
for itself once a build step arrived with a dev server that proxies. The
part that earned its keep — replaying fold's exact CSP against the built
bundle — moved into vite.config.ts, and still fails on drift from
gateway/console.go.
- Version skew is handled instead of assumed away. src/lib/version.ts gates
each gateway-dependent surface on the version that introduced it: a feature
the gateway is too old for is absent, never broken.
- mcpPath is resolved relative to the page rather than used as a
root-absolute path, which was broken behind a proxy adding a prefix — the
same bug ../api already avoided.
- owner.contact is rendered. It has been in fold's API and never shown, and
it is the most useful field on the page about an upstream that is down.
- The size budget moves 320 KiB -> 384 KiB. Framework and router are ~137 KiB
of the 171 KiB bundle; the four font subsets are another 127 KiB. Current
total is 305 KiB.
Known bug, inherited and now documented at src/styles/app.css: the -400 and
-600 font subsets are byte-identical, so nothing on the page is actually bold.
The faces are declared honestly so regenerating the subsets is the only fix
needed. It also dictates how fonts are wired — a module import would let the
bundler deduplicate two of the four out of existence and break fold's sync.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
pnpm/action-setup refuses to start when a `version:` input and package.json's "packageManager" both name a version, rather than guess which is authoritative — so the workflow never reached a single check. Drop the input: corepack and every contributor's shell already read the manifest, and one pin cannot skew against itself. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This was referenced Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The console was one hand-written page with one address. That shape was the
limit: everything had to be visible at once, the upstream table crammed
endpoints, labels, owner and error text into cells you could only read by
scrolling sideways, and there was nothing to send a colleague but a screenshot.
It is now TypeScript, Preact via
preact/compat, TanStack Router and TanStackQuery, built with Vite, across five routes. Filters, sort and selection live in
the URL, so "the broken upstream" is a link.
#/#/upstreams#/upstreams/<id>#/catalog#/testRationale and what was deliberately left out:
docs/design.md.The vendored directory was
console/; it isdist/now.docs/fold-sync-console.patchcarries the one-line path change toscripts/sync-console.shplus reviewer notes, and must land in fold togetherwith a pin bump to this commit.
Until it does, fold's weekly
console-syncwill fail rather than open its PR —loudly, by design: a pre-rename pin has no
dist/, a post-rename one has noconsole/, so the failure mode is a red build, never silently vendored stalebytes. The embedded file set itself is unchanged, so fold's
MANIFESTandintrospection_test.goneed no edit. The patch is verified to apply cleanly toa pristine fold checkout.
Review notes
Build output is committed, in
dist/. fold builds from the Go module proxyalone, which runs no generators, so the built bytes have to be in git or they
never reach an operator. Nothing there is hand-written — CI rebuilds and fails
on any drift, which is what makes the vendored copy trustworthy. Review
src/;dist/is entailed by it.Fragment routing is a deployment constraint, not a preference. fold serves
these assets from an
http.FileServerover an embedded FS, so there is no SPAfallback and
GET /console/upstreamsis a 404 in every shipped binary — whichthis repo cannot fix. Hash routing makes every deep link a request for
/console/, and keeps the OAuthredirect_urito one registerable value.Security invariants are unchanged and now enforced. The token still lives in
page memory only. Upstream-controlled strings are still never markup — JSX
escapes text children, and eslint plus CI reject the escape hatches. Two CSP
consequences that were previously conventions now fail the build: no inline
<script>(Vite's module-preload polyfill is off for this reason) and nostyleattributes, sincedefault-src 'self'grants no'unsafe-inline'.The size budget moves 320 KiB → 384 KiB. Framework and router are ~137 KiB
of the 171 KiB bundle; the four font subsets are another 127 KiB. Current total
is 305 KiB. Flagging this explicitly — it is bytes on every operator's disk.
Also here
origin with the gateway; a Go module for one reverse proxy stopped paying for
itself once a build step arrived with a dev server that proxies. The part that
earned its keep — replaying fold's exact CSP against the built bundle —
moved into
vite.config.tsand still fails on drift fromgateway/console.go.src/lib/version.tsgates each gateway-dependent surface on the version that introduced it: a
feature the gateway is too old for is absent, never broken.
mcpPathwas used as a root-absolute path, which broke behind aproxy adding a prefix — the same bug
../apialready avoided.owner.contactis now rendered. It has been in fold's API and nevershown, and it is the most useful field on the page about an upstream that is
down.
Known bug, inherited
The
-400and-600font subsets are byte-identical, so nothing on the page isactually bold. Documented at
src/styles/app.css; the faces are declaredhonestly so regenerating the subsets is the only fix needed. It also dictates
how fonts are wired — a module import would let the bundler deduplicate two of
the four out of existence and break fold's sync.
Verification
Typecheck, lint and all CI checks pass locally. Exercised end-to-end in a
browser against a live gateway: overview, list filtering and sort, detail deep
link after a hard reload, MCP connect (14 tools / 4 prompts / 3 resources),
schema-derived argument prefill, and a successful
tools/call. No consoleerrors.
🤖 Generated with Claude Code