Skip to content
This repository was archived by the owner on Nov 25, 2026. It is now read-only.

test(vite): narrow and validate Vite 7/8 support - #367

Merged
jkomyno merged 67 commits into
mainfrom
tml-2294-vite-support-matrix
Apr 29, 2026
Merged

jkomyno merged 67 commits into
mainfrom
tml-2294-vite-support-matrix

Conversation

@jkomyno

@jkomyno jkomyno commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • narrow @prisma-next/vite-plugin-contract-emit peer support to Vite 7 and 8
  • add a focused Vite plugin integration entrypoint and CI matrix job that runs the HMR suite on Vite 7.3.1 and 8.0.9
  • update the canonical Vite plugin docs to match the tested support range and record the current Vite 8 compatibility note

Testing

  • pnpm test:vite-plugin
  • switched @prisma-next/integration-tests to [email protected] locally and reran pnpm test:vite-plugin

Tracking

Summary by CodeRabbit

  • New Features

    • HMR contract generation tests now validate rapid schema-edit behavior (final edit wins).
  • Tests

    • Added a dedicated Vite plugin HMR test suite running against Vite 7 and 8; CI now runs this suite and tightened error-reporting assertions.
  • Documentation

    • Clarified Vite plugin compatibility and installation guidance for Vite 7 and 8.
  • Chores

    • Added root script to run Vite plugin tests and narrowed plugin peer dependency to ^7.0.0 || ^8.0.0.

jkomyno and others added 30 commits April 19, 2026 23:37
The SQL provider was updated to use context.configDir but the mongo
provider was missed, causing watcher/loader path divergence when cwd
differs from the config directory.
…onfigDir

- Switch config-loader from node:path to pathe for consistency with
  the rest of the tooling layer.
- Resolve .ts contract paths inside load() via context.configDir instead
  of capturing process.cwd() at config-definition time, so the watcher
  and loader always reference the same file.
The paths branch omitted the config file from the watch set, so edits
to prisma-next.config.ts (e.g. changing paths or swapping provider)
would not trigger re-emit. Also surface a partial-coverage warning when
loadConfig fails instead of silently falling back.
Close D1 from the PR #356 review by driving a real Vite dev server
through both scenarios that were previously only unit-mocked:
modifying `contract.prisma` re-emits the contract, and editing the
config to swap the declared PSL input re-emits against the new file.
Align with the Mongo PSL provider and with the parser step's sourceId.
The absolute form stays accessible via meta.absoluteSchemaPath for
downstream consumers that need it.
Collapse the ~20-line inline provider that postgres and mongo facades
each build around a dynamic import of the user's `contract.ts`. The
logic (path resolution, pathToFileURL, default-export extraction) is
family-agnostic, so each contract-ts package exposes it as a sibling
to typescriptContract.
- handleTrackedFileChange now runs ctx.file through pathe.resolve
  before comparing against watchedFiles / ignoredOutputFiles, so
  symlinked or case-folded paths line up with the resolved entries.
- resolveContractOutputFiles no longer falls back to the hardcoded
  'src/prisma/contract.json' when contract.output is missing. The
  filter simply skips; defineConfig() guarantees output is present
  in the happy path, and raw-object configs get a clean no-op instead
  of a path the CLI never actually writes.
…ceContext

Left over from the split that moved configDir out of ContractSourceContext
into ContractSourceEnvironment — the context builder no longer needs it.
@coderabbitai

coderabbitai Bot commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: b989c789-09c3-4de7-b144-5e93905727e2

📥 Commits

Reviewing files that changed from the base of the PR and between f9636ad and 09578af.

📒 Files selected for processing (3)
  • packages/1-framework/3-tooling/vite-plugin-contract-emit/README.md
  • packages/1-framework/3-tooling/vite-plugin-contract-emit/package.json
  • packages/1-framework/3-tooling/vite-plugin-contract-emit/test/plugin.test.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/1-framework/3-tooling/vite-plugin-contract-emit/package.json
  • packages/1-framework/3-tooling/vite-plugin-contract-emit/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/1-framework/3-tooling/vite-plugin-contract-emit/test/plugin.test.ts

📝 Walkthrough

Walkthrough

Adds a CI job to run a dedicated Vite plugin test suite, restricts the Vite plugin peer dependency to Vite 7 and 8, adds root and integration test scripts for the Vite plugin, tightens a unit test, and refactors the HMR e2e test to run against both Vite 7 and Vite 8.

Changes

Cohort / File(s) Summary
CI
\.github/workflows/ci.yml
Adds test-vite-support job depending on build, sets TEST_TIMEOUT_MULTIPLIER=2, installs deps (pnpm install --frozen-lockfile), and runs pnpm test:vite-plugin using pinned action versions.
Docs & Guides
docs/reference/framework-integration-analysis.md, packages/1-framework/3-tooling/vite-plugin-contract-emit/README.md, test/integration/README.md
Clarifies supported Vite majors as 7 and 8, updates support matrix and peer-dependency guidance, and documents how to run the Vite plugin HMR test suite.
Root / Integration Scripts
package.json, test/integration/package.json
Adds root test:vite-plugin script; adds pretest:vite-plugin and test:vite-plugin in integration package; changes vite devDependency resolution and adds vite7/vite8 aliases for dual-version testing.
Vite Plugin Package
packages/1-framework/3-tooling/vite-plugin-contract-emit/package.json
Updates peerDependencies.vite from >=5.0.0 to `^7.0.0
Tests — Unit & E2E
packages/1-framework/3-tooling/vite-plugin-contract-emit/test/plugin.test.ts, test/integration/test/vite-plugin.hmr.e2e.test.ts
Unit test: relies on shared beforeEach mock and adds a console.error spy to assert no "Contract emit failed" log. E2E: refactors HMR suite to use a CreateServerLike/ViteServerLike abstraction, runs the same suite for vite7 and vite8, and adds a "last edit wins" scenario.
Minor Cleanup
packages/1-framework/3-tooling/cli/src/config-path-validation.ts
Removes an extra blank line in finalizeConfig (no behavior change).

Sequence Diagram(s)

sequenceDiagram
    participant Tester as Test Runner
    participant Factory as CreateServerLike
    participant Vite as Vite Dev Server
    participant Plugin as Vite Plugin
    participant FS as File System / Watcher
    participant Emitter as Contract Emitter
    Tester->>Factory: request server for vite7/vite8
    Factory->>Vite: createServer()
    Vite->>Plugin: load plugin
    Tester->>FS: write schema edits
    FS->>Vite: file change (HMR)
    Vite->>Plugin: transform/hmr event
    Plugin->>Emitter: trigger contract emit
    Emitter->>FS: write contract.json
    Tester->>FS: read contract.json -> assert results
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through lines of code at night,
Two Vites now dance in test-run light,
HMR hums, contracts grow,
Last edit wins — away we go! 🥕✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly reflects the main objective and primary change: narrowing and validating Vite 7/8 support across the plugin and tests. It is concise, specific, and clearly summarizes the core contribution.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tml-2294-vite-support-matrix

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.

Comment thread .github/workflows/ci.yml Resolved
@pkg-pr-new

pkg-pr-new Bot commented Apr 22, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@prisma-next/mongo-runtime

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-runtime@367

@prisma-next/family-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/family-mongo@367

@prisma-next/sql-runtime

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-runtime@367

@prisma-next/family-sql

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/family-sql@367

@prisma-next/middleware-telemetry

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/middleware-telemetry@367

@prisma-next/mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo@367

@prisma-next/extension-paradedb

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-paradedb@367

@prisma-next/extension-pgvector

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/extension-pgvector@367

@prisma-next/postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/postgres@367

@prisma-next/sql-orm-client

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-orm-client@367

@prisma-next/sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sqlite@367

@prisma-next/target-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-mongo@367

@prisma-next/adapter-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-mongo@367

@prisma-next/driver-mongo

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-mongo@367

@prisma-next/contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/contract@367

@prisma-next/utils

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/utils@367

@prisma-next/config

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/config@367

@prisma-next/errors

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/errors@367

@prisma-next/framework-components

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/framework-components@367

@prisma-next/operations

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/operations@367

@prisma-next/ts-render

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/ts-render@367

@prisma-next/contract-authoring

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/contract-authoring@367

@prisma-next/ids

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/ids@367

@prisma-next/psl-parser

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/psl-parser@367

@prisma-next/psl-printer

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/psl-printer@367

@prisma-next/cli

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/cli@367

@prisma-next/emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/emitter@367

@prisma-next/migration-tools

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/migration-tools@367

prisma-next

npm i https://pkg.pr.new/prisma/prisma-next@367

@prisma-next/vite-plugin-contract-emit

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/vite-plugin-contract-emit@367

@prisma-next/mongo-codec

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-codec@367

@prisma-next/mongo-contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-contract@367

@prisma-next/mongo-value

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-value@367

@prisma-next/mongo-contract-psl

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-contract-psl@367

@prisma-next/mongo-contract-ts

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-contract-ts@367

@prisma-next/mongo-emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-emitter@367

@prisma-next/mongo-schema-ir

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-schema-ir@367

@prisma-next/mongo-query-ast

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-query-ast@367

@prisma-next/mongo-orm

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-orm@367

@prisma-next/mongo-query-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-query-builder@367

@prisma-next/mongo-lowering

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-lowering@367

@prisma-next/mongo-wire

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/mongo-wire@367

@prisma-next/sql-contract

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract@367

@prisma-next/sql-errors

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-errors@367

@prisma-next/sql-operations

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-operations@367

@prisma-next/sql-schema-ir

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-schema-ir@367

@prisma-next/sql-contract-psl

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-psl@367

@prisma-next/sql-contract-ts

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-ts@367

@prisma-next/sql-contract-emitter

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-contract-emitter@367

@prisma-next/sql-lane-query-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-lane-query-builder@367

@prisma-next/sql-relational-core

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-relational-core@367

@prisma-next/sql-builder

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/sql-builder@367

@prisma-next/target-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-postgres@367

@prisma-next/target-sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/target-sqlite@367

@prisma-next/adapter-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-postgres@367

@prisma-next/adapter-sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/adapter-sqlite@367

@prisma-next/driver-postgres

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-postgres@367

@prisma-next/driver-sqlite

npm i https://pkg.pr.new/prisma/prisma-next/@prisma-next/driver-sqlite@367

commit: 09578af

Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
Co-authored-by: Alberto Schiabel <[email protected]>
Signed-off-by: Alberto Schiabel <[email protected]>
Comment thread .github/workflows/ci.yml Resolved

@SevInf SevInf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer we'd make it easier to run tests loсally. Right now, specific vite version are hardcoded in CI, pnpm outdated and renovate will not find them and we are almost certainly will forget to update them in time.

Additionally, running it locally requires copying very specific command from a GH Workflow and then not forgetting to undo your changes before you commit.

My suggestion is to do it that way:

  • Add both versions to our dependencies explicitly under different aliases.
  • Importing both in the test file:
import * as vite7 from 'vite7'
import * as vite8 from 'vite8'
  • Wrapping existing tests into a function that accepts generalized version of vite.createServer as an input
  • run those tests over both vite7.createServer and vite8.createServer

Base automatically changed from tml-2293-vite-plugin-test-coverage to main April 22, 2026 14:21
…-matrix

# Conflicts:
#	packages/1-framework/3-tooling/cli/src/config-path-validation.ts
#	packages/1-framework/3-tooling/vite-plugin-contract-emit/src/plugin.ts
#	packages/1-framework/3-tooling/vite-plugin-contract-emit/test/plugin.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/1-framework/3-tooling/vite-plugin-contract-emit/README.md (1)

14-14: Simplify the compatibility note by removing internal implementation detail.

The phrase "there is no Vite-8-specific code path today, so the support matrix exists to catch future hook or overlay regressions early" is internal implementation reasoning that doesn't materially affect how users interact with the plugin. As per coding guidelines, user-facing package READMEs should avoid internal implementation detail unless it materially affects usage.

📝 Simplified compatibility note
-- Compatibility note: the current implementation uses the same `configureServer` and `handleHotUpdate` flow on Vite 7 and Vite 8; there is no Vite-8-specific code path today, so the support matrix exists to catch future hook or overlay regressions early
+- Compatibility note: the plugin uses the same `configureServer` and `handleHotUpdate` flow on both Vite 7 and Vite 8

Or remove it entirely if the implementation approach doesn't affect usage decisions.

As per coding guidelines: "For user-facing packages, keep README.md focused on what the package does, when to use it, and a few concrete examples. Avoid internal implementation detail unless it materially affects usage"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/1-framework/3-tooling/vite-plugin-contract-emit/README.md` at line
14, The compatibility note in README.md includes internal implementation detail
("there is no Vite-8-specific code path today, so the support matrix exists to
catch future hook or overlay regressions early"); remove that clause or replace
it with a short, user-focused statement such as "Compatibility: works with Vite
7 and Vite 8" so the README only communicates compatibility to users and omits
internal reasoning; edit the line containing the compatibility note to delete
the internal explanation and keep a concise, user-facing compatibility message.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 188-209: The new CI job "test-vite-support" is missing the
TEST_TIMEOUT_MULTIPLIER environment setting used by other test jobs, causing
flakiness; modify the test-vite-support job to include an env block that sets
TEST_TIMEOUT_MULTIPLIER: 2 (same as other CI test jobs) so the Vite matrix runs
use the shared timeout multiplier; locate the job by the name test-vite-support
in the workflow and add the env entry alongside existing keys to ensure the HMR
suite uses the increased timeout under CI load.

In `@test/integration/test/vite-plugin.hmr.e2e.test.ts`:
- Around line 443-557: Remove the duplicated "it('preserves the last good
artifacts after a bad PSL edit and recovers on the next good edit')" test block
(keep only the intended single copy), replace the hardcoded setTimeout delay
(new Promise(resolve => setTimeout(resolve, 100))) with the shared short timeout
helper from `@prisma-next/test-utils` (use the project's timeouts constant, e.g.
timeouts.fileWatchDebounce or a similar named helper), and avoid waiting the
full long TypeScript compilation timeout on the passing path by changing the
waitForFileChange calls that pass initialJsonStats.mtimeMs /
initialDtsStats.mtimeMs with timeouts.typeScriptCompilation to use a shorter
helper timeout (or a smaller explicit timeout constant from timeouts) for the
success path; adjust calls to waitForFileChange, readJsonFileWhenReady,
replaceInFileOrThrow and server.watcher.emit accordingly so the test is no
longer duplicated and uses the shared timeout helpers instead of raw numbers.

---

Nitpick comments:
In `@packages/1-framework/3-tooling/vite-plugin-contract-emit/README.md`:
- Line 14: The compatibility note in README.md includes internal implementation
detail ("there is no Vite-8-specific code path today, so the support matrix
exists to catch future hook or overlay regressions early"); remove that clause
or replace it with a short, user-focused statement such as "Compatibility: works
with Vite 7 and Vite 8" so the README only communicates compatibility to users
and omits internal reasoning; edit the line containing the compatibility note to
delete the internal explanation and keep a concise, user-facing compatibility
message.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 542d438a-2028-411f-ba89-8eeacd3ee72c

📥 Commits

Reviewing files that changed from the base of the PR and between 3134f51 and 44ab47f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • .github/workflows/ci.yml
  • docs/reference/framework-integration-analysis.md
  • package.json
  • packages/1-framework/3-tooling/cli/src/config-path-validation.ts
  • packages/1-framework/3-tooling/vite-plugin-contract-emit/README.md
  • packages/1-framework/3-tooling/vite-plugin-contract-emit/package.json
  • packages/1-framework/3-tooling/vite-plugin-contract-emit/test/plugin.test.ts
  • test/integration/README.md
  • test/integration/package.json
  • test/integration/test/vite-plugin.hmr.e2e.test.ts
💤 Files with no reviewable changes (1)
  • packages/1-framework/3-tooling/cli/src/config-path-validation.ts

Comment thread .github/workflows/ci.yml Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/integration/package.json`:
- Around line 73-75: The test's Vite runtime and the plugin's resolved peer
dependency are mismatched: the package.json alias "vite" points to the catalog
(v7) while "vite8" points to npm:[email protected] and the HMR test calls
vite8.createServer(), but `@prisma-next/vite-plugin-contract-emit` is resolving to
Vite 7; fix by updating the package.json "vite" entry to "npm:[email protected]" (to
match "vite8") or modify the test/vite.config.ts to explicitly import/pass the
Vite instance from the vite8 alias into the plugin (so the plugin runs against
the same Vite instance used by vite8.createServer()).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 2dd99e4b-adf5-4ffa-8c66-0b13c0dbf68f

📥 Commits

Reviewing files that changed from the base of the PR and between 44ab47f and a42337d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • test/integration/README.md
  • test/integration/package.json
  • test/integration/test/vite-plugin.hmr.e2e.test.ts
✅ Files skipped from review due to trivial changes (1)
  • test/integration/README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/ci.yml
  • test/integration/test/vite-plugin.hmr.e2e.test.ts

Comment thread test/integration/package.json Resolved
@jkomyno
jkomyno requested a review from SevInf April 24, 2026 05:54
jkomyno and others added 2 commits April 28, 2026 10:05
The Vite plugin guarantees that, given two watcher events within or close to
the debounce window, the LAST edit wins on disk. The unit tests verify the
internal supersession invariant (`publishContractArtifactPairSerialized` queue
or cancel-and-restart, depending on plugin version), but no end-to-end test
locked in the user-visible outcome.

Add `'last edit wins when two saves arrive in rapid succession'` to the HMR
suite. The test edits `contract.prisma` twice back-to-back (each followed by
`server.watcher.emit('change', ...)`) and asserts that the final on-disk
`contract.json` reflects the second edit (`nickname` column) and not the first
(`name` column).

Runs against both Vite 7 and Vite 8 via the existing `runVitePluginHmrSuite`
matrix runner. Implementation-agnostic — equally valid whether the plugin uses
queue+coalesce or cancel-and-restart, since both deliver the same user-visible
guarantee.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/integration/test/vite-plugin.hmr.e2e.test.ts (1)

41-60: Consider static import for node:fs/promises.

The file imports sync methods from node:fs at line 1, but uses dynamic import('node:fs/promises') at lines 51 and 410. For consistency, you could add a static import at the top:

import { stat } from 'node:fs/promises';

This is a minor style nit—Node.js caches dynamic imports, so there's no correctness or performance issue.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/integration/test/vite-plugin.hmr.e2e.test.ts` around lines 41 - 60, Add
a static import for stat from 'node:fs/promises' and replace the dynamic imports
inside waitForFileChange and the other occurrence with direct calls to stat;
specifically, add "import { stat } from 'node:fs/promises'" at the top and
change the dynamic import usage in the waitForFileChange function (and the other
place currently using import('node:fs/promises')) to call stat(filePath)
instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test/integration/test/vite-plugin.hmr.e2e.test.ts`:
- Around line 41-60: Add a static import for stat from 'node:fs/promises' and
replace the dynamic imports inside waitForFileChange and the other occurrence
with direct calls to stat; specifically, add "import { stat } from
'node:fs/promises'" at the top and change the dynamic import usage in the
waitForFileChange function (and the other place currently using
import('node:fs/promises')) to call stat(filePath) instead.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: c33acbe9-2f5a-40f2-b42d-f4f266a17d96

📥 Commits

Reviewing files that changed from the base of the PR and between a017851 and f9636ad.

📒 Files selected for processing (1)
  • test/integration/test/vite-plugin.hmr.e2e.test.ts

…-matrix

# Conflicts:
#	packages/1-framework/3-tooling/vite-plugin-contract-emit/test/plugin.test.ts
@jkomyno
jkomyno merged commit 13b3a30 into main Apr 29, 2026
7 checks passed
@jkomyno
jkomyno deleted the tml-2294-vite-support-matrix branch April 29, 2026 08:40
saevarb pushed a commit that referenced this pull request Apr 29, 2026
The previous two pushes (commits 0d9b095 and 75c3502) both
hit `startup_failure` on the `CI (PR)` workflow — GitHub Actions
created the run record but bailed during bootstrap, so no job ever
launched and the required status checks (Build, Test, Type Check,
Lint, Coverage, E2E Tests, Integration Tests) sit indefinitely as
"Expected — Waiting for status to be reported".

Same workflow file was green on the immediately prior commit
(8b005db) and PR #367 also hit the same `startup_failure` mode
during its development, so this looks like transient flakiness in
GitHub's Actions infra rather than anything in this branch.

GitHub's API refuses to retry runs in `startup_failure` state
(`This workflow run cannot be retried`), so the only path back to
green checks is a fresh `pull_request` trigger event. This empty
commit produces one without polluting the diff.
wmadden pushed a commit that referenced this pull request May 4, 2026
## Summary
- narrow `@prisma-next/vite-plugin-contract-emit` peer support to Vite 7
and 8
- add a focused Vite plugin integration entrypoint and CI matrix job
that runs the HMR suite on Vite 7.3.1 and 8.0.9
- update the canonical Vite plugin docs to match the tested support
range and record the current Vite 8 compatibility note

## Testing
- `pnpm test:vite-plugin`
- switched `@prisma-next/integration-tests` to `[email protected]` locally and
reran `pnpm test:vite-plugin`

## Tracking
- Linear: TML-2294
- Parent PR: #366

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* HMR contract generation tests now validate rapid schema-edit behavior
(final edit wins).

* **Tests**
* Added a dedicated Vite plugin HMR test suite running against Vite 7
and 8; CI now runs this suite and tightened error-reporting assertions.

* **Documentation**
* Clarified Vite plugin compatibility and installation guidance for Vite
7 and 8.

* **Chores**
* Added root script to run Vite plugin tests and narrowed plugin peer
dependency to ^7.0.0 || ^8.0.0.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Alberto Schiabel <[email protected]>
Co-authored-by: jkomyno <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants