Invert the Callback Cycle
Hard About 45 min Katabench Pro
Notifications calls back into Orders, closing a four-module cycle. A Shop.Contracts leaf already exists, but the back-edge is a call, not a shared data type, so hoisting another type into the leaf does nothing, and a contracts type that imports Orders trips the leaf-purity rule. Invert the direction with an IOrderCallback port the leaf owns.
The full brief is part of Katabench Pro
Pro opens this kata's brief, its starter code and its grader. To see how the track works first, try Break the Checkout Cycle, which is free.
How it is graded
You work across multiple files, and architecture rules turn the design boundaries into executable feedback.
What it practices
- Dependency cycles
- Find and break cycles between modules by inverting or extracting a dependency.
- Dependency inversion
- Point dependencies at abstractions the core owns, never at outer mechanisms.
Related katas
- Break the Checkout Cycle Hard Free Orders, Pricing and Promotions import each other in a three-hop cycle while Pricing also reaches into Inventory's internals. Moving the obvious call only rotates the cycle; hoist the shared vocabulary into a kernel leaf and reach Inventory through its published port to turn every rule green.
- Config Is Infrastructure Medium Free The shipping core reads a framework configuration type directly, welding the domain to infrastructure. Invert it behind a core-owned options port, and don't just rename the framework wrapper into the core, which trips a second rule.
- Move the Port Home Medium Free A
*Portabstraction is declared beside its adapter, so the core reaches outward to see its own port. Move the single port into the core; duplicating it leaves a stray copy that fails the role-placement rule. - The Layer Skip Medium Free A controller reaches past the application layer straight into infrastructure for the order total. Route the call back through the middle layer with a port the application owns; a thin pass-through that still touches infrastructure only moves the smell, it doesn't remove it.