docs(api): TRA-743 — single-source OpenAPI spec, retire mirror#158
Merged
Conversation
Platform PR #357 removed `info.contact.url` from the spec source so the
docs site can redirect spec asset requests to the platform without
re-introducing the URL-drift class BB42/BB43 surfaced. This is the docs
side of that pivot.
- Redocusaurus `/api` page now fetches the spec from
`app.{env}.trakrf.id/api/v1/openapi.yaml` at build time. No bundled
spec copy lives in the docs repo anymore.
- `functions/_middleware.js` 302-redirects `/api/openapi.{json,yaml}`
(and the five legacy aliases) to the platform origin, env-aware via
the docs request hostname.
- Mirror sync machinery retired: `refresh-openapi.sh`,
`swap-openapi-env.mjs`, `generate-postman.mjs`, the bundled
`openapi.{json,yaml}`, `platform-meta.json`, the Postman collection,
`check-spec-sync.sh`, and the `predev`/`postbuild` package.json
hooks plus `openapi-to-postmanv2` are all gone.
- Postman page rewritten to URL-import guidance for Postman, Insomnia,
Bruno, and Hoppscotch. Quickstart's Postman + raw-spec sections
updated to match.
- `SpecMirrorBadge` and its callout deleted — "spec mirrored from"
has no referent in a single-source world.
- `docs/health.json` keeps the `docs.{commit, build_time}` block;
the `platform` block is gone (platform identity lives on
`app.{env}.trakrf.id/health.json`).
- `BB.md` updated to describe the redirect; `check-deploy-lag.sh`
replaces the spec-sync preflight (simpler probe: is preview docs on
`origin/main`?). `bb_cycle` preflight loop preserved with the new
probe.
- `BACKLOG.md` gains the deferred-work entry for restoring
`info.contact.url` (trigger: helpdesk or topic-routing /contact
page lands).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🚀 Preview Deployment Update ✅ This PR has been successfully merged into the preview branch. The preview environment will update shortly at: https://docs.preview.trakrf.id |
Deploying docs with
|
| Latest commit: |
7ec727c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9d998333.docs-4n7.pages.dev |
| Branch Preview URL: | https://preview.docs-4n7.pages.dev |
This was referenced May 16, 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.
TRA-743 — docs side of the "eliminate docs-side mirror, single source on platform" pivot.
Platform PR #357 (merged) removed
info.contact.urlfrom the spec source so the docs site can redirect spec asset requests toapp.{env}.trakrf.idwithout re-introducing the URL-drift class TRA-742 / BB42 / BB43 surfaced. This PR lands the docs side: a redirect-based architecture in place of the mirrored static assets, plus retirement of every sync mechanism that existed only to service the mirror.Architecture
/apipage fetches the spec fromapp.{env}.trakrf.id/api/v1/openapi.yamlat build time (redocusaurus's URL form). Build container needs outbound access to the platform host; both deploy through the same CF/Railway pipeline so this is a non-issue./api/openapi.{json,yaml}302-redirects to the platform viafunctions/_middleware.js. Env-aware off the docs request hostname (docs.trakrf.id→ prod,docs.preview.trakrf.id→ preview, anything else → preview). The five legacy alias paths (/api/v1/openapi.*,/openapi.*,/redocusaurus/trakrf-api.yaml) collapse to/api/openapi.*first, then chain to the platform via the same redirect.Why
functions/_middleware.jsinstead of_redirectsCloudflare Pages on this project does not honor
_redirects(history note already in the middleware file, see TRA-598 / TRA-694). Pages Functions run in the Workers runtime ahead of static-asset serving and are config-independent, so the redirect lives there.Deleted
Scripts:
refresh-openapi.sh,swap-openapi-env.mjs,generate-postman.mjs,tests/blackbox/check-spec-sync.sh.Static assets:
openapi.{json,yaml},trakrf-api.postman_collection.json(also dropped from.gitignore),platform-meta.json.Components:
src/components/SpecMirrorBadge.tsxand the callout that used it ondocs/api/README.mdx. "Spec mirrored from " has no referent in a single-source world.package.jsonscripts:predev,postbuild,refresh-openapi,generate-postman.prebuildkeepswrite-health-json.mjs(now docs-commit-only — theplatformblock is gone since platform identity lives onapp.{env}.trakrf.id/health.json).Dev dependency:
openapi-to-postmanv2.Rewritten
docs/api/postman.mdx— URL-import guidance for Postman, Insomnia, Bruno, Hoppscotch. Replaces "download this file" with "paste this URL."docs/api/README.mdx— removes the SpecMirrorBadge callout; the codegen pointer now references the platform spec URLs directly.docs/api/quickstart.mdx— §4 (Postman) and §5 (raw spec) updated; both now reference the platform URLs via<EnvBaseURL />.README.md/health.jsonand "deploy modes" sections updated.BB harness
check-spec-sync.sh(three-way diff: platform-source, docs-mirror, app-live) is gone. With no mirror there's no drift to detect.check-deploy-lag.shreplaces it (simpler probe: isdocs.preview.trakrf.id/health.jsonreportingorigin/main's tip?).bb_cyclepreflight loop preserved with the new probe — Cloudflare Pages build queue lag is still a real failure mode the BB cycle should fail-fast on.BB.md§1 ("Fetch the spec") updated to describe the redirect-based architecture so the BB run doesn't misinterpret an/api/openapi.yaml302 as a finding.BACKLOG entry
tests/blackbox/BACKLOG.mdgains the deferred-work entry for restoringinfo.contact.url. Trigger: helpdesk lands (Zendesk / Help Scout / Intercom) or a marketing/contactpage with topic routing ships. Current state —info.contact.{name, email}only — renders fine in Redoc / Swagger UI; adding URL later is non-breaking by OpenAPI 3.0 design.CORS — deferred
Per ticket. The 302 path works for browser navigation, curl, and programmatic fetch without
Access-Control-Allow-Originon the spec endpoint. Revisit if the docs site adds browser-side spec rendering that fetches the spec via XHR/fetch against a different origin.Test plan
pnpm lintclean (excluding pre-existingspec/superpowers/**warnings)pnpm typecheckcleanDEPLOY_ENV=preview pnpm buildsucceeds; Redoc/apipage renders the preview-host spec (verified host strings present inbuild/api/index.html)bash scripts/test_bb_cycle.sh— 8/8 pass with the newcheck-deploy-lag.shprobestatic/health.jsonemits just thedocsblockcurl -IL https://docs.preview.trakrf.id/api/openapi.yamlfollows 302 toapp.preview.trakrf.id/api/v1/openapi.yaml(verified after merge)openapi.jsonand the five legacy aliases (/api/v1/openapi.*,/openapi.*,/redocusaurus/trakrf-api.yamlchain through cleanly)/apipage ondocs.preview.trakrf.idshows the current operation set with no contact.url fieldmain → previewcut🤖 Generated with Claude Code