Error code docs: render the ably-common registry into the docs site#3458
Error code docs: render the ably-common registry into the docs site#3458lmars wants to merge 2 commits into
Conversation
Render the Ably error-code registry into the docs site as a page per code plus an index, sourced from the ably-common registry. - Add ably-common as a pinned git submodule (source of the registry). - bin/generate-error-pages.ts (yarn generate:errors): reads ably-common/errors/codes/*.md and writes committed MDX pages under src/pages/docs/platform/errors/codes/ plus the codes.mdx index, each carrying a "DO NOT EDIT" MDX comment. Committing the output means the site build/deploy needs no submodule (CircleCI checkout doesn't init submodules). - CI check-error-docs: inits the submodule, regenerates, and fails on any diff so the committed pages can't drift from the registry or be hand-edited. - PageHeader gains an optional subtitle slot; MDXWrapper renders the error identifier there as the sub-title. - Error-code detail pages resolve to the Platform "Error codes" nav entry (layout-context) so they show the Platform sidebar. - Footer "Edit on GitHub" points error-code pages at their ably-common source file, and is hidden on the generated index. - Migrate 8 inline links from /docs/platform/errors/codes#<code> to the new /docs/platform/errors/codes/<code> detail pages. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Committed output of `yarn generate:errors` (bin/generate-error-pages.ts): one page per code at /docs/platform/errors/codes/<code> and the index at /docs/platform/errors/codes (replacing the hand-maintained codes.mdx). Each file carries a hidden "DO NOT EDIT" MDX comment. Regenerate and commit after bumping the ably-common submodule; the check-error-docs CI job fails if these are out of date or hand-edited. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
m-hulbert
left a comment
There was a problem hiding this comment.
This mostly LGTM. Just a few comments/suggestions:
- I think the index of error codes would work better as a table, rather than 100s of headings. Debatable whether it's 1 continuous table or we split it into error code batches for easier navigation.
- I think a design pass at the sub-header identifier is probably in order as it looks a bit odd.
- I think the identifier should probably be output to the .md version of each page (configured in
data/onPostBuild/transpileMdxToMarkdown.ts) for LLM consumption.
Summary
Renders the Ably error-code registry (introduced in ably-common#348) into the docs site: a documentation page per error code plus a browsable index, all sourced from
ably-common/errors/codes/*.md./docs/platform/errors/codes/<code>: heading<code>: <title>, the stableidentifieras a soft sub-title, the summary as the primary description, then the detail body (causes / how to resolve)./docs/platform/errors/codes: one section per code (linkedcode: titleheading, identifier, summary), replacing the old hand-maintainedcodes.mdx.Screenshots
Index page
Detail page (summary only)
Detail page (summary + body)
How it works
The pages are generated and committed, not built at runtime:
bin/generate-error-pages.ts(yarn generate:errors) reads theably-commonsubmodule and writes the MDX pages undersrc/pages/docs/platform/errors/codes/. Each carries a hidden{/* DO NOT EDIT */}MDX comment.checkoutdoesn't init submodules — build-time generation would silently emit nothing).check-error-docs) inits the submodule, regenerates, and fails on any diff, so the committed pages can't drift from the registry or be hand-edited.The two commits are split as machinery (submodule, generator, CI, component changes, link migrations) and generated pages (the 254 pages + index).
Supporting changes
PageHeadergains an optionalsubtitleslot;MDXWrapperrendersfrontmatter.identifierthere.ably-commonsource file (hidden on the generated index).…/errors/codes#<code>now point at the detail pages; the index keeps the/docs/platform/errors/codesURL (old/docs/errors/codesredirect preserved) and carries#<code>anchors for old deep links.Depends on / follow-ups
ably-commonmain— until then the "Edit on GitHub" links targetmainand 404.help.ably.io/error/{code}→/docs/platform/errors/codes/<code>redirect cutover.Verification
gatsby buildsucceeds: 254 detail pages + index emitted, LLM-markdown export and redirects generated.🤖 Generated with Claude Code