Skip to content

Conversation

@stijnvanhulle
Copy link
Collaborator

@stijnvanhulle stijnvanhulle commented Nov 6, 2025

Summary by CodeRabbit

  • New Features

    • Expanded public schemas and endpoints for apps, machines, volumes, secrets, tokens, metadata.
  • Performance

    • Faster generation by parallelizing schema and operation builds.
  • Improvements

    • More robust mocks and file-matching with deduplication and safer error handling.
    • Improved timeout/delay lifecycle behavior.
    • Simplified logging/event handling and consolidated file emission.
    • New keyword helpers exported for more reliable schema parsing and mapping.

@changeset-bot
Copy link

changeset-bot bot commented Nov 6, 2025

⚠️ No Changeset found

Latest commit: 4ba4ed2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@dosubot
Copy link

dosubot bot commented Nov 6, 2025

Related Documentation

Checked 1 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 6, 2025

Warning

Rate limit exceeded

@stijnvanhulle has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between bd91869 and 4ba4ed2.

📒 Files selected for processing (1)
  • biome.json (1 hunks)

Walkthrough

Refactors PluginManager mock signatures and matchFiles (deduplication, parsing/formatting), makes format async with early returns, resolves timeouts with handles and clears them, parallelizes plugin-zod generation and consolidates emissions, adds many generated Zod schemas, and updates a minor ignore pattern.

Changes

Cohort / File(s) Summary
Mocks & file matching
configs/mocks.ts
Reworked PluginManager mock: removed Plugin import; format is now async with early-return for falsy source and returns original source on error; resolveName refactored to switch mapping (camelCase/pascalCase); logger.on changed to no-arg function; getPluginByKey now no-arg; getFile meta simplified; final cast changed to as unknown as PluginManager; matchFiles now guards empty input, deduplicates by file.path, parses once, skips formatting for .json baseNames, snapshots with optional pre-folder, and returns a processed map.
Generated schemas (large)
examples/simple-single/src/gen2/index.ts
Adds an extensive set of exported Zod schemas and related request/response/path/query/mutation types for apps, machines, volumes, secrets/secretkeys, tokens, placements/regions, IP assignments, leases, and related endpoints; removes the previous apps-block at file end.
Plugin Zod generator
packages/plugin-zod/src/plugin.ts
Runs schema and operation generators in parallel via Promise.all, consolidates emissions into a single addFile call combining schema/operation/barrel files, and simplifies barrel meta formatting.
Timeout utilities & example config
packages/core/src/utils/timeout.ts, examples/zod/kubb.config.js
Timeout wrappers now resolve with the setTimeout handle and clear the timeout in a subsequent .then(...) instead of resolving booleans or inline clearing.
OAS schema mapper & exports
packages/plugin-oas/src/SchemaMapper.ts, packages/plugin-oas/src/index.ts
Adds helpers: createSchemaKeywordMap, createSchemaKeywordSet, getSchemaByKeyword, hasKeyword; re-exports them alongside existing isKeyword/schemaKeywords.
Parsers updated to use keyword helpers
packages/plugin-faker/src/parser.ts, packages/plugin-ts/src/parser.ts, packages/plugin-zod/src/parser.ts
Refactors object property handling to use new keyword-map/set helpers (createSchemaKeywordMap, createSchemaKeywordSet, getSchemaByKeyword, hasKeyword), centralizes per-property keyword extraction and mapping, and updates property/type construction logic.
Schema traversal robustness
packages/plugin-oas/src/SchemaGenerator.ts
Replaces optional-chaining-based traversal with explicit guards and for-of loops in deepSearch and find, making recursion and early returns more explicit.
Misc config
biome.json
Minor ignore pattern update: replace excluded ceviz-report.htm with ceviz-report.html.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Focus review on behavioral/signature changes in configs/mocks.ts (caller compatibility for getPluginByKey, logger.on, format, and matchFiles behavior).
  • Verify plugin parsers (plugin-zod, plugin-ts, plugin-faker) correctly use the new keyword helpers and maintain previous semantics for optional/nullable/ref handling.
  • Check plugin-zod parallelization for potential race conditions or ordering assumptions when combining files into a single emission.
  • Scan the large generated schema file for naming conflicts, missing exports, or unintended removals.

Possibly related PRs

Suggested labels

@kubb/plugin-oas

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main focus of the changeset—optimizing helper functions and refactoring for improved performance across multiple modules.

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 6, 2025

More templates

@kubb/cli

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/cli@2001

@kubb/core

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/core@2001

kubb

npm i https://pkg.pr.new/kubb-labs/kubb@2001

@kubb/mcp

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/mcp@2001

@kubb/oas

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/oas@2001

@kubb/plugin-client

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-client@2001

@kubb/plugin-cypress

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-cypress@2001

@kubb/plugin-faker

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-faker@2001

@kubb/plugin-mcp

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-mcp@2001

@kubb/plugin-msw

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-msw@2001

@kubb/plugin-oas

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-oas@2001

@kubb/plugin-react-query

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-react-query@2001

@kubb/plugin-redoc

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-redoc@2001

@kubb/plugin-solid-query

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-solid-query@2001

@kubb/plugin-svelte-query

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-svelte-query@2001

@kubb/plugin-swr

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-swr@2001

@kubb/plugin-ts

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-ts@2001

@kubb/plugin-vue-query

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-vue-query@2001

@kubb/plugin-zod

npm i https://pkg.pr.new/kubb-labs/kubb/@kubb/plugin-zod@2001

unplugin-kubb

npm i https://pkg.pr.new/kubb-labs/kubb/unplugin-kubb@2001

commit: 4ba4ed2

@kubb-labs-dev
Copy link

kubb-labs-dev bot commented Nov 6, 2025

The preview deployment for kubb-labs/kubb:main is ready. 🟢

Open Preview | Open Build Logs

Last updated at: 2025-11-20 22:25:24 CET

Copy link
Contributor

@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

🧹 Nitpick comments (1)
examples/zod/kubb.config.js (1)

8-14: Consider using the timeout utility instead of duplicating the logic.

This implements the same timeout pattern as the utility in packages/core/src/utils/timeout.ts. Consider importing and using that utility to reduce code duplication.

Apply this diff:

 import { defineConfig } from '@kubb/core'
+import { timeout } from '@kubb/core'
 import { pluginClient } from '@kubb/plugin-client'
 import { pluginOas, schemaKeywords } from '@kubb/plugin-oas'
 import { pluginTs } from '@kubb/plugin-ts'
 import { pluginZod } from '@kubb/plugin-zod'

 export default defineConfig(async () => {
-  await new Promise((resolve) => {
-    const timeout = setTimeout(() => {
-      resolve(timeout)
-    }, 1000)
-  }).then((timeout) => {
-    clearTimeout(timeout)
-  })
+  await timeout(1000)

   return {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 996d2ab and 2ccfba5.

⛔ Files ignored due to path filters (1)
  • examples/simple-single/src/gen/zod.ts is excluded by !**/gen/**
📒 Files selected for processing (5)
  • configs/mocks.ts (3 hunks)
  • examples/simple-single/src/gen2/index.ts (6 hunks)
  • examples/zod/kubb.config.js (1 hunks)
  • packages/core/src/utils/timeout.ts (1 hunks)
  • packages/plugin-zod/src/plugin.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
packages/plugin-zod/src/plugin.ts (1)
packages/core/src/utils/getBarrelFiles.ts (1)
  • getBarrelFiles (36-76)
examples/zod/kubb.config.js (1)
packages/core/src/utils/timeout.ts (1)
  • timeout (1-9)
configs/mocks.ts (1)
packages/core/src/PluginManager.ts (1)
  • PluginManager (78-708)
🪛 Biome (2.1.2)
examples/simple-single/src/gen2/index.ts

[error] 71-71: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 83-83: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 133-133: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 140-140: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 145-145: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 172-172: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 183-183: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 188-188: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 294-294: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 306-306: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 311-311: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 316-316: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 364-364: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 376-376: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 381-381: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 386-386: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 398-398: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 416-416: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 449-449: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 454-454: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 630-631: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 662-662: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 667-668: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 691-692: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 708-709: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 713-714: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 742-743: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 747-748: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 898-898: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 923-924: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 941-942: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 959-960: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 971-972: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 976-977: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 981-982: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 993-994: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1011-1012: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1016-1017: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1021-1022: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1039-1040: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1044-1045: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1049-1050: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1061-1062: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1066-1067: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1071-1072: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1089-1090: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1094-1095: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1099-1100: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1250-1252: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1255-1257: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1289-1291: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1325-1327: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1330-1332: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1335-1337: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1347-1349: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1364-1366: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1375-1377: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1380-1382: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1392-1394: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1404-1406: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1409-1411: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1414-1416: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1486-1488: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1498-1500: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1503-1505: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1515-1517: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1534-1536: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1539-1541: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1557-1559: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1576-1578: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1593-1595: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)


[error] 1598-1600: This variable is used before its declaration.

The variable is declared here:

(lint/correctness/noInvalidUseBeforeDeclaration)

🔇 Additional comments (8)
packages/plugin-zod/src/plugin.ts (2)

160-160: LGTM: Clean single-line formatting.

The meta object formatting is more concise and has no functional impact.


154-154: ****

The original review comment incorrectly identifies a race condition. Analysis shows that OperationGenerator does not access usedEnumNames at all—only SchemaGenerator mutates this state during its own build() method (line 729 of SchemaGenerator.ts). Since OperationGenerator operates independently and never touches this shared state, there is no concurrent access to the mutable object during parallelization. The two generators process different concerns (schemas vs. operations) and can safely run in parallel without conflict on this state.

Likely an incorrect or invalid review comment.

packages/core/src/utils/timeout.ts (1)

3-7: LGTM! Cross-environment compatibility improvement.

The use of globalThis.setTimeout and globalThis.clearTimeout ensures compatibility across Node.js, browser, and other JavaScript environments. The timeout is properly cleaned up after resolution.

configs/mocks.ts (5)

22-28: LGTM! Improved error handling.

The early return for empty source and catch-without-binding pattern (when the error object isn't needed) are both appropriate improvements.


34-42: LGTM! Cleaner control flow.

The switch statement is more readable than the previous if-else chain and maintains the same logic.


57-57: Mock signature simplified by removing unused parameter.

The parameter was removed since this mock always returns undefined regardless of input. This aligns with the removal of the Plugin import.


71-97: LGTM! Improved performance with deduplication.

The addition of the processed Map prevents redundant file processing and caching results. The early returns and clearer control flow are good improvements.


67-67: The review comment is incorrect. This double assertion is not indicative of mock drift.

The as unknown as PluginManager pattern is a standard TypeScript escape hatch used intentionally here because the mock is a partial implementation—it provides only the subset of PluginManager methods needed for specific use cases. This is appropriate design for a test configuration file.

Additionally, the mock (mockedPluginManager and createMockedPluginManager) has zero usages across the codebase. Grep searches found no imports or calls, and the entire configs/ directory is excluded from test coverage. The double assertion has existed through recent PluginManager refactoring (commit 29a43be), unchanged. This is dead or transitional code in a configuration context, not an active mock with drift concerns.

Likely an incorrect or invalid review comment.

@stijnvanhulle stijnvanhulle force-pushed the chore/perf-improvements branch from 2ccfba5 to 897433f Compare November 6, 2025 16:17
@stijnvanhulle stijnvanhulle marked this pull request as draft November 20, 2025 22:25
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.

3 participants