test(docs): validate the Kubernetes manifest examples parse - #720
test(docs): validate the Kubernetes manifest examples parse#720veyron-kairo wants to merge 2 commits into
Conversation
Add a node --test check that walks the documentation, takes the fenced yaml blocks that declare both apiVersion and kind (the manifests a reader would apply), and asserts each one parses. Bare snippets and annotated example lists are skipped, so it only holds real manifests to being valid. This caught one broken example: the zh metax scheduling guide wrote the annotations key and its value on a single line, which is invalid YAML. Fix it to the nested form the en page already uses, in both current and the v2.9.0 snapshot. Add js-yaml as a devDependency for the check. Signed-off-by: Shridhar Panigrahi <198173519+veyron-kairo@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: veyron-kairo The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for project-hami ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Review limit reached
Next review available in: 35 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough本次变更修正 MetaX GPU 文档示例的 YAML 注解结构,并新增测试扫描和解析当前文档中的 Kubernetes 风格 YAML 代码块。 Changes文档 YAML 结构与校验
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/doc-manifests.test.mjs`:
- Line 16: Update the documentation traversal that builds markdownFiles to use
readdirSync with withFileTypes enabled, and recurse only when
entry.isDirectory() is true; avoid statSync so directory symlinks are not
followed and traversal cannot loop.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: dcef705c-66be-4b33-b650-6f1372461407
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
i18n/zh/docusaurus-plugin-content-docs/current/userguide/metax-device/metax-gpu/enable-metax-gpu-schedule.mdi18n/zh/docusaurus-plugin-content-docs/version-v2.9.0/userguide/metax-device/metax-gpu/enable-metax-gpu-schedule.mdpackage.jsontest/doc-manifests.test.mjs
Use readdirSync withFileTypes and Dirent.isDirectory/isFile instead of statSync, which follows symlinks and could recurse outside the docs tree. Addresses review feedback. Signed-off-by: Shridhar Panigrahi <198173519+veyron-kairo@users.noreply.github.com>
What this does
Adds a documentation test that validates the Kubernetes manifest examples in the docs actually parse, and fixes one that didn't.
Many pages show YAML the reader is expected to copy and
kubectl apply. Nothing checked that those examples are valid, so a broken one could ship. This adds anode --testcheck (test/doc-manifests.test.mjs) that:docs/,tutorials/, and the zhcurrent/docs;yamlblocks that declare bothapiVersionandkind— i.e. real manifests, not bareresources:snippets or the annotated example lists that deliberately repeat keys;Running it surfaced one broken example: the Chinese metax scheduling guide wrote the pod's
annotationskey and its value on a single line (annotations: hami.io/node-scheduler-policy: "spread"), which is invalid YAML. I fixed it to the nested form the English page already uses, in bothcurrentand thev2.9.0snapshot (per the versioning workflow inAGENTS.md). Fixing the block also let Prettier format it, which added a space in acommand: ["sleep", "infinity"]array on the same block.Adds
js-yamlas a devDependency for the check.Checks
npm test,npm run lint, andnpm run format:checkpass. I confirmed the check fails (with a clearfile (manifest #N): reason) when the manifest is left broken, so it guards against regressions rather than just passing today.AI assistance disclosure
I used AI assistance (Claude Code) while locating the broken example. I reviewed and verified it, confirmed it catches the regression, ran the checks locally, and take responsibility for the change.
Summary by CodeRabbit
Documentation
spreadscheduling behavior.Tests