Skip to content

fix(rust-docs): hierarchical splice so library crates collapse properly#66

Merged
WomB0ComB0 merged 1 commit intomainfrom
fix/rust-hierarchical-splice
May 10, 2026
Merged

fix(rust-docs): hierarchical splice so library crates collapse properly#66
WomB0ComB0 merged 1 commit intomainfrom
fix/rust-hierarchical-splice

Conversation

@WomB0ComB0
Copy link
Copy Markdown
Member

Symptom (from your screenshot)

Clicking `Resq dsa` in the sidebar showed the resq-dsa index content but the left sidebar was flat — no collapsible group, no `bloom`/`count_min`/`graph`/`heap`/`trie` sub-entries. The right-side TOC showed module structure (because the page itself rendered fine), but you couldn't navigate to per-module pages from the nav.

Root cause

The Rust template's splice was the original flat-list version from PR #49: every entry from `_pages.json` mapped to a standalone PAGE registration. That worked when every crate was a single stub page. PR #62 introduced multi-file output for library crates (resq-dsa with `bloom.md`, `count_min.md`, `graph.md`, ...) but the splice still flattened them.

Fix

Replace with the hierarchical-with-landing splice from PR #61 (already in use by TS / .NET / Python / C++). Each top-level dir under `sdks/rust/api/` becomes a collapsible group with its `index.md` as the landing, and per-module pages as children. Single-file stub crates (binary-only TUIs) stay as leaf PAGEs.

Verified structure

README leaf
resq-ai GROUP (4 pages)
resq-bin GROUP (3 pages)
resq-cli GROUP (6 pages)
resq-dsa GROUP (7 pages: index, bloom, count_min, graph, heap, resq_dsa, trie)
resq-tui GROUP (3 pages)
resq-clean leaf (binary-only)
resq-deploy leaf (binary-only)
resq-flame leaf (binary-only)
resq-health leaf (binary-only)
resq-logs leaf (binary-only)
resq-perf leaf (binary-only)

The Rust template's splice was the original flat version: every
entry from _pages.json mapped to a standalone PAGE registration
under the language group. This worked when every crate was a
single stub page (PR #49 era), but PR #62 introduced multi-file
output for library crates (resq-dsa with bloom.md, count_min.md,
graph.md, ...). The flat splice rendered all those module pages
as direct siblings of the language group rather than collapsing
them into a `resq-dsa` group.

Visible symptom: clicking `Resq dsa` in the sidebar showed only
the index page; the per-module pages were registered but not
discoverable from the nav (the user had to type each URL by
hand or hope for autocomplete). The right-side TOC showed module
structure but the left sidebar was flat.

Replace with the hierarchical-with-landing splice from PR #61
(used by TS / .NET / Python / C++): each top-level dir under
sdks/rust/api/ becomes a collapsible group with its index.md as
the landing, and per-module pages as children. Single-file stub
crates (binary-only TUIs) stay as leaf PAGEs.

Local docs.json re-spliced with `scripts/splice-sdk-nav.py` so
main reflects the corrected structure immediately.

Verified Rust nav structure:
  1 README + 6 leaf PAGEs (binary-only)
              + 5 GROUPs (library crates with rustdoc API)
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

Warning

Rate limit exceeded

@WomB0ComB0 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 29 minutes and 40 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 953b88d7-df34-4890-943b-9499b4535b73

📥 Commits

Reviewing files that changed from the base of the PR and between 751b76c and 2ec8e5a.

📒 Files selected for processing (2)
  • automation/source-repo-templates/api-docs.rust.yml
  • docs.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/rust-hierarchical-splice

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added area:content MDX/MD documentation content area:meta Repo meta — docs.json, README, etc. labels May 10, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Rust API documentation generation process to create a hierarchical sidebar structure in Mintlify instead of a flat list. This is achieved by implementing a tree-building algorithm in the GitHub Actions workflow that groups library crates and submodules. Feedback was provided to refine the to_mintlify function to prevent duplicate sidebar entries by merging files that serve as landing pages for subdirectories into their respective groups.

Comment on lines +552 to +560
def to_mintlify(node, group_name):
pages = []
if "_landing" in node:
pages.append(node["_landing"])
for fname, full_id in sorted(node.get("_files", [])):
pages.append(full_id)
for dname, sub in sorted(node.get("_dirs", {}).items()):
pages.append(to_mintlify(sub, dname))
return pages if group_name is None else {"group": group_name, "pages": pages}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The current logic results in duplicate entries in the sidebar when a module (e.g., commands) has both a documentation file and a subdirectory for submodules. This happens because the file is added to the parent's _files list while the subdirectory becomes a separate group.

We should detect when a file name matches a subdirectory name and use that file as the landing page for the group to provide a cleaner navigation experience and ensure the output adheres to the Mintlify nested group structure.

          def to_mintlify(node, group_name):
              pages = []
              if "_landing" in node:
                  pages.append(node["_landing"])

              files = {fname: full_id for fname, full_id in node.get("_files", [])}
              dirs = node.get("_dirs", {})

              # Merge files that act as landing pages for subdirectories
              for dname, sub in dirs.items():
                  if dname in files:
                      sub["_landing"] = files.pop(dname)

              for fname in sorted(files):
                  pages.append(files[fname])
              for dname, sub in sorted(dirs.items()):
                  pages.append(to_mintlify(sub, dname))

              return pages if group_name is None else {"group": group_name, "pages": pages}
References
  1. In Mintlify docs.json navigation configuration, use a nested group object to define custom sidebar labels for pages, as the schema does not support a label property within the pages array.

@WomB0ComB0 WomB0ComB0 merged commit a6fcbb8 into main May 10, 2026
13 checks passed
@WomB0ComB0 WomB0ComB0 deleted the fix/rust-hierarchical-splice branch May 10, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:content MDX/MD documentation content area:meta Repo meta — docs.json, README, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants