Entrypoints and Services
Status: 🌱
Motivation
Separate trigger mechanisms from business rules so behavior stays reusable, testable, and safer in legacy boundaries.
Connections
Pattern
- Keep entrypoints thin: scheduled tasks, ad hoc tasks, upgrade scripts, or user-driven actions should only orchestrate.
- Centralize business rules in services so one behavior has one source of truth.
- Treat tasks as wrappers that call service methods and handle runtime concerns (scheduling, retries, logs).
Naming Convention
- Use
run_*(): voidin services for business flows that are not directly initiated by a user action. - This signals asynchronous or operational intent (scheduler, maintenance, migration, legacy integration).
Legacy Safety Layer
- When a subsystem is third-party or legacy-owned, place a service layer on top as a controlled boundary.
- Use that layer for validation, guards, telemetry, and invariant checks before touching external/unstable domains.