Skip to content

feat(import): deterministic sidebar discovery for Fern sites - #41

Open
minhthanhdang wants to merge 7 commits into
mainfrom
minh/rm-17896-fern-sites-imported-content-doesnt-match-original-site
Open

feat(import): deterministic sidebar discovery for Fern sites#41
minhthanhdang wants to merge 7 commits into
mainfrom
minh/rm-17896-fern-sites-imported-content-doesnt-match-original-site

Conversation

@minhthanhdang

@minhthanhdang minhthanhdang commented Aug 13, 2026

Copy link
Copy Markdown
Contributor
🚥 Resolves RM-17896

🧰 Changes

Fern sites (vapi, cohere, elevenlabs, zep, hume, ...) imported with scattered structure: the Firecrawl sidebar scrape fails acceptance on them, so the pipeline clustered llms.txt pages by URL path into invented categories. On vapi that meant 21 made-up categories instead of the site's real 12-section sidebar.

Every Fern page embeds the complete nav tree in its SSR payload, so we now read the sidebar from there instead of guessing.

🧬 QA & Testing

Fern sites result
https://claude.ai/code/artifact/5386a2a1-f0d1-47df-8523-0c45d7d97e3a?via=auto_preview

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f2a69fe2-205d-4dc9-9523-6223abc1f8ca

📥 Commits

Reviewing files that changed from the base of the PR and between 7e19766 and df7189b.

📒 Files selected for processing (2)
  • src/commands/import.js
  • src/commands/import.test.js
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • readmeio/ai (manual)
  • readmeio/gitto (manual)
  • readmeio/markdown (manual)
  • readmeio/readme (manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/commands/import.test.js
  • src/commands/import.js

Walkthrough

The importer probes Fern sites between Mintlify and Archbee detection. It parses Fern Next.js RSC payloads, merges selected tab trees, preserves hierarchy and metadata, excludes hidden or unsupported nodes, and removes duplicate pages. Fern navigation becomes the scrape result when available. Orphan matching now traverses nested pages. The test helper exposes tryFernNav, with coverage for parsing, filtering, metadata precedence, tab merging, and fetch failures.


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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/commands/import.js (1)

1523-1533: 🩺 Stability & Availability | 🟠 Major | 💤 Low value

Isolate Fern tab failures and resolve tab URLs with new URL. A malformed pointsTo value or a rejected tab fetch currently runs inside the function-level failure path, so one tab can discard the complete navigation tree. Resolve each tab URL with new URL(tab.pointsTo, \${origin}/`), and wrap each tab's fetch and collection in its own try/catch` so later tabs and entry categories survive independently.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/commands/import.js` around lines 1523 - 1533, Update the tab URL
construction in the extractFernTabs loop to resolve tab.pointsTo with the URL
API against origin instead of concatenating strings. Preserve the existing
normalizePath comparison and fetch flow, ensuring leading-slash, absolute,
relative, and empty tab targets resolve correctly.

Apply the same fix in `@src/commands/import.js` around lines 1523 - 1533.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/commands/import.js`:
- Around line 1661-1685: Limit Fern page nesting to five levels before
categories are uploaded. Update addFernCategories, using the page structures
returned by fernPageFromNode and processed by dedupeFernPages, to flatten or cap
descendants deeper than five levels beneath each category while preserving valid
shallower hierarchy.

---

Nitpick comments:
In `@src/commands/import.js`:
- Around line 1523-1533: Update the tab URL construction in the extractFernTabs
loop to resolve tab.pointsTo with the URL API against origin instead of
concatenating strings. Preserve the existing normalizePath comparison and fetch
flow, ensuring leading-slash, absolute, relative, and empty tab targets resolve
correctly.

Apply the same fix in `@src/commands/import.js` around lines 1523 - 1533.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 208ff203-9706-4a18-b768-24ab68a8f1fd

📥 Commits

Reviewing files that changed from the base of the PR and between 0b01be7 and 4ded8bf.

📒 Files selected for processing (2)
  • src/commands/import.js
  • src/commands/import.test.js
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • readmeio/ai (manual)
  • readmeio/gitto (manual)
  • readmeio/markdown (manual)
  • readmeio/readme (manual)

Comment thread src/commands/import.js
@minhthanhdang
minhthanhdang marked this pull request as draft August 13, 2026 13:46
@minhthanhdang
minhthanhdang marked this pull request as ready for review August 13, 2026 13:46

@xavierandueza xavierandueza 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.

LGTM!

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.

2 participants