Skip to content

chore: Prisma 7#864

Merged
CarlosGamero merged 29 commits intomainfrom
chore/prisma_7
Feb 20, 2026
Merged

chore: Prisma 7#864
CarlosGamero merged 29 commits intomainfrom
chore/prisma_7

Conversation

@CarlosGamero
Copy link
Copy Markdown
Collaborator

@CarlosGamero CarlosGamero commented Feb 12, 2026

Changes

Updating prisma-utils for Prisma 7

  • Prisma transaction → Maintains the same behavior as before, with added support for PostgreSQL. As a result, dbDriver is now a required parameter.
  • Prisma metrics plugin → Removed. The metrics feature is no longer available in Prisma, and it is not possible to monitor the connection pool using Prisma alone. Supporting this would require integrating database-specific drivers (e.g., pg for PostgreSQL). This likely deserves a separate library per database type to avoid installing unnecessary dependencies.
  • Prisma factory → Keeps the same behavior as before. It can now be configured to return an extended Prisma Client that records metrics for all queries executed through it.

Checklist

  • Apply one of following labels; major, minor, patch or skip-release
  • I've updated the documentation, or no changes were necessary
  • I've updated the tests, or no changes were necessary

AI Assistance Tracking

We're running a metric to understand where AI assists our engineering work. Please select exactly one of the options below:

Mark "Yes" if AI helped in any part of this work, for example: generating code, refactoring, debugging support,
explaining something, reviewing an idea, or suggesting an approach.

  • Yes, AI assisted with this PR
  • No, AI did not assist with this PR

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Prometheus metrics collection for database query monitoring and performance tracking
    • Added automatic retry mechanism with exponential backoff for resilient distributed database operations
    • Added multi-database driver support (CockroachDB and Postgres)
  • Improvements

    • Enhanced database client factory with configurable metrics integration
    • Upgraded to Prisma 7.x for improved performance
  • Refactoring

    • Reorganized metrics collection system for more efficient integration

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 12, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'tools'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

This PR refactors the prisma-utils package, migrating from Prisma 6 to Prisma 7, replacing a plugin-based metrics system with a factory/extension pattern, reorganizing code structure with dedicated factory and transaction modules, and updating transaction handling to use an options-parameter API.

Changes

Cohort / File(s) Summary
Configuration & Infrastructure
biome.json, packages/app/prisma-utils/.env, packages/app/prisma-utils/.gitignore, packages/app/prisma-utils/docker-compose.yml
Updated file exclusion patterns, added SSL parameter to database connection, created git ignore rule for test artifacts, and added healthcheck to CockroachDB container.
Prisma Configuration
packages/app/prisma-utils/prisma/prisma.config.ts, packages/app/prisma-utils/prisma/schema.prisma
Added dedicated Prisma config file using defineConfig, updated schema to use new generator output path, removed datasource URL from schema (moved to config), and added model mappings.
Package Management & Dependencies
packages/app/prisma-utils/package.json
Updated build scripts to reference new Prisma config path, upgraded from Prisma 6 to 7, added Prometheus client as peer dependency, removed fastify-extras and zod, updated @lokalise/node-core peer requirement.
Documentation
packages/app/prisma-utils/README.md
Expanded with installation instructions, feature overview, detailed Prisma client factory usage, metrics integration examples, transaction patterns, and comprehensive retry mechanism documentation.
Metrics System (New Factory Pattern)
packages/app/prisma-utils/src/factory/extendPrismaClientWithMetrics.ts, packages/app/prisma-utils/src/factory/extendPrismaClientWithMetrics.spec.ts, packages/app/prisma-utils/src/factory/prismaClientFactory.ts, packages/app/prisma-utils/src/factory/prismaClientFactory.spec.ts, packages/app/prisma-utils/src/factory/index.ts
Introduced new metrics extension system using Prisma's \$extends hook to collect Prometheus metrics (queries, duration, errors), created Prisma client factory with configurable metrics integration, replaced old plugin-based approach with lightweight extension.
Metrics System (Removed)
packages/app/prisma-utils/src/plugins/MetricsCollector.ts, packages/app/prisma-utils/src/plugins/prismaMetricsPlugin.ts, packages/app/prisma-utils/src/plugins/CollectionScheduler.ts
Removed legacy plugin-based metrics system including MetricsCollector class, FastifyPluginCallback wrapper, and scheduled collection infrastructure; functionality migrated to new factory pattern.
Transaction Handling
packages/app/prisma-utils/src/transaction/prismaTransaction.ts, packages/app/prisma-utils/src/transaction/prismaTransaction.spec.ts, packages/app/prisma-utils/src/transaction/prismaTransaction.isolationLevel.spec.ts, packages/app/prisma-utils/src/transaction/types.ts, packages/app/prisma-utils/src/transaction/index.ts
Refactored transaction API to accept options as second parameter (dbDriver, retries, timeouts), added new PrismaTransactionOptions and related types, updated Prisma runtime imports to use RuntimePrisma alias, created barrel export for transaction module.
Error Handling
packages/app/prisma-utils/src/errors/cockroachdbError.ts, packages/app/prisma-utils/src/errors/cockroachdbError.spec.ts, packages/app/prisma-utils/src/errors/prismaError.ts
Updated import paths for PrismaClientKnownRequestError from Prisma 7's new runtime client module path.
Type System & Module Exports
packages/app/prisma-utils/src/types.ts, packages/app/prisma-utils/src/index.ts, packages/app/prisma-utils/src/isolation_level/isolationLevel.ts
Removed old transaction-related types now housed in transaction/types.ts, updated DbDriverEnum (COCKROACHDB → COCKROACH\_DB, added POSTGRES), removed isolation level type exports, restructured main index exports to use barrel imports from factory and transaction modules.
Legacy Files Removed
packages/app/prisma-utils/src/prismaClientFactory.ts, packages/app/prisma-utils/src/prismaClientFactory.spec.ts
Deleted old factory implementation and tests; functionality replaced with new metrics-aware factory in factory/ subdirectory.
Test Infrastructure
packages/app/prisma-utils/test/DbCleaner.ts
Updated PrismaClient type import to reference new test database client output location.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: Prisma 7' clearly and concisely summarizes the main change: upgrading Prisma to version 7.
Description check ✅ Passed The PR description is comprehensive and well-structured. It covers the three main aspects of the changes (transaction, metrics plugin removal, factory), provides clear rationale for each change, and completes all checklist items including documentation, tests, and AI assistance tracking.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/prisma_7

Comment @coderabbitai help to get the list of available commands and usage tips.

@@ -1 +1 @@
DATABASE_URL=postgresql://testuser:pass@localhost:26257/test
DATABASE_URL=postgresql://testuser:pass@localhost:26257/test?sslmode=no-verify
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines -25 to -33
maxWait?: number
timeout?: number
/*
For now library only supports CockroachDB, when we add support for other databases we need to update this to
use union types and depending on DbDriver allow different isolation levels

Also, this is a temporal solution in the meantime Prisma includes ReadCommitted as a valid isolation level for CockroachDB
*/
isolationLevel?: CockroachDbIsolationLevel
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No longer needed, it is already included on Prisma types

@CarlosGamero CarlosGamero changed the title [IN PROGRESS] chore: Prisma 7 chore: Prisma 7 Feb 15, 2026
export const DbDriverEnum = {
COCKROACHDB: 'CockroachDb',
COCKROACH_DB: 'CockroachDb',
POSTGRES: 'Postgres',
Copy link
Copy Markdown
Collaborator Author

@CarlosGamero CarlosGamero Feb 15, 2026

Choose a reason for hiding this comment

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

Adding Postgres, so in case we need to handle any specific error, the lib is ready without a having a major release


generator client {
provider = "prisma-client-js"
previewFeatures = ["metrics"]
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Removed from Prisma 7


generator client {
provider = "prisma-client"
output = "../test/db-client"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Output is now mandatory

@CarlosGamero CarlosGamero marked this pull request as ready for review February 15, 2026 20:17
@CarlosGamero CarlosGamero requested review from a team, dariacm and kibertoad as code owners February 15, 2026 20:17
Copy link
Copy Markdown

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

🤖 Fix all issues with AI agents
In `@packages/app/prisma-utils/src/errors/cockroachdbError.ts`:
- Line 1: Replace the unstable internal import of PrismaClientKnownRequestError
from '@prisma/client/runtime/client' with the public API: import { Prisma } from
'@prisma/client', then update all type references (e.g.,
PrismaClientKnownRequestError) to use the namespaced type
Prisma.PrismaClientKnownRequestError in cockroachdbError.ts (and other affected
files) so the code relies on the stable Prisma public API.

In `@packages/app/prisma-utils/src/factory/extendPrismaClientWithMetrics.spec.ts`:
- Around line 36-39: The beforeEach test setup only calls cleanTables(prisma,
[DB_MODEL.item1]) so records for DB_MODEL.item2 created in tests (e.g., in the
test that inserts item2 on lines ~57-60) will persist; update the beforeEach to
call cleanTables(prisma, [DB_MODEL.item1, DB_MODEL.item2]) (or include
DB_MODEL.item2 in the cleanup array) so both models are cleared before each
test; modify the setup that references beforeEach and cleanTables accordingly.

In `@packages/app/prisma-utils/src/factory/prismaClientFactory.ts`:
- Around line 1-9: The Prometheus import uses a default-style type import but
the code and tests treat it as a namespace (accessing
Prometheus.Counter/Histogram); change the import to a namespace type import
(import type * as Prometheus from 'prom-client') so usages and the
prismaClientFactoryOptions.promClient type align with the rest of the codebase
and docs, and ensure any references to Prometheus in this file (e.g.,
promClient?: typeof Prometheus) remain correct after the change.

In `@packages/app/prisma-utils/src/transaction/prismaTransaction.ts`:
- Line 5: The code imports PrismaClient from a test-only path which will be
missing in published packages; update the import in prismaTransaction.ts,
prismaClientFactory.ts and extendPrismaClientWithMetrics.ts to import the type
from '@prisma/client' (e.g. replace "import type { PrismaClient } from
'../../test/db-client/client.ts'" with "import type { PrismaClient } from
'@prisma/client'") and leave the generic constraint pattern (e.g. <P extends
PrismaClient>) intact so compatibility is preserved.
🧹 Nitpick comments (7)
packages/app/prisma-utils/src/factory/index.ts (1)

1-1: Consider exporting extendPrismaClientWithMetrics for flexibility.

The factory is exported, but consumers who already have a PrismaClient instance and want to add metrics may benefit from direct access to extendPrismaClientWithMetrics. Consider whether this should also be part of the public API.

 export { prismaClientFactory } from './prismaClientFactory.ts'
+export { extendPrismaClientWithMetrics } from './extendPrismaClientWithMetrics.ts'
packages/app/prisma-utils/src/factory/extendPrismaClientWithMetrics.spec.ts (1)

117-126: Test re-extends an already-extended client instead of a fresh base client.

Line 122 calls extendPrismaClientWithMetrics(prisma, promClient) where prisma is already the extended client from beforeAll. This tests re-extending an extended client, not re-extending a base client. If the intent is to verify idempotency when called multiple times with the same registry, this is fine. If the intent is to verify that a fresh base client reuses existing metrics, consider storing basePrisma for use here.

packages/app/prisma-utils/src/factory/extendPrismaClientWithMetrics.ts (2)

26-32: Simplify result tracking without Either type.

The Either type is imported but used as a plain object with manual result/error keys. This doesn't leverage the Either pattern properly. Consider either using Either correctly with its constructors, or simplifying to a plain union type:

-import type { Either } from '@lokalise/node-core'
 ...
-          let result: Either<unknown, unknown> = { result: undefined }
+          let queryResult: unknown
+          let queryError: unknown

           try {
             const response = await query(args)
-            result = { result: response }
+            queryResult = response
           } catch (error) {
-            result = { error }
+            queryError = error
           } finally {
             ...
-            status: result.error ? 'error' : 'success',
+            status: queryError ? 'error' : 'success',
             ...
-            if (result.error) {
-              const errorCode = (result.error as Error & { code?: string })?.code || 'unknown'
+            if (queryError) {
+              const errorCode = (queryError as Error & { code?: string })?.code || 'unknown'
           }

-          if (result.error) throw result.error
-          return result.result
+          if (queryError) throw queryError
+          return queryResult

109-111: Empty catch block silently swallows errors.

While the intent is to return null when metrics don't exist, silently catching all errors could hide unexpected issues. Consider being more specific or adding debug logging:

   } catch {
-    // If any error occurs (e.g. metrics not found), return null to create new metrics
+    // getSingleMetric returns undefined for missing metrics and doesn't throw,
+    // so reaching here indicates an unexpected error - safe to ignore and recreate
   }
packages/app/prisma-utils/package.json (1)

42-46: Consider making prom-client an optional peer dependency.

Since the metrics functionality is optional (configured via factory), consumers who don't use metrics would still get a peer dependency warning if prom-client isn't installed. Consider marking it as optional:

"peerDependenciesMeta": {
  "prom-client": {
    "optional": true
  }
}
packages/app/prisma-utils/src/transaction/prismaTransaction.ts (2)

94-101: The @ts-expect-error suggests a typing issue worth investigating.

The suppression at line 96 may be masking a type incompatibility. Once the PrismaClient import is fixed to use the proper type from @prisma/client, this type error may resolve or require a different approach.

Consider documenting why this suppression is needed if it persists after fixing the import.


29-36: JSDoc parameter order doesn't match function signature.

The JSDoc lists arg before options, but the actual signature is (prisma, options, arg). Update for accuracy:

📝 Suggested JSDoc fix
 /**
  * Perform a Prisma DB transaction with automatic retries if needed.
  *
  * `@template` T | T extends Prisma.PrismaPromise<unknown>[]
  * `@param` {PrismaClient} prisma
- * `@param` {PrismaTransactionFn<T> | RuntimePrisma.PrismaPromise<unknown>[]} arg	 operation to perform into the transaction
  * `@param` {PrismaTransactionOptions} options transaction configuration
+ * `@param` {PrismaTransactionFn<T> | RuntimePrisma.PrismaPromise<unknown>[]} arg operation to perform into the transaction
  * `@return` {Promise<PrismaTransactionReturnType<T>>}
  */

import type * as runtime from '@prisma/client/runtime/library'
import { isCockroachDBRetryTransaction } from './errors/cockroachdbError.ts'
import type * as RuntimePrisma from '@prisma/client/runtime/client'
import type { PrismaClient } from '../../test/db-client/client.ts'
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Feb 15, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check how PrismaClient is typed in other source files and what's exported
echo "=== Checking PrismaClient usage in src files ==="
rg -n "PrismaClient" packages/app/prisma-utils/src --type ts -g '!*.spec.ts'

echo ""
echo "=== Checking package exports ==="
cat packages/app/prisma-utils/package.json | jq '.files, .exports'

echo ""
echo "=== Check if there's a types.ts that re-exports PrismaClient ==="
fd -e ts -p 'types' packages/app/prisma-utils/src --exec cat -n {}

Repository: lokalise/shared-ts-libs

Length of output: 4750


🏁 Script executed:

#!/bin/bash
# Check the test directory structure
echo "=== Checking if test/db-client exists ==="
ls -la packages/app/prisma-utils/test/db-client/ 2>&1 | head -20

echo ""
echo "=== Checking index.ts exports ==="
cat packages/app/prisma-utils/src/index.ts

echo ""
echo "=== Count files affected ==="
rg -l "from '../../test/db-client" packages/app/prisma-utils/src --type ts

Repository: lokalise/shared-ts-libs

Length of output: 890


🏁 Script executed:

#!/bin/bash
# Check if test directory is generated or if there's a setup
echo "=== Check git status for test/db-client ==="
cd packages/app/prisma-utils && git status test/ 2>&1 | head -20

echo ""
echo "=== Check if there's a test setup file ==="
find packages/app/prisma-utils -name "*.config.*" -o -name "setup*" -o -name "vitest*" | head -10

echo ""
echo "=== Look at one of the spec files that also imports from test ==="
head -20 packages/app/prisma-utils/src/factory/prismaClientFactory.spec.ts

Repository: lokalise/shared-ts-libs

Length of output: 490


🏁 Script executed:

#!/bin/bash
# Find the actual structure
echo "=== List what's in packages/app ==="
find packages/app -maxdepth 2 -type d | head -20

echo ""
echo "=== Find any prisma-utils related files ==="
find . -name "prismaTransaction.ts" -type f

echo ""
echo "=== Check if this is about a different package ==="
find . -path "*/test/db-client*" -type d

Repository: lokalise/shared-ts-libs

Length of output: 880


🏁 Script executed:

#!/bin/bash
# Find the test/db-client directory properly
echo "=== Find test/db-client directory in prisma-utils ==="
find ./packages/app/prisma-utils -path "*/test/db-client*" -type d

echo ""
echo "=== List all directories under prisma-utils ==="
find ./packages/app/prisma-utils -maxdepth 3 -type d | sort

echo ""
echo "=== Check if test directory exists at all ==="
ls -la ./packages/app/prisma-utils/test 2>&1

echo ""
echo "=== Look for db-client anywhere in the repo ==="
find . -name "db-client" -type d

Repository: lokalise/shared-ts-libs

Length of output: 931


🏁 Script executed:

#!/bin/bash
# Check the actual content of the test directory
echo "=== Content of test directory ==="
ls -la ./packages/app/prisma-utils/test/

echo ""
echo "=== Check if db-client is a generated artifact ==="
cat ./packages/app/prisma-utils/package.json | jq '.scripts, .devDependencies | keys' | head -30

echo ""
echo "=== Check tsconfig or build config ==="
cat ./packages/app/prisma-utils/tsconfig.json 2>&1 | head -20

echo ""
echo "=== Check if there's a README explaining setup ==="
cat ./packages/app/prisma-utils/README.md 2>&1 | head -30

Repository: lokalise/shared-ts-libs

Length of output: 1719


🏁 Script executed:

#!/bin/bash
# Check .gitignore and see if db-client is ignored
echo "=== Check .gitignore in prisma-utils ==="
cat ./packages/app/prisma-utils/.gitignore 2>&1

echo ""
echo "=== Check root .gitignore ==="
cat .gitignore 2>&1 | grep -i "db-client\|test"

echo ""
echo "=== Verify the import path actually used ==="
head -10 ./packages/app/prisma-utils/src/transaction/prismaTransaction.ts

echo ""
echo "=== Check if Prisma generates a client somewhere ==="
grep -r "db-client" ./packages/app/prisma-utils --include="*.ts" --include="*.json" 2>&1

Repository: lokalise/shared-ts-libs

Length of output: 2253


🏁 Script executed:

#!/bin/bash
# Let's see what's in the generated db-client during tests
echo "=== Check the prisma schema to understand the setup ==="
cat ./packages/app/prisma-utils/prisma/schema.prisma | head -30

echo ""
echo "=== Check the db:update-client script ==="
cat ./packages/app/prisma-utils/package.json | jq '.scripts["db:update-client"]'

echo ""
echo "=== Verify what dist exports ==="
cat ./packages/app/prisma-utils/src/index.ts

echo ""
echo "=== Check if types are re-exported in a way that avoids test imports ==="
grep -n "export.*PrismaClient" ./packages/app/prisma-utils/src/**/*.ts 2>&1

Repository: lokalise/shared-ts-libs

Length of output: 1793


🏁 Script executed:

#!/bin/bash
# Final verification: check what a consumer would see
echo "=== What gets published to npm (based on files array) ==="
echo "Only: dist/, README.md, LICENSE.md"

echo ""
echo "=== The functions use PrismaClient as a type constraint, not a concrete type ==="
grep -A2 "export const prismaClientFactory\|export const prismaTransaction" ./packages/app/prisma-utils/src/factory/prismaClientFactory.ts ./packages/app/prisma-utils/src/transaction/prismaTransaction.ts

echo ""
echo "=== This means consumers cannot pass their own PrismaClient because the types won't resolve ==="
echo "Consumer would do: prismaTransaction(myPrisma, ...)"
echo "But types expect PrismaClient from ../../test/db-client/client.ts which doesn't exist in node_modules"

Repository: lokalise/shared-ts-libs

Length of output: 1146


Production code imports from test directory—this will break the published package for all consumers.

PrismaClient is imported from ../../test/db-client/client.ts, which is a Prisma-generated test artifact. This directory is gitignored and not included in the published package (only dist/, README.md, LICENSE.md per package.json files array). When consumers install via npm, type resolution will fail because the path does not exist in node_modules.

The issue affects:

  • src/transaction/prismaTransaction.ts (line 5)
  • src/factory/prismaClientFactory.ts (line 3)
  • src/factory/extendPrismaClientWithMetrics.ts (line 3)

Import from @prisma/client instead. The generic constraint pattern (<P extends PrismaClient>) already allows any PrismaClient implementation, so this change maintains compatibility while fixing the path resolution issue.

🤖 Prompt for AI Agents
In `@packages/app/prisma-utils/src/transaction/prismaTransaction.ts` at line 5,
The code imports PrismaClient from a test-only path which will be missing in
published packages; update the import in prismaTransaction.ts,
prismaClientFactory.ts and extendPrismaClientWithMetrics.ts to import the type
from '@prisma/client' (e.g. replace "import type { PrismaClient } from
'../../test/db-client/client.ts'" with "import type { PrismaClient } from
'@prisma/client'") and leave the generic constraint pattern (e.g. <P extends
PrismaClient>) intact so compatibility is preserved.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@CarlosGamero this looks alarming indeed, and it wasn't the case before

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

t is, but I believe we had the same situation before. The main difference is that the generated client used to be saved in node_modules, which is no longer possible.

So I’m not entirely sure about the impact, we would need to test the behavior in a real service to confirm.

The most reliable way to validate this would be to release it and test it in an actual service. Alternatively, we could try integrating the local package into a service and test it that way, but that would require more time.

# Conflicts:
#	packages/app/prisma-utils/package.json
Copy link
Copy Markdown

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

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

Inline comments:
In `@packages/app/prisma-utils/package.json`:
- Around line 42-44: The package currently declares a peer dependency on
"prom-client" without marking it optional; update the package.json to either add
a peerDependenciesMeta entry making "prom-client" optional by adding
"peerDependenciesMeta": { "prom-client": { "optional": true } } or, if you
intend to require metrics, ensure the README/migration notes and changelog
explicitly state that "prom-client" is now a mandatory peer dependency; locate
the package.json's dependency block (symbols: "prom-client",
"peerDependenciesMeta") and apply the chosen change.
- Around line 26-30: The npm scripts "db:migration:dev" and "test:migrate"
reference the Prisma config without the .ts extension and will fail on Prisma 7;
update the --config value in the package.json scripts for db:migration:dev and
test:migrate to point to ./prisma/prisma.config.ts (the actual file name) so
Prisma can resolve the config file correctly.

# Conflicts:
#	packages/app/prisma-utils/package.json
Copy link
Copy Markdown

@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.

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

Duplicate comments:
In `@packages/app/prisma-utils/package.json`:
- Line 26: Update the Prisma script entries in package.json that set
"db:migration:dev" (and the similar script at the other occurrence) to reference
the full config filename including the .ts extension; change any occurrences of
--config=./prisma/prisma.config to --config=./prisma/prisma.config.ts so Prisma
7 will locate prisma.config.ts correctly when running prisma migrate dev.
- Line 42: The package.json currently lists "prom-client" as a required peer
dependency; add a peerDependenciesMeta entry to mark "prom-client" optional so
consumers that don't need metrics won't be forced to install it. In package.json
add a "peerDependenciesMeta" object with "prom-client": { "optional": true }
alongside the existing "peerDependencies" entry for "prom-client" to indicate
the dependency is not required by all consumers.

Copy link
Copy Markdown

@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

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

Inline comments:
In `@packages/app/prisma-utils/docker-compose.yml`:
- Around line 13-18: The CockroachDB healthcheck in the healthcheck block
references --certs-dir=certs but the container is started in secure mode (no
--insecure) and no certs are provided; update the docker-compose service so the
healthcheck and start command match: either switch to insecure dev mode by
adding --insecure to the service start command and remove --certs-dir=certs from
the healthcheck test, or provision/mount real certs and keep --certs-dir
pointing to the mounted path; locate the CockroachDB service definition and the
healthcheck block in docker-compose.yml and make the corresponding changes so
the healthcheck can succeed.

---

Duplicate comments:
In `@packages/app/prisma-utils/package.json`:
- Around line 37-42: Update package.json to mark the prom-client peer as
optional by adding a peerDependenciesMeta entry for "prom-client" with
"optional": true; specifically, modify the existing peerDependencies block that
lists "prom-client" and add a top-level "peerDependenciesMeta" object
referencing "prom-client" so consumers aren't forced to install it when metrics
aren't required.
- Around line 26-29: Update the npm scripts that call Prisma to include the .ts
extension on the config path: in package.json adjust the "db:migration:dev"
script (currently using --config=./prisma/prisma.config) and the "test:migrate"
script (currently using --config=./prisma/prisma.config) to use
--config=./prisma/prisma.config.ts so Prisma 7 can locate the config file.

Comment on lines +13 to +18
healthcheck:
test: [ "CMD-SHELL", "cockroach sql --host=127.0.0.1:26257 --certs-dir=certs -e 'SELECT 1;' || exit 1" ]
interval: 3s # run check every 3 seconds
timeout: 5s # fail if longer than 5s
retries: 10 # require 10 consecutive failures before unhealthy
start_period: 10s # grace period for initialization
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

cat -n packages/app/prisma-utils/docker-compose.yml

Repository: lokalise/shared-ts-libs

Length of output: 898


🏁 Script executed:

rg -n "cockroach|certs-dir|cockroach-certs|start-single-node|--insecure" -S --type yaml

Repository: lokalise/shared-ts-libs

Length of output: 733


🏁 Script executed:

fd -a "certs" .

Repository: lokalise/shared-ts-libs

Length of output: 49


CockroachDB healthcheck will fail—no certificates exist for secure mode.

The container runs in secure mode (no --insecure flag in command), but the healthcheck references --certs-dir=certs which doesn't exist anywhere in the repository. This will cause the healthcheck to fail indefinitely, breaking depends_on: condition: service_healthy and local dev workflows.

Either add --insecure to the start command and remove --certs-dir from the healthcheck, or generate/mount certificates with the correct path and credentials.

✅ Example fix (insecure dev mode)
-    command: start-single-node --cluster-name=example-single-node
+    command: start-single-node --insecure --cluster-name=example-single-node
     healthcheck:
-      test: [ "CMD-SHELL", "cockroach sql --host=127.0.0.1:26257 --certs-dir=certs -e 'SELECT 1;' || exit 1" ]
+      test: [ "CMD-SHELL", "cockroach sql --insecure --host=127.0.0.1:26257 -e 'SELECT 1;' || exit 1" ]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/app/prisma-utils/docker-compose.yml` around lines 13 - 18, The
CockroachDB healthcheck in the healthcheck block references --certs-dir=certs
but the container is started in secure mode (no --insecure) and no certs are
provided; update the docker-compose service so the healthcheck and start command
match: either switch to insecure dev mode by adding --insecure to the service
start command and remove --certs-dir=certs from the healthcheck test, or
provision/mount real certs and keep --certs-dir pointing to the mounted path;
locate the CockroachDB service definition and the healthcheck block in
docker-compose.yml and make the corresponding changes so the healthcheck can
succeed.

@CarlosGamero CarlosGamero merged commit b46e9d2 into main Feb 20, 2026
7 checks passed
@CarlosGamero CarlosGamero deleted the chore/prisma_7 branch February 20, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants