fix: add has trap to client proxy for in operator support#26
fix: add has trap to client proxy for in operator support#26ktmouk wants to merge 1 commit intocodepunkt:mainfrom
Conversation
|
Note
|
| Cohort / File(s) | Summary |
|---|---|
Test Validation src/contest.test.ts |
Adds two test cases verifying trap behavior: confirms trap returns true for existing properties ('$connect' and meta) and false for non-existent properties; validates trap returns false when no active transaction exists. |
Proxy Implementation src/context.ts |
Implements a "has" trap on the Prisma client proxy that checks for active transaction client; returns false when none exists, otherwise delegates to transaction client to determine property existence. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
🐰✨ A trap so clever, a "has" so neat,
The proxy checks before we meet,
Transaction client takes the call,
When active—or returns false to all! 🎭
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title accurately describes the main change: adding a has trap to the client proxy for in operator support, which is the core fix implemented in the PR. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
✏️ 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
📝 Coding Plan
- Generate coding plan for human review comments
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 @coderabbitai help to get the list of available commands and usage tips.
Tip
CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.
OpenGrep is compatible with Semgrep configurations. Add an opengrep.yml or semgrep.yml configuration file to your project to enable OpenGrep analysis.
Summary
Proxywas missing ahastrap, so theinoperator (e.g."chapter" in client) always returnedfalse— this broke libraries like Pothos Prisma plugin that rely oninto check for delegate existencehastrap that delegates totransactionClientwhen active, or returnsfalsewhen no transaction is activeTest plan
hastrap returnstruefor existing properties andfalsefor non-existent properties during active transactionhastrap returnsfalsewhen no transaction is activeSummary by CodeRabbit
Tests
Improvements