Skip to content

docs: make middleware examples compile and safely handle streaming guardrails - #21210

Merged
gr2m merged 1 commit into
mainfrom
documentation-fix-21209-20260920213826612291
Sep 22, 2026
Merged

gr2m merged 1 commit into
mainfrom
documentation-fix-21209-20260920213826612291

Conversation

@ai-sdk-factory

Copy link
Copy Markdown
Contributor

Background

The middleware examples omitted the required V4 specification field, and the guardrails example provided no safe streaming implementation, leaving readers vulnerable to matches split across stream deltas.

Summary

Added specificationVersion: 'v4' to all five middleware examples and implemented per-text-block buffered streaming redaction with guidance about latency, memory use, split matches, and unbounded patterns.

Testing

pnpm check, pnpm type-check:full, pnpm validate:docs, docs tests, MDX generation, formatting, and focused snippet/runtime checks passed. The docs-site type-check reached MDX generation but failed on an unrelated existing LayoutProps error in app/[lang]/layout.tsx.

Related Issues

Fixes #21209

Co-authored-by: roshcompanylabs <[email protected]>
@gr2m
gr2m merged commit 2801737 into main Sep 22, 2026
60 checks passed
@gr2m
gr2m deleted the documentation-fix-21209-20260920213826612291 branch September 22, 2026 20:08

This branch was successfully deployed

1 active deployment
Preview — f388e7dd Deployed Sep 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: guardrails example leaves wrapStream unimplemented

2 participants