Skip to content

fix: enable DI for FeatureOptInService#13

Open
tomerqodo wants to merge 2 commits into
augment_full_base_fix_enable_di_for_featureoptinservice_pr13from
augment_full_head_fix_enable_di_for_featureoptinservice_pr13
Open

fix: enable DI for FeatureOptInService#13
tomerqodo wants to merge 2 commits into
augment_full_base_fix_enable_di_for_featureoptinservice_pr13from
augment_full_head_fix_enable_di_for_featureoptinservice_pr13

Conversation

@tomerqodo

Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#13

@augmentcode

augmentcode Bot commented Jan 26, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR enables dependency injection (DI) for the feature opt-in stack and standardizes how the feature flags repository is wired.

Changes:

  • Adds DI token namespaces for flags and feature opt-in (`FLAGS_DI_TOKENS`, `FEATURE_OPT_IN_DI_TOKENS`) and merges them into `DI_TOKENS`.
  • Replaces the old `Features` DI module with a dedicated `FeaturesRepository` module and updates call sites to import it.
  • Introduces a DI module + container getter for `FeatureOptInService` and switches the TRPC feature opt-in router to use it.
  • Adds a DI container getter for `FeaturesRepository` to avoid direct construction with Prisma in callers/tests.
  • Updates `FeatureOptInService` integration tests to obtain the service/repository via DI containers.
  • Extracts the service contract and `ResolvedFeatureState` type into `IFeatureOptInService`, and has `FeatureOptInService` implement it.

Technical Notes: Uses bindModuleToClassOnToken to ensure transitive module loading (Prisma → FeaturesRepository → FeatureOptInService).

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 1 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

});

export const moduleLoader: ModuleLoader = {
token: moduleToken,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

moduleLoader.token is set to moduleToken, but bindModuleToClassOnToken consumers use dep.token as the injectable token, and container.get() here also uses moduleLoader.token. This will try to resolve FEATURES_REPOSITORY_MODULE (which is only a load key) instead of the bound FEATURES_REPOSITORY token, causing runtime DI resolution failures.

Other Locations
  • packages/features/di/containers/FeaturesRepository.ts:7
  • packages/features/di/modules/FeatureOptInService.ts:16
  • packages/features/bookings/di/RegularBookingService.module.ts:32
  • packages/features/booking-audit/di/BookingAuditTaskConsumer.module.ts:22

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant