Skip to content

docs: add snippet verification for docs/ pages - #2115

Merged
maxisbey merged 1 commit into
v1.xfrom
fweinberger/v1x-docs-snippets
Feb 23, 2026
Merged

maxisbey merged 1 commit into
v1.xfrom
fweinberger/v1x-docs-snippets

Conversation

@felixweinberger

Copy link
Copy Markdown
Contributor

Stacked on #2102.

Motivation and Context

The existing snippet verification system (update_readme_snippets.py) only checked README.md. The new docs/ pages have code examples that should also be verified against runnable source files.

How Has This Been Tested?

  • uv run scripts/update_doc_snippets.py --check passes (all 10 doc files verified)
  • uv run pre-commit run --all-files passes all hooks
  • All 18 snippet files pass ruff format, ruff check, and pyright

Breaking Changes

None. CI job renamed from readme-snippets to doc-snippets.

Types of changes

  • Documentation update

Additional context

  • Script renamed: update_readme_snippets.py -> update_doc_snippets.py
  • 18 new runnable snippet files in examples/snippets/
  • CI and pre-commit updated to verify docs/*.md files
  • All new code blocks tagged with <!-- snippet-source --> for CI verification

@maxisbey
maxisbey force-pushed the fweinberger/v1x-docs-links branch from 09b9e62 to 4f64325 Compare February 23, 2026 15:20
@maxisbey
maxisbey force-pushed the fweinberger/v1x-docs-snippets branch from f401457 to 9fac4d1 Compare February 23, 2026 15:24
@maxisbey
maxisbey marked this pull request as ready for review February 23, 2026 15:24
Base automatically changed from fweinberger/v1x-docs-links to v1.x February 23, 2026 15:26
Extend the snippet verification system to cover docs/*.md in addition to
README.md. Create runnable example files for all 18 new code snippets.

Script changes:
- Rename update_readme_snippets.py -> update_doc_snippets.py
- Process README.md + all docs/*.md files via glob
- Update CI job and pre-commit hook references

New snippet files (18):
- examples/snippets/servers/: audio, binary resources, resource templates,
  resource subscriptions, embedded resource results (text + binary),
  prompt embedded resources, prompt image content, prompt change notifications,
  tool change notifications, elicitation enum/complete, set logging level,
  JSON schema
- examples/snippets/clients/: roots, SSE client, logging, cancellation

All snippet-source tags verified: uv run scripts/update_doc_snippets.py --check
@maxisbey
maxisbey force-pushed the fweinberger/v1x-docs-snippets branch from 9fac4d1 to 4725650 Compare February 23, 2026 15:31
maxisbey
maxisbey approved these changes Feb 23, 2026