fix: enable DI for FeatureOptInService#13
Open
tomerqodo wants to merge 2 commits into
Open
Conversation
Code Review by Qodo
1. FeaturesRepository moduleLoader token mismatch
|
Comment on lines
+19
to
+22
| export const moduleLoader: ModuleLoader = { | ||
| token: moduleToken, | ||
| loadModule, | ||
| }; |
There was a problem hiding this comment.
1. featuresrepository moduleloader token mismatch 📘 Rule violation ⛯ Reliability
• packages/features/di/modules/FeaturesRepository.ts exports moduleLoader.token as the module token, but binds FeaturesRepository on FLAGS_DI_TOKENS.FEATURES_REPOSITORY, making DI resolution likely to fail at runtime. • getFeaturesRepository() uses featuresRepositoryModuleLoader.token to resolve the repository, so the mismatch can throw and break any callers (including FeatureOptInService injection) without graceful degradation. • This violates the requirement to identify and handle failure points (dependency resolution) with actionable context rather than letting runtime errors occur implicitly.
Agent prompt
## Issue description
`packages/features/di/modules/FeaturesRepository.ts` binds `FeaturesRepository` to `FLAGS_DI_TOKENS.FEATURES_REPOSITORY`, but exports `moduleLoader.token` as `FLAGS_DI_TOKENS.FEATURES_REPOSITORY_MODULE`. Callers use `moduleLoader.token` for injection/resolution, so DI resolution can fail at runtime.
## Issue Context
`bindModuleToClassOnToken` binds the class on the provided `token` and injects dependencies using `dep.token`. Therefore `moduleLoader.token` must represent the binding token (the one used in `module.bind(token)`), not the module token used for `container.load(moduleToken, module)`.
## Fix Focus Areas
- packages/features/di/modules/FeaturesRepository.ts[7-22]
- packages/features/di/containers/FeaturesRepository.ts[4-8]
- packages/features/di/di.ts[94-105]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Benchmark PR from agentic-review-benchmarks#13