Repository navigation
fix(server): index mcp.md in the chat-searchable docs corpus - #905
Merged
WaylandYang merged 2 commits intoSep 24, 2026
Merged
Conversation
The backend corpus at crates/utopia-server/src/docs_corpus.rs only indexed ingest.md. The frontend Docs page (web/src/pages/Docs.tsx) listed both ingest.md and mcp.md, so users reading the docs saw MCP documentation that the chat's search_docs tool could never find. A user asking the chat about MCP tokens, agent access, or write permissions would get nothing back even though the answer is in the docs. Fix: add mcp to ARTICLES. Drift guard: new test every_corpus_md_file_is_indexed walks web/src/docs/ and asserts the .md files match the slugs in ARTICLES one-to-one. The invariant is "on-disk → indexed" (not the other way round) so a new file dropped in without being indexed fails the test. This is the same shape as the_backstop_can_be_raised — a number defined in two places, drift between them is the bug, the test locks the invariant. Signed-off-by: rollroyces <royce@rollroyces.com>
WaylandYang
approved these changes
Sep 24, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
One-line fix with the right drift guard: the slugs and titles match the Docs page's list, and the test walks the directory rather than the constant so a new file is the failing side. CI green. Approving and merging.
This was referenced Sep 24, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Index mcp.md in the chat-searchable docs corpus
The backend docs corpus (
crates/utopia-server/src/docs_corpus.rs) only indexedingest.md. The frontend Docs page (web/src/pages/Docs.tsx) listed bothingest.mdandmcp.md, so users reading the docs saw MCP documentation that the chat'ssearch_docstool could never find. A user asking the chat about MCP tokens, agent access, or write permissions would get nothing back even though the answer is in the docs.The corpus is built into
AppState.docsat server startup (state.rs:59) and queried via thesearch_docstool the chat agent uses. So today:web/src/docs/mcp.mdexists, is bundled into the frontend, is readable to humans — but is invisible to the chat agent.Fix
Add
mcptoARTICLES. That's the whole code change.Drift guard
The drift shape is "files in
web/src/docs/↔ entries inARTICLES". The doc-comment at the top ofdocs_corpus.rsalready calls out the invariant (slug 必须与前端 DOCS 清单一致), but there was no test catching it. Without one,mcp.mdslipped in front-end-only on whatever commit added it.New test
every_corpus_md_file_is_indexed:web/src/docs/, picks every*.md.ARTICLESreferences, mapped to{slug}.md.The invariant is on-disk → indexed (not the other way round). A new file dropped in without being indexed fails the test. This is the same shape as
the_backstop_can_be_raised— a value defined in two places, drift is the bug, the test locks the invariant.If we ever add a doc that's intentionally agent-invisible (a human-only reference page, say), that needs to be encoded as a feature flag in
ARTICLES(e.g.("changelog", "...", false)with the third element meaningindexable: bool) rather than silently dropped from the backend list. Not needed today; calling it out so the next person doesn't add an invisible flag the test can't see.Signed-off-by: rollroyces royce@rollroyces.com