Search docs
Docs searchValidation rule
Back to Rule CatalogAP-DEP-004DependencyCross-module dependency missing from module contract
Flags an actual cross-module import that is not declared in the source module contract.
errorviolationNo auto-fix
How to fix
- Decide whether the dependency is legitimate.
- If legitimate, add the target module to the source module contract dependsOn list.
- If not legitimate, move the behavior behind the correct public module boundary.
What the rule validates
A module depends on another module in code, but that relationship is not declared in its contract. In component-aware repositories, the module is the code-level grouping inside the owning component.
Why it matters
Undeclared dependencies hide coupling and make architecture impact hard to review.
Common causes
- A new import was added without updating dependsOn.
- The module contract is stale.
- The code should call a different module boundary instead.
Typical violation example
mobile imports notifications code while mobile's contract does not declare notifications.Typical compliant example
mobile declares notifications in dependsOn or routes the behavior through an approved boundary.Related rules
AP-DEP-001 - Circular module dependency detectedAP-DEP-002 - Forbidden cross-module dependency detectedAP-DEP-003 - Non-public cross-module import detectedAP-DEP-005 - Cross-module import bypasses public module surface
Adjacent categories
Related files/config
.archpilot/architecture.json.archpilot/contracts/*.json
Related CLI commands
archpilot validatearchpilot validate --ci
VS Code / Inspector action
Open the finding and compare the source module, target module, and contract dependsOn list.