Skip to content

Conversation

@ymc9
Copy link
Member

@ymc9 ymc9 commented Sep 24, 2025

Summary by CodeRabbit

  • New Features
    • Added a document build service that adjusts validation to stop after early lexing/parsing/linking errors unless validation is explicitly disabled.
  • Bug Fixes
    • Improved stability when aggregating fields/attributes by safely skipping unresolved or missing references.
    • Validation checks now run unconditionally for all node types for more consistent diagnostics.
  • Chores
    • Bumped package version from 3.0.6 to 3.0.8.

Copilot AI review requested due to automatic review settings September 24, 2025 00:23
@coderabbitai
Copy link

coderabbitai bot commented Sep 24, 2025

Walkthrough

Adds ZModelDocumentBuilder and registers it in the shared module; validators now run unconditionally; utilities tolerate unresolved mixin/baseModel references; test names/content adjusted; VS Code extension version bumped from 3.0.6 to 3.0.8.

Changes

Cohort / File(s) Summary of Changes
VS Code extension manifest
packages/ide/vscode/package.json
Version bumped from 3.0.6 to 3.0.8. No other edits.
Language: tolerant reference handling & utilities
packages/language/src/utils.ts
Replaced invariant-based assumptions with guarded checks when recursing mixins/baseModel (skip unresolved refs); updated base resolution to search by $refText; removed top-level invariant import. No public signature changes.
Language: document builder & module wiring
packages/language/src/zmodel-document-builder.ts, packages/language/src/module.ts
Added ZModelDocumentBuilder extending the default builder and overriding buildDocuments to adjust validation options; registered DocumentBuilder in the shared shared-module workspace wiring.
Language: validators invocation simplification
packages/language/src/validator.ts
Removed private shouldCheck guard and now unconditionally instantiate/run all validators in each checkXxx method; trimmed imports accordingly. No public API signature changes.
Tests
packages/language/test/expression-validation.test.ts
Renamed two test cases and added a new authorId Int field in one test case; expectations regarding model comparison error remain unchanged.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

I'm a rabbit in the code-hop glen,
Skipping broken refs now and then.
Builders hum, validators play,
Extension hops to a brighter day. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title concisely and accurately describes the primary change: preventing exceptions in the language validator when reference resolution fails. It names the affected subsystem ("language") and clearly signals a bug fix, matching the PR's updates to utils.ts, validator behavior, and related tests.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/validator

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 fixes a bug where unresolved references in mixins and base models would cause exceptions in the validator. The fix replaces invariant assertions with conditional checks to gracefully handle missing references.

  • Replaced invariant calls with null checks for mixin and base model references
  • Updated VS Code extension version from 3.0.6 to 3.0.8

Reviewed Changes

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

File Description
packages/language/src/utils.ts Replaced invariant assertions with conditional checks for ref resolution
packages/ide/vscode/package.json Version bump to 3.0.8

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

@claude
Copy link

claude bot commented Sep 24, 2025

Claude finished @ymc9's task —— View job


Pull Request Review

Todo List:

  • Read and analyze changed files
  • Review code quality and best practices
  • Check for potential bugs or issues
  • Assess performance considerations
  • Identify security concerns
  • Evaluate test coverage needs
  • Provide comprehensive feedback

Code Quality Analysis

This PR addresses a validator exception issue by replacing invariant assertions with conditional checks. The changes are well-focused and follow good defensive programming practices.

Positive Aspects:

  1. Defensive Programming: Replacing invariant calls with null checks prevents runtime exceptions when references fail to resolve during validation.

  2. Consistent Implementation: Both getAllFields() and getAllAttributes() functions are updated with the same pattern, maintaining consistency.

  3. Graceful Degradation: Instead of crashing, the code now silently skips unresolved references, allowing validation to continue.

  4. Clean Code: The conditional checks are simple and readable.

Potential Concerns:

  1. Silent Failures: The most significant concern is that unresolved references are now silently ignored. This could mask configuration errors or incomplete schema parsing:

    // Before: Would throw an exception with clear error message
    invariant(mixin.ref, `Mixin ${mixin.$refText} is not resolved`);
    
    // After: Silently skips, potentially hiding issues
    if (mixin.ref) {
        fields.push(...getAllFields(mixin.ref, includeIgnored, seen));
    }
  2. Missing Error Reporting: There's no logging or warning when references fail to resolve, making debugging more difficult.

  3. Incomplete Behavior: Fields and attributes from unresolved mixins/base models won't be included, which might lead to incomplete validation or code generation.

Recommendations:

  1. Add Logging: Consider adding debug/warning logs when references are unresolved:

    if (mixin.ref) {
        fields.push(...getAllFields(mixin.ref, includeIgnored, seen));
    } else {
        // Log warning about unresolved mixin reference
        console.warn(`Mixin ${mixin.$refText} is not resolved`);
    }
  2. Context-Aware Handling: Consider whether this should be conditional based on validation phase (strict during final validation, lenient during parsing).

  3. Test Coverage: Add tests that verify behavior with unresolved references to ensure the fix works as intended.

Security & Performance

  • Security: No security concerns identified. The changes reduce crash potential.
  • Performance: Minimal impact. Removing exception throwing might slightly improve performance in error cases.

Test Coverage

The fix appears to lack test coverage. Consider adding:

  • Tests with deliberately unresolved mixin references
  • Tests with unresolved base model references
  • Integration tests to ensure validation continues properly

Version Bump

The VSCode extension version bump from 3.0.6 to 3.0.8 seems appropriate for a bug fix release.

Overall Assessment

This is a solid defensive fix that prevents validator crashes. The approach is pragmatic, though ideally it would include better error reporting. The silent failure approach may be acceptable if this occurs during incremental parsing/validation where complete resolution isn't expected.

Recommendation: Approve with consideration for adding warning logs in a follow-up PR.


@claude
Copy link

claude bot commented Sep 24, 2025

Claude finished @ymc9's task —— View job


Pull Request Review

Todo List:

  • Read and analyze changed files
  • Review code quality and best practices
  • Check for potential bugs or issues
  • Assess performance considerations
  • Identify security concerns
  • Evaluate test coverage needs
  • Provide comprehensive feedback

Code Quality Analysis

This PR addresses a validator exception issue by replacing invariant assertions with conditional checks. The changes are well-focused and follow good defensive programming practices.

Positive Aspects:

  1. Defensive Programming: Replacing invariant calls with null checks prevents runtime exceptions when references fail to resolve during validation.

  2. Consistent Implementation: Both getAllFields() and getAllAttributes() functions are updated with the same pattern, maintaining consistency.

  3. Graceful Degradation: Instead of crashing, the code now silently skips unresolved references, allowing validation to continue.

  4. Clean Code: The conditional checks are simple and readable.

Potential Concerns:

  1. Silent Failures: The most significant concern is that unresolved references are now silently ignored. This could mask configuration errors or incomplete schema parsing:

    // Before: Would throw an exception with clear error message
    invariant(mixin.ref, `Mixin ${mixin.$refText} is not resolved`);
    
    // After: Silently skips, potentially hiding issues
    if (mixin.ref) {
        fields.push(...getAllFields(mixin.ref, includeIgnored, seen));
    }
  2. Missing Error Reporting: There's no logging or warning when references fail to resolve, making debugging more difficult.

  3. Incomplete Behavior: Fields and attributes from unresolved mixins/base models won't be included, which might lead to incomplete validation or code generation.

Recommendations:

  1. Add Logging: Consider adding debug/warning logs when references are unresolved:

    if (mixin.ref) {
        fields.push(...getAllFields(mixin.ref, includeIgnored, seen));
    } else {
        // Log warning about unresolved mixin reference
        console.warn(`Mixin ${mixin.$refText} is not resolved`);
    }
  2. Context-Aware Handling: Consider whether this should be conditional based on validation phase (strict during final validation, lenient during parsing).

  3. Test Coverage: Add tests that verify behavior with unresolved references to ensure the fix works as intended.

Security & Performance

  • Security: No security concerns identified. The changes reduce crash potential.
  • Performance: Minimal impact. Removing exception throwing might slightly improve performance in error cases.

Test Coverage

The fix appears to lack test coverage. Consider adding:

  • Tests with deliberately unresolved mixin references
  • Tests with unresolved base model references
  • Integration tests to ensure validation continues properly

Version Bump

The VSCode extension version bump from 3.0.6 to 3.0.8 seems appropriate for a bug fix release.

Overall Assessment

This is a solid defensive fix that prevents validator crashes. The approach is pragmatic, though ideally it would include better error reporting. The silent failure approach may be acceptable if this occurs during incremental parsing/validation where complete resolution isn't expected.

Recommendation: Approve with consideration for adding warning logs in a follow-up PR.


@claude
Copy link

claude bot commented Sep 24, 2025

Claude finished @ymc9's task —— View job


Pull Request Review

Todo List:

  • Read and analyze changed files
  • Review code quality and best practices
  • Check for potential bugs or issues
  • Assess performance considerations
  • Identify security concerns
  • Evaluate test coverage needs
  • Provide comprehensive feedback

Code Quality Analysis

This PR addresses a validator exception issue by replacing invariant assertions with conditional checks. The changes are well-focused and follow good defensive programming practices.

Positive Aspects:

  1. Defensive Programming: Replacing invariant calls with null checks prevents runtime exceptions when references fail to resolve during validation.

  2. Consistent Implementation: Both getAllFields() and getAllAttributes() functions are updated with the same pattern, maintaining consistency.

  3. Graceful Degradation: Instead of crashing, the code now silently skips unresolved references, allowing validation to continue.

  4. Clean Code: The conditional checks are simple and readable.

Potential Concerns:

  1. Silent Failures: The most significant concern is that unresolved references are now silently ignored. This could mask configuration errors or incomplete schema parsing:

    // Before: Would throw an exception with clear error message
    invariant(mixin.ref, `Mixin ${mixin.$refText} is not resolved`);
    
    // After: Silently skips, potentially hiding issues
    if (mixin.ref) {
        fields.push(...getAllFields(mixin.ref, includeIgnored, seen));
    }
  2. Missing Error Reporting: There's no logging or warning when references fail to resolve, making debugging more difficult.

  3. Incomplete Behavior: Fields and attributes from unresolved mixins/base models won't be included, which might lead to incomplete validation or code generation.

Recommendations:

  1. Add Logging: Consider adding debug/warning logs when references are unresolved:

    if (mixin.ref) {
        fields.push(...getAllFields(mixin.ref, includeIgnored, seen));
    } else {
        // Log warning about unresolved mixin reference
        console.warn(`Mixin ${mixin.$refText} is not resolved`);
    }
  2. Context-Aware Handling: Consider whether this should be conditional based on validation phase (strict during final validation, lenient during parsing).

  3. Test Coverage: Add tests that verify behavior with unresolved references to ensure the fix works as intended.

Security & Performance

  • Security: No security concerns identified. The changes reduce crash potential.
  • Performance: Minimal impact. Removing exception throwing might slightly improve performance in error cases.

Test Coverage

The fix appears to lack test coverage. Consider adding:

  • Tests with deliberately unresolved mixin references
  • Tests with unresolved base model references
  • Integration tests to ensure validation continues properly

Version Bump

The VSCode extension version bump from 3.0.6 to 3.0.8 seems appropriate for a bug fix release.

Overall Assessment

This is a solid defensive fix that prevents validator crashes. The approach is pragmatic, though ideally it would include better error reporting. The silent failure approach may be acceptable if this occurs during incremental parsing/validation where complete resolution isn't expected.

Recommendation: Approve with consideration for adding warning logs in a follow-up PR.


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)
packages/language/src/validator.ts (1)

51-85: Unconditional validations: verify no noise on stdlib or partially‑linked docs

Running all checks unconditionally is fine given the new builder settings; please confirm it doesn’t surface diagnostics for stdlib/plugin modules or when linking is incomplete.

Minor perf refactor: reuse validator instances instead of re‑instantiating per node.

-    checkModel(node: Model, accept: ValidationAcceptor): void {
-        new SchemaValidator(this.services.shared.workspace.LangiumDocuments).validate(node, accept);
-    }
+    checkModel(node: Model, accept: ValidationAcceptor): void {
+        this.schemaValidator.validate(node, accept);
+    }

-    checkDataSource(node: DataSource, accept: ValidationAcceptor): void {
-        new DataSourceValidator().validate(node, accept);
-    }
+    checkDataSource(node: DataSource, accept: ValidationAcceptor): void {
+        this.dataSourceValidator.validate(node, accept);
+    }

-    checkDataModel(node: DataModel, accept: ValidationAcceptor): void {
-        new DataModelValidator().validate(node, accept);
-    }
+    checkDataModel(node: DataModel, accept: ValidationAcceptor): void {
+        this.dataModelValidator.validate(node, accept);
+    }

-    checkTypeDef(node: TypeDef, accept: ValidationAcceptor): void {
-        new TypeDefValidator().validate(node, accept);
-    }
+    checkTypeDef(node: TypeDef, accept: ValidationAcceptor): void {
+        this.typeDefValidator.validate(node, accept);
+    }

-    checkEnum(node: Enum, accept: ValidationAcceptor): void {
-        new EnumValidator().validate(node, accept);
-    }
+    checkEnum(node: Enum, accept: ValidationAcceptor): void {
+        this.enumValidator.validate(node, accept);
+    }

-    checkAttribute(node: Attribute, accept: ValidationAcceptor): void {
-        new AttributeValidator().validate(node, accept);
-    }
+    checkAttribute(node: Attribute, accept: ValidationAcceptor): void {
+        this.attributeValidator.validate(node, accept);
+    }

-    checkExpression(node: Expression, accept: ValidationAcceptor): void {
-        new ExpressionValidator().validate(node, accept);
-    }
+    checkExpression(node: Expression, accept: ValidationAcceptor): void {
+        this.expressionValidator.validate(node, accept);
+    }

-    checkFunctionInvocation(node: InvocationExpr, accept: ValidationAcceptor): void {
-        new FunctionInvocationValidator().validate(node, accept);
-    }
+    checkFunctionInvocation(node: InvocationExpr, accept: ValidationAcceptor): void {
+        this.functionInvocationValidator.validate(node, accept);
+    }

-    checkFunctionDecl(node: FunctionDecl, accept: ValidationAcceptor): void {
-        new FunctionDeclValidator().validate(node, accept);
-    }
+    checkFunctionDecl(node: FunctionDecl, accept: ValidationAcceptor): void {
+        this.functionDeclValidator.validate(node, accept);
+    }

Add these fields to the class:

// inside ZModelValidator
private readonly schemaValidator: SchemaValidator;
private readonly dataSourceValidator = new DataSourceValidator();
private readonly dataModelValidator = new DataModelValidator();
private readonly typeDefValidator = new TypeDefValidator();
private readonly enumValidator = new EnumValidator();
private readonly attributeValidator = new AttributeValidator();
private readonly expressionValidator = new ExpressionValidator();
private readonly functionInvocationValidator = new FunctionInvocationValidator();
private readonly functionDeclValidator = new FunctionDeclValidator();

constructor(protected readonly services: ZModelServices) {
    this.schemaValidator = new SchemaValidator(services.shared.workspace.LangiumDocuments);
}
packages/language/src/zmodel-document-builder.ts (2)

8-17: Preserve caller’s other validation options (deep‑merge instead of overwrite)

If a caller passes a custom validation object, it gets replaced. Merge and force only the stop‑after flags.

-                validation:
-                    // force overriding validation options
-                    options.validation === false || options.validation === undefined
-                        ? options.validation
-                        : {
-                              stopAfterLexingErrors: true,
-                              stopAfterParsingErrors: true,
-                              stopAfterLinkingErrors: true,
-                          },
+                validation:
+                    options.validation === false || options.validation === undefined
+                        ? options.validation
+                        : {
+                              ...(typeof options.validation === 'object' ? options.validation : {}),
+                              stopAfterLexingErrors: true,
+                              stopAfterParsingErrors: true,
+                              stopAfterLinkingErrors: true,
+                          },

4-4: Type the cancellation token

Use a proper CancellationToken type for better API clarity.

-import { DefaultDocumentBuilder, type BuildOptions, type LangiumDocument } from 'langium';
+import { DefaultDocumentBuilder, type BuildOptions, type LangiumDocument } from 'langium';
+import type { CancellationToken } from 'vscode-jsonrpc';

-export class ZModelDocumentBuilder extends DefaultDocumentBuilder {
-    override buildDocuments(documents: LangiumDocument[], options: BuildOptions, cancelToken: any): Promise<void> {
+export class ZModelDocumentBuilder extends DefaultDocumentBuilder {
+    override buildDocuments(
+        documents: LangiumDocument[],
+        options: BuildOptions,
+        cancelToken: CancellationToken,
+    ): Promise<void> {
📜 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 cf80771 and d11bde4.

📒 Files selected for processing (4)
  • packages/language/src/module.ts (2 hunks)
  • packages/language/src/utils.ts (3 hunks)
  • packages/language/src/validator.ts (2 hunks)
  • packages/language/src/zmodel-document-builder.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
{packages,samples,tests}/**

📄 CodeRabbit inference engine (CLAUDE.md)

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

Files:

  • packages/language/src/module.ts
  • packages/language/src/utils.ts
  • packages/language/src/validator.ts
  • packages/language/src/zmodel-document-builder.ts
🧬 Code graph analysis (3)
packages/language/src/module.ts (1)
packages/language/src/zmodel-document-builder.ts (1)
  • ZModelDocumentBuilder (3-22)
packages/language/src/utils.ts (1)
packages/language/src/generated/ast.ts (4)
  • TypeDef (725-733)
  • TypeDef (735-735)
  • isTypeDef (737-739)
  • isDataModel (391-393)
packages/language/src/validator.ts (1)
packages/language/src/validators/schema-validator.ts (1)
  • SchemaValidator (10-58)
⏰ 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). (2)
  • GitHub Check: build-test (20.x, sqlite)
  • GitHub Check: build-test (20.x, postgresql)
🔇 Additional comments (3)
packages/language/src/utils.ts (2)

522-525: Good: guard unresolved refs to prevent pre‑link exceptions

The defensive checks on mixin.ref and decl.baseModel.ref make field/attribute aggregation resilient during early phases.

Confirm that skipping unresolved mixins/base models is acceptable for callers that may rely on partial results pre‑link (no hidden regressions in validations or codegen).

Also applies to: 528-531, 548-551, 554-557


174-177: Avoid regression: prefer mixin.ref with fallback to name lookup

Only searching decl.$container.declarations can miss imported mixins that resolve after linking — use mixin.ref when present and fall back to name lookup pre-link.

File: packages/language/src/utils.ts (lines 174–177)

-        const baseDecl = decl.$container.declarations.find(
-            (d): d is TypeDef => isTypeDef(d) && d.name === mixin.$refText,
-        );
+        const baseDecl =
+            mixin.ref ??
+            decl.$container.declarations.find(
+                (d): d is TypeDef => isTypeDef(d) && d.name === mixin.$refText,
+            );
packages/language/src/module.ts (1)

53-53: LGTM: register custom DocumentBuilder

Binding DocumentBuilder to ZModelDocumentBuilder in shared services is correct and composes cleanly with the existing WorkspaceManager.

@claude
Copy link

claude bot commented Sep 24, 2025

Claude finished @ymc9's task —— View job


Pull Request Review

Todo List:

  • Read and analyze changed files
  • Review code quality and best practices
  • Check for potential bugs or issues
  • Assess performance considerations
  • Identify security concerns
  • Evaluate test coverage needs
  • Provide comprehensive feedback

Code Quality Analysis

This PR addresses a validator exception issue by replacing invariant assertions with conditional checks. The changes are well-focused and follow good defensive programming practices.

Positive Aspects:

  1. Defensive Programming: Replacing invariant calls with null checks prevents runtime exceptions when references fail to resolve during validation.

  2. Consistent Implementation: Both getAllFields() and getAllAttributes() functions are updated with the same pattern, maintaining consistency.

  3. Clean Architecture: The new ZModelDocumentBuilder properly extends the default builder and integrates cleanly with the module system.

  4. Validation Flow Improvement: The document builder forces early stopping after lexing/parsing/linking errors, which complements the defensive reference handling.

Potential Concerns:

  1. Silent Failures: The most significant concern is that unresolved references are now silently ignored. This could mask configuration errors or incomplete schema parsing:

    // packages/language/src/utils.ts:522-525, 548-551
    // Before: Would throw an exception with clear error message
    invariant(mixin.ref, `Mixin ${mixin.$refText} is not resolved`);
    
    // After: Silently skips, potentially hiding issues
    if (mixin.ref) {
        fields.push(...getAllFields(mixin.ref, includeIgnored, seen));
    }
  2. Missing Error Reporting: There's no logging or warning when references fail to resolve, making debugging more difficult.

  3. Incomplete Behavior: Fields and attributes from unresolved mixins/base models won't be included, which might lead to incomplete validation or code generation.

  4. Performance: The validator now creates new instances for each validation call rather than reusing instances (packages/language/src/validator.ts:51-85). This could impact performance in large schemas.

Specific Issues Found:

  1. Reference Resolution Logic: In getRecursiveBases() (packages/language/src/utils.ts:174-177), the function searches by name in decl.$container.declarations but doesn't use mixin.ref when available, which could miss imported mixins.

  2. Type Safety: The cancelToken parameter in ZModelDocumentBuilder uses any type instead of proper CancellationToken type.

  3. Validation Options Override: The document builder completely overwrites caller's validation options instead of merging them.

Recommendations:

  1. Add Logging: Consider adding debug/warning logs when references are unresolved:

    if (mixin.ref) {
        fields.push(...getAllFields(mixin.ref, includeIgnored, seen));
    } else {
        console.warn(`Mixin ${mixin.$refText} is not resolved - skipping field aggregation`);
    }
  2. Performance Optimization: Cache validator instances in the ZModelValidator class instead of recreating them.

  3. Better Reference Resolution: In getRecursiveBases(), prefer mixin.ref when available and fall back to name lookup.

Security & Performance

  • Security: No security concerns identified. The changes reduce crash potential without introducing vulnerabilities.
  • Performance: Minor negative impact from creating new validator instances per validation call. The removal of exception throwing might slightly improve performance in error cases.

Test Coverage

The PR includes minimal test changes in expression-validation.test.ts but lacks comprehensive test coverage for the core changes:

  • Tests with deliberately unresolved mixin references
  • Tests with unresolved base model references
  • Integration tests to ensure validation continues properly with partial reference resolution

Version Bump

The VSCode extension version bump from 3.0.6 to 3.0.8 is appropriate for a bug fix release.

Overall Assessment

This is a solid defensive fix that prevents validator crashes during incremental parsing/validation phases. The approach is pragmatic for handling incomplete reference resolution in development environments. However, the silent failure approach should ideally include better error reporting for debugging purposes.

The architectural changes with ZModelDocumentBuilder properly integrate with Langium's validation flow and complement the defensive reference handling.

Recommendation: Approve with consideration for adding warning logs and performance optimizations in follow-up PRs.


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 (1)
packages/language/test/expression-validation.test.ts (1)

26-26: Make the second test title specific

Avoid numeric suffixes; be explicit about what’s compared.

Proposed change:

-it('should reject model comparison2', async () => {
+it('should reject comparing relation field to this (User.profile vs User)', async () => {
📜 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 d11bde4 and 72427de.

📒 Files selected for processing (1)
  • packages/language/test/expression-validation.test.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
{packages,samples,tests}/**

📄 CodeRabbit inference engine (CLAUDE.md)

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

Files:

  • packages/language/test/expression-validation.test.ts
⏰ 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, sqlite)
  • GitHub Check: build-test (20.x, postgresql)
  • GitHub Check: claude-review
🔇 Additional comments (2)
packages/language/test/expression-validation.test.ts (2)

18-18: Good fix: relation scalar field added

Adding authorId Int correctly satisfies the @relation(fields: [authorId], references: [id]) requirement and avoids unrelated schema errors masking the intended validation.


5-5: Rename test to a descriptive title; loadSchemaWithError already checks substrings

Replace the test title as suggested — no changes needed to the error assertions: loadSchemaWithError checks case-insensitive substring matches for string errors and supports RegExp.

-it('should reject model comparison1', async () => {
+it('should reject comparing relation field to this (Post.author vs Post)', async () => {

@ymc9 ymc9 merged commit 3a2f1f9 into dev Sep 24, 2025
5 of 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