Skip to content

Conversation

@ymc9
Copy link
Member

@ymc9 ymc9 commented Oct 13, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Relation selection now accepts either a single orderBy object or an array for to-many relations.
    • Prevented duplicate “.ts” extensions when supplying extra source files in test utilities.
    • Improved base-model and mixin inheritance resolution for data models.
  • Tests

    • Added extensive regression tests covering multi-schema behavior, policy enforcement, inheritance/delegation, nested create/update flows, enum defaults, ordering (single/array/nested), JSON fields, unsupported types, and relation connect scenarios.

Copilot AI review requested due to automatic review settings October 13, 2025 05:12
@coderabbitai
Copy link

coderabbitai bot commented Oct 13, 2025

Walkthrough

Updates language base-resolution to include mixins and optional baseModel, broadening declaration matching. Adjusts runtime relation validator to accept single or array orderBy in to-many selects/includes. Fixes testtools extraSourceFiles extension handling. Adds multiple regression tests under tests/regression/test/v2-migrated covering schemas, policies, delegation, ordering, and validation scenarios.

Changes

Cohort / File(s) Summary
Language base resolution
packages/language/src/utils.ts
Refactors getRecursiveBases to aggregate bases from mixins and optional baseModel; expands base declaration lookup to match by name across TypeDef and DataModel.
Runtime relation validator
packages/runtime/src/client/crud/validator/index.ts
In makeRelationSelectIncludeSchema (to-many), wraps orderBy in lazy(orArray(...)) to allow single or array orderBy inputs.
Testtools schema helpers
packages/testtools/src/schema.ts
Appends .ts to extraSourceFiles keys only when missing, preventing double extensions.
Regression tests additions
tests/regression/test/v2-migrated/issue-1647.test.ts, .../issue-1648.test.ts, .../issue-1674.test.ts, .../issue-1681.test.ts, .../issue-1693.test.ts, .../issue-1695.test.ts, .../issue-1698.test.ts, .../issue-1734.test.ts, .../issue-1745.test.ts, .../issue-1755.test.ts, .../issue-1758.test.ts, .../issue-1763.test.ts, .../issue-1786.test.ts, .../issue-1835.test.ts, .../issue-1849.test.ts, .../issue-1857.test.ts, .../issue-1870.test.ts, .../issue-1894.test.ts
Adds tests for multi-schema inheritance, policy enforcement, delegation, orderBy (single/array, nested), schema loading/validation, polymorphism constraints, JSON fields, unsupported types, and relation connect flows. Some tests are skipped.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

A whisk of code, a hop through base and mixin trails,
I nibbled at orderBy till arrays could wag their tails.
No double .ts—my paws fixed that neat,
Then tests sprang up like clover, complete.
Thump-thump! The garden compiles—so sweet. 🥕🐇

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 reflects the main code change—a fix for the relation include orderBy validation issue—while also noting the substantial addition of migrated tests, making it both concise and specific to the pull request contents.
✨ 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 fix/include-validation

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

Claude finished @ymc9's task —— View job


Code Review Completed

PR Summary: This PR fixes a validation issue with relation include orderBy and adds 18 new regression tests migrated from v2.

🔧 Core Changes Analysis

1. Runtime Validator Fix (packages/runtime/src/client/crud/validator/index.ts:680-682)

  • Issue Fixed: Relation include orderBy validation was not properly handling array syntax
  • Solution: Wrapped makeOrderBySchema with orArray() to allow both scalar and array forms
  • Impact: Enables { include: { relation: { orderBy: [{ field: 'desc' }] } } } syntax

2. Language Utils Enhancement (packages/language/src/utils.ts:166-180)

  • Improvement: Enhanced getRecursiveBases() to handle both mixins and base models uniformly
  • Change: Combined mixin and baseModel processing into a single loop for better maintainability
  • Type Safety: Updated type guard to handle both TypeDef and DataModel

3. Test Tools Fix (packages/testtools/src/schema.ts:57)

  • Bug Fix: File extension handling now properly checks for .ts suffix to avoid double-extension

📋 Test Coverage Assessment

Added 18 comprehensive regression tests covering:

  • ✅ Polymorphic inheritance (delegates)
  • ✅ Multi-schema support
  • ✅ Access control policies
  • ✅ Relation orderBy validation (the main fix!)
  • ✅ Complex delegate relationships
  • ✅ JSON type handling
  • ✅ Enum imports across files

🎯 Code Quality

Strengths:

  • ✅ Minimal, focused changes addressing specific issues
  • ✅ Comprehensive test coverage for edge cases
  • ✅ Proper TypeScript types and validation
  • ✅ Following existing code patterns consistently

Security Considerations:

  • ✅ No security concerns - validation improvements actually enhance security
  • ✅ Input validation is strengthened, not weakened

Performance Impact:

  • ✅ Minimal performance impact - just adds array validation option
  • ✅ No new computational complexity introduced

🏆 Overall Assessment

This is a high-quality fix that:

  1. Solves a real user pain point - relation orderBy array syntax wasn't properly validated
  2. Maintains backward compatibility - scalar orderBy still works
  3. Includes comprehensive testing - 18 new regression tests prevent future regressions
  4. Follows clean code principles - minimal, focused changes

Recommendation: ✅ APPROVE

The validation fix is essential for users who need to sort included relations using array syntax, and the extensive test suite greatly improves confidence in the stability of delegate/polymorphic features.


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 fixes a relation include orderBy validation issue and adds multiple test migrations for various bug regression tests. The fix ensures that orderBy validation properly handles arrays in relation includes, while the test migrations verify that previously reported issues remain resolved.

  • Fixed orderBy validation in relation includes to properly handle array inputs
  • Added comprehensive regression test coverage for issues #1647-#1894
  • Updated testtools to handle TypeScript file extensions more flexibly

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.

File Description
packages/runtime/src/client/crud/validator/index.ts Fixed orderBy validation to use orArray wrapper for relation includes
packages/testtools/src/schema.ts Added support for .ts file extension handling in extra source files
packages/language/src/utils.ts Enhanced recursive base type resolution to include base models alongside mixins
tests/regression/test/v2-migrated/*.test.ts Added 17 regression test files covering various schema validation and functionality issues

Tip: Customize your code reviews with copilot-instructions.md. Create the file or 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: 3

🧹 Nitpick comments (7)
tests/regression/test/v2-migrated/issue-1758.test.ts (1)

4-4: Consider a more descriptive test name.

The test name "verifies issue 1758" is functional but doesn't convey what the test validates. Consider a more descriptive name that explains the scenario being tested.

Apply this diff for a more descriptive name:

-it('verifies issue 1758', async () => {
+it('validates error when using inherited fields from polymorphic base in @@unique', async () => {

Optionally, add a comment referencing the issue number for traceability:

+// Regression test for issue #1758
 it('validates error when using inherited fields from polymorphic base in @@unique', async () => {
tests/regression/test/v2-migrated/issue-1849.test.ts (1)

1-27: LGTM! Consider adding a comment describing issue 1849.

The test correctly exercises schema loading with an external enum module import and default enum value usage. The loadSchema call properly maps the additional schema key 'enum' to enum.zmodel, which resolves the import statement import './enum' as expected.

The implicit assertion via loadSchema's internal validation is sufficient for a regression test verifying that this schema pattern loads without errors.

Optionally, add a brief comment explaining what issue 1849 was to improve maintainability:

+// Issue 1849: [brief description of the original issue]
 it('verifies issue 1849', async () => {
tests/regression/test/v2-migrated/issue-1786.test.ts (1)

1-46: LGTM! Well-structured regression test.

The test correctly follows the v2-migrated pattern: loading an inline schema with mixins (with BaseContent), inheritance (extends Content), delegation (@@delegate), and access control rules. The implicit assertion in loadSchema (which validates successful schema loading) is sufficient for verifying that issue 1786's scenario compiles without errors.

Consider adding a brief comment above the test explaining what specific aspect of issue 1786 this verifies (e.g., "Tests delegation with mixins and inheritance" or similar context).

tests/regression/test/v2-migrated/issue-1698.test.ts (2)

41-59: Consider removing debug console.log statements.

The data creation logic is correct and properly connects the polymorphic entities. The console.log statements (lines 44, 49, 54, 59) are useful during development but could be removed for cleaner test output.

Apply this diff to remove the console.log statements:

     const door1 = await db.ironDoor.create({
         data: { strength: 100, color: 'blue' },
     });
-    console.log(door1);
 
     const door2 = await db.woodenDoor.create({
         data: { texture: 'pine', color: 'red' },
     });
-    console.log(door2);
 
     const house1 = await db.privateHouse.create({
         data: { size: 5000, door: { connect: { id: door1.id } } },
     });
-    console.log(house1);
 
     const house2 = await db.skyscraper.create({
         data: { height: 3000, door: { connect: { id: door2.id } } },
     });
-    console.log(house2);

61-71: Assertions correctly verify polymorphic relation includes.

The test properly validates that including delegated relations returns the correct polymorphic type with all fields (IronDoor's strength and WoodenDoor's texture). The expected values match the created data.

Similar to the data creation block, consider removing the console.log statements (lines 62, 68) for cleaner test output.

Apply this diff to remove the console.log statements:

     const r1 = await db.privateHouse.findFirst({ include: { door: true } });
-    console.log(r1);
     expect(r1).toMatchObject({
         door: { color: 'blue', strength: 100 },
     });
 
     const r2 = (await db.skyscraper.findMany({ include: { door: true } }))[0];
-    console.log(r2);
     expect(r2).toMatchObject({
         door: { color: 'red', texture: 'pine' },
     });
tests/regression/test/v2-migrated/issue-1857.test.ts (1)

25-25: Replace type assertion with proper options.

Using {} as any bypasses type checking and could hide configuration issues.

-                const db = new ZenStackClient(schema, {} as any);
+                const db = new ZenStackClient(schema, { dialect: options.dialect });

Note: You may need to pass the dialect or other required options from the outer scope.

tests/regression/test/v2-migrated/issue-1734.test.ts (1)

4-5: Skipped test is appropriate for incomplete feature.

The test is correctly skipped with a clear TODO comment indicating that field-level policy support is pending. This is good practice for work-in-progress features.

If there isn't already a tracking issue for field-level policy support, would you like me to help draft one to ensure this test gets re-enabled once the feature is complete?

📜 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 332b1db and c1ad53e.

📒 Files selected for processing (21)
  • packages/language/src/utils.ts (1 hunks)
  • packages/runtime/src/client/crud/validator/index.ts (1 hunks)
  • packages/testtools/src/schema.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1647.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1648.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1674.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1681.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1693.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1695.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1698.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1734.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1745.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1755.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1758.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1763.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1786.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1835.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1849.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1857.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1870.test.ts (1 hunks)
  • tests/regression/test/v2-migrated/issue-1894.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
{packages,samples,tests}/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place packages only under packages/, samples/, or tests/

Files:

  • tests/regression/test/v2-migrated/issue-1755.test.ts
  • tests/regression/test/v2-migrated/issue-1647.test.ts
  • tests/regression/test/v2-migrated/issue-1693.test.ts
  • tests/regression/test/v2-migrated/issue-1648.test.ts
  • packages/testtools/src/schema.ts
  • packages/runtime/src/client/crud/validator/index.ts
  • tests/regression/test/v2-migrated/issue-1681.test.ts
  • tests/regression/test/v2-migrated/issue-1870.test.ts
  • tests/regression/test/v2-migrated/issue-1734.test.ts
  • tests/regression/test/v2-migrated/issue-1698.test.ts
  • tests/regression/test/v2-migrated/issue-1786.test.ts
  • tests/regression/test/v2-migrated/issue-1894.test.ts
  • tests/regression/test/v2-migrated/issue-1835.test.ts
  • tests/regression/test/v2-migrated/issue-1695.test.ts
  • tests/regression/test/v2-migrated/issue-1857.test.ts
  • tests/regression/test/v2-migrated/issue-1745.test.ts
  • packages/language/src/utils.ts
  • tests/regression/test/v2-migrated/issue-1674.test.ts
  • tests/regression/test/v2-migrated/issue-1763.test.ts
  • tests/regression/test/v2-migrated/issue-1849.test.ts
  • tests/regression/test/v2-migrated/issue-1758.test.ts
**/schema.ts

📄 CodeRabbit inference engine (CLAUDE.md)

The generated TypeScript schema should be named schema.ts

Files:

  • packages/testtools/src/schema.ts
🧠 Learnings (1)
📚 Learning: 2025-09-04T12:38:14.150Z
Learnt from: CR
PR: zenstackhq/zenstack-v3#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-04T12:38:14.150Z
Learning: Applies to **/schema.ts : The generated TypeScript schema should be named `schema.ts`

Applied to files:

  • packages/testtools/src/schema.ts
🧬 Code graph analysis (19)
tests/regression/test/v2-migrated/issue-1755.test.ts (2)
packages/testtools/src/client.ts (1)
  • createTestClient (51-166)
packages/runtime/src/client/functions.ts (1)
  • now (106-106)
tests/regression/test/v2-migrated/issue-1647.test.ts (1)
packages/testtools/src/schema.ts (1)
  • loadSchema (94-124)
tests/regression/test/v2-migrated/issue-1693.test.ts (1)
packages/testtools/src/schema.ts (1)
  • loadSchema (94-124)
tests/regression/test/v2-migrated/issue-1648.test.ts (1)
packages/testtools/src/client.ts (1)
  • createPolicyTestClient (176-187)
tests/regression/test/v2-migrated/issue-1681.test.ts (1)
packages/testtools/src/client.ts (1)
  • createTestClient (51-166)
tests/regression/test/v2-migrated/issue-1870.test.ts (1)
packages/testtools/src/schema.ts (1)
  • loadSchema (94-124)
tests/regression/test/v2-migrated/issue-1734.test.ts (1)
packages/testtools/src/client.ts (1)
  • createPolicyTestClient (176-187)
tests/regression/test/v2-migrated/issue-1698.test.ts (1)
packages/testtools/src/client.ts (1)
  • createTestClient (51-166)
tests/regression/test/v2-migrated/issue-1786.test.ts (1)
packages/testtools/src/schema.ts (1)
  • loadSchema (94-124)
tests/regression/test/v2-migrated/issue-1894.test.ts (1)
packages/testtools/src/client.ts (1)
  • createTestClient (51-166)
tests/regression/test/v2-migrated/issue-1835.test.ts (1)
packages/testtools/src/schema.ts (1)
  • loadSchema (94-124)
tests/regression/test/v2-migrated/issue-1695.test.ts (1)
packages/testtools/src/schema.ts (1)
  • loadSchema (94-124)
tests/regression/test/v2-migrated/issue-1857.test.ts (1)
packages/testtools/src/client.ts (1)
  • createTestClient (51-166)
tests/regression/test/v2-migrated/issue-1745.test.ts (1)
packages/testtools/src/schema.ts (1)
  • loadSchema (94-124)
packages/language/src/utils.ts (2)
packages/language/src/generated/ast.ts (6)
  • isDataModel (391-393)
  • TypeDef (725-733)
  • TypeDef (735-735)
  • DataModel (377-387)
  • DataModel (389-389)
  • isTypeDef (737-739)
packages/language/src/ast.ts (1)
  • DataModel (49-54)
tests/regression/test/v2-migrated/issue-1674.test.ts (1)
packages/testtools/src/client.ts (1)
  • createPolicyTestClient (176-187)
tests/regression/test/v2-migrated/issue-1763.test.ts (1)
packages/testtools/src/client.ts (1)
  • createTestClient (51-166)
tests/regression/test/v2-migrated/issue-1849.test.ts (1)
packages/testtools/src/schema.ts (1)
  • loadSchema (94-124)
tests/regression/test/v2-migrated/issue-1758.test.ts (1)
packages/testtools/src/schema.ts (1)
  • loadSchemaWithError (126-148)
⏰ 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). (3)
  • GitHub Check: build-test (20.x, postgresql)
  • GitHub Check: build-test (20.x, sqlite)
  • GitHub Check: claude-review
🔇 Additional comments (25)
tests/regression/test/v2-migrated/issue-1758.test.ts (1)

4-27: LGTM! Well-structured regression test.

The test correctly validates that ZenStack prevents using inherited fields from a polymorphic base model (Content with @@delegate) in a @@unique constraint on the derived model (Store). The schema setup properly demonstrates the error condition, and the expected error message is specific and clear.

tests/regression/test/v2-migrated/issue-1698.test.ts (2)

1-2: LGTM!

Imports are correct and appropriate for the test.


4-39: LGTM!

The schema correctly implements delegation-based polymorphism for both House and Door hierarchies, with proper relations between them. The test setup effectively validates that includes work correctly with delegated models.

tests/regression/test/v2-migrated/issue-1857.test.ts (1)

37-38: Verify if zod schema validation should be implemented now.

The TODO comment suggests pending work for zod schema support. Should this be completed as part of this test migration, or is it acceptable to defer?

If this validation is important for verifying issue 1857, consider implementing it now or creating a separate issue to track it.

packages/testtools/src/schema.ts (1)

55-61: LGTM! Good defensive coding.

The refactored logic correctly prevents double .ts extensions when extraSourceFiles keys already include the extension. This aligns with the test suite's usage patterns where supplemental TypeScript sources may be passed with or without the extension.

packages/runtime/src/client/crud/validator/index.ts (1)

680-682: LGTM! Expands orderBy flexibility for to-many relations.

The change correctly allows orderBy to accept both a single object and an array of objects in to-many relation includes/selects. This aligns with Prisma's behavior and is validated by the test coverage in tests/regression/test/v2-migrated/issue-1755.test.ts.

tests/regression/test/v2-migrated/issue-1695.test.ts (1)

1-21: LGTM! Well-structured regression test.

The test correctly verifies schema loading with a SoftDelete mixin and access control rules. The inline schema follows ZenStack conventions and properly demonstrates the issue scenario.

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

169-174: LGTM! Correctly aggregates bases from mixins and baseModel.

The refactored logic properly includes both mixins and the optional baseModel when decl is a DataModel, broadening the base resolution to handle inheritance scenarios. The updated type predicate correctly matches both TypeDef and DataModel declarations.

tests/regression/test/v2-migrated/issue-1755.test.ts (1)

1-58: LGTM! Comprehensive orderBy validation test.

The test thoroughly verifies both scalar and array orderBy forms at top-level and nested relation levels. This properly validates the runtime validator changes that expanded orderBy acceptance for to-many relations.

tests/regression/test/v2-migrated/issue-1745.test.ts (1)

1-94: LGTM! Comprehensive schema validation test.

The test verifies a complex schema with delegation, enums, type inheritance, and access control rules. The inline schema is well-structured and properly demonstrates the scenario from issue 1745.

tests/regression/test/v2-migrated/issue-1693.test.ts (1)

1-18: LGTM! Clean delegation test.

The test correctly verifies schema loading with a simple delegation pattern where Dog extends Animal. The inline schema is minimal and focused on the specific scenario from issue 1693.

tests/regression/test/v2-migrated/issue-1870.test.ts (1)

1-14: LGTM! Validates Unsupported type handling.

The test correctly verifies schema loading with PostgreSQL's Unsupported type for spatial data and a Gist index. The inline schema is minimal and properly demonstrates the scenario from issue 1870.

tests/regression/test/v2-migrated/issue-1835.test.ts (1)

1-23: LGTM!

The test correctly verifies that a schema with an enum and a model marked with @@ignore can be loaded successfully. The test structure is appropriate for a regression test.

tests/regression/test/v2-migrated/issue-1648.test.ts (1)

4-42: Test logic is correct.

The test properly validates that the deny rule based on a related model's field works as expected. The policy enforcement is correctly tested for both allowed and denied cases.

tests/regression/test/v2-migrated/issue-1647.test.ts (1)

4-51: LGTM! Skipped test with clear TODO.

The test suite is appropriately skipped with a clear TODO comment indicating it's pending multi-schema support. The test structure is correct and ready to be enabled once the feature is available.

tests/regression/test/v2-migrated/issue-1681.test.ts (1)

4-29: LGTM!

The test correctly validates that authentication context propagates to nested operations and that both createMany and createManyAndReturn work with auth().id defaults. The test logic is sound.

tests/regression/test/v2-migrated/issue-1674.test.ts (1)

4-80: LGTM!

The test correctly validates policy enforcement on delegated models. The expectation that postA.create is rejected is correct since the Post model (and its derived models) lacks an explicit @@allow rule for create operations.

tests/regression/test/v2-migrated/issue-1763.test.ts (1)

4-42: LGTM!

The test validates extraSourceFiles handling with delegated models. The test structure is appropriate for verifying that the generated TypeScript code compiles and executes correctly with the schema.

tests/regression/test/v2-migrated/issue-1734.test.ts (3)

81-103: LGTM! Test logic correctly validates field-level policies.

The test assertions properly verify the expected behavior:

  1. Queries the polymorphic profile table for both user and organization
  2. Verifies that without authentication, the published field is not readable (lines 94-95)
  3. Verifies that with authentication (user who has access), the published field becomes readable (line 103)

The explicit check for published being undefined (line 95) is a good defensive assertion on top of the toMatchObject check.


44-44: @default(auth().id) is supported; no further action needed.


52-79: Tests already verify type auto-population via delegation.

The inline schema declares @@delegate(type) on Profile, and the existing assertions on foundUser and foundOrg confirm the type field is populated as expected. No further action required.

tests/regression/test/v2-migrated/issue-1894.test.ts (4)

1-2: LGTM!

The imports are appropriate for a Vitest-based ZenStack regression test.


7-23: LGTM!

The schema correctly demonstrates ZenStack's delegation and inheritance features. The relation setup and @@DeleGate directive are properly configured.


44-45: LGTM!

The test assertions correctly verify that model delegation works with relation connections. The use of explicit id: 0 and the connect syntax properly exercises the feature being tested.


26-40: Missing await on async function call.

Line 37 calls main() without awaiting it. Since main() is declared as async and performs asynchronous database operations, this will cause the script to exit before those operations complete, potentially leading to incomplete execution or race conditions.

Apply this diff to fix the async handling:

-        main();
+        await main();

Additionally, note that line 32 uses {} as any for the client options. While acceptable in test code, consider passing a more specific type or at least an empty object without the type assertion if no options are needed.

Likely an incorrect or invalid review comment.

@ymc9 ymc9 merged commit 8d9f296 into dev Oct 13, 2025
9 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