Skip to content

fix(nav): de-duplicate package landing pages in splice#61

Merged
WomB0ComB0 merged 1 commit intomainfrom
fix/splice-duplicate-landing
May 10, 2026
Merged

fix(nav): de-duplicate package landing pages in splice#61
WomB0ComB0 merged 1 commit intomainfrom
fix/splice-duplicate-landing

Conversation

@WomB0ComB0
Copy link
Copy Markdown
Member

@WomB0ComB0 WomB0ComB0 commented May 10, 2026

Symptom

After the multi-package TS refactor (#58 + #60), each package showed up twice in the TypeScript sub-group:

  • once as a standalone PAGE entry (e.g. `analytics`)
  • once as a collapsible GROUP entry (`{group: "analytics", pages: ["analytics/index/..."]}`)

Root cause

The splice's `/index` strip turned the entry `analytics/index` into the bare path `analytics`, which got registered as a leaf file in the parent's `_files` list. Then sibling entries like `analytics/index/classes/Analytics` created a sibling `analytics/` directory tree. Both surfaced into the parent group's `pages` list.

Fix

New `insert_landing()` stores the landing page id on the dir node itself (`_landing`) rather than as a sibling `_files` leaf. `to_mintlify` emits `_landing` first inside the dir's group, before any `_files` or sub-`_dirs`. Each package now gets exactly one collapsible group, with its landing page as the first child.

Applied to both:

  • `automation/source-repo-templates/api-docs.typescript.yml` (doc-generation time)
  • `scripts/splice-sdk-nav.py` (local re-splice for all five languages)

`docs.json` re-spliced locally to clear the duplicates already on main from PR #60.

Verified structure

Language Top-level entries Layout
TypeScript 8 1 README + 7 package groups
.NET 7 1 README + 6 namespace groups
Python 3 1 README + 2 package groups
Rust 12 1 README + 11 crate pages
C++ 2 1 README + 1 package group

Summary by CodeRabbit

  • Documentation
    • Improved documentation navigation structure with more consistent grouping for TypeScript package references.
    • Eliminated duplicate navigation entries for directory landing pages.
    • Enhanced clarity in the documentation hierarchy through better organization of module and submodule groupings.

Review Change Stack

After the multi-package TS refactor (#58), each package showed up
twice in the TypeScript sub-group:
- once as a standalone PAGE entry (e.g. \`analytics\`)
- once as a collapsible GROUP entry (\`{group: \"analytics\", pages: [\"analytics/index/...\"]}\`)

Root cause: the splice's \`/index\` strip turned \`analytics/index\`
into the bare path \`analytics\`, which got registered as a leaf
file at the parent level. Then \`analytics/index/classes/Analytics\`
(and siblings) created a sibling \`analytics/\` directory tree.
Both ended up in the parent group's pages list.

Fix: introduce \`insert_landing()\` which stores the landing page id
on the dir node itself (\`_landing\`) rather than as a sibling
\`_files\` leaf. \`to_mintlify\` emits \`_landing\` first inside the
dir's group, before any \`_files\` or sub-\`_dirs\`. Result: each
package gets exactly one collapsible group, with its landing page
as the first child.

Applied to both:
- automation/source-repo-templates/api-docs.typescript.yml (used at
  doc-generation time)
- scripts/splice-sdk-nav.py (used for local re-splicing across all
  languages: TS, .NET, Python, Rust, C++)

docs.json re-spliced locally to clear the duplicates already on
main from PR #60.
@github-actions github-actions Bot added area:content MDX/MD documentation content area:meta Repo meta — docs.json, README, etc. labels May 10, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f361cad-0d57-4dde-bb0a-fa7bc955807d

📥 Commits

Reviewing files that changed from the base of the PR and between cb0484b and 5395dec.

📒 Files selected for processing (3)
  • automation/source-repo-templates/api-docs.typescript.yml
  • docs.json
  • scripts/splice-sdk-nav.py

📝 Walkthrough

Walkthrough

This PR prevents duplicate directory landing pages in the TypeScript SDK navigation by introducing landing page tracking in the nav-tree builder. The core script now distinguishes between regular file pages and directory-rooted pages (ending in /index or /README), storing the latter on directory nodes via a _landing field. The workflow and resulting docs.json configuration apply this pattern across multiple package groups.

Changes

Navigation Landing Page Deduplication

Layer / File(s) Summary
Core Nav Logic
scripts/splice-sdk-nav.py
Added insert_landing() to record directory landing pages on nodes; updated to_mintlify() to emit _landing before _files; modified build_lang_group() to detect /index and /README suffixes and route them as directory landings instead of regular files.
Workflow Integration
automation/source-repo-templates/api-docs.typescript.yml
Refactored Python helpers from a single generic insert() to insert_file() and insert_landing(), distinguishing between directory-rooted pages and file pages. Updated the page-processing loop and to_mintlify() to handle _landing fields in rendered groups.
Navigation Configuration
docs.json
Restructured TypeScript "Generated Package References" to use explicit nested {group, pages} objects for analytics, decorators, DSA, HTTP, logger, rate-limiting, and security submodules, reflecting the new directory-landing-aware nav structure.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • resq-software/docs#40: Both PRs modify the nav-splicing pipeline in scripts/splice-sdk-nav.py and related workflow files; this PR introduces directory landing deduplication logic while the referenced PR updates nav group targeting.

Suggested labels

area:content, area:meta

Poem

🐰 A rabbit hopped through navigation's maze,
Finding duplicate landings blocking the way,
With _landing fields planted so neat,
Directories now stand alone, complete! 📚✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(nav): de-duplicate package landing pages in splice' clearly and concisely describes the main change: fixing a duplication bug in package landing pages within the navigation splice logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/splice-duplicate-landing

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.

@WomB0ComB0 WomB0ComB0 merged commit 834aceb into main May 10, 2026
13 checks passed
@WomB0ComB0 WomB0ComB0 deleted the fix/splice-duplicate-landing branch May 10, 2026 08:02
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 addresses a duplicate-entries bug in the multi-package navigation by introducing a dedicated landing page mechanism for directory groups. The navigation tree construction logic in api-docs.typescript.yml and splice-sdk-nav.py has been refactored to store landing pages (such as index.md or README.md) directly on directory nodes using a new _landing key, ensuring they are not rendered as separate standalone entries. These changes are reflected in the updated structure of docs.json. Feedback was provided to refactor the insert_file function from a recursive to an iterative approach to improve consistency with the new insert_landing function and mitigate potential recursion depth issues in deep directory structures.

Comment on lines +456 to +465
def insert_file(node, parts, full_id):
if len(parts) == 1:
node.setdefault("_files", []).append((parts[0], full_id))
return
head, *rest = parts
insert(node.setdefault("_dirs", {}).setdefault(head, {}), rest, full_id)
insert_file(
node.setdefault("_dirs", {}).setdefault(head, {}),
rest,
full_id,
)
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 insert_file function (renamed from insert) uses recursion, whereas the new insert_landing function is iterative. Switching to an iterative approach here would improve consistency and is generally safer for deep directory structures, avoiding potential recursion depth limits.

          def insert_file(node, parts, full_id):
              cur = node
              for i in range(len(parts) - 1):
                  cur = cur.setdefault("_dirs", {}).setdefault(parts[i], {})
              cur.setdefault("_files", []).append((parts[-1], full_id))

WomB0ComB0 added a commit that referenced this pull request May 10, 2026
The current Rust template emits one stub page per crate with name +
version + embedded README + a link out to docs.rs. Functional but
not what users expect from an SDK reference — they see prose, not
the type/function surface (modules, structs, traits, methods with
doc comments and examples) that the canonical rustdoc HTML at
github.io/crates already serves.

Use cargo-doc-md (the maintained rustdoc-JSON-to-markdown
converter) to render real API docs into Mintlify. JSON output
requires nightly so the workflow installs both stable + nightly
toolchains.

Hybrid pipeline: cargo-doc-md handles library crates (lib.rs);
README stubs remain the fallback for binary-only crates (TUIs:
resq-clean, resq-deploy, resq-flame, resq-health, resq-logs,
resq-perf — none of which have a public lib API to document).

Output layout:
  - lib crates → OUTPUT_DIR/<crate>/index.md (landing) + per-module
    siblings (resq_dsa/bloom.md, resq_dsa/graph.md, etc.)
  - bin crates → OUTPUT_DIR/<crate>.md (single README stub)

The version banner injects after the H1 of each landing page so
both shapes carry the same metadata strip. Splice already handles
the dir-with-landing form (PR #61) and flat-file form (PR #49)
naturally.

Co-authored-by: Mike Odnis <engineer@resq.software>
WomB0ComB0 added a commit that referenced this pull request May 10, 2026
…ly (#66)

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)

Co-authored-by: Mike Odnis <engineer@resq.software>
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