Extract shared wiring logic between main.rs and worker/main.rs #18

Open
opened 2026-07-25 11:18:47 +00:00 by GKaszewski · 0 comments
Owner

Severity: Low

crates/presentation/src/main.rs wire_dependencies() (~150 lines) and crates/worker/src/main.rs main() (~200 lines) duplicate most of the same wiring logic: database connection, federation setup, event bus creation, enrichment handler construction.

The infra-wiring crate exists but only holds types/config, not the actual wiring. A shared wire() function in infra-wiring that returns all the arcs would cut both files in half and eliminate a class of bugs where one binary gets a new adapter wired but the other doesn't.

**Severity: Low** `crates/presentation/src/main.rs` `wire_dependencies()` (~150 lines) and `crates/worker/src/main.rs` `main()` (~200 lines) duplicate most of the same wiring logic: database connection, federation setup, event bus creation, enrichment handler construction. The `infra-wiring` crate exists but only holds types/config, not the actual wiring. A shared `wire()` function in `infra-wiring` that returns all the arcs would cut both files in half and eliminate a class of bugs where one binary gets a new adapter wired but the other doesn't.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GKaszewski/movies-diary#18