Skip to content

[PASO 2.10] Standardize DI pattern — remove providedIn:'root', add missing factories#34

Merged
mfg1986 merged 3 commits into
developfrom
feature/paso-2.10-val-inc-di-standardization
May 20, 2026
Merged

[PASO 2.10] Standardize DI pattern — remove providedIn:'root', add missing factories#34
mfg1986 merged 3 commits into
developfrom
feature/paso-2.10-val-inc-di-standardization

Conversation

@mfg1986
Copy link
Copy Markdown
Contributor

@mfg1986 mfg1986 commented May 20, 2026

Summary

  • Remove providedIn: 'root' from all 12 services that used it
  • Create 5 new provideX() factories for services that lacked them: provideAuth(), provideSession(), provideBreadcrumb(), provideApiClient(), provideUserContext()
  • Update 7 existing factories to explicitly register their service class
  • Fix 23 test files to include provideX() in TestBed configuration
  • Bump version to 0.11.0 (breaking change)

Result: All 16 framework services now follow the same DI pattern: @Injectable() + mandatory provideX() factory. Zero services use providedIn: '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

  • CI build passes
  • CI logs show 516/516 tests passing
  • grep -r "providedIn: 'root'" packages/core/src/lib --include="*.ts" | grep -v spec | grep -v "//" returns 0 service matches

mfg1986 added 3 commits May 20, 2026 12:41
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.
@mfg1986 mfg1986 merged commit 81bd9a2 into develop May 20, 2026
3 checks passed
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