ErrorsProject layout and modules · rule
layout.call_direction
Code in shared/ uses a declaration that belongs to one domain.
Area 1, Project layout and modules; not declinable; the next step is usually the human's.
Why Jadpo refuses it
shared/ holds the types, failures, libraries and messages that every
domain may use. If shared code used one domain's declaration, every
domain that used the shared code would depend on that domain too, and a
change inside it could break code that never named it.
Jadpo won't choose the fix for you. Either the shared declaration really belongs to the one domain, or the domain's declaration is needed by everyone, and that decides where the code lives.
What it looks like
shared/types/discount_terms.jadpo:
type DiscountTerms = Object { applies_to: OrderTotal}
error Shared code uses OrderTotal from domain ordering
--> shared/types/discount_terms.jadpo:2:17
|2 | applies_to: OrderTotal | ^^^^^^^^^^ domain code
- reason
shared/holds code every domain may use, so it can't depend on any one domain;OrderTotalis a type indomains/ordering/types/order_total.jadpo.- next
- Move the shared declaration into
ordering, or stop it depending onOrderTotal(human) - rule
- layout.
call_ direction - help
- https://jadpo.
dev/docs/errors/layout. call_ direction
(human) at the end of the next: line tells your coding agent to stop
and ask you which fix you want, because the choice is yours to make: it
decides whether DiscountTerms belongs to ordering or OrderTotal
belongs to every domain.
How to fix it
The question is whether other domains need DiscountTerms.
If only ordering uses it, move DiscountTerms into the domain, to
domains/ordering/types/discount_terms.jadpo, and import it from there:
use ordering/types { OrderTotal }type DiscountTerms = Object { applies_to: OrderTotal}
apply_discount now imports it with use ordering/types { DiscountTerms }.
DiscountTerms is private to ordering, so another domain can't use it
unless ordering marks it public.
If other domains need it too, move OrderTotal to shared/ as well,
to shared/types/order_total.jadpo, and import it there:
use shared/types { OrderTotal }Both types are now shared, so any domain may use them, and shared/
depends on no domain.
Related
Markdown for agents: /docs/errors/layout.call_direction.md.Built from Jadpo main at aee2e8f.