fix: preserve decorator metadata in published bundles - #1412
Conversation
|
Warning Review limit reached
Next review available in: 41 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. 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 Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (17)
📝 WalkthroughWalkthroughChanges게시 번들 DI 메타데이터
지연 초기화 런타임 환경
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant PackedPackage
participant SmokeScript
participant Container
PackedPackage->>SmokeScript: ESM/CJS 서비스와 design:paramtypes 로드
SmokeScript->>Container: 서비스 해석 요청
Container-->>SmokeScript: 의존성 주입 및 기본값 보존 결과
SmokeScript-->>PackedPackage: 성공 또는 메타데이터 오류 보고
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ 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 |
📊 Benchmark Results✅ All benchmarks passed
Updated: 2026-07-18T04:24:42.648Z · Commit: 80f5388 |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 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/auth-better-auth/src/libs/BetterAuthProvider.ts`:
- Around line 1-5: Replace each file-wide consistent-type-imports suppression
with a localized suppression on the required runtime DI import only:
BetterAuthFactory in packages/auth-better-auth/src/libs/BetterAuthProvider.ts
(lines 1-5), TxManager in
packages/membership-drizzle/src/libs/DrizzleMembershipStore.ts (lines 1-10),
NotificationProviderRegistry in
packages/notifications-core/src/libs/SendNotificationTask.ts (lines 1-7), and
TxManager in packages/onboarding-drizzle/src/libs/DrizzleOnboardingStore.ts
(lines 1-5). Remove the file-level directives while preserving the runtime
imports needed for emitted DI metadata.
In `@packages/framework-config/src/core.ts`:
- Line 29: Defer evaluation of SKIP_ENV_VALIDATION in the framework
configuration flow instead of initializing skipValidation at module import time.
Read and parse process.env.SKIP_ENV_VALIDATION on the first env access, ensuring
later environment changes are observed and invalid boolean values throw at that
access rather than during import.
In `@packages/framework-context/src/libs/Container.ts`:
- Around line 294-298: Update buildDependencyGraph’s dependency filter to
consult getParameterInjectionToken when parameterIndex is beyond node.length,
retaining explicitly `@Inject-declared` dependencies in the static graph while
excluding only parameters without an explicit injection token. Keep the existing
constructor-function and nodeSet checks for included dependencies.
In `@packages/invitation-core/src/libs/DomainPolicyManager.ts`:
- Around line 1-12: Separate only the pure type imports while preserving runtime
imports required for constructor injection: in
packages/invitation-core/src/libs/DomainPolicyManager.ts, move Membership and
MembershipRole to import type; in
packages/invitation-drizzle/src/libs/DrizzleDomainPolicyStore.ts, move
DomainPolicy to import type; and in
packages/invitation-drizzle/src/libs/DrizzleInvitationStore.ts, move Invitation
and InvitationStatus to import type. Keep EventPublisher, MembershipManager,
DomainPolicyStore, and other runtime dependencies unchanged.
In `@packages/transports-http/src/tests/ErrorHandler.spec.ts`:
- Around line 61-66: Update the ErrorHandler container-construction test to
verify the resolved ErrorHandler instance actually contains the logger
registered under LOGGER_TOKEN, rather than only asserting its ErrorHandler type.
Preserve the existing Container.register and Container.set setup while asserting
the injected logger matches mockLogger.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 343b5a35-ca6a-4c5e-9fe8-a8dbd532609a
⛔ Files ignored due to path filters (2)
packages/problems-core/src/generated/problem-code-registry.tsis excluded by!**/generated/**pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (33)
.changeset/preserve-decorator-metadata.mddocs/problem-code-registry.jsonpackage.jsonpackages/analytics-posthog/src/libs/PostHogAnalyticsManager.tspackages/auth-better-auth/src/libs/BetterAuthProvider.tspackages/docs/src/content/docs/en/reference/problem-recovery-cookbook.mdpackages/features-posthog/src/libs/PostHogFeatureManager.tspackages/framework-config/src/core.tspackages/framework-config/src/tests/Core.spec.tspackages/framework-context/src/libs/Container.tspackages/framework-context/src/tests/FrameworkContext.spec.tspackages/framework-logger/src/Logger.tspackages/invitation-core/src/libs/DomainPolicyManager.tspackages/invitation-core/src/libs/InvitationManager.tspackages/invitation-core/src/libs/RateLimitedInvitationService.tspackages/invitation-drizzle/src/libs/DrizzleDomainPolicyStore.tspackages/invitation-drizzle/src/libs/DrizzleInvitationStore.tspackages/membership-core/src/libs/MembershipManager.tspackages/membership-core/src/libs/MembershipService.tspackages/membership-drizzle/src/libs/DrizzleMembershipStore.tspackages/metering-core/src/libs/MeterRegistry.tspackages/metrics-billing/src/libs/BillingEventHandler.tspackages/notifications-core/src/libs/NotificationService.tspackages/notifications-core/src/libs/SendNotificationTask.tspackages/onboarding-core/src/libs/OnboardingManager.tspackages/onboarding-drizzle/src/libs/DrizzleOnboardingStore.tspackages/search-core/src/libs/sync/SearchAutoSync.tspackages/storage-r2/src/libs/R2StorageProvider.tspackages/transports-http/src/libs/ErrorHandler.tspackages/transports-http/src/tests/ErrorHandler.spec.tspnpm-workspace.yamlscripts/package-entrypoint-smoke.mtsscripts/tests/package-entrypoint-smoke.spec.ts
…corator-metadata # Conflicts: # packages/docs/src/content/docs/api/problems-core/src/variables/CROCO_PROBLEM_CODE_REGISTRY.md
Outcome
Published Croco ESM and CJS bundles now retain decorator metadata for concrete constructor dependencies. Installed consumers can resolve representative services through
Container.get, while trailing optional/default parameters keep their JavaScript defaults and explicit@Injecthandlers remain authoritative.The release smoke now fails when metadata is missing or when emitted trailing metadata is incorrectly injected.
Verification
pnpm checkpnpm build— 114/114 taskspnpm typecheck— 226/226 taskspnpm exec turbo test --concurrency=1— 227/227 taskspnpm package-entrypoints:smoke— 110 packed packages; CJS/ESM metadata and DI checks for auth, PostHog features, and metering defaultspnpm exec vitest run scripts/tests/package-entrypoint-smoke.spec.ts --config vitest.config.ts— 20/20 testsReview notes
@swc/corein the shared build toolchain so tsup emits metadata instead of silently skipping the transformer.Closes #1338
Summary by CodeRabbit
새로운 기능
버그 수정
테스트
문서