Upgrading Prisma Next to 0.8.0#467
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`SqlMiddlewareContext.scope` became required in 0.8 (was optional in 0.7); add `scope: 'runtime'` to the test mocks in `abort.test.ts` and `bulk-encrypt-middleware.test.ts`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…l codec `@prisma-next/sql-runtime@0.8` reorders the SQL execution pipeline so the `beforeExecute` middleware chain fires *before* `encodeParams`. `bulkEncryptMiddleware` now mutates params via `replaceValues` ahead of encode, so `CipherstashCellCodec.encode` is invoked with the wire-format string rather than the original envelope. Short-circuit string values through unchanged; the envelope path is kept intact for unit tests that exercise `encode` directly. Also bumps `examples/prisma` to `@prisma-next/*@0.8.0` so the consumer- app integration tests pick up the matching framework. All 36 live-PG + EQL + ZeroKMS e2e tests pass (1 pre-existing skip for the `cipherstashJsonbPathExists` predicate per TML-2504). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: f2aca22 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR upgrades Prisma Next dependencies from 0.6.0-dev.8 to 0.8.0 across example and package manifests, adapts the cell codec factory to handle pre-encoded string inputs in the new runtime execution pattern, and updates test helpers to set the middleware context scope to 'runtime'. ChangesPrisma Next 0.8.0 and Runtime Execution
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/prisma-next/src/execution/cell-codec-factory.ts`:
- Around line 144-146: The encode branch in the encode function currently
returns any string value verbatim (checked via `if (typeof value === 'string')
return value;`), which allows raw/malformed strings to bypass envelope safety;
change this to validate that `value` matches the expected composite-literal
shape `eql_v2_encrypted(...)` (use a strict check/regex for the
`eql_v2_encrypted` envelope format) and only return the string if it passes that
validation, otherwise throw or return an error/encode-path fallback so raw
strings cannot be passed through unchecked; update the `encode` function's
`value` handling accordingly.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 59209334-1f07-47ea-a29f-e54dc97f6e4e
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
examples/prisma/package.jsonpackages/prisma-next/package.jsonpackages/prisma-next/src/execution/cell-codec-factory.tspackages/prisma-next/test/abort.test.tspackages/prisma-next/test/bulk-encrypt-middleware.test.ts
| if (typeof value === 'string') { | ||
| return value; | ||
| } |
There was a problem hiding this comment.
Fail closed on raw-string passthrough in encode.
Line 144 currently accepts any string unchanged. That should be constrained to the expected eql_v2_encrypted composite-literal shape; otherwise malformed/raw values can bypass the envelope-path safety checks.
Suggested fix
- if (typeof value === 'string') {
- return value;
- }
+ if (typeof value === 'string') {
+ const trimmed = value.trim();
+ if (!trimmed.startsWith('(') || !trimmed.endsWith(')')) {
+ throw runtimeError(
+ 'RUNTIME.ENCODE_FAILED',
+ `cipherstash ${this.descriptor.codecId}: expected middleware-produced eql_v2_encrypted composite literal, got raw string input.`,
+ {
+ codecId: this.descriptor.codecId,
+ reason: 'cipherstash-invalid-wire-literal',
+ },
+ );
+ }
+ return value;
+ }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/prisma-next/src/execution/cell-codec-factory.ts` around lines 144 -
146, The encode branch in the encode function currently returns any string value
verbatim (checked via `if (typeof value === 'string') return value;`), which
allows raw/malformed strings to bypass envelope safety; change this to validate
that `value` matches the expected composite-literal shape
`eql_v2_encrypted(...)` (use a strict check/regex for the `eql_v2_encrypted`
envelope format) and only return the string if it passes that validation,
otherwise throw or return an error/encode-path fallback so raw strings cannot be
passed through unchecked; update the `encode` function's `value` handling
accordingly.
Summary by CodeRabbit
Release Notes
Chores
Tests