Commit 1739f71
docs(ai): knowledge-rag example declares adapterConfig, not the undeclared options key (#19261)
Fixes #19252
`content/docs/ai/knowledge-rag.mdx:37` configured its `ragflow`
knowledge source with the undeclared `options` key.
`KnowledgeSourceSchema` (`packages/spec/src/ai/knowledge-source.zod.ts`)
declares **`adapterConfig`** and is a plain `z.object` with no
`.passthrough()`, so the key is dropped before any adapter sees it.
Since #19251 landed (card #18973; maintainer ruling batch #160 item 2,
letter A: 「the spec wins」), `extractRagflowOptions` reads
`source.adapterConfig` with **no fallback**, so a source copied off this
page is refused by name at the first `upsert` / `search` / `delete`.
One line, one page:
```diff
- options: { datasetId: 'rgf_doc_dataset' },
+ adapterConfig: { datasetId: 'rgf_doc_dataset' },
```
No `packages/spec` change and **no ADR-0087 conversion**, exactly as the
ruling states: `options` was never a key `KnowledgeSourceSchema`
accepted, so nothing an author could declare is removed.
## Is :37 the only carrier? — measured, not assumed
All readings taken on this branch at `6ec845878`, over `content/docs/`:
| reading | result |
|---|---|
| `grep -rn "options: { datasetId" content/docs/` (pre-fix tree) | **1**
— this line only |
| firing control, same corpus, correct spelling |
`content/docs/references/ai/knowledge-source.mdx:83` spells
`adapterConfig` ⇒ the outlier is this page, not the docs tree |
| positive control, same corpus, same term | `datasetId` anywhere under
`content/docs/` ⇒ **1** hit (the same line) ⇒ the one-hit reading is a
reading, not a dead search |
| widened, different spellings: `grep -rn -A3 "options:" content/docs/`
filtered to `datasetId` | **1** — no multi-line or differently-quoted
second carrier |
| widened, by subject: every `content/docs/` file naming
`KnowledgeServicePlugin` / `adapter: 'ragflow'` / `adapter: 'memory'` /
`KnowledgeSource` (10 files) read for a source literal | no second
knowledge-source example carries `options` |
| every `options *:` occurrence under `content/docs/` (41 lines) read |
all are `Field.select` option lists, batch `options.atomic`, i18n option
maps or a dashboard widget — **none is a knowledge source** |
⇒ this is a single-carrier card, and the single carrier is fixed here.
The rest of `content/docs/**` is clean on this defect.
## The corrected example parses, and the old spelling is shown dropping
A throwaway script (⛔ not committed; removed, `git diff HEAD` empty
afterwards) lifted the `product_docs` literal **out of the page by
content** — not retyped — and parsed it against the built
`KnowledgeSourceSchema`:
```
--- block lifted from content/docs/ai/knowledge-rag.mdx (lines 33-37) ---
id: 'product_docs',
label: 'Product docs',
adapter: 'ragflow',
source: { kind: 'http', urls: ['https://docs.example.com/sitemap.xml'] },
adapterConfig: { datasetId: 'rgf_doc_dataset' },
=== LEG A: the page as it now stands ===
safeParse success: true
parsed adapterConfig: {"datasetId":"rgf_doc_dataset"}
adapter's read of source.adapterConfig.datasetId: rgf_doc_dataset
=== LEG B: ABLATION — the pre-fix spelling, in this scratch object only ===
safeParse success: true
unrecognized_keys issues: none
post-parse keys: adapter,adapterConfig,aiExposed,id,label,refresh,source
'options' survives the parse: false
parsed adapterConfig: {}
adapter's read of source.adapterConfig.datasetId: [MISSING -- RAGFlow adapter requires source.adapterConfig.datasetId on source 'product_docs']
```
*(one byte-level edit to the transcript above: the script's own
placeholder brackets around the MISSING line are rendered here as square
brackets, because this repo's rule is that angle-bracket-shaped
fragments are spelled out in words before they go into a GitHub body —
fences do not protect them.)*
1 parent c199772 commit 1739f71
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
0 commit comments