Skip to content

console: extract the source, name the API, and take the one breaking minor - #37

Merged
blakebauman merged 1 commit into
mainfrom
feat/console-extraction
Aug 11, 2026
Merged

blakebauman merged 1 commit into
mainfrom
feat/console-extraction

Conversation

@blakebauman

Copy link
Copy Markdown
Member

What

Two changes that turned out to be one. The console's assets move to fold-run/fold-console and are vendored back at a pinned commit; the read APIs they consume get names of their own and a frozen response shape.

The gateway still embeds and serves the console. What an operator receives is byte-identical — verified by hashing gateway/console/ before and after the first make sync-console.

Breaking, in a minor, deliberately

Was (≤ v1.8) Now
GET /console/api/state GET /api/federation
GET /console/api/auth GET /api/auth-hint
GET /healthz GET /health (alias removed)
server.console.groups server.introspection.groups
server.console.enabled alone plus server.introspection.enabled
…rejections_total{reason="console_viewer"} …{reason="introspection_viewer"}

No aliases. README.md "API stability" records that the deprecation contract applies from v1.9.0 forward and why this release is the exception: a major would change the module path, and go run github.com/fold-run/fold/cmd/fold@latest — published in the README and seven places in launch/ — would resolve to the v1 line forever, silently installing v1.8.0 for every future reader. fold has no users to protect today; it will after launch.

Config with a stale console.groups fails Parse outright (DisallowUnknownFields), so the break is loud rather than a silently-dropped viewer allowlist.

Why the API had to be renamed too

/console/api/state reports the effective policy default and rule count, audit sink types, whether shared state and tracing are on, discovery's last sync, and the viewer's tenant governance — configuration truth that /metrics structurally cannot answer. Naming it after its only consumer was fine while that consumer shipped from this repo and could never disagree with it. Once the console is versioned separately it can skew, which is what makes this a contract.

Vendoring

Pinned by commit SHA, not a tag or release tarball — a SHA is already a content hash, so it cannot be re-pointed at different bytes, and it keeps one pin idiom in the repo alongside scripts/conformance.sh. Assets stay checked in because the module proxy is fold's distribution channel: go run …@latest builds from the proxy zip alone, which runs no generators and — the reason a submodule is not an option — carries no submodule content.

Three things keep it honest:

  • make console-check (blocking CI job) re-vendors and diffs, so a hand edit here cannot merge.
  • A CI assertion that CONSOLE_REPO still points at the canonical repo, so a PR cannot repoint the pin at a fork and pass green.
  • TestConsoleEmbedManifest bounds the embedded file set exactly, so a sloppy sync cannot ship the console repo's README or CI config into an operator's binary.

console-sync.yml proposes weekly bumps as PRs and never auto-merges.

Also here, found on the way

  • server.mcpPath is validated against gateway-owned paths. mcpPath: "/api/federation" would register a duplicate ServeMux pattern and panic at startup; it now fails --validate.
  • The embedded fonts ship with their OFL text. Required since v1.2, absent since v1.2.
  • introspection_viewer is documented in the metrics table. It has existed as console_viewer since v1.3 and was never listed.

Verification

make check ✅ · make conformance 40/40 ✅ · make console-check ✅

Live-checked against a running gateway: renamed endpoints serve, old paths and /healthz 404, CSP intact, ../api/federation stays relative so path-prefixed deployments survive.

Reviewed by the gateway-reviewer and security-auditor agents. Both found real issues, all fixed here — notably a 403 banner still naming server.console.groups (fixed upstream, pin bumped, and the asset test now greps for stale config keys as well as stale paths), and console-sync.yml PRs arriving with no CI checks because GitHub does not run workflows for GITHUB_TOKEN pushes — verification now runs inline and the PR body says an empty check list means not run, never passed.

Not in scope

fold-discovery keeps its /healthz alias: removing it there falls through to the document handler rather than 404ing, so a stale probe would quietly 200 on the upstreams document. That needs an explicit 404 and its own decision.

🤖 Generated with Claude Code

A hand-written browser app was living in a Go repo whose review discipline is
built for a proxy path, released on that proxy's cadence. The source now lives
in fold-run/fold-console; gateway/console/ is vendored output pinned to a
commit and verified by CI, still embedded, so what an operator receives is
byte-identical. Assets stay checked in rather than fetched at build time
because the module proxy is fold's distribution channel — `go run ...@latest`
builds from the proxy zip alone, which runs no generators and carries no
submodule content.

Splitting the repo forced the second half. /console/api/state was named after
its only consumer, which was defensible while that consumer shipped from here
and could never disagree with it. It is now a contract: server.introspection
serves /api/federation and /api/auth-hint, server.console serves the page, and
the response shape joins the frozen wire surface. An operator scripting the
federation snapshot no longer has to serve a browser page to get it.

Breaking, in a minor, with no aliases — the one release that does this. The
deprecation contract in README "API stability" applies from v1.9.0 forward.
The alternative was a major, whose module path change would have silently
pinned every published `go run ...@latest` to v1.8.0 forever, and fold has no
users to protect today. /healthz goes with it: deprecated since v1.5.0 with
"removed in the next major", and declining to cut a major would have left it
with no removal date at all. fold-discovery keeps its alias, where removal
falls through to the document handler instead of 404ing.

Also here, found while doing the above:

- server.mcpPath is validated against gateway-owned paths. Serving MCP at
  /api/federation would register a duplicate ServeMux pattern and panic at
  startup with no useful message; it now fails --validate.
- The embedded fonts ship with their OFL text. Required since v1.2 and absent
  since v1.2; the embed-manifest test keeps it there.
- fold_http_rejections_total's introspection_viewer reason is documented. It
  has existed as console_viewer since v1.3 and was never in the table.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@blakebauman
blakebauman merged commit 80eaf25 into main Aug 11, 2026
7 checks passed
@blakebauman
blakebauman deleted the feat/console-extraction branch August 11, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant