Skip to content

feat(docs): /docs/api — grayscale public API reference with the connect flow (#867) - #1217

Merged
athvin merged 4 commits into
mainfrom
issue/867-api-docs-page
Nov 25, 2026
Merged

athvin merged 4 commits into
mainfrom
issue/867-api-docs-page

Conversation

@athvin

@athvin athvin commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Closes #867

🚧 Claimed by an agent session — 2026-11-25T08:13:02Z, session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 on Mac.
The claim is this open draft PR: closing it releases the ticket.

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

/docs/api: a signed-out visitor reads every public API operation, rendered in-house from openapi.public.json. Each operation shows:

  • its minimum role
  • path and query parameters
  • request and response fields, with $refs linked to a schemas section
  • a copyable curl

The page opens with the connect flow: create a key (#866), set it as the bearer, make the first call. GET /api/openapi serves the same document signed-out.

Owner decisions on #867, recorded on the ticket before any code:

  • No stock viewer, no design exception. Methods are told apart by weight, plus an outline for DELETE, never by hue.
  • No live "try it". The first call is a curl built from $ER_API_KEY and $ER_API_ORIGIN, so the BFF relays no customer credential and er-server gets no CORS.

Why

#857 / #1013: the visible deliverable of the OpenAPI epic, documenting the connect flow end to end.

Proof

Risk & rollback

New public surface: one static page and one public JSON route serving a committed document with no operator route and no secrets. Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 on Mac · 2026-11-25T09:41:18Z

Specific to this change

Context — plan, discoveries, measurements, files

Plan

  • The decisions, recorded on the ticket (owner chose in-house grayscale and copyable curl).
  • lib/docs/openapi-reference.ts (pure) plus api-reference.tsx and the page.
  • /api/openapi: UNAUTHENTICATED_DIRS and PUBLIC_PATHS, each with its reason.
  • MARKETING_PATHS (and so the sitemap), PAGE_UPDATED, the breadcrumb section, the footer link, the axe sweep.
  • Unit and Playwright coverage.
  • Skills: landing-page (/docs/api, and a stale claim corrected), frontend-design-system (the decision).

Discoveries

  • /docs/api was already public. /docs is a MARKETING_PATHS entry and the proxy matches by prefix. It still needed its own entry for the sitemap.
  • landing-page was stale. It claimed the OpenAPI document "contains no operations"; it has 115.
  • Flattened structs arrive as allOf. For example ModelDetail (feat(api): type the 17 operations still publishing {} (#1213) #1214). The field resolver merges the allOf members, so those fields render.

Measurements

Files

frontend/src/app/(marketing)/docs/api/page.tsx, frontend/src/components/marketing/docs/{api-reference.tsx,docs.css}, frontend/src/lib/docs/openapi-reference.ts, frontend/src/app/api/openapi/route.ts, frontend/src/{proxy.ts,lib/site/routes.ts,components/marketing/{seo.tsx,site-links.ts}}, frontend/scripts/check-bff-authz.mjs, tests, two skills.

bmoore813 and others added 2 commits November 25, 2026 00:30
…ct flow (#867)

A signed-out visitor reads every public operation at /docs/api,
rendered in-house from openapi.public.json. Owner decisions on #867:
- No stock viewer and no design exception. Methods are told apart by
  weight and an outline for DELETE, never hue.
- The first call is a copyable curl built from $ER_API_KEY and
  $ER_API_ORIGIN, never a live call, so the BFF relays no customer
  credential and er-server needs no CORS.

lib/docs/openapi-reference.ts is the pure half: workflow grouping with
an Other fallback, field tables resolving $ref and allOf (flattened
structs), and curlFor. Unit-tested against the real document: every
operation placed exactly once, only the probes in Other, no operator
route, #865 query params, #864 typed responses, and the exact mint
request.

GET /api/openapi serves the public document signed-out
(UNAUTHENTICATED_DIRS and PUBLIC_PATHS, each with its justification).
/docs/api joins MARKETING_PATHS (and so the sitemap), PAGE_UPDATED, a
Docs breadcrumb section, the footer and the axe sweep. Playwright covers
signed-out render, the copied first call (no key inside), an operation's
role, typed response and curl, and the public JSON.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
landing-page: what /docs/api is, the two owner decisions behind it,
and the public /api/openapi route. Also drops the stale claim that the
OpenAPI document contains no operations; it has 115.
frontend-design-system: the API reference is the standing case of a
third-party widget with its own palette, answered by rendering in-house,
not by an exception. Plus the regenerated screen inventories.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin marked this pull request as ready for review November 25, 2026 08:58
The export check rejected any path with an api segment, so the /docs/api
page's own export (docs/api, docs/api.html) read as server code. A
static export's server code lives at its root (api/ route handlers,
Cloudflare functions/ or _worker.js), so the pattern is anchored there.
A root api/ is still refused. The preview builds and verifies 35 routes
locally, /docs/api included.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

The marketing preview was removed because this PR is closed or merged.

@athvin
athvin merged commit 8d50786 into main Nov 25, 2026
42 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 25, 2026 09:15 — with GitHub Actions Inactive
athvin added a commit that referenced this pull request Nov 25, 2026
…thing but one (#1224)

deploy-resolve-digests.sh reused the newest digest with --output text,
which applies --query per page. er-api now holds 131 images (two pages),
so 'the newest' was one digest per page. The er_api= output line split,
GitHub rejected the stray line ('Invalid format sha256:e935…'), and both
deploy jobs failed on 8d50786 (#1217), so its er-web image never
shipped. --output json aggregates every page before the query runs:
verified read-only, it returns be6e… alone where text printed be6e… and
e935…. A digest that is not exactly one sha256: now refuses the deploy
rather than shipping whichever line came first.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was previously deployed

1 inactive deployment
marketing-preview — a1c98e0d Deployed Nov 25, 2026 by athvin via remove closed PR previews #45
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.

/docs/api: BFF-served public spec + grayscale API docs viewer

2 participants