Skip to content

Fix cross-module dependency between MonitoringModule and UserModule#148

Merged
TaprootFreak merged 1 commit intoLightningDotSpace:developfrom
TaprootFreak:fix/monitoring-cross-module-dependency
Feb 14, 2026
Merged

Fix cross-module dependency between MonitoringModule and UserModule#148
TaprootFreak merged 1 commit intoLightningDotSpace:developfrom
TaprootFreak:fix/monitoring-cross-module-dependency

Conversation

@TaprootFreak
Copy link
Contributor

Summary

  • MonitoringModule was directly importing LightningWalletEntity and LightingWalletRepository from the user subdomain, bypassing NestJS module boundaries
  • This made the circular dependency between MonitoringModule and UserModule invisible to the DI system
  • Now uses forwardRef to properly declare the circular dependency and exports LightingWalletRepository from UserModule

Test plan

  • yarn lint passes
  • yarn build passes
  • Verify scheduled and webhook-triggered balance monitoring still works in dev/staging
  • Confirm no DI resolution errors on startup

LightningWalletService,
UserTransactionService,
UserBoltcardService,
LightingWalletRepository,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think accessing the repository directly is not a good practice, normally we access it the data through the services, in this case LightningWalletService to avoid consumer classes to have too much access over the database.

@TaprootFreak TaprootFreak force-pushed the fix/monitoring-cross-module-dependency branch from 10518e2 to 31b4a89 Compare February 14, 2026 20:14
MonitoringModule was directly importing LightningWalletEntity and
LightningWalletRepository from the user subdomain, bypassing module
boundaries.

Use forwardRef to properly declare the circular dependency between
MonitoringModule and UserModule. Access balance data through
LightningWalletService instead of the repository directly, keeping
database access encapsulated in the service layer.
@TaprootFreak TaprootFreak force-pushed the fix/monitoring-cross-module-dependency branch from 31b4a89 to 6d7657c Compare February 14, 2026 20:21
@TaprootFreak TaprootFreak marked this pull request as ready for review February 14, 2026 20:21
@TaprootFreak TaprootFreak merged commit 9223acd into LightningDotSpace:develop Feb 14, 2026
1 check passed
TaprootFreak added a commit that referenced this pull request Feb 14, 2026
MonitoringService and LightningWalletService have a circular
dependency. PR #148 added forwardRef only on the MonitoringService
side. The missing forwardRef on LightningWalletService caused
the app to crash on startup (503).
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.

2 participants