fix(chunkers): preserve FAQ prose in docs chunks - #6383
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview This change extracts FAQ blocks first—before the existing tag/brace passes—and writes question/answer strings as plain text. Parsing is escape-aware for single/double quotes, multiline items, and optional trailing commas; emitted text strips Adds Reviewed by Cursor Bugbot for commit b71444b. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR updates docs chunk cleaning to preserve FAQ questions and answers as searchable prose while retaining the existing cleanup behavior for other JSX scaffolding.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/chunkers/docs-chunker.ts | Adds escape-aware extraction for both quote styles before existing JSX cleanup, and the previously reported single-quote omission is corrected. |
| apps/sim/lib/chunkers/docs-chunker.test.ts | Adds regression tests covering production FAQ syntax, difficult inline tokens, escaped quotes, and preservation of existing cleanup behavior. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Raw MDX documentation] --> B[Extract FAQ components]
B --> C[Emit question and answer prose]
C --> D[Strip remaining JSX scaffolding]
D --> E[Split cleaned content into chunks]
E --> F[Generate and persist docs embeddings]
Reviews (3): Last reviewed commit: "fix(chunkers): accept single-quoted FAQ ..." | Re-trigger Greptile
58af8aa to
cce016d
Compare
cleanContent deleted every FAQ section from the embedding index: the
multiline tag strip swallows an entire <FAQ items={[...]}/> block (it
matches from <FAQ to the first ">", often inside an answer string), and
the brace strip eats any surviving { question, answer } items — 637
Q&As across the docs never reached search, with mangled JSX fragments
embedded in their place. Consume FAQ blocks whole before the tag strip
and emit their question/answer text as plain prose, escape-aware so
braces and quotes inside answers survive. Tag and brace stripping are
otherwise unchanged — a corpus survey showed FAQ props are the only
place real page prose lives inside JSX syntax on searchable pages.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
cce016d to
0a03670
Compare
session-policies.mdx and verified-domains.mdx write FAQ items with single-quoted multiline values and trailing commas; the double-quote-only item pattern matched nothing there, so the component consumer replaced those whole FAQ blocks with a space. Capture either quote style escape-aware (quotes of the other style inside a value are fine) and allow the trailing comma; captured values keep their quotes and are unquoted before unescaping. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e814d46. Configure here.
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e814d46. Configure here.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
What
The docs chunker's
cleanContentdeletes every FAQ section before embedding:<FAQ items={[...]}/>blocks — it matches from<FAQto the first>, which is often inside an answer string — and the brace strip eats any surviving{ question: ..., answer: ... }items.This PR makes the chunker consume FAQ components whole (before the tag strip runs) and emit their question/answer text as plain prose. The extraction is escape-aware, so quotes and braces inside answers survive intact. Tag and brace stripping are otherwise byte-identical to today — a corpus survey confirmed FAQ props are the only place real page prose lives inside JSX syntax on searchable pages, so nothing else needed rescuing.
Why it matters
FAQ answers are the docs' most retrieval-shaped content — literal user questions paired with concrete answers ("What is the maximum file size for uploads?" → "20 MB"). Today a semantic search for exactly that question cannot match it, because the text isn't in the index. This fix applies to the existing
docs_embeddingspipeline, so current production search benefits on the next index rebuild — no dependency on other in-flight work.Testing
docs-chunker.test.ts: the 20 MB regression on the real page shape, nested-brace and angle-token answers, multiline item formatting, escaped quotes, unchanged scaffolding strips.apps/docs/content/docs/en, zero JSX debris.🤖 Generated with Claude Code