Skip to content

Conversation

@ymc9
Copy link
Member

@ymc9 ymc9 commented Dec 24, 2025

Summary by CodeRabbit

  • New Features

    • Added validation for views to prevent invalid constraints (@id, @@id, @@index).
    • Added test scripts for SQLite and PostgreSQL databases.
  • Documentation

    • Updated README with latest installation instructions and sponsor section.
    • Added CONTRIBUTING.md guide with setup, build, and development workflow instructions.
    • Improved CLI documentation links and descriptions.
  • Chores

    • Released v3.0.0 (final release).

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings December 24, 2025 09:08
@claude
Copy link

claude bot commented Dec 24, 2025

Claude Code is working…

I'll analyze this and get back to you.

View job run

@coderabbitai
Copy link

coderabbitai bot commented Dec 24, 2025

Warning

Rate limit exceeded

@ymc9 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 48 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 cc952b1 and 6891412.

📒 Files selected for processing (2)
  • CONTRIBUTING.md
  • README.md

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

Walkthrough

This PR performs a comprehensive 3.0.0 release of ZenStack, including version bumps across all packages from 3.0.0-beta.34 to 3.0.0, adds CONTRIBUTING.md documentation, updates README with new branding and sections, adds database-specific test scripts, updates CLI descriptions, implements view validation constraints, modifies type signatures for improved type inference, and updates test schemas.

Changes

Cohort / File(s) Summary
Version Bumping (3.0.0-beta.34 → 3.0.0)
package.json, packages/auth-adapters/better-auth/package.json, packages/cli/package.json, packages/clients/tanstack-query/package.json, packages/common-helpers/package.json, packages/config/eslint-config/package.json, packages/config/typescript-config/package.json, packages/config/vitest-config/package.json, packages/create-zenstack/package.json, packages/language/package.json, packages/orm/package.json, packages/plugins/policy/package.json, packages/schema/package.json, packages/sdk/package.json, packages/server/package.json, packages/testtools/package.json, packages/zod/package.json, samples/next.js/package.json, samples/orm/package.json, tests/e2e/package.json, tests/regression/package.json, tests/runtimes/bun/package.json, tests/runtimes/edge-runtime/package.json
Uniform version field updates across 23 package manifests to release version 3.0.0
Documentation & Project Configuration
.gitignore, CONTRIBUTING.md, README.md
Added macOS .DS_Store to gitignore; created new CONTRIBUTING.md with setup, development workflow, and project structure guidance; updated README header, feature descriptions, quick-start examples, installation commands, and added Sponsors/Community sections
Root Package Scripts & Build
package.json (root)
Added test:all, test:sqlite, test:pg scripts for database-specific testing; removed --tag next flag from publish-all and publish-preview scripts
CLI Package Updates
packages/cli/package.json, packages/cli/src/index.ts
Updated CLI description from "data layer" to "modern data layer"; changed docs URL from /docs/3.x to /docs
Language Package View Validation
packages/language/src/validators/attribute-application-validator.ts, packages/language/src/validators/datamodel-validator.ts, packages/language/test/view.test.ts
Added _checkId validator method and enhanced _checkConstraint to disallow @id, @@id, @@index on views; skip unique criteria validation for views; added comprehensive test suite for view validation rules
Type System Enhancements
packages/language/src/utils.ts, packages/orm/src/client/contract.ts
Changed getContainingDataModel parameter type from Expression to AstNode (broadens input acceptance); added default type parameter ClientOptions<Schema> to ClientConstructor Options generic for improved type inference
Policy Plugin Documentation
packages/plugins/policy/plugin.zmodel
Updated check(field, operation) function documentation to clarify it delegates access control to relations
Test Schema Updates
tests/e2e/github-repos/cal.com/schema.ts, tests/e2e/github-repos/cal.com/schema.zmodel
Removed @id attribute from BookingTimeStatusDenormalized view's id field, retaining only @unique

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A rabbit hops with glee,
Version three point oh is free!
Views are validated with care,
New docs everywhere,
The stable release we shall see! 🚀

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 'merge dev to main (v3.0.0)' directly corresponds to the pull request's primary objective of merging the dev branch into main for version 3.0.0 release, as evidenced by the comprehensive version bumps and release-related changes across the entire codebase.

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.

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, releasing ZenStack version 3.0.0 as a stable release (upgrading from 3.0.0-beta.34). Key changes include:

  • Version bumps across all packages from 3.0.0-beta.34 to 3.0.0
  • New validation rules for database views (disallowing @id and @@id/@@index attributes)
  • Documentation updates removing beta notices and improving clarity
  • New CONTRIBUTING.md guide for contributors

Reviewed changes

Copilot reviewed 34 out of 35 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
package.json Bumped version to 3.0.0, updated npm scripts to remove beta tags, added test scripts for different database providers
packages/*/package.json Updated version to 3.0.0 across all packages (cli, orm, language, server, sdk, schema, zod, testtools, plugins, clients, auth-adapters, config packages)
tests/*/package.json Updated version to 3.0.0 across all test packages (e2e, regression, runtime tests)
samples/*/package.json Updated version to 3.0.0 across sample projects
packages/language/test/view.test.ts New test file validating that views don't allow @id, @@id, or @@index attributes but do allow @@unique
packages/language/src/validators/attribute-application-validator.ts Added validation checks to reject @id, @@id, and @@index on views
packages/language/src/validators/datamodel-validator.ts Skip unique criteria requirement check for views
packages/language/src/utils.ts Broadened getContainingDataModel signature to accept AstNode instead of just Expression
tests/e2e/github-repos/cal.com/schema.zmodel Removed @id attribute from BookingTimeStatusDenormalized view, keeping only @unique
tests/e2e/github-repos/cal.com/schema.ts Updated schema definition to reflect removal of @id attribute for view
packages/orm/src/client/contract.ts Added default type parameter to ClientConstructor interface for better API flexibility
packages/plugins/policy/plugin.zmodel Updated documentation for check() function to correctly describe delegation behavior
packages/cli/src/index.ts Updated CLI description and documentation URL (removed version-specific path)
README.md Comprehensive documentation update: removed beta warnings, updated installation instructions, added sponsor section, improved feature descriptions
CONTRIBUTING.md New contributor guide with development workflow, project structure, and testing instructions
.gitignore Added .DS_Store to ignore macOS system files

💡 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: 0

🧹 Nitpick comments (3)
CONTRIBUTING.md (1)

1-109: Comprehensive contribution guide - excellent addition!

The CONTRIBUTING.md provides clear and helpful guidance for new contributors, covering prerequisites, setup steps, development workflow, and project structure. The content is well-organized and thorough.

Optional: Minor wording refinements

Line 12: Consider using "PostgreSQL" instead of "postgres" for consistency with formal naming conventions.

Line 31: Consider replacing "very simple" with "straightforward" to strengthen the wording.

README.md (1)

8-8: Documentation updates for 3.0.0 release look great!

The changes appropriately reflect the stable release:

  • Updated branding and feature descriptions
  • Installation commands now point to @latest instead of @next
  • Documentation links updated to the stable path
  • Nice additions for Sponsors and Community sections
Optional: Minor markdown style improvement

Line 26: Consider wrapping the bare URL in angle brackets for better markdown compliance:

-> Read full documentation at 👉🏻 https://zenstack.dev/docs.
+> Read full documentation at 👉🏻 <https://zenstack.dev/docs>.

Also applies to: 26-26, 59-59, 67-67, 75-76, 85-113

packages/language/src/validators/attribute-application-validator.ts (1)

309-312: Consider adding early return after view validation error.

When @@id or @@index is used on a view, the validation continues and may emit additional errors about the fields argument. Consider returning early after the view error to provide a cleaner single error message.

🔎 Proposed fix
         const dm = getContainingDataModel(attr);
         if (dm?.isView && (attr.decl.$refText === '@@id' || attr.decl.$refText === '@@index')) {
             accept('error', `\`${attr.decl.$refText}\` is not allowed for views`, { node: attr });
+            return;
         }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e371ec9 and cc952b1.

📒 Files selected for processing (35)
  • .gitignore
  • CONTRIBUTING.md
  • README.md
  • package.json
  • packages/auth-adapters/better-auth/package.json
  • packages/cli/package.json
  • packages/cli/src/index.ts
  • packages/clients/tanstack-query/package.json
  • packages/common-helpers/package.json
  • packages/config/eslint-config/package.json
  • packages/config/typescript-config/package.json
  • packages/config/vitest-config/package.json
  • packages/create-zenstack/package.json
  • packages/language/package.json
  • packages/language/src/utils.ts
  • packages/language/src/validators/attribute-application-validator.ts
  • packages/language/src/validators/datamodel-validator.ts
  • packages/language/test/view.test.ts
  • packages/orm/package.json
  • packages/orm/src/client/contract.ts
  • packages/plugins/policy/package.json
  • packages/plugins/policy/plugin.zmodel
  • packages/schema/package.json
  • packages/sdk/package.json
  • packages/server/package.json
  • packages/testtools/package.json
  • packages/zod/package.json
  • samples/next.js/package.json
  • samples/orm/package.json
  • tests/e2e/github-repos/cal.com/schema.ts
  • tests/e2e/github-repos/cal.com/schema.zmodel
  • tests/e2e/package.json
  • tests/regression/package.json
  • tests/runtimes/bun/package.json
  • tests/runtimes/edge-runtime/package.json
🧰 Additional context used
📓 Path-based instructions (2)
**/*.zmodel

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.zmodel: Always run zenstack generate after modifying ZModel schemas
ZModel schema files should define database structure and policies that compile to TypeScript via zenstack generate

Files:

  • packages/plugins/policy/plugin.zmodel
  • tests/e2e/github-repos/cal.com/schema.zmodel
tests/e2e/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

E2E tests should validate real-world schema compatibility with established projects

Files:

  • tests/e2e/github-repos/cal.com/schema.ts
🧠 Learnings (11)
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to **/*.zmodel : ZModel schema files should define database structure and policies that compile to TypeScript via `zenstack generate`

Applied to files:

  • packages/zod/package.json
  • packages/language/package.json
  • packages/schema/package.json
  • CONTRIBUTING.md
  • README.md
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to tests/e2e/**/*.{ts,tsx} : E2E tests should validate real-world schema compatibility with established projects

Applied to files:

  • tests/e2e/package.json
  • packages/language/test/view.test.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.test.{ts,tsx} : ORM package tests should include comprehensive client API tests and policy tests

Applied to files:

  • CONTRIBUTING.md
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/cli/**/*.test.{ts,tsx} : CLI package tests should focus on action-specific tests for each command

Applied to files:

  • CONTRIBUTING.md
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to tests/**/type*.{ts,tsx} : Ensure TypeScript inference and type coverage are validated through type coverage tests

Applied to files:

  • packages/language/test/view.test.ts
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.{ts,tsx} : Use Kysely as the query builder interface for low-level database queries, avoiding raw SQL when possible

Applied to files:

  • README.md
  • packages/orm/package.json
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Database migrations should use Prisma CLI under the hood via ZenStack commands

Applied to files:

  • README.md
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to packages/zenstackhq/orm/**/*.{ts,tsx} : Implement plugin hooks at ORM, Kysely, and entity mutation levels for query interception and customization

Applied to files:

  • README.md
  • packages/orm/package.json
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Use `pnpm` with workspaces for package management, pinned to version `pnpm10.12.1`

Applied to files:

  • package.json
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Use Turbo for build orchestration and run `pnpm build`, `pnpm watch`, `pnpm lint`, and `pnpm test` for development tasks

Applied to files:

  • package.json
📚 Learning: 2025-11-26T01:55:04.540Z
Learnt from: CR
Repo: zenstackhq/zenstack-v3 PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-26T01:55:04.540Z
Learning: Applies to ide/vscode/**/{package.json,version.ts} : The VSCode IDE extension package should maintain a different version from other packages to comply with VSCode Marketplace requirements

Applied to files:

  • tests/runtimes/bun/package.json
🧬 Code graph analysis (3)
packages/language/src/utils.ts (2)
packages/language/src/ast.ts (3)
  • AstNode (4-4)
  • AstNode (66-71)
  • DataModel (49-54)
packages/language/src/generated/ast.ts (2)
  • DataModel (377-387)
  • DataModel (389-389)
packages/orm/src/client/contract.ts (2)
packages/schema/src/schema.ts (1)
  • SchemaDef (11-19)
packages/orm/src/client/options.ts (1)
  • ClientOptions (45-110)
packages/language/src/validators/attribute-application-validator.ts (2)
packages/schema/src/schema.ts (1)
  • AttributeApplication (40-43)
packages/language/src/utils.ts (1)
  • getContainingDataModel (504-513)
🪛 LanguageTool
CONTRIBUTING.md

[grammar] ~12-~12: Ensure spelling is correct
Context: ... SQLite and Postgres. You should have a postgres server (16 or above) running (either na...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[style] ~31-~31: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...# Development workflow ZenStack adopts a very simple development workflow: 1. Changes shou...

(EN_WEAK_ADJECTIVE)


[style] ~107-~107: Consider shortening or rephrasing this to strengthen your wording.
Context: ...the packages in the workspace. Once you make changes to a package and rebuild it, the sample pr...

(MAKE_CHANGES)

🪛 markdownlint-cli2 (0.18.1)
README.md

26-26: Bare URL used

(MD034, no-bare-urls)

⏰ 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). (4)
  • GitHub Check: Agent
  • GitHub Check: claude-review
  • GitHub Check: build-test (20.x, postgresql)
  • GitHub Check: build-test (20.x, sqlite)
🔇 Additional comments (34)
tests/runtimes/edge-runtime/package.json (1)

3-3: LGTM! Version bump aligns with v3.0.0 release.

The version update from beta to stable is appropriate for the coordinated v3.0.0 release across the monorepo.

packages/orm/package.json (1)

3-3: LGTM! Version bump aligns with v3.0.0 release.

The version update from beta to stable is appropriate for the coordinated v3.0.0 release across the monorepo.

samples/orm/package.json (1)

3-3: LGTM! Version bump aligns with v3.0.0 release.

The version update from beta to stable is appropriate for the coordinated v3.0.0 release across the monorepo.

packages/config/vitest-config/package.json (1)

4-4: LGTM! Version bump aligns with v3.0.0 release.

The version update from beta to stable is appropriate for the coordinated v3.0.0 release across the monorepo.

packages/server/package.json (1)

3-3: LGTM! Version bump aligns with v3.0.0 release.

The version update from beta to stable is appropriate for the coordinated v3.0.0 release across the monorepo.

packages/config/typescript-config/package.json (1)

3-3: LGTM! Version bump aligns with v3.0.0 release.

The version update from beta to stable is appropriate for the coordinated v3.0.0 release across the monorepo.

samples/next.js/package.json (1)

3-3: LGTM! Version bump aligns with v3.0.0 release.

The version update from beta to stable is appropriate for the coordinated v3.0.0 release across the monorepo.

packages/language/package.json (1)

4-4: LGTM! Version bump aligns with v3.0.0 release.

The version update from beta to stable is appropriate for the coordinated v3.0.0 release across the monorepo.

tests/e2e/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version update from beta to stable release is consistent with the PR objective.

packages/clients/tanstack-query/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version update is appropriate for the stable release.

packages/common-helpers/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version update is consistent with the monorepo-wide release.

tests/regression/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version update aligns with the workspace-wide release.

packages/auth-adapters/better-auth/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version update is appropriate for the stable release of the Better Auth adapter.

packages/zod/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version update is consistent with the monorepo-wide release.

.gitignore (1)

11-11: LGTM! Standard macOS system file exclusion.

Adding .DS_Store to .gitignore is a common best practice to prevent macOS system metadata from being committed to the repository.

packages/sdk/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version update is appropriate for the stable release of the SDK package.

packages/testtools/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version bump from 3.0.0-beta.34 to 3.0.0 is appropriate for the final release.

packages/plugins/policy/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version bump from 3.0.0-beta.34 to 3.0.0 is appropriate for the final release.

tests/e2e/github-repos/cal.com/schema.zmodel (1)

1650-1650: Ensure zenstack generate has been run after this schema change.

The removal of @id from the view's id field aligns with view-specific validation constraints. As per coding guidelines, please confirm that zenstack generate has been executed after modifying this ZModel schema.

Based on coding guidelines: ZModel schema files should define database structure and policies that compile to TypeScript via zenstack generate.

tests/runtimes/bun/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version bump from 3.0.0-beta.34 to 3.0.0 is appropriate for the final release.

packages/config/eslint-config/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version bump from 3.0.0-beta.34 to 3.0.0 is appropriate for the final release.

packages/create-zenstack/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version bump from 3.0.0-beta.34 to 3.0.0 is appropriate for the final release.

packages/schema/package.json (1)

3-3: LGTM! Version bump for 3.0.0 release.

The version bump from 3.0.0-beta.34 to 3.0.0 is appropriate for the final release.

packages/cli/src/index.ts (1)

53-53: LGTM! CLI description and documentation URL updated for 3.0.0 release.

The updated description text and simplified docs URL appropriately reflect the 3.0.0 release branding and documentation structure.

packages/language/src/utils.ts (1)

504-513: LGTM! Backward-compatible type broadening.

Widening the parameter type from Expression to AstNode is a safe change since Expression is a subtype of AstNode. The function body only relies on the $container property from AstNode, so the implementation remains correct. This enables validators to retrieve the containing DataModel from any AST node type, as needed for the view-aware validation work.

tests/e2e/github-repos/cal.com/schema.ts (1)

6658-6663: View id attribute change is consistent with new view constraints

Dropping the @id attribute for BookingTimeStatusDenormalized.id while keeping id: true, unique: true, and @unique matches the pattern already used for other views (e.g., BookingTimeStatus) and aligns with the new rule that views shouldn’t declare @id/@@id but may still have a unique logical key. This keeps the e2e cal.com fixture representative while complying with the updated validator semantics, as per coding guidelines for real‑world schema compatibility.

packages/plugins/policy/plugin.zmodel (1)

36-38: Documentation improvement looks good.

The updated description more accurately conveys the delegation semantics of the check function. The clarification that only to-one relations are supported is helpful.

Based on coding guidelines, remember to run zenstack generate after modifying ZModel schemas.

packages/orm/src/client/contract.ts (1)

246-246: Type inference improvement LGTM.

Adding a default value for the Options generic parameter improves the developer experience by enabling better type inference when the parameter doesn't need to be explicitly specified.

packages/cli/package.json (1)

6-6: Version bump to 3.0.0 looks good.

The version update from beta to stable release is appropriate for this PR's objectives.

packages/language/src/validators/datamodel-validator.ts (1)

53-53: View exemption from unique criteria validation is appropriate.

Exempting views from the requirement to have unique criteria makes sense, as views are read-only database objects that don't need the same constraints as regular models. This change aligns well with the view validation tests introduced in this PR.

packages/language/test/view.test.ts (1)

1-84: Well-structured test suite for view validation.

The test cases comprehensively cover the new view validation constraints:

  • Regular views work without unique criteria
  • Disallowed constructs (@id, @@id, @@index) are properly rejected
  • Allowed constructs (@@unique) are accepted

The test structure follows Vitest conventions and aligns well with the validator changes.

package.json (1)

3-3: Root package updates for 3.0.0 release LGTM.

The changes appropriately support the stable release:

  • Version bump to 3.0.0
  • Database-specific test scripts (test:sqlite, test:pg, test:all) enable flexible testing workflows
  • Publish scripts updated to remove the --tag next flag

These align well with the testing guidance in CONTRIBUTING.md.

Also applies to: 12-14, 19-20

packages/language/src/validators/attribute-application-validator.ts (2)

30-30: LGTM!

The import of getContainingDataModel is correctly added and appropriately placed with other utility imports from the same module.


297-303: LGTM!

The new _checkId validation correctly prevents @id from being used on view data models. The implementation follows the established pattern for attribute checkers, and the error message is clear and consistent.

@claude
Copy link

claude bot commented Dec 24, 2025

Claude finished @ymc9's task —— View job


PR Review: ZenStack v3.0.0 Release

This is a comprehensive review of the v3.0.0 stable release PR merging dev to main. Overall, this appears to be a well-executed major release with careful attention to version consistency and thoughtful feature additions.

Review Tasks

  • Read repository guidelines (CLAUDE.md)
  • Analyze version consistency across packages
  • Review view validation implementation
  • Check documentation updates
  • Evaluate test coverage
  • Review security considerations
  • Assess overall code quality

✅ Strengths

1. Version Management Excellence

  • Consistent versioning: All 23 packages properly bumped from 3.0.0-beta.34 to 3.0.0
  • Proper release preparation: Removed --tag next flags from publish scripts in root package.json:19-20
  • Smart test organization: Added database-specific test scripts (test:sqlite, test:pg, test:all) that align with the multi-database support strategy

2. Robust View Validation Implementation

The new view validation feature is well-implemented:

  • Clear validation logic in packages/language/src/validators/attribute-application-validator.ts:297-312:

    • @id validation (lines 298-303)
    • @@id and @@index validation (lines 309-312)
    • Allows @@unique on views (appropriate for read-only database objects)
  • Comprehensive test coverage in packages/language/test/view.test.ts:

    • Tests regular views work without unique criteria
    • Validates rejection of @id, @@id, @@index on views
    • Confirms @@unique is allowed on views
  • Smart integration with existing validation in packages/language/src/validators/datamodel-validator.ts:53:

    • Views exempted from unique criteria requirements (appropriate for read-only objects)

3. Documentation Improvements

  • Professional CONTRIBUTING.md: Clear setup instructions, development workflow, and project structure
  • Updated README.md: Removed beta warnings, updated installation to use @latest, improved feature descriptions
  • Consistent CLI updates: Updated descriptions and documentation URLs in packages/cli/src/index.ts

4. Type System Enhancements

  • Improved type inference in packages/orm/src/client/contract.ts:246: Added default type parameter for better developer experience
  • Broader API support in packages/language/src/utils.ts:504: Changed parameter type from Expression to AstNode for more flexibility

⚠️ Areas for Improvement

1. Minor Documentation Issues

  • Connection string syntax error in CONTRIBUTING.md:14:

    - `postgresql://${TEST_PG_USER}:${TEST_PG_PASSWORD}$@${TEST_PG_HOST}$:${TEST_PG_PORT}`
    + `postgresql://${TEST_PG_USER}:${TEST_PG_PASSWORD}@${TEST_PG_HOST}:${TEST_PG_PORT}`

    Dollar signs should only prefix variable names, not suffix them.

  • Bare URL in README at line 26: Consider wrapping in angle brackets for better markdown compliance.

2. Validation Logic Consideration

  • Potential error cascade in packages/language/src/validators/attribute-application-validator.ts:309-312:
    When @@id or @@index is used on a view, validation continues and may emit additional confusing errors about the fields argument. Consider early return after view validation error for cleaner UX.

3. Schema Migration Verification

  • E2E test schema update: The change in tests/e2e/github-repos/cal.com/schema.zmodel:1650 removes @id from the view's id field, keeping only @unique. This aligns with the new validation rules, but ensure zenstack generate was run after this change per CLAUDE.md guidelines.

🔒 Security Assessment

No security concerns identified. The changes are primarily:

  • Version bumps and documentation updates
  • Database schema validation enhancements (defensive)
  • Type system improvements
  • No new external dependencies or security-sensitive code paths

🧪 Test Coverage Assessment

Strong test coverage for new features:

  • View validation has comprehensive test suite covering all new constraints
  • Real-world compatibility maintained through cal.com schema updates
  • Database-specific test scripts support the multi-provider testing strategy

Recommendation: Consider adding tests for the validation error cascade scenario mentioned above.

📈 Performance Considerations

No performance regressions expected:

  • New validation logic runs only during schema compilation
  • Type system changes improve compile-time inference without runtime impact
  • No new runtime dependencies or algorithmic changes

🎯 Overall Assessment

This is a high-quality major release that demonstrates:

  • Careful version management across a complex monorepo
  • Thoughtful feature implementation with proper testing
  • Professional documentation and developer experience improvements
  • Attention to backwards compatibility and migration paths

The view validation feature adds important database constraints while maintaining the schema-first design philosophy. The release is ready for production use.

Recommendation: ✅ Approve for merge


@ymc9 ymc9 added this pull request to the merge queue Dec 24, 2025
Merged via the queue into main with commit 2966af1 Dec 24, 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