fix: isolate tRPC procedures in scoped DI context - #1762
Conversation
|
Warning Review limit reached
Next review available in: 11 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
📝 WalkthroughWalkthroughtRPC 프로시저가 요청별 ChangestRPC 요청 컨텍스트 및 의존성 주입
생성 앱 스모크 릴리스 증거
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client as tRPC client
participant Router as createTrpcRouter
participant Context as Croco Context
participant Container as Croco Container
participant Controller as Controller resolver
Client->>Router: procedure 호출
Router->>Context: RequestContext 생성 및 Context.run 실행
Context->>Container: 컨트롤러와 provider 해석
Container-->>Controller: 요청 범위 인스턴스 반환
Controller-->>Router: procedure 결과 또는 오류
Router-->>Client: tRPC 응답
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
📊 Benchmark Results✅ All benchmarks passed
Updated: 2026-08-07T15:14:44.275Z · Commit: cb98250 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/protocols-trpc/src/libs/createTrpcRouter.ts`:
- Around line 294-295: Update the header lookup in the visible value-reading
logic so ordinary object headers are resolved case-insensitively, including keys
such as Traceparent and X-Request-Id. Normalize the requested name or search
available keys without case sensitivity, while preserving array handling and
readString conversion.
- Around line 305-309: Update parseTraceparent() after regex matching to return
undefined when traceId is all zeros or spanId is all zeros, while preserving
valid identifier parsing; add tests covering all-zero traceparent identifiers.
In `@packages/protocols-trpc/src/tests/TrpcExecutionPipeline.spec.ts`:
- Around line 383-392: Update the rejection assertion in the test “requires a
container for providers with constructor dependencies” to call rejects.toThrow()
before the existing rejects.toMatchObject(...) check, preserving the current
cause-code validation and matching the async error assertion convention used in
the file.
🪄 Autofix
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: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a8ae5873-fb10-42f8-a03c-692f16a5f5f7
⛔ Files ignored due to path filters (1)
packages/problems-core/src/generated/problem-code-registry.tsis excluded by!**/generated/**
📒 Files selected for processing (8)
.changeset/trpc-request-context.mddocs/problem-code-registry.jsonpackages/docs/src/content/docs/api/protocols-trpc/src/type-aliases/TrpcRouterOptions.mdpackages/docs/src/content/docs/en/reference/problem-recovery-cookbook.mdpackages/protocols-trpc/README.mdpackages/protocols-trpc/src/libs/createTrpcRouter.tspackages/protocols-trpc/src/tests/TrpcExecutionPipeline.spec.tspackages/protocols-trpc/src/tests/createTrpcRouter.spec.ts
|
@coderabbitai resolve |
✅ Action performedComments resolved and changes approved. |
1814f81 to
38beba1
Compare
Outcome
Verification
pnpm --filter @croco/protocols-trpc test— 26/26 passedpnpm typecheck— 233/233 tasks passedpnpm public-api:check— 115 snapshots matchedpnpm problem-registry:check— 576/576 codes passedpnpm test— 234/234 tasks passedReview gates
createRequestContextmapper; preserves the existing custom-container and no-argument fallback paths; validates supported traceparent versions.Residual risk
pnpm checkpassed 23/25 repository checks locally. The verification runner timed out while asserting its own timeout-output capture (the isolated test passed immediately afterward), and the gitleaks smoke environment produced malformed temporary SARIF. Neither failure touched the changed package.Fixes #1677
Summary by CodeRabbit
새로운 기능
문서
버그 수정