fix: isolate docs pages that embed a WebContainer example - #1276
Conversation
…ples The Examples tab already sets COOP/COEP. Tutorial pages that embed ::client-example did not, so WebContainer failed with cross-origin isolation.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe change adds a helper that detects WebContainer client examples in documentation content. Both documentation routes use the helper to add runtime headers alongside cache headers. Tests cover matching, missing, and rejected examples. ChangesDocumentation embed runtime handling
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The documentation header handling is ready to merge with normal checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
WebContainer needs COOP/COEP so the page is cross-origin isolated. The Examples tab already sends those headers. Tutorial docs pages did not, so a
::client-exampleembed on/ai/latest/docs/tutorials/basic-chatfailed with "WebContainer requires cross-origin isolation."This PR reads the markdown for
::client-examplecomments. If the example boots a WebContainer, the docs page gets the same isolation headers as the Examples tab.Testing
pnpm exec tsx --test tests/docs-embed-headers.test.tspassed./ai/latest/docs/tutorials/basic-chatafter deploy.window.crossOriginIsolatedshould be true. The live sandbox should boot.Risk / rollback
COEP
credentiallesscan affect third-party scripts on those docs pages only. Revert this PR to restore cache-only headers. Other docs pages are unchanged.Summary by CodeRabbit
Bug Fixes
Tests