Search docs
Docs searchValidation rule
Back to Rule CatalogAP-APP-002Application LayeringRepository contains business logic
Flags repository/data-access code that contains domain or workflow decisions.
warningviolationNo auto-fix
How to fix
- Move workflow decisions into a service or domain object.
- Keep repository methods explicit about read/write behavior.
- Test business branching outside the repository layer.
What it means
A repository appears to make business decisions while reading or writing data.
Why it matters
Repositories should expose persistence operations without hiding policy or workflow behavior in data access.
Common causes
- A data helper grew into a workflow.
- Conditional business rules were placed near database queries.
- Persistence code performs side effects beyond storage.
Example bad pattern
OrderRepository decides whether a refund is allowed before updating payment rows.Example good pattern
RefundService decides eligibility, then asks OrderRepository to persist the approved change.Related files/config
apps/api/srcapps/webpackages
Related CLI commands
archpilot validatearchpilot validate --ci