Skip to content

fix(llms): avoid import(variableName) pattern#3733

Merged
farnabaz merged 3 commits intomainfrom
fix/exteral-deps-import
Feb 26, 2026
Merged

fix(llms): avoid import(variableName) pattern#3733
farnabaz merged 3 commits intomainfrom
fix/exteral-deps-import

Conversation

@larbish
Copy link
Collaborator

@larbish larbish commented Feb 25, 2026

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vercel
Copy link

vercel bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
content Ready Ready Preview, Comment Feb 25, 2026 11:30am

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 25, 2026

npm i https://pkg.pr.new/@nuxt/content@3733

commit: 4204442

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 010db36 and 4204442.

📒 Files selected for processing (1)
  • src/features/llms/runtime/server/utils.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/features/llms/runtime/server/utils.ts

📝 Walkthrough

Walkthrough

The PR makes small, localized changes in two LLMs runtime server files. In the plugin, the generated markdown is asserted non-null before being pushed to contents. In utils, MDCRoot is added to the MDC imports, ContentLLMSCollectionSection gains contentCollection? and contentFilters? fields, the document generator now imports visit and stringifyMarkdown directly at runtime (removing a wrapper), stringifyMarkdown is invoked with an MDCRoot cast, and refineDocumentBody is simplified to early-skip nodes and update link-related props via el.props when present.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description is a template with no substantive content filled in. While the title indicates the nature of the change, the description itself contains only unfilled checkboxes and placeholders with no meaningful information about why the change was made or what problem it solves. Add a substantive description explaining the rationale for removing the external package import, what problem this addresses, and any relevant context or impact.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(llms): remove external package import' clearly summarizes the main change: removing an external package dependency from the llms feature, which is confirmed by the raw_summary showing import changes in utils.ts.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/exteral-deps-import

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/features/llms/runtime/server/content-llms.plugin.ts (1)

49-49: ⚠️ Potential issue | 🟡 Minor

Typo in comment: "emoty" → "empty".

-    // Delete emoty auto generated sections
+    // Delete empty auto generated sections
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/features/llms/runtime/server/content-llms.plugin.ts` at line 49, Fix the
typo in the inline comment: change the comment text "// Delete emoty auto
generated sections" to read "// Delete empty auto generated sections" so the
word "emoty" is corrected to "empty" in
src/features/llms/runtime/server/content-llms.plugin.ts (look for the exact
comment string in the file).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/features/llms/runtime/server/content-llms.plugin.ts`:
- Around line 79-81: The non-null assertion on markdown (returned from
generateDocument) can mask a real runtime undefined/empty-string; update the
logic around generateDocument(doc, options) and the push to contents so you
explicitly guard the result (e.g., check for null/undefined/empty string) before
pushing to contents, and handle the failure case deterministically (throw a
descriptive error or skip/log and continue) to avoid silently corrupting the LLM
output; look for the generateDocument call and the contents.push(markdown!) site
and replace the assertion with a conditional check and an explicit error or skip
path.

---

Outside diff comments:
In `@src/features/llms/runtime/server/content-llms.plugin.ts`:
- Line 49: Fix the typo in the inline comment: change the comment text "//
Delete emoty auto generated sections" to read "// Delete empty auto generated
sections" so the word "emoty" is corrected to "empty" in
src/features/llms/runtime/server/content-llms.plugin.ts (look for the exact
comment string in the file).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f406942 and 010db36.

📒 Files selected for processing (2)
  • src/features/llms/runtime/server/content-llms.plugin.ts
  • src/features/llms/runtime/server/utils.ts

Comment on lines 79 to 81
const markdown = await generateDocument(doc, options)
contents.push(markdown)
contents.push(markdown!)
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Non-null assertion masks a real runtime risk — guard instead.

If stringifyMarkdown resolves to undefined or an empty string (which TypeScript is already flagging as possible), markdown! is still undefined at runtime — the assertion only suppresses the compile error. Silently pushing undefined into contents will corrupt the LLMs full output without any error surface.

Prefer an explicit guard:

🛡️ Proposed fix
-        const markdown = await generateDocument(doc, options)
-        contents.push(markdown!)
+        const markdown = await generateDocument(doc, options)
+        if (markdown) {
+          contents.push(markdown)
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const markdown = await generateDocument(doc, options)
contents.push(markdown)
contents.push(markdown!)
}
const markdown = await generateDocument(doc, options)
if (markdown) {
contents.push(markdown)
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/features/llms/runtime/server/content-llms.plugin.ts` around lines 79 -
81, The non-null assertion on markdown (returned from generateDocument) can mask
a real runtime undefined/empty-string; update the logic around
generateDocument(doc, options) and the push to contents so you explicitly guard
the result (e.g., check for null/undefined/empty string) before pushing to
contents, and handle the failure case deterministically (throw a descriptive
error or skip/log and continue) to avoid silently corrupting the LLM output;
look for the generateDocument call and the contents.push(markdown!) site and
replace the assertion with a conditional check and an explicit error or skip
path.

@larbish larbish changed the title fix(llms): remove external package import fix(llms): avoid import(variableName) pattern Feb 25, 2026
@farnabaz farnabaz merged commit 89c0b25 into main Feb 26, 2026
8 checks passed
@farnabaz farnabaz deleted the fix/exteral-deps-import branch February 26, 2026 13:12
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