Skip to content

Adjust documentation website to import C++ sdk documentation - #2

Merged
bcastets-robotiq merged 1 commit into
mainfrom
feature/cpp-api-docs
Sep 14, 2026
Merged

bcastets-robotiq merged 1 commit into
mainfrom
feature/cpp-api-docs

Conversation

@bcastets-robotiq

Copy link
Copy Markdown
Collaborator
  • Render C++ sdk doxygen API documentation
  • Render C++ readme and attached md documentation files
  • Provide instructions about how to document C++ repository and import it to the documentation website

@bcastets-robotiq
bcastets-robotiq force-pushed the feature/cpp-api-docs branch 3 times, most recently from f35342f to ca3a554 Compare September 11, 2026 17:54

@ebarnett3 ebarnett3 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scope: main...feature/cpp-api-docs.
Verified locally: npm ci, npm run generate, npx docusaurus build and
npm test all run; the build passes and the working tree stays clean
afterwards. Findings 1, 2 and 3 were confirmed against the generated
output rather than read off the diff.

Rendered check (2026-09-11/12): the site was regenerated on this branch
with SKIP_SUBMODULE_RESET=1 and external/2f85_cpp checked out at the
grippers documentation-update branch (859a2a4), then browsed under
http://localhost:3000/docs/drivers/2F%20hande/SDK/C++/. Findings 1-4
reproduce on the rendered pages; findings 9 and 10 come from that pass.
docusaurus build at ca3a554 still passes with the one broken-anchor
warning from finding 4.

Findings 1-11 are inline. 12. Noted during the rendered pass — fine to fix in later work (info)

None of these needs to land in this PR; they are recorded here so they are
not lost.

  • Homepage cards are not links. src/components/HomepageFeatures/index.js
    renders Sense / Grip / Integrate as <div> + <img> with no <Link>,
    same as on main and on the live site; this PR only swaps the ROS2 logo
    path. Wrapping styles.featureCard in <Link to=…> is a separate change.
  • //! leaks into the Core API diagram. API/groups/core-api shows the
    block diagram with a //! prefix on every line and the following \note
    rendered as raw text. The markers are already in Doxygen's XML
    (group__core__api.xml:17-36, inside <verbatim>), so this is a
    grippers-side issue: groups.dox uses \verbatim inside a //! comment,
    and Doxygen keeps the comment markers there where \code stripped them.
    That change was made at my request during the grippers #26 review, so the
    fix belongs there: \code{.unparsed} or a /*! … */ block for that
    section.
  • Dev workflow. Running npm run generate or docusaurus build while
    npm start is up rewrites .docusaurus/ under the dev server and leaves
    the open tab requesting chunks that no longer exist (ChunkLoadError,
    "Unexpected token '<'"); npm run clear and a restart recover. Worth one
    sentence in docs/contribute/index.mdx next to the preview instructions.

Comment thread scripts/sync-external-docs.js Outdated
Comment thread scripts/sync-external-docs.js
Comment thread scripts/sync-external-docs.js
Comment thread docusaurus.config.js
Comment thread .vscode/settings.json Outdated
Comment thread scripts/sync-external-docs.js Outdated
Comment thread scripts/check-doc-snippets.js
Comment thread src/css/custom.css
Comment thread scripts/sync-external-docs.js Outdated
Comment thread scripts/sync-external-docs.js Outdated
Comment thread scripts/sync-external-docs.js
Comment thread scripts/sync-external-docs.js Outdated
Comment thread scripts/check-doc-snippets.js Outdated
Comment thread sidebars.js Outdated
Comment thread scripts/folder-sidebar.mjs Outdated
Comment thread templates/check_doc_groups.py
@mbegin-robotiq

Copy link
Copy Markdown
Contributor

Test coverage

Leaving the review findings aside, I want to flag the pattern behind them rather than just the individual bugs.

This PR adds ~1,800 lines, of which scripts/sync-external-docs.js is now 1,281 lines and 40+ top-level functions. Most of those are pure string-in/string-out transforms: stripDeadDoxygenLinks, mergeMemberIndexTables, moveDetailedDescriptionToTop, splitTopLevelParams, splitMemberSignatures, doxygenSidebarOutputPath. The file exports nothing, so none of them is reachable from a test.

What we have today is npm testscripts/check-build.js: 5 pages exist, the intro page has a <table> with a badge. That is a genuinely good smoke test and the comment at the top is right that onBrokenLinks: 'throw' carries most of the weight. But it runs after a full Doxygen + Docusaurus build and asserts almost nothing about the ~18 generated API pages this PR introduces.

The result is visible in this review. Of the findings raised across both passes, 11 are one-assertion unit tests — I wrote and ran each of them against ca3a554 and every one fails; they're posted inline on the relevant threads. None needed a build, a submodule, or Doxygen; the slowest took milliseconds. The remaining ones split into content assertions on the generated tree (Members index ordering, pages whose <title> is their slug, duplicated sidebar labels) and environment gaps.

Three concrete asks:

1. Make the transforms testable. Add module.exports = { ... } at the bottom of sync-external-docs.js behind a require.main === module guard, and a "test:unit": "node --test" script. Node 20 has the runner built in — no new dependency. The 11 tests above are then the starting suite.

2. Assert on the generated tree, not just that it exists. Extend check-build.js, or add a second check that runs after npm run generate: no page <title> equal to its own slug, ## Members appearing before the first detail section on class pages, no sidebar label appearing twice under one parent. Each of those corresponds to a defect found by hand-browsing localhost in this cycle.

3. Cover the degraded paths in CI. CI is one job: Ubuntu, all submodules present, doxygen installed. Three findings live precisely outside it — python3 missing on Windows, ENOENT when a glob directory is absent from the pinned submodule, and the hardcoded sidebars.js link.id that turns a missing submodule into an opaque Docusaurus error instead of the warning sync-external-docs.js deliberately emits. A windows-latest leg and a "submodule/doxygen unavailable" leg would cover all three. templates/*.py (231 lines) has no tests of any kind.

One thing I'd flag separately: onBrokenAnchors was relaxed from 'throw' to 'warn' in this PR, and the dead anchor it was reporting is now shipping. That is the one automated check that caught a real defect here, and the change switches it off rather than fixing the upstream heading. I'd rather see the heading fixed and throw kept — or the leniency scoped to the generated tree only.

None of this needs to block the merge; the feature works and the build is green. But the transforms are regex-based rewriting of third-party generator output, which is exactly the code that breaks silently the next time doxygen2docusaurus or upstream Doxygen changes its markup. Without unit tests, every such change reopens this review by hand.

@mbegin-robotiq mbegin-robotiq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving.

The feature works, the build is green, and none of the findings from my pass
block the merge — the two I'd most like to see land before this goes out are
moveDetailedDescriptionToTop (the Members index ending up at the bottom of
every class page) and the folder-guide titles, both already on Eric's threads
with a failing test attached.

The test-coverage ask in the comment above stands as follow-up work rather than
a condition on this PR.

@bcastets-robotiq
bcastets-robotiq force-pushed the feature/cpp-api-docs branch 2 times, most recently from c8556f8 to a101e43 Compare September 14, 2026 17:20
- Render C++ SDK doxygen API documentation
- Render C++ readme and attached md documentation files
- Provide instructions about how to document a C++ repository and import
  it to the documentation website

Migrates the C++ SDK's API reference from the archived Doxybook2 to the
actively maintained @xpack/doxygen2docusaurus, registers the 2f85_cpp
submodule, and wires it into scripts/sync-external-docs.js:

- A `doxygen2docusaurus` job type generates into a gitignored staging
  folder (apiFolderPath/apiBaseUrl pre-set to this site's real mount
  point), then copies the filtered result into docs/, builds a Global
  Index directly from the Doxygen XML (every class plus every
  \ingroup-owned free function/variable/data-type/enum, regardless of how
  it's grouped - neither Doxygen's nor doxygen2docusaurus's own indices
  cover that), and writes a pruned/merged sidebar subtree so sidebars.js
  needs no manual group/class upkeep as the SDK's \defgroup/\ingroup
  hierarchy changes.
- Post-processing matches Doxygen's own reference look: strips private
  members, merges per-kind member tables into one continuous table,
  rebuilds multi-parameter signatures as a real aligned table, moves each
  page's full description to the top instead of a truncated brief + jump
  link, and strips the noisy re-embedded source/"Definition at line N"
  caption under every member.
- Nothing about this pipeline is hardcoded to this one SDK: the Global
  Index's namespace list is discovered fresh from Doxygen's own index.xml
  every run (not a hand-maintained array), the section's landing page is
  doxygen2docusaurus's own generated Topics overview (not a hand-authored
  page that can drift from the submodule), and `doxygen-xml/` is deleted
  before every run so an excluded/removed symbol can never leak back in
  from stale output Doxygen itself never cleans up.
- `scripts/check-doc-snippets.js` + `templates/check_doc_snippets.py`
  verify a hand-authored guide's `<!-- snippet: file tag -->` fence still
  matches the real, compiled example it claims to copy; independent of
  which tool generates the API reference.
- `docs/contribute/` documents the whole pipeline (Doxyfile setup,
  \ingroup vs \addtogroup, \cond DOXYGEN_EXCLUDE, check_doc_groups.py,
  the docs/ guide-file naming convention, the Global Index, matching
  Doxygen's reference look) and ends with a "Checklist: onboarding a new
  C++ tool repo" so a second SDK repo can adopt this same pipeline with
  no changes needed in this repo beyond one job entry.
- Fixes two dev-server crashes hit while iterating on this (rspack's
  persistent module-graph cache panicking, and an OOM during the
  server-side compile) and a `.gitignore` gap where generated API/docs
  content across all products was being committed instead of ignored.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@bcastets-robotiq
bcastets-robotiq merged commit 62a6304 into main Sep 14, 2026
1 check passed
@bcastets-robotiq
bcastets-robotiq deleted the feature/cpp-api-docs branch September 15, 2026 18:05
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.

3 participants