docs(api): TRA-743 BB44-preflight followups#159
Merged
Conversation
Four items surfaced when validating the merged PR #158 against live preview surfaces ahead of BB44: 1. Spec redirect now targets canonical platform URL `/api/openapi.{json,yaml}`. The previous `/api/v1/openapi.{json,yaml}` is itself a 301 to canonical on platform, so the middleware was sending clients through an extra hop. Same change in `docusaurus.config.ts` (build-time fetch) and in customer-facing prose (README, docs/api/README.mdx, postman.mdx, quickstart.mdx, BB.md). The middleware REWRITE_MAP still rewrites `/api/v1/openapi.*` → `/api/openapi.*` for legacy-caller support. 2. `functions/_middleware.js` now returns explicit `410 Gone` with `Cache-Control: no-store` for `/api/platform-meta.json` and `/api/trakrf-api.postman_collection.json`. The files were deleted in PR #158 but Cloudflare's edge cache continued serving the last-deploy 200 for the cache-TTL window — a BB cycle hitting the stale body would treat it as ground truth and file false drift findings. The 410 displaces stale 200s on next request. 3. BB.md step 11 ("Multi-format spec consistency") trimmed. The byte-equivalent-after-canonical-sort check guarded against independent docs-mirror copies drifting; with YAML and JSON both 302-ing to the same platform binary, the only divergence class left is "platform encodes the spec twice and the two encoders disagree" — that's a platform bug, not a docs-side concern. Renamed to "Multi-format spec sanity" with the remaining (still-useful) checks: numeric-literal divergence, hardcoded URLs, discoverability. 4. BB.md §1 prose updated to name the actual canonical URL (item 1 above) so a BB run doesn't quote the intermediate-hop URL in findings. 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: |
4d213d3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e1713905.docs-4n7.pages.dev |
| Branch Preview URL: | https://preview.docs-4n7.pages.dev |
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 follow-up to PR #158 — four items surfaced when validating the merged change against live preview surfaces ahead of BB44.
1. Spec redirect targets canonical platform URL
/api/openapi.{json,yaml}redirect now points atapp.{env}.trakrf.id/api/openapi.{json,yaml}— the previous target/api/v1/openapi.{json,yaml}is itself a301to canonical on platform, so the middleware was sending every client through an extra hop:Same change in
docusaurus.config.ts(build-time fetch) and in every customer-facing prose mention (README.md,docs/api/README.mdx,docs/api/postman.mdx,docs/api/quickstart.mdx,tests/blackbox/BB.md). The middlewareREWRITE_MAPcontinues to rewrite/api/v1/openapi.*→/api/openapi.*so legacy callers still resolve cleanly.2. Defensive 410 Gone for retired mirror artifacts
functions/_middleware.jsreturns410 GonewithCache-Control: no-storefor/api/platform-meta.jsonand/api/trakrf-api.postman_collection.json.The files themselves were deleted in PR #158 (gitignored Postman collection dropped from
.gitignore,platform-meta.jsonremoved fromstatic/api/). But Cloudflare's edge cache continued serving the last-deploy200for the cache-TTL window — a BB cycle pullingplatform-meta.jsonas "ground truth" would see an07b5edbcommit hash with a2026-05-16T11:36:28Zspec_refreshed_at, neither of which matches the current platform deploy. False drift findings would result.The
410response displaces stale200entries on next request andno-storekeeps the response itself out of edge cache. Verified locally: requests with a cache-buster already return404(the files are genuinely gone from the build); without a cache-buster, requests to plain paths return the stale cached200. The410makes the cleanup observable to clients without depending on edge cache TTL.3. BB.md "Multi-format spec consistency" → "Multi-format spec sanity"
The byte-equivalent-after-canonical-sort check guarded against independent docs-mirror copies of the YAML and JSON drifting. With both formats now
302-ing to the same platform binary, the only divergence class left is "platform encodes the spec twice and the two encoders disagree" — that's a platform bug, not a docs-mirror drift question. Section renamed and the byte-equivalence bullet dropped; the still-useful checks (numeric-literal divergence, hardcoded URLs, discoverability) stay.4. BB.md §1 canonical-URL prose
§1 ("Fetch the spec") was naming the intermediate-hop URL (
/api/v1/openapi.{yaml,json}) as canonical. Updated to name the actual canonical path so a BB run doesn't quote the wrong URL in findings.Out of scope (platform-side)
Items 5 and 6 from the BB44 pre-flight comment are platform concerns and not addressed here:
app.preview.trakrf.id/health.jsonreturns SPA HTML. Needs a platform/health.jsonroute exposed, or the BB.md /check-deploy-lag.shcomment / acceptance criterion need to point at a different surface. Filed against TRA-743 platform side.components.headers.Deprecationin the spec. FYI only per the comment; BB44 will pick it up if relevant.Test plan
pnpm lint,pnpm typecheck,DEPLOY_ENV=preview pnpm buildcleanapp.preview.trakrf.id/api/openapi.yaml(not/v1/)grepforapi/v1/openapishows only the middlewareREWRITE_MAP(legacy-alias support) and the historical changelog entrycurl -sIL https://docs.preview.trakrf.id/api/openapi.yamlshows a single 302 hop toapp.preview.trakrf.id/api/openapi.yaml(no longer chains through/api/v1/)curl -I https://docs.preview.trakrf.id/api/platform-meta.jsonreturns410(or404if edge cache TTL has already expired on its own)🤖 Generated with Claude Code