Skip to content

Conversation

@ymc9
Copy link
Member

@ymc9 ymc9 commented Nov 19, 2025

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

📝 Walkthrough

Walkthrough

Validator behavior changed: when a DataSource is missing the url field, validation now returns early (treating url as optional for newer Prisma versions) instead of emitting an error; other url and shadowDatabaseUrl validation logic remains unchanged. Tests and some integration test package pins were updated accordingly.

Changes

Cohort / File(s) Summary
DataSource validator URL handling
packages/schema/src/language-server/validator/datasource-validator.ts
Added an early return when a DataSource url field is missing (making url optional for newer Prisma versions); preserved remaining url / shadowDatabaseUrl validation logic.
Datasource validation test update
packages/schema/tests/schema/validation/datasource-validation.test.ts
Adjusted test expectation for missing fields: rejection reason no longer includes a url error and now reports only the provider message.
Generator test Prisma pinning
packages/schema/tests/generator/prisma-generator.test.ts
Pinned the Prisma package in the test setup command to prisma@6.19.x (was unpinned).
Integration test dependency pinning
tests/integration/tests/cli/generate.test.ts
Pinned installed packages in test setup to prisma@6.19.x and @prisma/client@6.19.x (previously unpinned installs).

Sequence Diagram(s)

sequenceDiagram
  participant SchemaAST as Schema AST
  participant Validator as DataSource Validator
  rect rgba(220,235,255,0.6)
    note right of SchemaAST: Incoming DataSource node
  end

  SchemaAST->>Validator: validateDataSource(node)
  alt url field present
    Validator->>Validator: validate url and shadowDatabaseUrl
    Validator-->>SchemaAST: emit errors/warnings (if any)
  else url field missing (OLD)
    Validator->>Validator: emit error ("url field missing")
    Validator-->>SchemaAST: emit error
  else url field missing (NEW)
    Validator-->>SchemaAST: return early (no url error)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

  • Review placement of the early return to ensure other validations (especially shadowDatabaseUrl and downstream checks) remain executed when appropriate.
  • Verify unit/integration tests reflect the intended behavior and that error messages/expectations were adjusted correctly.
  • Confirm the pinned Prisma versions in tests do not unintentionally change test outcomes or CI environments.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided by the author, making it impossible to assess relevance to the changeset. Add a description explaining why the URL field is now optional and any compatibility notes with newer Prisma versions.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: making the datasource URL optional in the validator.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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/datasource-url-optional

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

@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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2e2024 and fcbd538.

📒 Files selected for processing (1)
  • packages/schema/src/language-server/validator/datasource-validator.ts (1 hunks)
⏰ 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: build-test (20.x)
  • GitHub Check: build-test (20.x)
  • GitHub Check: dependency-review
  • GitHub Check: build-test (20.x)

Copy link
Contributor

@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/schema/tests/schema/validation/datasource-validation.test.ts (1)

83-99: Add test coverage for optional url scenario.

The success tests all include the url field. Consider adding a test case that validates a datasource with only the provider field (no url) to ensure the optional url feature works correctly:

it('success without url', async () => {
    await loadModel(`
        datasource db {
            provider = "postgresql"
        }
    `);
});
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fcbd538 and e5d8a1f.

📒 Files selected for processing (2)
  • packages/schema/tests/schema/validation/datasource-validation.test.ts (1 hunks)
  • tests/integration/tests/cli/generate.test.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/integration/tests/cli/generate.test.ts (1)
packages/testtools/src/schema.ts (1)
  • installPackage (68-70)
⏰ 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: build-test (20.x)
  • GitHub Check: build-test (20.x)
  • GitHub Check: dependency-review
  • GitHub Check: build-test (20.x)
🔇 Additional comments (2)
packages/schema/tests/schema/validation/datasource-validation.test.ts (1)

13-13: The test change is correct and verified.

The validator implementation confirms that the url field is optional. In the validateUrl() method (lines 40-48), when the url field is not present, the validator returns early without raising an error. The validateProvider() method remains the only validator that will produce an error when the provider field is missing.

The test now correctly expects a single error message about the missing provider field, which aligns with the validator's behavior where only the provider is required.

tests/integration/tests/cli/generate.test.ts (1)

48-48: The review comment is based on an incorrect premise and should be disregarded.

Prisma 6.19 does not support optional datasource URLs—the url field is required in Prisma 6.x. The test schema itself explicitly provides a datasource URL (url = "file:./dev.db"), so it does not depend on optional URL support. The reason for pinning to version 6.19.x remains undocumented in the code, but it is not for optional URL field support as the original review suggested.

Likely an incorrect or invalid review comment.

Copy link
Contributor

@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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e5d8a1f and f3d8716.

📒 Files selected for processing (1)
  • packages/schema/tests/generator/prisma-generator.test.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/schema/tests/generator/prisma-generator.test.ts (1)
packages/schema/src/utils/exec-utils.ts (1)
  • execSync (6-10)
⏰ 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: build-test (20.x)
  • GitHub Check: dependency-review
  • GitHub Check: build-test (20.x)
  • GitHub Check: build-test (20.x)

@ymc9 ymc9 merged commit c23ff10 into dev Nov 19, 2025
8 checks passed
@ymc9 ymc9 deleted the fix/datasource-url-optional branch November 19, 2025 22:21
@jamiter
Copy link
Contributor

jamiter commented Nov 20, 2025

FYI, for Prisma 7 the url has been deprecated completely and this change is required to upgrade to v7.

@ymc9
Copy link
Member Author

ymc9 commented Nov 20, 2025

Thanks @jamiter . The current plan is to not support v7 for ZenStack v2. I'll share this information with the next release and collect feedback.

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.

3 participants