Skip to content

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented Nov 3, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Fixed schema handling in request bodies to support multiple content types (application/json, application/json-patch+json, and wildcard).
  • Documentation

    • Added comprehensive API documentation for Deployments and DaemonSet resources.
    • Added Workload APIs overview documentation in multiple languages.

Copilot AI review requested due to automatic review settings November 3, 2025 09:21
@changeset-bot
Copy link

changeset-bot bot commented Nov 3, 2025

🦋 Changeset detected

Latest commit: 217afb8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@alauda/doom Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Nov 3, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This PR fixes a bug where requestBody schema could be undefined by implementing fallback content-type resolution, and adds comprehensive documentation for Kubernetes workload APIs (Deployments, DaemonSets) in both English and Chinese locales.

Changes

Cohort / File(s) Summary
Bug Fix
packages/doom/src/runtime/components/OpenAPIPath.tsx
Adds defensive fallback logic to resolve requestBody schema by checking multiple content types (application/json, application/json-patch+json, or */*) instead of directly accessing a single content type, with eslint-disable guard.
Changeset Metadata
.changeset/grumpy-berries-dress.md
Adds changeset entry for patch release documenting the requestBody schema fix.
Documentation — Workload APIs (English)
docs/en/apis/advanced-apis/workload/index.mdx
docs/en/apis/advanced-apis/workload/deployment.mdx
docs/en/apis/advanced-apis/workload/daemonset.mdx
New documentation pages for Workload APIs index and two Kubernetes API endpoints: Deployments and DaemonSets, each with OpenAPIPath components referencing cluster-scoped API paths.
Documentation — Workload APIs (Chinese)
docs/zh/apis/advanced-apis/workload/index.mdx
docs/zh/apis/advanced-apis/workload/deployment.mdx
docs/zh/apis/advanced-apis/workload/daemonset.mdx
Chinese-language equivalents of Workload APIs documentation (index, Deployments, and DaemonSets).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

  • OpenAPIPath.tsx: Verify the fallback content-type resolution logic correctly handles edge cases and that the eslint-disable guard is appropriately scoped.
  • Documentation additions: Standard content review for accuracy and consistency across locales.

Possibly related PRs

Suggested labels

bug, documentation

Poem

🐰 A schema undefined? No more despair!
With fallback content types, we show we care,
And workload docs now bloom in English and more,
The APIs shine brightly, worth documenting for! ✨

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "fix: schema in requestBody could be undefined" directly addresses the primary functional change in the pull request, which is the modification to packages/doom/src/runtime/components/OpenAPIPath.tsx to handle cases where the schema in requestBody could be undefined. The title accurately describes this core fix by introducing fallback logic for multiple content types. While the PR also includes documentation additions for various API files (deployment, daemonset, and workload index pages in both English and Chinese), these are supporting reference materials rather than the primary change. The title is clear, concise, and specific enough that a teammate reviewing the git history would understand the main functional improvement.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/null_pointer

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 3, 2025

Open in StackBlitz

yarn add https://pkg.pr.new/@alauda/doom@212.tgz
yarn add https://pkg.pr.new/@alauda/doom-export@212.tgz

commit: 217afb8

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates multiple dependencies to their latest versions and adds support for additional content types in OpenAPI request body handling. Additionally, it introduces new documentation files for Workload APIs.

  • Updated various ESLint and React-related packages from version 2.2.4 to 2.3.1
  • Updated @RsPress packages from beta.34 to beta.35
  • Enhanced OpenAPIPath component to handle multiple content types (application/json, application/json-patch+json, and /) in request bodies
  • Added new Workload API documentation files for Deployments and DaemonSets

Reviewed Changes

Copilot reviewed 12 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
yarn.lock Updated dependency versions for ESLint packages (9.38.0 → 9.39.0), @eslint-react packages (2.2.4 → 2.3.1), @RsPress packages (beta.34 → beta.35), globals (16.4.0 → 16.5.0), simple-git (3.28.0 → 3.30.0), and @types/node (24.9.2 → 24.10.0)
packages/doom/src/runtime/components/OpenAPIPath.tsx Enhanced request body content type handling to support multiple MIME types beyond just application/json
packages/doom/package.json Updated dependency versions to match yarn.lock changes
package.json Updated devDependency versions for @eslint/js, @types/node, and eslint
docs/zh/apis/advanced-apis/workload/*.mdx Added Chinese documentation files for Workload APIs including index, deployment, and daemonset pages
docs/en/apis/advanced-apis/workload/*.mdx Added English documentation files for Workload APIs including index, deployment, and daemonset pages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d59479 and 21004ae.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (12)
  • .changeset/grumpy-berries-dress.md (1 hunks)
  • docs/en/apis/advanced-apis/workload/damonset.mdx (1 hunks)
  • docs/en/apis/advanced-apis/workload/deployment.mdx (1 hunks)
  • docs/en/apis/advanced-apis/workload/deployment_one.mdx (1 hunks)
  • docs/en/apis/advanced-apis/workload/index.mdx (1 hunks)
  • docs/zh/apis/advanced-apis/workload/damonset.mdx (1 hunks)
  • docs/zh/apis/advanced-apis/workload/deployment.mdx (1 hunks)
  • docs/zh/apis/advanced-apis/workload/deployment_one.mdx (1 hunks)
  • docs/zh/apis/advanced-apis/workload/index.mdx (1 hunks)
  • package.json (1 hunks)
  • packages/doom/package.json (3 hunks)
  • packages/doom/src/runtime/components/OpenAPIPath.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: JounQin
Repo: alauda/doom PR: 34
File: src/cli/load-config.ts:290-0
Timestamp: 2025-05-29T10:23:34.965Z
Learning: In the alauda/doom project, JounQin prefers concise error handling over verbose validation. While they prefer throwing on invalid configuration rather than graceful fallbacks, they don't want overly detailed validation with multiple explicit checks and error messages.
📚 Learning: 2025-05-26T09:09:21.339Z
Learnt from: JounQin
Repo: alauda/doom PR: 30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T09:09:21.339Z
Learning: The alauda/doom project uses yarn v4 for dependency management, which handles package exports and module resolution correctly, so imports like `rspress/core/theme` work without any ESLint errors.

Applied to files:

  • packages/doom/package.json
  • package.json
📚 Learning: 2025-05-26T09:09:21.339Z
Learnt from: JounQin
Repo: alauda/doom PR: 30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T09:09:21.339Z
Learning: JounQin has mentioned multiple times that the alauda/doom project uses yarn v4, and there are no ESLint import resolution errors for rspress/core subpath imports.

Applied to files:

  • packages/doom/package.json
📚 Learning: 2025-06-09T03:10:41.010Z
Learnt from: JounQin
Repo: alauda/doom PR: 75
File: src/cli/load-config.ts:4-7
Timestamp: 2025-06-09T03:10:41.010Z
Learning: The alauda/doom project uses yarn v4 as the package manager, not npm. Always reference yarn commands when suggesting package management operations.

Applied to files:

  • packages/doom/package.json
📚 Learning: 2025-06-06T07:08:55.881Z
Learnt from: JounQin
Repo: alauda/doom PR: 69
File: package.json:101-101
Timestamp: 2025-06-06T07:08:55.881Z
Learning: When a package has peer dependencies that require TypeScript (like `eslint-react/eslint-plugin`), TypeScript should be moved from devDependencies to dependencies to satisfy the peer dependency requirement.

Applied to files:

  • packages/doom/package.json
  • package.json
📚 Learning: 2025-05-26T08:59:41.491Z
Learnt from: JounQin
Repo: alauda/doom PR: 30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T08:59:41.491Z
Learning: In rspress/core v2.0.0-beta.7, the '/theme' export is available in the package exports field as `"./theme": { "default": "./theme.ts" }`, so imports like `import { Badge, Button } from 'rspress/core/theme'` are valid even if ESLint shows resolution errors.

Applied to files:

  • packages/doom/package.json
📚 Learning: 2025-05-29T16:25:28.086Z
Learnt from: JounQin
Repo: alauda/doom PR: 40
File: src/plugins/sitemap/index.ts:7-7
Timestamp: 2025-05-29T16:25:28.086Z
Learning: In rspress/shared v2.0.0-beta.8, the '/logger' export is available in the package exports field, so imports like `import { logger } from 'rspress/shared/logger'` are valid even if ESLint shows resolution errors. This is used throughout the codebase in files like src/cli/translate.ts, src/cli/load-config.ts, src/utils/git.ts, and src/plugins/sitemap/index.ts.

Applied to files:

  • packages/doom/package.json
📚 Learning: 2025-06-09T03:09:17.876Z
Learnt from: JounQin
Repo: alauda/doom PR: 75
File: src/cli/load-config.ts:4-7
Timestamp: 2025-06-09T03:09:17.876Z
Learning: When ESLint shows "Unable to resolve path to module" errors for packages that are listed in package.json dependencies, the issue is usually that npm install hasn't been run yet, not that the packages are missing from dependencies or that there's an ESLint configuration problem.

Applied to files:

  • package.json
🔇 Additional comments (9)
.changeset/grumpy-berries-dress.md (1)

1-5: Changeset format is correct.

The changeset file follows the standard format and properly documents the patch release with an appropriate description.

package.json (1)

36-49: Version bumps are standard and appropriate.

Minor and patch version updates for ESLint tooling and @types/node are safe and align with typical maintenance practices.

packages/doom/package.json (1)

45-45: Coordinated dependency updates look good.

The rspress ecosystem update (beta.34 → beta.35) is coordinated, and complementary tooling bumps (ESLint, simple-git, globals) follow appropriate patterns for a patch release.

Also applies to: 52-56, 65-65, 67-67, 98-98

docs/zh/apis/advanced-apis/workload/index.mdx (1)

1-3: Documentation structure is appropriate.

The Workload APIs index page follows the expected structure with header and Overview component.

docs/zh/apis/advanced-apis/workload/deployment_one.mdx (1)

1-10: Documentation and component usage are correct.

The OpenAPIPath component is properly configured for the namespaced Deployment endpoint with appropriate path and cluster prefix.

docs/en/apis/advanced-apis/workload/index.mdx (1)

1-7: Documentation structure is appropriate.

The English Workload APIs index page properly includes front matter with sourceSHA and Overview component.

docs/en/apis/advanced-apis/workload/deployment.mdx (1)

1-10: Documentation and component usage are correct.

The OpenAPIPath component is properly configured for the Deployments list endpoint with appropriate cluster prefix.

docs/en/apis/advanced-apis/workload/deployment_one.mdx (1)

1-10: Documentation and component usage are correct.

The OpenAPIPath component is properly configured for the namespaced Deployment endpoint.

packages/doom/src/runtime/components/OpenAPIPath.tsx (1)

246-254: Good fix for handling undefined schema in requestBody.

The fallback logic correctly addresses the issue where requestBody.content['application/json'] might not exist. The implementation properly checks multiple content types (application/json, application/json-patch+json, */*) in order of preference and uses optional chaining to prevent undefined access. The ESLint disable comment is appropriate since the TypeScript compiler may not recognize that these properties can be undefined at runtime depending on the OpenAPI document structure.

Verification confirms no similar unsafe patterns exist elsewhere in the codebase.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21004ae and 217afb8.

📒 Files selected for processing (8)
  • .changeset/grumpy-berries-dress.md (1 hunks)
  • docs/en/apis/advanced-apis/workload/daemonset.mdx (1 hunks)
  • docs/en/apis/advanced-apis/workload/deployment.mdx (1 hunks)
  • docs/en/apis/advanced-apis/workload/index.mdx (1 hunks)
  • docs/zh/apis/advanced-apis/workload/daemonset.mdx (1 hunks)
  • docs/zh/apis/advanced-apis/workload/deployment.mdx (1 hunks)
  • docs/zh/apis/advanced-apis/workload/index.mdx (1 hunks)
  • packages/doom/src/runtime/components/OpenAPIPath.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • docs/en/apis/advanced-apis/workload/index.mdx
  • docs/zh/apis/advanced-apis/workload/index.mdx
  • docs/zh/apis/advanced-apis/workload/deployment.mdx
  • .changeset/grumpy-berries-dress.md
  • docs/en/apis/advanced-apis/workload/deployment.mdx
  • packages/doom/src/runtime/components/OpenAPIPath.tsx
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: JounQin
Repo: alauda/doom PR: 34
File: src/cli/load-config.ts:290-0
Timestamp: 2025-05-29T10:23:34.965Z
Learning: In the alauda/doom project, JounQin prefers concise error handling over verbose validation. While they prefer throwing on invalid configuration rather than graceful fallbacks, they don't want overly detailed validation with multiple explicit checks and error messages.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Build and Lint with Node.js 24 on ubuntu-latest
  • GitHub Check: Build and Lint with Node.js 20 on ubuntu-latest
  • GitHub Check: Build and Lint with Node.js 22 on ubuntu-latest
  • GitHub Check: Build and Lint with Node.js 22 on ubuntu-latest
  • GitHub Check: Build and Lint with Node.js 20 on ubuntu-latest
  • GitHub Check: Build and Lint with Node.js 24 on ubuntu-latest
🔇 Additional comments (3)
docs/zh/apis/advanced-apis/workload/daemonset.mdx (1)

3-10: Approve OpenAPIPath configuration.

The OpenAPIPath component configuration looks correct:

  • Path /apis/apps/v1/daemonsets aligns with the Kubernetes API endpoint
  • PathPrefix /kubernetes/{cluster} follows the established pattern for workload resources
docs/en/apis/advanced-apis/workload/daemonset.mdx (2)

7-10: Approve OpenAPIPath configuration.

The OpenAPIPath component is correctly configured with appropriate path and pathPrefix values that align with the Kubernetes DaemonSet API and established workload documentation patterns.


1-3: Confirm whether locale-specific front matter approach is intentional.

Verification shows front matter is present in EN docs but absent in ZH docs—a pattern consistent across multiple files (DaemonSet and Deployment both follow this structure). Additionally, EN headers use escaped brackets \[apps/v1] while ZH headers use unescaped brackets [apps/v1].

If this locale-specific metadata structure is intentional by design, no changes are needed. If both locales should have consistent front matter and formatting, please align them.

@JounQin JounQin requested a review from Copilot November 3, 2025 09:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

packages/doom/src/runtime/components/OpenAPIPath.tsx:1

  • The nested parentheses make this code difficult to read. Consider extracting the content type selection into a separate variable for better clarity. For example: const mediaTypeContent = requestBody.content['application/json'] || requestBody.content['application/json-patch+json'] || requestBody.content['*/*'] followed by mediaTypeContent?.schema as OpenAPIV3_1.ReferenceObject | undefined)?.$ref
import { usePage } from '@rspress/core/runtime'

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JounQin JounQin merged commit 9976fc6 into main Nov 3, 2025
20 checks passed
@JounQin JounQin deleted the fix/null_pointer branch November 3, 2025 09:41
@coderabbitai coderabbitai bot mentioned this pull request Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants