Skip to content

Conversation

@ymc9
Copy link
Member

@ymc9 ymc9 commented Nov 18, 2025

No description provided.

ymc9 and others added 8 commits November 15, 2025 09:10
)

* refactor(orm): consolidate kysely dialects under /dialects exports

* update
* chore: import CLI help text

* update
* feat: better-auth adapter

* address pr comments
…umber (#417)

* fix(cli): error generating TS schema when default value is negative number

fixes #393

* update
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
* feat(cli): add "format" command

* better-auth: format generated schema

* update
Copilot AI review requested due to automatic review settings November 18, 2025 05:15
@coderabbitai
Copy link

coderabbitai bot commented Nov 18, 2025

Warning

Rate limit exceeded

@ymc9 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 26 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 778526d and 710cb8b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (54)
  • package.json (1 hunks)
  • packages/auth-adapters/better-auth/eslint.config.js (1 hunks)
  • packages/auth-adapters/better-auth/package.json (2 hunks)
  • packages/auth-adapters/better-auth/src/adapter.ts (1 hunks)
  • packages/auth-adapters/better-auth/src/index.ts (1 hunks)
  • packages/auth-adapters/better-auth/src/schema-generator.ts (1 hunks)
  • packages/auth-adapters/better-auth/tsconfig.json (1 hunks)
  • packages/auth-adapters/better-auth/vitest.config.ts (1 hunks)
  • packages/cli/package.json (1 hunks)
  • packages/cli/src/actions/action-utils.ts (1 hunks)
  • packages/cli/src/actions/format.ts (1 hunks)
  • packages/cli/src/actions/generate.ts (1 hunks)
  • packages/cli/src/actions/index.ts (1 hunks)
  • packages/cli/src/index.ts (6 hunks)
  • packages/cli/src/plugins/typescript.ts (1 hunks)
  • packages/cli/src/utils/exec-utils.ts (1 hunks)
  • packages/cli/test/format.test.ts (1 hunks)
  • packages/clients/tanstack-query/package.json (1 hunks)
  • packages/common-helpers/package.json (1 hunks)
  • packages/config/eslint-config/package.json (1 hunks)
  • packages/config/typescript-config/package.json (1 hunks)
  • packages/config/vitest-config/package.json (1 hunks)
  • packages/create-zenstack/package.json (1 hunks)
  • packages/dialects/sql.js/README.md (0 hunks)
  • packages/dialects/sql.js/eslint.config.js (0 hunks)
  • packages/dialects/sql.js/src/index.ts (0 hunks)
  • packages/dialects/sql.js/test/getting-started/database.ts (0 hunks)
  • packages/dialects/sql.js/test/getting-started/person-repository.test.ts (0 hunks)
  • packages/dialects/sql.js/test/getting-started/person-repository.ts (0 hunks)
  • packages/dialects/sql.js/test/getting-started/types.ts (0 hunks)
  • packages/dialects/sql.js/tsconfig.json (0 hunks)
  • packages/language/package.json (1 hunks)
  • packages/language/src/document.ts (2 hunks)
  • packages/language/src/index.ts (1 hunks)
  • packages/language/src/zmodel-code-generator.ts (4 hunks)
  • packages/orm/package.json (4 hunks)
  • packages/orm/src/client/crud-types.ts (2 hunks)
  • packages/orm/src/dialects/postgres.ts (1 hunks)
  • packages/orm/src/dialects/sql.js/index.ts (1 hunks)
  • packages/orm/src/dialects/sqlite.ts (1 hunks)
  • packages/orm/tsup.config.ts (1 hunks)
  • packages/plugins/policy/package.json (1 hunks)
  • packages/schema/package.json (1 hunks)
  • packages/sdk/package.json (1 hunks)
  • packages/sdk/src/ts-schema-generator.ts (7 hunks)
  • packages/server/package.json (1 hunks)
  • packages/testtools/package.json (1 hunks)
  • packages/zod/package.json (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
  • samples/next.js/package.json (1 hunks)
  • samples/orm/package.json (1 hunks)
  • tests/e2e/package.json (1 hunks)
  • tests/regression/package.json (1 hunks)
  • tests/regression/test/issue-393.test.ts (1 hunks)

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 Nov 18, 2025

Claude finished @ymc9's task —— View job


PR Review for v3.0.0-beta.24

I've completed a comprehensive review of this release PR. Here's my analysis:

Review Tasks:

  • Analyze the new better-auth adapter implementation
  • Review the CLI format command addition
  • Check schema generation improvements
  • Evaluate removal of sql.js dialect
  • Review test coverage for new features
  • Check for potential security issues
  • Assess performance implications
  • Verify code quality and best practices
  • Provide final review summary

Major Changes Analysis

Better-Auth Adapter (packages/auth-adapters/better-auth/)

Strengths:

  • Well-structured adapter implementation with proper error handling
  • Good separation of concerns between adapter logic and schema generation
  • Comprehensive database operation support (CRUD + count)
  • Proper transaction support via $transaction
  • Handles complex where clauses with AND/OR logic
  • Schema generation with relation mapping

Areas for Improvement:

  • Heavy use of as any type assertions (26+ instances) - consider stronger typing
  • Some console.warn calls in schema generator could be better structured logging
  • TODO comment about respecting package.json zenstack entry

CLI Format Command (packages/cli/src/actions/format.ts)

Strengths:

  • Clean, simple implementation
  • Proper error handling with colored output
  • Good test coverage with both valid and invalid schema handling
  • Follows existing CLI patterns

Schema Generation Improvements

Strengths:

SQL.js Dialect Consolidation

Assessment:

  • Proper refactoring - moved from separate package to ORM dialects exports
  • No breaking changes to public API
  • Good consolidation strategy

Code Quality Assessment

Security

  • No security vulnerabilities identified
  • File operations are properly scoped
  • No unsafe eval/Function usage
  • Auth adapter doesn't expose sensitive information

Performance

  • Async/await patterns used correctly
  • Reasonable database query patterns
  • No obvious N+1 issues
  • Efficient array operations (map/filter/reduce)

Test Coverage ⚠️

Best Practices ⚠️

  • Concern: Excessive use of as any in better-auth adapter
  • Good: Proper error handling patterns
  • Good: TypeScript strict mode compliance
  • Minor: Some console.warn usage that could be improved

Recommendations

  1. Add Tests for Better-Auth Adapter: This is the most significant new feature but lacks test coverage
  2. Improve Type Safety: Reduce the heavy reliance on as any in the adapter code
  3. Consider Structured Logging: Replace console.warn with proper logging infrastructure
  4. Documentation: Add README or docs for the better-auth adapter usage

Summary

This is a solid release with well-implemented features. The better-auth adapter is comprehensive and follows good patterns, though it could benefit from stronger typing and test coverage. The CLI format command is well-implemented with good tests. Overall code quality is high with proper error handling and security practices.

Recommendation: Approved with suggestions - Consider addressing the test coverage and type safety issues in a follow-up PR.

Copilot finished reviewing on behalf of ymc9 November 18, 2025 05:18
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 version 3.0.0-beta.24, introducing several key enhancements and bug fixes.

Key changes:

  • Adds a new format command to the CLI for formatting ZModel schema files
  • Fixes negative number literal generation in TypeScript schema output (issue #393)
  • Adds Better Auth adapter for ZenStack ORM
  • Moves sql.js dialect from a separate package into the main ORM package
  • Changes schema file lookup priority to favor ./schema.zmodel over ./zenstack/schema.zmodel

Reviewed Changes

Copilot reviewed 54 out of 60 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/regression/test/issue-393.test.ts Adds regression test for negative default values in schema
packages/sdk/src/ts-schema-generator.ts Fixes TypeScript generation of negative number literals and adds importWithFileExtension option
packages/cli/src/actions/format.ts Implements new format command for schema files
packages/cli/src/actions/action-utils.ts Updates schema file lookup to prioritize root-level schema.zmodel
packages/cli/src/utils/exec-utils.ts Adds fallback to npx/bunx when prisma module is not found
packages/language/src/zmodel-code-generator.ts Migrates from resolved references to $refText for code generation
packages/language/src/document.ts Exports new formatDocument function
packages/orm/src/dialects/ Consolidates sql.js dialect into main ORM package with SQLite and PostgreSQL dialects
packages/auth-adapters/better-auth/ Adds new Better Auth adapter with schema generation capabilities
packages/orm/src/client/crud-types.ts Exports additional input types for external usage
pnpm-workspace.yaml & pnpm-lock.yaml Adds sql.js and better-auth dependencies
All package.json files Bumps version to 3.0.0-beta.24
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

@claude
Copy link

claude bot commented Nov 18, 2025

Claude finished @ymc9's task —— View job


PR Review for v3.0.0-beta.24

I've completed a comprehensive review of this release PR. Here's my analysis:

Review Tasks:

  • Analyze the new better-auth adapter implementation
  • Review the CLI format command addition
  • Check schema generation improvements
  • Evaluate removal of sql.js dialect
  • Review test coverage for new features
  • Check for potential security issues
  • Assess performance implications
  • Verify code quality and best practices
  • Provide final review summary

Major Changes Analysis

Better-Auth Adapter (packages/auth-adapters/better-auth/)

Strengths:

  • Well-structured adapter implementation with proper error handling
  • Good separation of concerns between adapter logic and schema generation
  • Comprehensive database operation support (CRUD + count)
  • Proper transaction support via $transaction
  • Handles complex where clauses with AND/OR logic
  • Schema generation with relation mapping

Areas for Improvement:

  • Heavy use of as any type assertions (26+ instances) - consider stronger typing
  • Some console.warn calls in schema generator could be better structured logging
  • TODO comment about respecting package.json zenstack entry

CLI Format Command (packages/cli/src/actions/format.ts)

Strengths:

  • Clean, simple implementation
  • Proper error handling with colored output
  • Good test coverage with both valid and invalid schema handling
  • Follows existing CLI patterns

Schema Generation Improvements

Strengths:

SQL.js Dialect Consolidation

Assessment:

  • Proper refactoring - moved from separate package to ORM dialects exports
  • No breaking changes to public API
  • Good consolidation strategy

Code Quality Assessment

Security

  • No security vulnerabilities identified
  • File operations are properly scoped
  • No unsafe eval/Function usage
  • Auth adapter doesn't expose sensitive information

Performance

  • Async/await patterns used correctly
  • Reasonable database query patterns
  • No obvious N+1 issues
  • Efficient array operations (map/filter/reduce)

Test Coverage ⚠️

Best Practices ⚠️

  • Concern: Excessive use of as any in better-auth adapter
  • Good: Proper error handling patterns
  • Good: TypeScript strict mode compliance
  • Minor: Some console.warn usage that could be improved

Recommendations

  1. Add Tests for Better-Auth Adapter: This is the most significant new feature but lacks test coverage
  2. Improve Type Safety: Reduce the heavy reliance on as any in the adapter code
  3. Consider Structured Logging: Replace console.warn with proper logging infrastructure
  4. Documentation: Add README or docs for the better-auth adapter usage

Summary

This is a solid release with well-implemented features. The better-auth adapter is comprehensive and follows good patterns, though it could benefit from stronger typing and test coverage. The CLI format command is well-implemented with good tests. Overall code quality is high with proper error handling and security practices.

Recommendation: Approved with suggestions - Consider addressing the test coverage and type safety issues in a follow-up PR.


@ymc9 ymc9 added this pull request to the merge queue Nov 18, 2025
Merged via the queue into main with commit 5a36a7d Nov 18, 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.

2 participants