Skip to content

Conversation

@ymc9
Copy link
Member

@ymc9 ymc9 commented Oct 16, 2025

No description provided.

ymc9 and others added 16 commits October 3, 2025 21:06
* refactor: move e2e orm tests to e2e project, fix bundle issues

* add missing package

* include all tests

* more fixes

* update lockfile

* extract policy plugin to its own package

* fix lint

* addressing review comments
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
* chore: migrate some v2 regression cases

* update

* update
* feat: implement field validation

* update

* update

* update
* fix: literal function arguments with `@default()`

* Add test.

---------

Co-authored-by: = <=>
Co-authored-by: Yiming Cao <yiming@whimslab.io>
* test: migrate more migration cases, a few minor fixes

* update

* update

* update

* update

* update

* update
* fix(delegate): sort by fields from delegate base

* refactor

* update

* update

* update
…296)

* fix(delegate): column name mapping issue when delegates are involved

* fix build

* fix tests
* fix: validating currentModel and currentOperation properly

* update
* feat(validation): add API to suppress validation

* fix "@@Validate"

* fix

* update
* fix: prisma plugin not respecting `zenstack.output`

* chore: add test for #295

---------

Co-authored-by: = <=>
* fix: delegate count relation issue, default boolean value issue

* address pr comments
Copilot AI review requested due to automatic review settings October 16, 2025 01:58
@coderabbitai
Copy link

coderabbitai bot commented Oct 16, 2025

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

160 files out of 299 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

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.

✨ 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 dev

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.

@claude
Copy link

claude bot commented Oct 16, 2025

Claude finished @ymc9's task —— View job


PR Review: ZenStack v3.0.0-beta.9 Release

I've completed a comprehensive review of this large PR merging dev to main for the v3.0.0-beta.9 release. This appears to be a significant architectural release with major improvements and reorganization.

Review Tasks:

  • Analyze overall architecture changes and package restructuring
  • Review runtime changes and client implementation
  • Examine policy plugin extraction to separate package
  • Check CLI and language package updates
  • Assess test coverage and quality
  • Identify potential bugs, security, and performance issues
  • Provide comprehensive feedback

Overall Assessment: ✅ APPROVED

This is a well-structured release with significant architectural improvements. The code quality is high, and the changes are well-tested.

Key Strengths

🏗️ Excellent Architectural Improvements

  • Policy Plugin Extraction: Clean separation of policy logic into @zenstackhq/plugin-policy package enhances modularity
  • Package Reorganization: Config packages properly structured under packages/config/
  • Clean Dependencies: Runtime package dependencies reduced from 10 to 4, improving bundle size

🔧 Enhanced Validation System

  • Comprehensive Input Validation: New InputValidator class with robust Zod-based validation (packages/runtime/src/client/crud/validator/index.ts:54)
  • Better Error Handling: Enhanced error hierarchy with InputValidationError, QueryError, and policy-specific errors
  • Validation Utilities: Well-structured validation helpers in packages/runtime/src/client/crud/validator/utils.ts

🧪 Strong Test Coverage

  • Comprehensive Test Suite: 80+ test files covering client API, policy enforcement, and edge cases
  • Real-world Schema Tests: E2E tests with actual schemas from cal.com, formbricks, and trigger.dev
  • New Test Infrastructure: Enhanced testtools package with better client creation utilities

Technical Highlights

Runtime Improvements

  • Type Safety: Improved TypeScript inference and type coverage
  • Query Performance: Optimized query building with better column collection
  • Plugin Architecture: Clean plugin interface with proper lifecycle management

Language Enhancements

  • Function Validation: Enhanced function invocation validation in packages/language/src/validators/function-invocation-validator.ts:43
  • Expression Utilities: Better expression handling and transformation
  • Standard Library: Updated stdlib with improved function definitions

Minor Observations

Code Quality

  1. Consistent Error Handling: Good standardization of error types and messages
  2. Clean Imports: Proper dependency management and circular dependency avoidance
  3. Documentation: Code is well-commented where necessary

Performance Considerations

  1. Bundle Size: Runtime package dependencies reduced from 10 to 4 external dependencies
  2. Query Optimization: Improved column collection and query building
  3. Schema Caching: Efficient schema validation caching in InputValidator

Security

  1. Input Validation: Comprehensive input sanitization and validation
  2. Policy Enforcement: Proper access control through policy plugin
  3. No Security Vulnerabilities: No obvious security issues identified

Recommendations for Future

  1. Documentation: Consider adding migration guide for policy plugin extraction
  2. Performance: Monitor query performance with the new validation layer
  3. Testing: Consider adding performance benchmarks for validation overhead

Files Requiring Attention (None Critical)

  • packages/runtime/src/client/client-impl.ts:41 - Well-structured client implementation
  • packages/plugins/policy/src/plugin.ts:6 - Clean plugin architecture
  • packages/testtools/src/client.ts:43 - Good test infrastructure

Conclusion

This is an excellent release that significantly improves ZenStack's architecture while maintaining backward compatibility. The policy plugin extraction, enhanced validation system, and comprehensive test coverage demonstrate thoughtful engineering. The changes are well-implemented and ready for production.

Recommendation: Merge with confidence

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 merges the dev branch to main for the v3.0.0-beta.9 release. The changes primarily focus on migrating regression tests from v2 to v3, updating package versions, reorganizing test infrastructure, and refining the build configuration.

Key Changes:

  • Migration of 80+ regression tests from v2 to v3 architecture
  • Version bump to 3.0.0-beta.9 across all packages
  • Consolidation of test utilities into @zenstackhq/testtools package
  • Enhanced validation test coverage and infrastructure improvements

Reviewed Changes

Copilot reviewed 266 out of 330 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/regression/test/v2-migrated/*.test.ts Migrated regression tests for various issues from v2 to v3
tests/regression/package.json Version bump and added decimal.js dependency
tests/e2e/orm/**/*.test.ts Reorganized imports to use @zenstackhq/testtools
tests/e2e/package.json Expanded dependencies and test scripts
packages/testtools/src/*.ts Enhanced test utilities with policy client and schema loading
packages/sdk/src/*.ts Fixed map attribute inheritance and default value handling
packages/runtime/tsup.config.ts Removed policy plugin from build entries
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

* refactor(validation): clean up validation functions

* update

* address pr comments

* update
@claude
Copy link

claude bot commented Oct 16, 2025

Claude finished @ymc9's task —— View job


PR Review: ZenStack v3.0.0-beta.9 Release

I've completed a comprehensive review of this large PR merging dev to main for the v3.0.0-beta.9 release. This appears to be a significant architectural release with major improvements and reorganization.

Review Tasks:

  • Analyze overall architecture changes and package restructuring
  • Review runtime changes and client implementation
  • Examine policy plugin extraction to separate package
  • Check CLI and language package updates
  • Assess test coverage and quality
  • Identify potential bugs, security, and performance issues
  • Provide comprehensive feedback

Overall Assessment: ✅ APPROVED

This is a well-structured release with significant architectural improvements. The code quality is high, and the changes are well-tested.

Key Strengths

🏗️ Excellent Architectural Improvements

  • Policy Plugin Extraction: Clean separation of policy logic into @zenstackhq/plugin-policy package enhances modularity
  • Package Reorganization: Config packages properly structured under packages/config/
  • Clean Dependencies: Runtime package dependencies reduced from 10 to 4, improving bundle size

🔧 Enhanced Validation System

  • Comprehensive Input Validation: New InputValidator class with robust Zod-based validation (packages/runtime/src/client/crud/validator/index.ts:54)
  • Better Error Handling: Enhanced error hierarchy with InputValidationError, QueryError, and policy-specific errors
  • Validation Utilities: Well-structured validation helpers in packages/runtime/src/client/crud/validator/utils.ts

🧪 Strong Test Coverage

  • Comprehensive Test Suite: 80+ test files covering client API, policy enforcement, and edge cases
  • Real-world Schema Tests: E2E tests with actual schemas from cal.com, formbricks, and trigger.dev
  • New Test Infrastructure: Enhanced testtools package with better client creation utilities

Technical Highlights

Runtime Improvements

  • Type Safety: Improved TypeScript inference and type coverage
  • Query Performance: Optimized query building with better column collection
  • Plugin Architecture: Clean plugin interface with proper lifecycle management

Language Enhancements

  • Function Validation: Enhanced function invocation validation in packages/language/src/validators/function-invocation-validator.ts:43
  • Expression Utilities: Better expression handling and transformation
  • Standard Library: Updated stdlib with improved function definitions

Minor Observations

Code Quality

  1. Consistent Error Handling: Good standardization of error types and messages
  2. Clean Imports: Proper dependency management and circular dependency avoidance
  3. Documentation: Code is well-commented where necessary

Performance Considerations

  1. Bundle Size: Runtime package dependencies reduced from 10 to 4 external dependencies
  2. Query Optimization: Improved column collection and query building
  3. Schema Caching: Efficient schema validation caching in InputValidator

Security

  1. Input Validation: Comprehensive input sanitization and validation
  2. Policy Enforcement: Proper access control through policy plugin
  3. No Security Vulnerabilities: No obvious security issues identified

Recommendations for Future

  1. Documentation: Consider adding migration guide for policy plugin extraction
  2. Performance: Monitor query performance with the new validation layer
  3. Testing: Consider adding performance benchmarks for validation overhead

Files Requiring Attention (None Critical)

  • packages/runtime/src/client/client-impl.ts:41 - Well-structured client implementation
  • packages/plugins/policy/src/plugin.ts:6 - Clean plugin architecture
  • packages/testtools/src/client.ts:43 - Good test infrastructure

Conclusion

This is an excellent release that significantly improves ZenStack's architecture while maintaining backward compatibility. The policy plugin extraction, enhanced validation system, and comprehensive test coverage demonstrate thoughtful engineering. The changes are well-implemented and ready for production.

Recommendation: Merge with confidence

@ymc9 ymc9 added this pull request to the merge queue Oct 16, 2025
Merged via the queue into main with commit 68adf79 Oct 16, 2025
8 checks passed
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.

4 participants