Conversation
Prisma Optimize is being discontinued. This removes the entire optimize/ directory (6 example projects) and the corresponding section from the root README.
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughRemoved the entire Prisma Optimize section and all optimize example/demo projects (including the starter workspace), deleted associated configs/schemas/scripts/docs, and updated tests to allocate unique ports for Prisma dev server startup. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
The concurrent tests all called startPrismaDevServer() with the default name "default" in stateless mode. On slow CI runners, multiple tests would scan for servers simultaneously, find none, and all try to bind the same port (51216), causing EADDRINUSE failures. Passing a unique name per test lets the port allocator see other servers and pick distinct ports.
The previous approach of using unique names didn't work because stateless mode never writes server state to disk, so concurrent tests still race on the same default port range. Instead, assign each test its own set of 3 ports (server, database, shadow database) from a counter starting at 52000. Since all tests in a file share a single Node.js event loop, the synchronous counter increment is atomic against concurrent async calls.
With singleFork: false, vitest distributes concurrent tests across separate worker processes. Each worker re-imports the module, resetting the port counter, so multiple workers race on the same ports. Setting singleFork: true ensures all tests in a file share one process, making the portOffset counter effective. Combined with explicit unique ports per test (starting at 52000, 3 ports each), concurrent tests never collide.
@prisma/dev internally allocates ports beyond the 3 user-configurable ones (port, databasePort, shadowDatabasePort). When many PGLite instances start concurrently, they race on these internal ports (51216+), causing EADDRINUSE. Run tests sequentially (maxConcurrency: 1, remove describe.concurrent) to ensure only one @prisma/dev server runs at a time. This is slower (~4min vs ~1min per test file) but eliminates the flaky port conflicts that have been failing CI consistently.
Summary
optimize/directory containing 6 example projects (starter, excessive-rows, full-table-scan, repeated-query, select-returning-all, unindexed-column)Test plan
@prisma/extension-optimizeorPRISMA_OPTIMIZEin the repoSummary by CodeRabbit