[PASO 2.10] Standardize DI pattern — remove providedIn:'root', add missing factories#34
Merged
Merged
Conversation
Create provider factories for services that lacked them: - provideAuth() for AuthService - provideSession(config?) for SessionService - provideBreadcrumb() for BreadcrumbService - provideApiClient() for ApiClient - provideUserContext() for UserContextService Pattern consistent with provideStorage()/provideEnvironment(). Barrel exports updated. Build OK, 516/516 tests pass.
…t' + fix tests Remove providedIn: 'root' from all 12 services, requiring explicit registration via provideX() factories: - ErrorService, FeatureFlagService, NavigationService, BreadcrumbService - PermissionService, AlertService, MasterDataService, TransportRegistry - ApiClient, AuthService, UserContextService, SessionService Update 7 existing factories to register their service class: - provideErrorHandling, provideFeatureFlags, provideNavigation - providePermissions, provideAlerts, provideMasterData - provideFireflyTransport Fix 23 test files to use provideX() in TestBed configuration. Build OK, 516/516 tests pass.
BREAKING: All services require explicit provideX() registration. 5 new factories added, 7 existing updated. Migration guide in CHANGELOG. Build OK, 516/516 tests pass.
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.
Summary
providedIn: 'root'from all 12 services that used itprovideX()factories for services that lacked them:provideAuth(),provideSession(),provideBreadcrumb(),provideApiClient(),provideUserContext()provideX()in TestBed configurationResult: All 16 framework services now follow the same DI pattern:
@Injectable()+ mandatoryprovideX()factory. Zero services useprovidedIn: 'root'.Motivation
Inconsistency detected during PASO 2.10 validation: 12/16 services used
providedIn: 'root'(auto-registered) while 4 newer services used@Injectable()with mandatory factory. This PR standardizes all services on the correct pattern.Test plan
grep -r "providedIn: 'root'" packages/core/src/lib --include="*.ts" | grep -v spec | grep -v "//"returns 0 service matches