Skip to content

Feature/library review fixes - #115

Merged
alessandrobellesia merged 5 commits into
developfrom
feature/library-review-fixes
Jun 15, 2026
Merged

alessandrobellesia merged 5 commits into
developfrom
feature/library-review-fixes

Conversation

@alessandrobellesia

@alessandrobellesia alessandrobellesia commented Jun 15, 2026 •

Copy link
Copy Markdown
Member
  • Fix FormTemplateComponent exported type (was aliased to VvFormFieldsGroup)
  • Export defaultObjectByJSONSchema from the package entry point
  • VvForm: route external modelValue updates through formDataAdapter so
    schema defaults and the class option are applied consistently with init
  • Refactor defaultObjectBySchema to share one implementation across Zod
    v3/v4 via an internal adapter (~150 fewer duplicated lines, no behavior change)
  • Add ambient declarations for *.vue and @volverjs/style so type-check passes
  • Tighten useForm scoped-instance return type
  • Lint cleanup in docs and browser test specs

Summary by CodeRabbit

  • New Features

    • Exported defaultObjectByJSONSchema() for generating default objects from JSON schemas.
  • Bug Fixes

    • Resolved type correctness issues across the codebase.
    • Fixed VvForm handling of external modelValue updates.
    • Corrected FormTemplateComponent type definition.
  • Chores

    • Upgraded multiple dependencies to latest versions.
    • Added TypeScript module type declarations.

Alessandro Bellesia and others added 2 commits June 15, 2026 16:38
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Fix FormTemplateComponent exported type (was aliased to VvFormFieldsGroup)
- Export defaultObjectByJSONSchema from the package entry point
- VvForm: route external modelValue updates through formDataAdapter so
  schema defaults and the class option are applied consistently with init
- Refactor defaultObjectBySchema to share one implementation across Zod
  v3/v4 via an internal adapter (~150 fewer duplicated lines, no behavior change)
- Add ambient declarations for *.vue and @volverjs/style so type-check passes
- Tighten useForm scoped-instance return type
- Lint cleanup in docs and browser test specs

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@alessandrobellesia, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 29 minutes and 16 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2aed570a-efa3-4c51-96cd-22f02ec30415

📥 Commits

Reviewing files that changed from the base of the PR and between 5552e14 and 6cc9a3d.

📒 Files selected for processing (2)
  • package.json
  • src/utils.ts

Walkthrough

Version 1.1.3 refactors defaultObjectBySchema in src/utils.ts to use a new ZodAdapter abstraction that unifies Zod v3/v4 branching logic. defaultObjectByJSONSchema is newly exported from the package entry point. The VvForm modelValue watcher now routes through formDataAdapter directly. The FormTemplateComponent type alias is corrected, TypeScript shims are added, and devDependencies are bumped.

Changes

Core library fixes and refactors

Layer / File(s) Summary
ZodAdapter abstraction and defaultObjectBySchema refactor
src/utils.ts
Introduces ZodAdapter interface with zod3Adapter/zod4Adapter instances encapsulating version-specific schema operations. Adds _resolveShapeEntry and _defaultObjectFromShape helpers, and rewrites defaultObjectBySchema to use the adapter-driven path instead of inline v3/v4 branching.
Public exports, type fixes, and VvForm watcher
src/index.ts, src/VvForm.ts
Exports defaultObjectByJSONSchema from the package entry point, corrects FormTemplateComponent type alias to ReturnType<typeof defineFormTemplate>, applies non-null assertion to scoped useForm cache retrieval, and replaces the manual deep-clone in the modelValue watcher with a direct formDataAdapter(original) call.
TypeScript ambient module declarations
src/shims.d.ts
Adds declare module blocks for @volverjs/style, @volverjs/style/*, and *.vue (with DefineComponent default export) so that pnpm run type-check passes.
Changelog, docs fix, and test guard formatting
CHANGELOG.md, docs/VvFormField.md, test-playwright/VvForm.v4.spec.ts, test-playwright/VvFormFieldsGroup.v3.spec.ts, test-playwright/VvFormFieldsGroup.v4.spec.ts
Adds 1.1.3 changelog entry, corrects superRefine example from find() to some(), and reformats DOM null-guard throws in Playwright tests to multi-line if blocks.

Dependency and workspace tooling updates

Layer / File(s) Summary
devDependencies bump and workspace config
package.json, pnpm-workspace.yaml
Updates packageManager to pnpm@11.7.0, bumps devDependencies across Vue/Vite/Vitest/Playwright/ESLint packages, and adds minimumReleaseAgeExclude entries in pnpm-workspace.yaml for Vitest, Playwright, and @volverjs/style.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • volverjs/form-vue#93: Directly related — both PRs modify src/utils.ts to refactor defaultObjectBySchema for improved Zod v4 handling, replacing branching logic with schema introspection and recursive default construction.
  • volverjs/form-vue#71: Directly related — both PRs modify useForm() scope handling in src/index.ts, with overlapping changes to scoped instance retrieval and return type correctness.

Poem

🐇 Hop, hop, adapters align,
Zod v3 and v4 now share the same vine.
The watcher skips cloning, the types are corrected,
defaultObjectByJSONSchema — finally exported!
With shims and bumped deps, the type-check is clear,
A tidy release from this little hare. 🌿

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Feature/library review fixes' is vague and generic, using non-descriptive terms that don't convey the specific nature of the changes (type fixes, exports, refactoring, etc.). Consider a more descriptive title like 'Fix FormTemplateComponent type alias, export defaultObjectByJSONSchema, and refactor defaultObjectBySchema adapter' that specifically highlights the main changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/library-review-fixes

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.

- Fix FormTemplateComponent exported type (was aliased to VvFormFieldsGroup)
- Export defaultObjectByJSONSchema from the package entry point
- VvForm: route external modelValue updates through formDataAdapter so
  schema defaults and the class option are applied consistently with init
- Refactor defaultObjectBySchema to share one implementation across Zod
  v3/v4 via an internal adapter (~150 fewer duplicated lines, no behavior change)
- Add ambient declarations for *.vue and @volverjs/style so type-check passes
- Tighten useForm scoped-instance return type
- Lint cleanup in docs and browser test specs

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

# Conflicts:
#	src/VvForm.ts
#	src/utils.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
src/utils.ts (1)

378-423: 💤 Low value

Consider extracting sub-handlers to reduce cognitive complexity.

SonarCloud flags this function with a cognitive complexity of 21 (threshold: 15). While the complexity is inherent to handling multiple Zod schema types (optional, default, nullable, array, record, object), extracting some logic into focused helpers could improve readability:

  • Array handling (lines 398-404) → _resolveArrayEntry
  • Record handling (lines 405-414) → _resolveRecordEntry

That said, the current structure is clear and directly mirrors the Zod type hierarchy, so this is optional polish rather than a blocker.

🤖 Prompt for 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.

In `@src/utils.ts` around lines 378 - 423, The function _resolveShapeEntry has
cognitive complexity of 21, exceeding the threshold of 15. Extract the array
handling logic (the conditional block checking adapter.isArray where arrayType
is handled) into a new helper function named _resolveArrayEntry that accepts
adapter, innerType, and originalValue parameters and returns a tuple. Similarly,
extract the record handling logic (the conditional block checking
adapter.isRecord where valueType is handled) into a new helper function named
_resolveRecordEntry with the same signature. Replace the corresponding inline
blocks in _resolveShapeEntry with calls to these new helpers to reduce the
function's complexity and improve readability without changing behavior.

Source: Linters/SAST tools

🤖 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 `@package.json`:
- Around line 76-99: The `engines.node` field in package.json specifies Node.js
>= 16.x, but the upgraded dependencies now require Node.js 20.19.0 or higher.
Locate the `engines.node` configuration field in package.json and update it to
at least `>= 20.19.0` (or `>= 22.12.0` if targeting the strictest requirement
based on Vitest 4.1.9) to accurately reflect the minimum Node.js version
required by Vite, Vitest, Playwright, and ESLint.

In `@pnpm-workspace.yaml`:
- Around line 5-18: The minimumReleaseAgeExclude list in pnpm-workspace.yaml is
ineffective without a configured minimumReleaseAge baseline. Either define
minimumReleaseAge in pnpm-workspace.yaml to establish the supply-chain
protection policy that makes the exclusion list meaningful, or remove the unused
minimumReleaseAgeExclude configuration entirely to clean up the configuration
file.

---

Nitpick comments:
In `@src/utils.ts`:
- Around line 378-423: The function _resolveShapeEntry has cognitive complexity
of 21, exceeding the threshold of 15. Extract the array handling logic (the
conditional block checking adapter.isArray where arrayType is handled) into a
new helper function named _resolveArrayEntry that accepts adapter, innerType,
and originalValue parameters and returns a tuple. Similarly, extract the record
handling logic (the conditional block checking adapter.isRecord where valueType
is handled) into a new helper function named _resolveRecordEntry with the same
signature. Replace the corresponding inline blocks in _resolveShapeEntry with
calls to these new helpers to reduce the function's complexity and improve
readability without changing behavior.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1e01b2bf-9119-4e8f-bbbb-83e02d0a8660

📥 Commits

Reviewing files that changed from the base of the PR and between 4f4f3ba and 5552e14.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • CHANGELOG.md
  • docs/VvFormField.md
  • package.json
  • pnpm-workspace.yaml
  • src/VvForm.ts
  • src/index.ts
  • src/shims.d.ts
  • src/utils.ts
  • test-playwright/VvForm.v4.spec.ts
  • test-playwright/VvFormFieldsGroup.v3.spec.ts
  • test-playwright/VvFormFieldsGroup.v4.spec.ts

Comment thread package.json
Comment thread pnpm-workspace.yaml
Alessandro Bellesia and others added 2 commits June 15, 2026 17:21
- bump engines.node to ^20.19.0 || >=22.12.0 to match vite/vitest/eslint
- remove inert minimumReleaseAgeExclude (no minimumReleaseAge baseline set)
- extract array/record default-value resolution into helpers

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pnpm 11.7.0 enforces a built-in minimumReleaseAge, so the exclude list is
required to allow the freshly-bumped dev deps. Removing it broke install
with ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Jun 15, 2026 •

Copy link
Copy Markdown

@alessandrobellesia
alessandrobellesia merged commit dbe994c into develop Jun 15, 2026
9 checks passed
@alessandrobellesia
alessandrobellesia deleted the feature/library-review-fixes branch June 15, 2026 15:33
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.

1 participant